Lines 31-44
fix_ifup()
Link Here
|
31 |
file="/sbin/ifup" |
31 |
file="/sbin/ifup" |
32 |
|
32 |
|
33 |
[ -f "${file}" ] || return 0 |
33 |
[ -f "${file}" ] || return 0 |
34 |
[ "x${VE_STATE}" != "xstarting" ] && return 0 |
34 |
[ "${VE_STATE}" = "starting" ] || return 0 |
35 |
|
35 |
|
36 |
if grep -q 'if \[ "\${DEVICE}" = "lo" \]; then' ${file} 2>/dev/null |
36 |
if grep -qs 'if \[ "\${DEVICE}" = "lo" \]; then' "${file}"; then |
37 |
then |
37 |
sed -i 's/if \[ "\${DEVICE}" = "lo" \]; then/if \[ "${IPADDR}" = "127.0.0.1" \]; then/g' "${file}" |
38 |
${CP} ${file} ${file}.$$ || return 1 |
|
|
39 |
/bin/sed -e 's/if \[ "\${DEVICE}" = "lo" \]; then/if \[ "${IPADDR}" = "127.0.0.1" \]; then/g' < ${file} > ${file}.$$ && |
40 |
mv -f ${file}.$$ ${file} |
41 |
rm -f ${file}.$$ 2>/dev/null |
42 |
fi |
38 |
fi |
43 |
} |
39 |
} |
44 |
|
40 |
|
Lines 53-86
ARPCHECK=\"no\"
Link Here
|
53 |
IPADDR=127.0.0.1 |
49 |
IPADDR=127.0.0.1 |
54 |
NETMASK=255.255.255.255 |
50 |
NETMASK=255.255.255.255 |
55 |
BROADCAST=0.0.0.0 |
51 |
BROADCAST=0.0.0.0 |
56 |
ARPCHECK=\"no\"" > $IFCFG || error "Can't write to file $IFCFG" $VZ_FS_NO_DISK_SPACE |
52 |
ARPCHECK=\"no\"" > "${IFCFG}" || error "Can't write to file ${IFCFG}" ${VZ_FS_NO_DISK_SPACE} |
57 |
|
53 |
|
58 |
# Set /etc/sysconfig/network |
54 |
# Set /etc/sysconfig/network |
59 |
put_param $NETFILE NETWORKING yes |
55 |
put_param "${NETFILE}" NETWORKING yes |
60 |
# Set default route to venet0 |
56 |
# Set default route to venet0 |
61 |
put_param $NETFILE GATEWAYDEV ${VENET_DEV} |
57 |
put_param "${NETFILE}" GATEWAYDEV ${VENET_DEV} |
62 |
# Remove old (obsoleted) fake route |
58 |
# Remove old (obsoleted) fake route |
63 |
del_param $NETFILE GATEWAY |
59 |
del_param "${NETFILE}" GATEWAY |
64 |
# setup ipv6 |
60 |
# setup ipv6 |
65 |
setup6_network |
61 |
setup6_network |
66 |
|
62 |
|
67 |
# Set up /etc/hosts |
63 |
# Set up /etc/hosts |
68 |
if [ ! -f ${HOSTFILE} ]; then |
64 |
if [ ! -f "${HOSTFILE}" ]; then |
69 |
echo "127.0.0.1 localhost.localdomain localhost" > $HOSTFILE |
65 |
echo "127.0.0.1 localhost.localdomain localhost" > "${HOSTFILE}" |
70 |
fi |
66 |
fi |
71 |
fix_ifup |
67 |
fix_ifup |
72 |
} |
68 |
} |
73 |
|
69 |
|
74 |
setup6_network() |
70 |
setup6_network() |
75 |
{ |
71 |
{ |
76 |
[ "${IPV6}" != "yes" ] && return 0 |
72 |
[ "${IPV6}" = "yes" ] || return 0 |
77 |
|
73 |
|
78 |
if ! grep -q 'IPV6INIT="yes"' ${IFCFG}; then |
74 |
if ! grep -q 'IPV6INIT="yes"' "${IFCFG}"; then |
79 |
put_param ${IFCFG} IPV6INIT yes |
75 |
put_param "${IFCFG}" IPV6INIT yes |
80 |
fi |
76 |
fi |
81 |
if ! grep -q 'NETWORKING_IPV6="yes"' ${NETFILE}; then |
77 |
if ! grep -q 'NETWORKING_IPV6="yes"' "${NETFILE}"; then |
82 |
put_param ${NETFILE} NETWORKING_IPV6 yes |
78 |
put_param "${NETFILE}" NETWORKING_IPV6 yes |
83 |
put_param ${NETFILE} IPV6_DEFAULTDEV ${VENET_DEV} |
79 |
put_param "${NETFILE}" IPV6_DEFAULTDEV "${VENET_DEV}" |
84 |
NETWORKRESTART=yes |
80 |
NETWORKRESTART=yes |
85 |
fi |
81 |
fi |
86 |
} |
82 |
} |
Lines 102-109
NETMASK=${netmask}" > $file ||
Link Here
|
102 |
|
98 |
|
103 |
add_ip6() |
99 |
add_ip6() |
104 |
{ |
100 |
{ |
105 |
[ "${IPV6}" != "yes" ] && return 0 |
101 |
[ "$IPV6" = "yes" ] || return 0 |
106 |
if ! grep -qw "$1" ${IFCFG} 2>/dev/null; then |
102 |
if ! grep -qsw "$1" "${IFCFG}"; then |
107 |
setup6_network |
103 |
setup6_network |
108 |
add_param ${IFCFG} IPV6ADDR_SECONDARIES "$1/$2" |
104 |
add_param ${IFCFG} IPV6ADDR_SECONDARIES "$1/$2" |
109 |
if have_ifconfig; then |
105 |
if have_ifconfig; then |
Lines 139-145
get_free_aliasid()
Link Here
|
139 |
|
135 |
|
140 |
[ -z "${IFNUMLIST}" ] && get_all_aliasid |
136 |
[ -z "${IFNUMLIST}" ] && get_all_aliasid |
141 |
while test -z ${found}; do |
137 |
while test -z ${found}; do |
142 |
let IFNUM=IFNUM+1 |
138 |
IFNUM=$((IFNUM+1)) |
143 |
echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null || |
139 |
echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null || |
144 |
found=1 |
140 |
found=1 |
145 |
done |
141 |
done |