--- client/scripts/bsdos +++ client/scripts/bsdos @@ -81,6 +81,9 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi if [ x$reason = xMEDIUM ]; then eval "ifconfig $interface $medium" @@ -141,7 +141,7 @@ $new_broadcast_arg $medium" route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do - route add default $router >/dev/null 2>&1 + route add default $router $metric_arg dev $interface >/dev/null 2>&1 done if [ "$new_static_routes" != "" ]; then set $new_static_routes @@ -207,7 +207,7 @@ fi route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do - route add default $router >/dev/null 2>&1 + route add default $router $metric_arg dev $interface >/dev/null 2>&1 done set $new_static_routes while [ $# -gt 1 ]; do --- client/scripts/freebsd +++ client/scripts/freebsd @@ -91,6 +91,9 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi if [ x$reason = xMEDIUM ]; then eval "ifconfig $interface $medium" @@ -157,7 +157,7 @@ fi route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do - route add default $router >/dev/null 2>&1 + route add default $router $metric_arg dev $interface >/dev/null 2>&1 done if [ -n "$new_static_routes" ]; then $LOGGER "New Static Routes: $new_static_routes" @@ -228,7 +228,7 @@ fi route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do - route add default $router >/dev/null 2>&1 + route add default $router $metric_arg dev $interface >/dev/null 2>&1 done set -- $new_static_routes while [ $# -gt 1 ]; do --- client/scripts/linux +++ client/scripts/linux @@ -103,6 +103,9 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi if [ x$reason = xMEDIUM ]; then # Linux doesn't do mediums (ok, ok, media). @@ -148,13 +148,11 @@ if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ [ x$alias_ip_address != x$old_ip_address ]; then # Possible new alias. Remove old alias. - ifconfig $interface:0- inet 0 + ifconfig $interface:0- inet 0.0.0.0 fi if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then - # IP address changed. Bringing down the interface will delete all routes, - # and clear the ARP cache. - ifconfig $interface inet 0 down - + # IP address changed - set existing to 0. + ifconfig $interface inet 0.0.0.0 fi if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then @@ -167,14 +165,14 @@ route add -net $new_network_number $new_subnet_arg dev $interface fi for router in $new_routers; do - route add default gw $router + route add default gw $router $metric_arg dev $interface done 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 + route add -host $alias_ip_address dev $interface:0 fi make_resolv_conf exit_with_hooks 0 @@ -187,12 +185,12 @@ ifconfig $interface:0- inet 0 fi if [ x$old_ip_address != x ]; then - # Shut down interface, which will delete routes and clear arp cache. - ifconfig $interface inet 0 down + # Remove old address + ifconfig $interface inet 0.0.0.0 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 + route add -host $alias_ip_address dev $interface:0 fi exit_with_hooks 0 fi @@ -213,15 +211,15 @@ fi if [ $relmajor -lt 2 ] || \ ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then - route add -net $new_network_number + route add -net $new_network_number dev $interface fi for router in $new_routers; do - route add default gw $router + route add default gw $router $metric_arg dev $interface done make_resolv_conf exit_with_hooks 0 fi - ifconfig $interface inet 0 down + ifconfig $interface inet 0.0.0.0 exit_with_hooks 1 fi --- client/scripts/netbsd +++ client/scripts/netbsd @@ -81,6 +81,9 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi if [ x$reason = xMEDIUM ]; then eval "ifconfig $interface $medium" @@ -141,7 +141,7 @@ $new_broadcast_arg $medium" route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do - route add default $router >/dev/null 2>&1 + route add default $router $metric_arg dev $interface >/dev/null 2>&1 done if [ "$new_static_routes" != "" ]; then set $new_static_routes @@ -207,7 +207,7 @@ fi route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do - route add default $router >/dev/null 2>&1 + route add default $router $metric_arg dev $interface >/dev/null 2>&1 done set $new_static_routes while [ $# -gt 1 ]; do --- client/scripts/openbsd +++ client/scripts/openbsd @@ -81,6 +81,9 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi if [ x$reason = xMEDIUM ]; then eval "ifconfig $interface $medium" @@ -141,7 +141,7 @@ $new_broadcast_arg $medium" route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do - route add default $router >/dev/null 2>&1 + route add default $router $metric_arg dev $interface >/dev/null 2>&1 done if [ "$new_static_routes" != "" ]; then set $new_static_routes @@ -207,7 +207,7 @@ fi route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do - route add default $router >/dev/null 2>&1 + route add default $router $metric_arg dev $interface >/dev/null 2>&1 done set $new_static_routes while [ $# -gt 1 ]; do