Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 176223 - sys-apps/baselayout-1.12.10-r3 default route generation
Summary: sys-apps/baselayout-1.12.10-r3 default route generation
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-27 09:58 UTC by Tobias Klausmann (RETIRED)
Modified: 2007-09-01 12:40 UTC (History)
0 users

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


Attachments
Trim leading spaces (ifconfig.patch,512 bytes, patch)
2007-04-30 06:45 UTC, Roy Marples (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Klausmann (RETIRED) gentoo-dev 2007-04-27 09:58:49 UTC
Suppose you have the following in /etc/conf.d/net:

config_eth0=( "192.168.52.147 netmask 255.255.255.248 brd 192.168.52.151" )
routes_eth0=(" default gw 192.168.52.145")

Looks like a working config, doesn't it? The gateway is reachable and all.

The routing table looks okay, too:

[root@ganesha ~]# route -n
Kernel IP routing table
Destination     Gateway          Genmask         Flags Metric Ref    Use Iface
192.168.52.144  0.0.0.0          255.255.255.248 U     0      0        0 eth0
127.0.0.0       0.0.0.0          255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.52.145   255.255.255.255 UG    0      0        0 eth0

Except: it isn't okay. The machine is not reachable from other nets and can't connect to anything outside its own net. The usual error is "Net unreachable".

Note the slightly different routing table that makes things work:

[root@ganesha ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
194.97.52.144   0.0.0.0         255.255.255.248 U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         194.97.52.145   0.0.0.0         UG    0      0        0 eth0

The ip/mask for the default route should be 0/0, not 0/32 (as above).

Further investigation found that the culprit is the leading space on the default-route config line. Changing

routes_eth0=(" default gw 192.168.52.145")

to

routes_eth0=("default gw 192.168.52.145")

makes the init scripts create the correct route (0/0) instead of one that only looks correct at first sight (0/32).

I think this should be corrected. Leading (and trailing) spaces on the config strings can be easily stripped and shouldn't result in different behaviour.

In this case the result was very confusing to boot.

(Note: route without -n would have helped finding it earlier. However, the DNS server wasn;'t reachable so it seemed the natural thing to do.)
Comment 1 Tobias Klausmann (RETIRED) gentoo-dev 2007-04-27 10:00:02 UTC
Oops. please ignore the changing first two octets in my examples. I wanted to hide the original IPs. oh well.
Comment 2 Roy Marples (RETIRED) gentoo-dev 2007-04-30 06:45:21 UTC
Created attachment 117698 [details, diff]
Trim leading spaces

Does this patch fix things for you?
Comment 3 Tobias Klausmann (RETIRED) gentoo-dev 2007-05-02 17:53:05 UTC
Yes, looks good. Can't reproduce the 0/32 "default route" problem
with that patch applied to lib64/rcscripts/net/ifconfig.sh

Thanks!