vm/network: replace route in more elegant way
This commit is contained in:
parent
67369b170b
commit
6610b22f97
@ -29,7 +29,7 @@ case "$command" in
|
|||||||
online)
|
online)
|
||||||
ifconfig ${vif} up
|
ifconfig ${vif} up
|
||||||
echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
|
echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
|
||||||
ipcmd='add'
|
ipcmd='replace'
|
||||||
iptables_cmd='-I FORWARD 1'
|
iptables_cmd='-I FORWARD 1'
|
||||||
cmdprefix=''
|
cmdprefix=''
|
||||||
;;
|
;;
|
||||||
@ -45,7 +45,6 @@ if [ "${ip}" ] ; then
|
|||||||
# If we've been given a list of IP addresses, then add routes from dom0 to
|
# If we've been given a list of IP addresses, then add routes from dom0 to
|
||||||
# the guest using those addresses.
|
# the guest using those addresses.
|
||||||
for addr in ${ip} ; do
|
for addr in ${ip} ; do
|
||||||
${cmdprefix} ip route del ${addr} || true
|
|
||||||
${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} || true
|
${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} || true
|
||||||
done
|
done
|
||||||
echo ${cmdprefix} iptables $iptables_cmd -i ${vif} \! -s ${ip} -j DROP
|
echo ${cmdprefix} iptables $iptables_cmd -i ${vif} \! -s ${ip} -j DROP
|
||||||
|
Loading…
Reference in New Issue
Block a user