diff options
author | Michael Brown | 2008-07-08 02:13:59 +0200 |
---|---|---|
committer | Michael Brown | 2008-07-08 02:13:59 +0200 |
commit | 2df682c5beaaf6f0cc926a9b802f08a5c8175258 (patch) | |
tree | d99477b82c19242ac5149b63528f7416d71a6b74 /src/net | |
parent | [phantom] Add support for NetXen Phantom NICs (diff) | |
download | ipxe-2df682c5beaaf6f0cc926a9b802f08a5c8175258.tar.gz ipxe-2df682c5beaaf6f0cc926a9b802f08a5c8175258.tar.xz ipxe-2df682c5beaaf6f0cc926a9b802f08a5c8175258.zip |
[dhcp] Allow DHCP non-option settings to be cleared
dhcppkt_store() is supposed to clear the setting if passed NULL for the
setting data. In the case of fixed-location fields (e.g. client IP
address), this requires setting the content of the field to all-zeros.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/dhcppkt.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/net/dhcppkt.c b/src/net/dhcppkt.c index 2537e254..c8bf215b 100644 --- a/src/net/dhcppkt.c +++ b/src/net/dhcppkt.c @@ -138,12 +138,15 @@ find_dhcp_packet_field ( unsigned int tag ) { int dhcppkt_store ( struct dhcp_packet *dhcppkt, unsigned int tag, const void *data, size_t len ) { struct dhcp_packet_field *field; + void *field_data; int rc; /* If this is a special field, fill it in */ if ( ( field = find_dhcp_packet_field ( tag ) ) != NULL ) { if ( len > field->len ) return -ENOSPC; + field_data = dhcp_packet_field ( dhcppkt->dhcphdr, field ); + memset ( field_data, 0, field->len ); memcpy ( dhcp_packet_field ( dhcppkt->dhcphdr, field ), data, len ); return 0; |