SERVER_PORT = CLIENT_PORT - 1;
}
#endif
- if (opt & OPT_o)
- client_config.no_default_options = 1;
while (list_O) {
char *optstr = llist_pop(&list_O);
unsigned n = bb_strtou(optstr, NULL, 0);
}
client_config.opt_mask[n >> 3] |= 1 << (n & 7);
}
+ if (!(opt & OPT_o)) {
+ /*
+ unsigned i, n;
+ for (i = 0; (n = dhcp_optflags[i].code) != 0; i++) {
+ if (dhcp_optflags[i].flags & OPTION_REQ) {
+ client_config.opt_mask[n >> 3] |= 1 << (n & 7);
+ }
+ }
+ */
+ }
while (list_x) {
char *optstr = llist_pop(&list_x);
char *colon = strchr(optstr, ':');
static void add_client_options(struct dhcp_packet *packet)
{
- uint8_t c;
int i, end, len;
udhcp_add_simple_option(packet, DHCP_MAX_SIZE, htons(IP_UDP_DHCP_SIZE));
* No bounds checking because it goes towards the head of the packet. */
end = udhcp_end_option(packet->options);
len = 0;
- for (i = 0; (c = dhcp_optflags[i].code) != 0; i++) {
- if (( (dhcp_optflags[i].flags & OPTION_REQ)
- && !client_config.no_default_options
- )
- || (client_config.opt_mask[c >> 3] & (1 << (c & 7)))
- ) {
- packet->options[end + OPT_DATA + len] = c;
+ for (i = 1; i < DHCP_END; i++) {
+ if (client_config.opt_mask[i >> 3] & (1 << (i & 7))) {
+ packet->options[end + OPT_DATA + len] = i;
len++;
}
}
SERVER_PORT = CLIENT_PORT - 1;
}
#endif
- if (opt & OPT_o)
- client_config.no_default_options = 1;
while (list_O) {
char *optstr = llist_pop(&list_O);
unsigned n = bb_strtou(optstr, NULL, 0);
}
client_config.opt_mask[n >> 3] |= 1 << (n & 7);
}
+ if (!(opt & OPT_o)) {
+ unsigned i, n;
+ for (i = 0; (n = dhcp_optflags[i].code) != 0; i++) {
+ if (dhcp_optflags[i].flags & OPTION_REQ) {
+ client_config.opt_mask[n >> 3] |= 1 << (n & 7);
+ }
+ }
+ }
while (list_x) {
char *optstr = llist_pop(&list_x);
char *colon = strchr(optstr, ':');
struct client_config_t {
uint8_t client_mac[6]; /* Our mac address */
- char no_default_options; /* Do not include default options in request */
IF_FEATURE_UDHCP_PORT(uint16_t port;)
int ifindex; /* Index number of the interface to use */
uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */