iPXE - Open Source Boot Firmware

[ipv4] Allow calculation of default subnet mask
authorMichael Brown <mcb30@etherboot.org>
Sat, 14 Nov 2009 02:28:16 +0000 (02:28 +0000)
committerMichael Brown <mcb30@etherboot.org>
Mon, 16 Nov 2009 22:11:53 +0000 (22:11 +0000)
commit55d23b19a270b2caeb4dcd9435a91bc9c55383e2
tree2f5657c70beff1605012f2c95cdab2fb0c778021
parent2ce0d8f08be9172e8a2b267e3073c1ed0b54afae
[ipv4] Allow calculation of default subnet mask

ipv4.c calculates the default subnet mask before calling
fetch_ipv4_setting() to retrieve the configured subnet mask (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 fetching the setting first and calculating the default subnet
mask only if necessary.
src/net/ipv4.c