summaryrefslogtreecommitdiff
path: root/networking/udhcp/common.h
diff options
context:
space:
mode:
authorDenis Vlasenko2007-11-23 00:08:54 +0000
committerDenis Vlasenko2007-11-23 00:08:54 +0000
commit6884f665bd7bc101f56ff9047afaffbc06dc99e2 (patch)
tree9eb497068cdee02c112c2f55bd0def8ae6354e92 /networking/udhcp/common.h
parent68af8e7a084317191effa9b257483a50d994b11c (diff)
downloadbusybox-6884f665bd7bc101f56ff9047afaffbc06dc99e2.zip
busybox-6884f665bd7bc101f56ff9047afaffbc06dc99e2.tar.gz
dhcp: stop using magic constants; use (htonl(CONST) != a) - it's smaller
function old new delta udhcp_get_packet 146 134 -12 get_raw_packet 368 353 -15
Diffstat (limited to 'networking/udhcp/common.h')
-rw-r--r--networking/udhcp/common.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index 179c21f..4f2d31c 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -38,12 +38,18 @@ struct dhcpMessage {
uint8_t file[128];
uint32_t cookie;
uint8_t options[308]; /* 312 - cookie */
-};
+} ATTRIBUTE_PACKED;
struct udp_dhcp_packet {
struct iphdr ip;
struct udphdr udp;
struct dhcpMessage data;
+} ATTRIBUTE_PACKED;
+
+/* Let's see whether compiler understood us right */
+struct BUG_bad_sizeof_struct_udp_dhcp_packet {
+ char BUG_bad_sizeof_struct_udp_dhcp_packet
+ [sizeof(struct udp_dhcp_packet) != 576 ? -1 : 1];
};
void udhcp_init_header(struct dhcpMessage *packet, char type);