Cleanup our routes upon disconnect also when using /sbin/route command - even
if OS will do it for us when TUNDEV gets removed. That's the same what the
ip-route code already does.
Additionally, we obviously didn't need route deletion in set_network_route for
/sbin/route mode - this function didn't do anything until now. So remove this
call -- it's a bad idea to call del_network_route inside set_network_route
anyways because both modify the same global variables.
Signed-off-by: Gernot Hillier <gernot.hillier@siemens.com>
Tested-by: Thomas Zander <thomas.zander@siemens.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
NETWORK="$1"
NETMASK="$2"
NETMASKLEN="$3"
- del_network_route "$NETWORK" "$NETMASK" "$NETMASKLEN"
route add -net "$NETWORK" $route_syntax_netmask "$NETMASK" $route_syntax_gw "$INTERNAL_IP4_ADDRESS" $route_syntax_interface
}
}
del_network_route() {
- case "$OS" in
- Linux|NetBSD|OpenBSD|Darwin|SunOS) # and probably others...
- # routes are deleted automatically on device shutdown
- return
- ;;
- esac
NETWORK="$1"
NETMASK="$2"
NETMASKLEN="$3"