Bug 19677 - If no GATEWAYDEV, all interfaces try to set default route
If no GATEWAYDEV, all interfaces try to set default route
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
7.1
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Bill Nottingham
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-10-24 08:17 EDT by Pekka Savola
Modified: 2014-03-16 22:16 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-01-30 17:20:16 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Pekka Savola 2000-10-24 08:17:15 EDT
Fresh install of RHL7.0 with two interfaces.

The installer did not specify GATEWAYDEV in /etc/sysconfig/network.

However, when there is no GATEWAYDEV, and default route has been configured 
with GATEWAY in /etc/sysconfig/network, all interfaces try to add it and
fail with SIOCADDRT.

This happens at:
---
    if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
 	# set up default gateway
	if [ "${GATEWAY}" != "" ]; then
            route add default gw ${GATEWAY} ${DEVICE}
            DEFGW=${GATEWAY}
---

This _might_ have been caused by the fact that in RHL7.0, all interfaces
save for eth0 are disabled by default.

Fixing this without breaking stuff which use something other than ethX
requires some thought
(else you could just assume that eth0 == default gateway unless otherwise
specified).  Perhaps the correct place to fix this would be at install
time.
Comment 1 Bill Nottingham 2001-01-29 18:58:28 EST
Does this still happen with the beta?
Comment 2 Pekka Savola 2001-01-30 10:19:01 EST
Yes.  This can be seen with 'service network restart', which gives like:

Jan 30 16:26:07 install5 network: Shutting down interface eth1:  succeeded
Jan 30 16:26:08 install5 modprobe: modprobe: Can't locate module irlan0
Jan 30 16:26:08 install5 syslogd: sendto: Network is unreachable
Jan 30 16:26:08 install5 syslogd: sendto: Network is unreachable
Jan 30 16:26:08 install5 sysctl: net.ipv4.ip_forward = 0
Jan 30 16:26:08 install5 sysctl: net.ipv4.conf.all.rp_filter = 1
Jan 30 16:26:08 install5 sysctl: kernel.sysrq = 0
Jan 30 16:26:08 install5 network: Setting network parameters:  succeeded
Jan 30 16:26:08 install5 ifup: SIOCADDRT: Network is unreachable
Jan 30 16:26:08 install5 network: Bringing up interface lo:  succeeded
Jan 30 16:26:09 install5 network: Bringing up interface eth1:  succeeded

Note ifup line, as before.
Comment 3 Bill Nottingham 2001-01-30 16:23:50 EST
Hmm... we could always ping the gateway, to see if it's
reachable at that address. But that's a hack.
Comment 4 Bill Nottingham 2001-01-30 16:37:36 EST
We could certainly special-case lo to not try and add it; that would
eliminate some of the messages.
Comment 5 Bill Nottingham 2001-01-30 16:50:37 EST
OK, here's the fix that's going into initscripts-5.60-1; it
seems correct.

Change the test from:

if [ "${GATEWAY}" != "" ]; then

to 

if [ "${GATEWAY}" != "" -a "`ipcalc --network ${GATEWAY} ${NETMASK}`" = "`ipcalc
--network ${IPADDR} ${NETMASK}`" ]; then
Comment 6 Bill Nottingham 2001-01-30 16:54:30 EST
(of course, replace the second ipcalc call with just ${NETWORK} *thwap*)
Comment 7 Pekka Savola 2001-01-30 17:20:12 EST
This doesn't exactly work, but the idea is sound.

ipcalc --network ${GATEWAY} ${NETMASK} returns something like

NETWORK=1.2.3.4

not 1.2.3.4 ;-)

There are ways to get around this, but it might be useful to add a feature in ipcalc that'd omit
NETWORK=, NETMASK= etc. too.

I did this with:

if [ "${GATEWAY}" != "" -a "`ipcalc --network ${GATEWAY} ${NETMASK}`" = "NETWORK=${NETWORK}" ]; then

and the original bug disappeared. A bit hackish.
Comment 8 Bill Nottingham 2001-01-30 17:22:45 EST
Oops, yeah. Disregard the parenthetical comment entirely. :)

It's hackish, but it seems the quickest way to determine if you're
adding the gateway on a reasonably appropriate interface.

Note You need to log in before you can comment on or make changes to this bug.