Skip to content

Commit

Permalink
uvpn/dhclient-script: Use ip route instead of route
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Nov 2, 2018
1 parent 7222646 commit 9f58249
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions uvpn/dhclient-script
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,31 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
# Add a network route to the computed network address.
for router in $new_routers; do
if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
route add -host $router dev $interface
ip route add $router dev $interface
fi
route add default gw $router $metric_arg dev $interface
ip route add default via $router dev $interface $metric_arg
done
else
# we haven't changed the address, have we changed other options
# that we wish to update?
if [ x$new_routers != x ] && [ x$new_routers != x$old_routers ] ; then
# if we've changed routers delete the old and add the new.
for router in $old_routers; do
route del default gw $router
ip route del default via $router
done
for router in $new_routers; do
if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
route add -host $router dev $interface
fi
route add default gw $router $metric_arg dev $interface
ip route add $router dev $interface
fi
ip route add default via $router dev $interface $metric_arg
done
fi
fi
if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
then
ifconfig $interface:0- inet 0
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address $interface:0
ip route add $alias_ip_address dev $interface:0
fi
exit 0
fi
Expand All @@ -91,7 +91,7 @@ if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
fi
if [ x$alias_ip_address != x ]; then
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address $interface:0
ip route add $alias_ip_address dev $interface:0
fi
exit 0
fi
Expand All @@ -107,13 +107,13 @@ if [ x$reason = xTIMEOUT ]; then
if [ x$new_ip_address != x$alias_ip_address ] && \
[ x$alias_ip_address != x ]; then
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address dev $interface:0
ip route add $alias_ip_address dev $interface:0
fi
for router in $new_routers; do
if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
route add -host $router dev $interface
ip route add $router dev $interface
fi
route add default gw $router $metric_arg dev $interface
ip route add default via $router dev $interface $metric_arg
done
exit 0
fi
Expand Down

0 comments on commit 9f58249

Please sign in to comment.