iPXE - Open Source Boot Firmware

[ipv4] Use a zero address to indicate "no gateway", rather than INADDR_NONE
authorMichael Brown <mcb30@etherboot.org>
Sat, 14 Nov 2009 02:21:13 +0000 (02:21 +0000)
committerMichael Brown <mcb30@etherboot.org>
Mon, 16 Nov 2009 22:09:23 +0000 (22:09 +0000)
commit2ce0d8f08be9172e8a2b267e3073c1ed0b54afae
treeaaeac490a1af934678bad2d77dff63c832a37f8c
parent76d5e493d198b35a6d9395d4edd33b9fa7220f8d
[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/net/ipv4.c
src/usr/route.c