udhcpc: support for -O <option>.
Two important notes: * nissrv and nisdomain are not requested by default anymore! * inconsistency between "XXXsvr" and "XXsrv" in option names resolved, all are "XXXsrv" now. function old new delta udhcpc_main 2494 2600 +106 packed_usage 23023 23067 +44 add_requests 91 119 +28 static.udhcpc_longopts 209 226 +17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 195/0) Total: 195 bytes
This commit is contained in:
@@ -57,13 +57,18 @@ static void init_packet(struct dhcpMessage *packet, char type)
|
||||
* goes towards the head of the packet. */
|
||||
static void add_requests(struct dhcpMessage *packet)
|
||||
{
|
||||
uint8_t c;
|
||||
int end = end_option(packet->options);
|
||||
int i, len = 0;
|
||||
|
||||
packet->options[end + OPT_CODE] = DHCP_PARAM_REQ;
|
||||
for (i = 0; dhcp_options[i].code; i++)
|
||||
if (dhcp_options[i].flags & OPTION_REQ)
|
||||
packet->options[end + OPT_DATA + len++] = dhcp_options[i].code;
|
||||
for (i = 0; (c = dhcp_options[i].code) != 0; i++) {
|
||||
if (dhcp_options[i].flags & OPTION_REQ
|
||||
|| (client_config.opt_mask[c >> 3] & (1 << (c & 7)))
|
||||
) {
|
||||
packet->options[end + OPT_DATA + len++] = c;
|
||||
}
|
||||
}
|
||||
packet->options[end + OPT_LEN] = len;
|
||||
packet->options[end + OPT_DATA + len] = DHCP_END;
|
||||
|
||||
|
Reference in New Issue
Block a user