summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2005-04-18 16:38:51 +0200
committerMichael Brown2005-04-18 16:38:51 +0200
commite02c699a054ce5821c9a2b53b4fd876bc895d104 (patch)
tree2f4236be53453bdf8bd156410a6e001ea0a2b409
parent"make bin/xxx DEBUG=yyy,zzz" now works seemingly perfectly. :) (diff)
downloadipxe-e02c699a054ce5821c9a2b53b4fd876bc895d104.tar.gz
ipxe-e02c699a054ce5821c9a2b53b4fd876bc895d104.tar.xz
ipxe-e02c699a054ce5821c9a2b53b4fd876bc895d104.zip
Fix endianness of dhcp device id structure.
-rw-r--r--src/core/nic.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/nic.c b/src/core/nic.c
index 5b52bea1c..50ca4e81b 100644
--- a/src/core/nic.c
+++ b/src/core/nic.c
@@ -916,11 +916,14 @@ static int bootp(void)
unsigned char *bp_vend;
#ifndef NO_DHCP_SUPPORT
- dhcp_machine_info[4] = dev.devid.bus_type;
- dhcp_machine_info[5] = dev.devid.vendor_id & 0xff;
- dhcp_machine_info[6] = ((dev.devid.vendor_id) >> 8) & 0xff;
- dhcp_machine_info[7] = dev.devid.device_id & 0xff;
- dhcp_machine_info[8] = ((dev.devid.device_id) >> 8) & 0xff;
+ struct {
+ uint8_t bus_type;
+ uint16_t vendor_id;
+ uint16_t device_id;
+ } __attribute__((packed)) *dhcp_dev_id = (void*)&dhcp_machine_info[4];
+ dhcp_dev_id->bus_type = dev.devid.bus_type;
+ dhcp_dev_id->vendor_id = htons ( dev.devid.vendor_id );
+ dhcp_dev_id->device_id = htons ( dev.devid.device_id );
#endif /* NO_DHCP_SUPPORT */
memset(&ip, 0, sizeof(struct bootpip_t));
ip.bp.bp_op = BOOTP_REQUEST;