diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-17 11:57:09 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-17 11:57:09 +0200 |
commit | 31af3d5a1dbc750d8646f948ce642e6ae57ce880 (patch) | |
tree | 37d72b13f986b1da25def340771b49be4dd3028b /networking/udhcp/common.h | |
parent | ac906fa85e61b4e34161709de777616f858bc945 (diff) | |
download | busybox-w32-31af3d5a1dbc750d8646f948ce642e6ae57ce880.tar.gz busybox-w32-31af3d5a1dbc750d8646f948ce642e6ae57ce880.tar.bz2 busybox-w32-31af3d5a1dbc750d8646f948ce642e6ae57ce880.zip |
udhcp: shorten mac len from 16 to 6 in lease file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/common.h')
-rw-r--r-- | networking/udhcp/common.h | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h index 40b8df4df..a01597f68 100644 --- a/networking/udhcp/common.h +++ b/networking/udhcp/common.h | |||
@@ -23,8 +23,8 @@ extern const uint8_t MAC_BCAST_ADDR[6]; /* six all-ones */ | |||
23 | 23 | ||
24 | #define DHCP_OPTIONS_BUFSIZE 308 | 24 | #define DHCP_OPTIONS_BUFSIZE 308 |
25 | 25 | ||
26 | //TODO: rename to dhcp_packet; rename ciaddr/yiaddr/chaddr | 26 | //TODO: rename ciaddr/yiaddr/chaddr |
27 | struct dhcpMessage { | 27 | struct dhcp_packet { |
28 | uint8_t op; /* 1 = BOOTREQUEST, 2 = BOOTREPLY */ | 28 | uint8_t op; /* 1 = BOOTREQUEST, 2 = BOOTREPLY */ |
29 | uint8_t htype; /* hardware address type. 1 = 10mb ethernet */ | 29 | uint8_t htype; /* hardware address type. 1 = 10mb ethernet */ |
30 | uint8_t hlen; /* hardware address length */ | 30 | uint8_t hlen; /* hardware address length */ |
@@ -45,39 +45,38 @@ struct dhcpMessage { | |||
45 | uint8_t options[DHCP_OPTIONS_BUFSIZE + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS]; | 45 | uint8_t options[DHCP_OPTIONS_BUFSIZE + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS]; |
46 | } PACKED; | 46 | } PACKED; |
47 | 47 | ||
48 | //TODO: rename to ip_udp_dhcp_packet? | 48 | struct ip_udp_dhcp_packet { |
49 | struct udp_dhcp_packet { | ||
50 | struct iphdr ip; | 49 | struct iphdr ip; |
51 | struct udphdr udp; | 50 | struct udphdr udp; |
52 | struct dhcpMessage data; | 51 | struct dhcp_packet data; |
53 | } PACKED; | 52 | } PACKED; |
54 | 53 | ||
55 | /* Let's see whether compiler understood us right */ | 54 | /* Let's see whether compiler understood us right */ |
56 | struct BUG_bad_sizeof_struct_udp_dhcp_packet { | 55 | struct BUG_bad_sizeof_struct_ip_udp_dhcp_packet { |
57 | char BUG_bad_sizeof_struct_udp_dhcp_packet | 56 | char BUG_bad_sizeof_struct_ip_udp_dhcp_packet |
58 | [(sizeof(struct udp_dhcp_packet) != 576 + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS) ? -1 : 1]; | 57 | [(sizeof(struct ip_udp_dhcp_packet) != 576 + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS) ? -1 : 1]; |
59 | }; | 58 | }; |
60 | 59 | ||
61 | uint16_t udhcp_checksum(void *addr, int count) FAST_FUNC; | 60 | uint16_t udhcp_checksum(void *addr, int count) FAST_FUNC; |
62 | 61 | ||
63 | void udhcp_init_header(struct dhcpMessage *packet, char type) FAST_FUNC; | 62 | void udhcp_init_header(struct dhcp_packet *packet, char type) FAST_FUNC; |
64 | 63 | ||
65 | /*int udhcp_recv_raw_packet(struct dhcpMessage *dhcp_pkt, int fd); - in dhcpc.h */ | 64 | /*int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd); - in dhcpc.h */ |
66 | int udhcp_recv_kernel_packet(struct dhcpMessage *packet, int fd) FAST_FUNC; | 65 | int udhcp_recv_kernel_packet(struct dhcp_packet *packet, int fd) FAST_FUNC; |
67 | 66 | ||
68 | int udhcp_send_raw_packet(struct dhcpMessage *dhcp_pkt, | 67 | int udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt, |
69 | uint32_t source_ip, int source_port, | 68 | uint32_t source_ip, int source_port, |
70 | uint32_t dest_ip, int dest_port, const uint8_t *dest_arp, | 69 | uint32_t dest_ip, int dest_port, const uint8_t *dest_arp, |
71 | int ifindex) FAST_FUNC; | 70 | int ifindex) FAST_FUNC; |
72 | 71 | ||
73 | int udhcp_send_kernel_packet(struct dhcpMessage *dhcp_pkt, | 72 | int udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, |
74 | uint32_t source_ip, int source_port, | 73 | uint32_t source_ip, int source_port, |
75 | uint32_t dest_ip, int dest_port) FAST_FUNC; | 74 | uint32_t dest_ip, int dest_port) FAST_FUNC; |
76 | 75 | ||
77 | 76 | ||
78 | /**/ | 77 | /**/ |
79 | 78 | ||
80 | void udhcp_run_script(struct dhcpMessage *packet, const char *name) FAST_FUNC; | 79 | void udhcp_run_script(struct dhcp_packet *packet, const char *name) FAST_FUNC; |
81 | 80 | ||
82 | // Still need to clean these up... | 81 | // Still need to clean these up... |
83 | 82 | ||
@@ -104,16 +103,22 @@ int arpping(uint32_t test_ip, | |||
104 | extern int dhcp_verbose; | 103 | extern int dhcp_verbose; |
105 | # define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0) | 104 | # define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0) |
106 | # if CONFIG_UDHCP_DEBUG >= 2 | 105 | # if CONFIG_UDHCP_DEBUG >= 2 |
107 | void udhcp_dump_packet(struct dhcpMessage *packet) FAST_FUNC; | 106 | void udhcp_dump_packet(struct dhcp_packet *packet) FAST_FUNC; |
108 | # define log2(...) do { if (dhcp_verbose >= 2) bb_info_msg(__VA_ARGS__); } while (0) | 107 | # define log2(...) do { if (dhcp_verbose >= 2) bb_info_msg(__VA_ARGS__); } while (0) |
109 | # else | 108 | # else |
110 | # define udhcp_dump_packet(...) ((void)0) | 109 | # define udhcp_dump_packet(...) ((void)0) |
111 | # define log2(...) ((void)0) | 110 | # define log2(...) ((void)0) |
112 | # endif | 111 | # endif |
112 | # if CONFIG_UDHCP_DEBUG >= 3 | ||
113 | # define log3(...) do { if (dhcp_verbose >= 3) bb_info_msg(__VA_ARGS__); } while (0) | ||
114 | # else | ||
115 | # define log3(...) ((void)0) | ||
116 | # endif | ||
113 | #else | 117 | #else |
114 | # define udhcp_dump_packet(...) ((void)0) | 118 | # define udhcp_dump_packet(...) ((void)0) |
115 | # define log1(...) ((void)0) | 119 | # define log1(...) ((void)0) |
116 | # define log2(...) ((void)0) | 120 | # define log2(...) ((void)0) |
121 | # define log3(...) ((void)0) | ||
117 | #endif | 122 | #endif |
118 | 123 | ||
119 | POP_SAVED_FUNCTION_VISIBILITY | 124 | POP_SAVED_FUNCTION_VISIBILITY |