Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
dhcp.4389
dhclient-script-handle-static-route-updates.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dhclient-script-handle-static-route-updates.patch of Package dhcp.4389
diff --git a/dhclient-script b/tmp/dhclient-script index cd9301f..7eeec2e 100644 --- a/dhclient-script +++ b/dhclient-script @@ -163,6 +163,28 @@ parse_ipv4_classless_routes() echo "${_routes[*]}" return 0 } +del_ipv4_route() +{ + local dest=$1 ; shift + local mask=$1 ; shift + local gate=("$@") + local hops args + + hops=() + if [ ${#gate[@]} -gt 1 ] ; then + for((g=0; g<${#gate[@]}; g++)) ; do + hops+=(nexthop ${gate[$g]:+via ${gate[$g]}} + dev $interface weight $((g+1))) + done + elif [ ${#gate[@]} -gt 0 ] ; then + hops+=(${gate[$g]:+via ${gate[$g]}} dev $interface) + fi + [ ${#hops[@]} -eq 0 ] && hops=(dev $interface) + args=("$dest${mask:+/$mask}" $metric_arg ${hops[*]}) + + err=`LC_ALL=C /sbin/ip route del ${args[*]} 2>&1` && return 0 +} + set_ipv4_route() { local dest=$1 ; shift @@ -226,6 +248,28 @@ get_ipv4_default_gw() echo "$new_routers" fi } + +del_ipv4_routes() +{ + if [ "x$old_rfc3442_classless_static_routes" != x ] ; then + old_rfc3442_classless_static_routes_formatted=$( + parse_ipv4_classless_routes $old_rfc3442_classless_static_routes + ) + else + unset old_rfc3442_classless_static_routes_formatted + fi + if [ "x$old_rfc3442_classless_static_routes_formatted" != x -a \ + "x$old_rfc3442_classless_static_routes_formatted" != \ + "x$new_rfc3442_classless_static_routes_formatted" ] ; then + for r in $old_rfc3442_classless_static_routes_formatted ; do + route=(${r//,/ }) + del_ipv4_route ${route[*]} + done + elif [ "x$old_routers" != x -a "x$old_routers" != "x$new_routers" ] ; then + del_ipv4_route default "" $new_routers + fi +} + set_ipv4_routes() { if [ "x$new_rfc3442_classless_static_routes_formatted" != x ] ; then @@ -475,6 +519,8 @@ BOUND|RENEW|REBIND|REBOOT) fi fi + del_ipv4_routes + if [ x$new_interface_mtu != x ] ; then /sbin/ip link set $interface mtu $new_interface_mtu fi @@ -486,7 +532,6 @@ BOUND|RENEW|REBIND|REBOOT) ${new_broadcast_arg} \ dev $interface - set_ipv4_routes fi if [ x$new_ip_address != x$alias_ip_address -a x$alias_ip_address != x \ -a x$new_ip_address != x$old_ip_address ]; @@ -495,6 +540,7 @@ BOUND|RENEW|REBIND|REBOOT) dev $interface fi + set_ipv4_routes netconfig_modify if [ x$old_ip_address != x -a x$old_ip_address != x$new_ip_address ]; then
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor