diff options
author | Michael Brown | 2009-11-14 03:21:13 +0100 |
---|---|---|
committer | Michael Brown | 2009-11-16 23:09:23 +0100 |
commit | 2ce0d8f08be9172e8a2b267e3073c1ed0b54afae (patch) | |
tree | aaeac490a1af934678bad2d77dff63c832a37f8c /src/usr/route.c | |
parent | [libc] Use only generic errortab entries to match generic errors (diff) | |
download | ipxe-2ce0d8f08be9172e8a2b267e3073c1ed0b54afae.tar.gz ipxe-2ce0d8f08be9172e8a2b267e3073c1ed0b54afae.tar.xz ipxe-2ce0d8f08be9172e8a2b267e3073c1ed0b54afae.zip |
[ipv4] Use a zero address to indicate "no gateway", rather than INADDR_NONE
ipv4.c uses a gateway address of INADDR_NONE to represent "no
gateway". It initialises the gateway address to INADDR_NONE before
calling fetch_ipv4_setting() to retrieve the configured gateway
address (if any).
However, as of commit 612f4e7 "[settings] Avoid returning
uninitialised data on error in fetch_xxx_setting()",
fetch_ipv4_setting() will zero the IP address if the setting does not
exist, rather than leaving it unaltered.
Fix by using a zero IP address to indicate "no gateway", so that a
non-existent gateway address setting will be treated as such.
Diffstat (limited to 'src/usr/route.c')
-rw-r--r-- | src/usr/route.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/usr/route.c b/src/usr/route.c index cf5a55d6..18757419 100644 --- a/src/usr/route.c +++ b/src/usr/route.c @@ -36,7 +36,7 @@ void route ( void ) { printf ( "%s: %s/", miniroute->netdev->name, inet_ntoa ( miniroute->address ) ); printf ( "%s", inet_ntoa ( miniroute->netmask ) ); - if ( miniroute->gateway.s_addr != INADDR_NONE ) + if ( miniroute->gateway.s_addr ) printf ( " gw %s", inet_ntoa ( miniroute->gateway ) ); if ( ! ( miniroute->netdev->state & NETDEV_OPEN ) ) printf ( " (inaccessible)" ); |