summaryrefslogtreecommitdiff
path: root/networking/udhcp/common.h
diff options
context:
space:
mode:
authorDenys Vlasenko2010-05-30 23:41:23 +0200
committerDenys Vlasenko2010-05-30 23:41:23 +0200
commitb7d19cc400f14ccd64a1fedebe14022fe115029a (patch)
treecd4a50e2694628413a2460d3e1d2a706462d0e2b /networking/udhcp/common.h
parentc88c1a01904b5791dfd1ca5342c805a9f392e17f (diff)
downloadbusybox-b7d19cc400f14ccd64a1fedebe14022fe115029a.zip
busybox-b7d19cc400f14ccd64a1fedebe14022fe115029a.tar.gz
dhcp: readability cleanups and small code shrink
function old new delta udhcp_run_script 654 617 -37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/common.h')
-rw-r--r--networking/udhcp/common.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index c9dd0bb..75b787a 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -57,10 +57,20 @@ struct ip_udp_dhcp_packet {
struct dhcp_packet data;
} PACKED;
+struct udp_dhcp_packet {
+ struct udphdr udp;
+ struct dhcp_packet data;
+} PACKED;
+
+enum {
+ IP_UPD_DHCP_SIZE = sizeof(struct ip_udp_dhcp_packet) - CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS,
+ UPD_DHCP_SIZE = sizeof(struct udp_dhcp_packet) - CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS,
+ DHCP_SIZE = sizeof(struct dhcp_packet) - CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS,
+};
+
/* Let's see whether compiler understood us right */
struct BUG_bad_sizeof_struct_ip_udp_dhcp_packet {
- char BUG_bad_sizeof_struct_ip_udp_dhcp_packet
- [(sizeof(struct ip_udp_dhcp_packet) != 576 + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS) ? -1 : 1];
+ char c[IP_UPD_DHCP_SIZE == 576 ? 1 : -1];
};