vm/network: replace route in more elegant way

This commit is contained in:
Marek Marczykowski 2012-03-03 01:26:06 +01:00
parent 67369b170b
commit 6610b22f97

View File

@ -29,7 +29,7 @@ case "$command" in
online)
ifconfig ${vif} up
echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
ipcmd='add'
ipcmd='replace'
iptables_cmd='-I FORWARD 1'
cmdprefix=''
;;
@ -45,7 +45,6 @@ if [ "${ip}" ] ; then
# If we've been given a list of IP addresses, then add routes from dom0 to
# the guest using those addresses.
for addr in ${ip} ; do
${cmdprefix} ip route del ${addr} || true
${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} || true
done
echo ${cmdprefix} iptables $iptables_cmd -i ${vif} \! -s ${ip} -j DROP