in struct client_config.
-/* $OpenBSD: clparse.c,v 1.153 2017/12/08 20:17:28 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.154 2017/12/09 15:48:04 krw Exp $ */
/* Parser for dhclient config and lease files. */
void
parse_client_statement(FILE *cfile, char *name, int nested)
{
+ uint8_t list[DHO_COUNT];
char *val;
- int i, token;
+ int i, count, token;
token = next_token(NULL, cfile);
parse_semi(cfile);
break;
case TOK_IGNORE:
- if (parse_option_list(cfile, &config->ignored_option_count,
- config->ignored_options) == 1)
+ if (parse_option_list(cfile, &count, list) == 1) {
+ for (i = 0; i < count; i++)
+ config->default_actions[list[i]] = ACTION_IGNORE;
parse_semi(cfile);
+ }
break;
case TOK_INITIAL_INTERVAL:
if (parse_lease_time(cfile, &config->initial_interval) == 1)
-/* $OpenBSD: dhclient.c,v 1.539 2017/12/08 20:17:28 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.540 2017/12/09 15:48:04 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
apply_defaults(struct client_lease *lease)
{
struct client_lease *newlease;
- int i, j;
+ int i;
newlease = clone_lease(lease);
if (newlease == NULL)
newlease->next_server.s_addr = config->next_server.s_addr;
for (i = 0; i < DHO_COUNT; i++) {
- for (j = 0; j < config->ignored_option_count; j++) {
- if (config->ignored_options[j] == i) {
- free(newlease->options[i].data);
- newlease->options[i].data = NULL;
- newlease->options[i].len = 0;
- break;
- }
- }
- if (j < config->ignored_option_count)
- continue;
-
switch (config->default_actions[i]) {
+ case ACTION_IGNORE:
+ free(newlease->options[i].data);
+ newlease->options[i].data = NULL;
+ newlease->options[i].len = 0;
+ break;
+
case ACTION_SUPERSEDE:
free(newlease->options[i].data);
newlease->options[i].len = config->defaults[i].len;
list[ix++] = i;
}
- config->ignored_option_count = ix;
- memcpy(config->ignored_options, list, sizeof(config->ignored_options));
+ for (i = 0; i < ix; i++)
+ config->default_actions[list[i]] = ACTION_IGNORE;
}
void
-/* $OpenBSD: dhcpd.h,v 1.240 2017/12/07 19:03:15 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.241 2017/12/09 15:48:04 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
ACTION_DEFAULT,
ACTION_SUPERSEDE,
ACTION_PREPEND,
- ACTION_APPEND
+ ACTION_APPEND,
+ ACTION_IGNORE
} default_actions[DHO_COUNT];
struct in_addr address;
struct option_data send_options[DHO_COUNT];
uint8_t required_options[DHO_COUNT];
uint8_t requested_options[DHO_COUNT];
- uint8_t ignored_options[DHO_COUNT];
int requested_option_count;
int required_option_count;
- int ignored_option_count;
time_t timeout;
time_t initial_interval;
time_t link_timeout;