mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 00:12:19 +03:00
[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.
This commit is contained in:
@@ -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)" );
|
||||
|
||||
Reference in New Issue
Block a user