Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 98466 - udhcp resets default route at renew
Summary: udhcp resets default route at renew
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal
Assignee: Roy Marples (RETIRED)
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2005-07-09 07:34 UTC by Max Loparev
Modified: 2005-07-14 03:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Max Loparev 2005-07-09 07:34:01 UTC
I have the next configuration of network

local network connection throw eth0 
internet connection throw VPN tunnel on ppp0

So my local network routes added as static, and VPN always setted as default route.
And when udhcpc renews lease it brokes my route table, and I need to restart VPN(or set default route manually).

I think that right way is to reset default route only when it is setted throw interface udhcpc serving for.

for iproute2 i'd changed udchpc as follows

--- udhcpc-iproute2.old 2005-07-09 18:17:30.988577856 +0400
+++ udhcpc-iproute2     2005-07-09 18:17:11.703819520 +0400
@@ -61,6 +61,7 @@
 
 # Configure our default route
 x=$(ip route show | awk '{ if ($1 == "default") {print $3} }')
+x_dev=$(ip route show | awk '{ if ($1 == "default") {print $5} }')
 for r in ${router}; do
        # ip route doesn't pad 0's, so we strip any padding if we have any
        r=${r//000/0}
@@ -69,7 +70,7 @@
        # We can only have one default route!
        if [[ -z ${x} ]]; then
                ip route add default via ${r} dev ${interface} 2>/dev/null && br
eak
-       elif [[ ${x} != ${r} ]]; then
+       elif [[ ${x} != ${r} ] && [ ${x_dev} == ${interface} ]]; then
                ip route change default via ${r} dev ${interface} 2>/dev/null &&
 break
        fi
 done
Comment 1 Max Loparev 2005-07-09 11:11:02 UTC
sorry, forgot brackets in previous patch
--- udhcpc-iproute2.old 2005-07-09 18:17:30.988577856 +0400
+++ udhcpc-iproute2     2005-07-09 22:05:31.231196024 +0400
@@ -61,6 +61,7 @@
 
 # Configure our default route
 x=$(ip route show | awk '{ if ($1 == "default") {print $3} }')
+x_dev=$(ip route show | awk '{ if ($1 == "default") {print $5} }')
 for r in ${router}; do
        # ip route doesn't pad 0's, so we strip any padding if we have any
        r=${r//000/0}
@@ -69,7 +70,7 @@
        # We can only have one default route!
        if [[ -z ${x} ]]; then
                ip route add default via ${r} dev ${interface} 2>/dev/null && break
-       elif [[ ${x} != ${r} ]]; then
+       elif [[ ${x} != ${r} ]] && [[ ${x_dev} == ${interface} ]]; then
                ip route change default via ${r} dev ${interface} 2>/dev/null &&
break
        fi
 done
Comment 2 Roy Marples (RETIRED) gentoo-dev 2005-07-11 06:40:18 UTC
I don't like your solution because some people may require udhcpc to change the
default route.

One possible option is to add a dhcp_eth0="nogateway" option which would
instruct udhcpc not to replace a gateway if there is one already present.

Would this satisfy your request?
Comment 3 Max Loparev 2005-07-12 09:07:40 UTC
ok, that would be enough in my case
Comment 4 Roy Marples (RETIRED) gentoo-dev 2005-07-12 10:07:03 UTC
Will be in baselayout-1.11.13
Comment 5 Roy Marples (RETIRED) gentoo-dev 2005-07-14 03:06:00 UTC
baselayout-1.11.13 is out