From 2ce0d8f08be9172e8a2b267e3073c1ed0b54afae Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 14 Nov 2009 02:21:13 +0000 Subject: [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. --- src/usr/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/usr') diff --git a/src/usr/route.c b/src/usr/route.c index cf5a55d6d..187574194 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)" ); -- cgit v1.2.3-55-g7522