[dhcp-agent-commits] dhcp-agent/src Makefile.am,1.10,1.11 dhcp-client-cache.c,1.8,1.9 dhcp-client-co
Status: Alpha
Brought to you by:
actmodern
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv14122 Modified Files: Makefile.am dhcp-client-cache.c dhcp-client-conf.c dhcp-client-conf.h dhcp-client-control.c dhcp-client-states.c dhcp-client.c dhcp-com.c dhcp-conf.c dhcp-conf.h dhcp-convert.c dhcp-librawnet.h dhcp-libutil.h dhcp-limits.h dhcp-options-strings.c dhcp-options-strings.h dhcp-print.c dhcp-sysconf.c Removed Files: dhcp-globconf.c dhcp-globconf.h Log Message: initial import of new client configuration code Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile.am 15 Dec 2002 00:22:02 -0000 1.10 --- Makefile.am 16 Dec 2002 07:20:41 -0000 1.11 *************** *** 15,19 **** noinst_HEADERS = dhcp-align.h dhcp-client-cache.h dhcp-client.h dhcp-daemon.h dhcp-interface.h \ dhcp-libutil.h dhcp-local.h dhcp-options-strings.h dhcp-print.h dhcp-cache-entry.h \ ! dhcp-client-conf.h dhcp-convert.h dhcp-globconf.h dhcp-librawnet.h dhcp-limits.h dhcp-log.h \ dhcp-parser.h dhcp-sysconf.h dhcp-conf.h --- 15,19 ---- noinst_HEADERS = dhcp-align.h dhcp-client-cache.h dhcp-client.h dhcp-daemon.h dhcp-interface.h \ dhcp-libutil.h dhcp-local.h dhcp-options-strings.h dhcp-print.h dhcp-cache-entry.h \ ! dhcp-client-conf.h dhcp-convert.h dhcp-librawnet.h dhcp-limits.h dhcp-log.h \ dhcp-parser.h dhcp-sysconf.h dhcp-conf.h *************** *** 42,46 **** dhcp-icmp.c \ dhcp-route.c \ ! dhcp-interrupt.c dhcp_sniff_SOURCES = dhcp-sniff.c \ --- 42,47 ---- dhcp-icmp.c \ dhcp-route.c \ ! dhcp-interrupt.c \ ! dhcp-conf.c dhcp_sniff_SOURCES = dhcp-sniff.c \ *************** *** 57,62 **** dhcp-options-strings.c \ dhcp-convert.c \ ! dhcp-sysconf.c \ ! dhcp-globconf.c dhcp_client_LDADD = -ldhcputil --- 58,62 ---- dhcp-options-strings.c \ dhcp-convert.c \ ! dhcp-sysconf.c dhcp_client_LDADD = -ldhcputil Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-cache.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-client-cache.c 24 Nov 2002 01:12:12 -0000 1.8 --- dhcp-client-cache.c 16 Dec 2002 07:20:41 -0000 1.9 *************** *** 249,253 **** if(data == NULL) { WARN_MESSAGE("option: %s may be malformed. I'll ignore and carry on.", ! dhcp_option_string_get(tag)); return NULL; } --- 249,253 ---- if(data == NULL) { WARN_MESSAGE("option: %s may be malformed. I'll ignore and carry on.", ! dhcp_option_printable_string_get(tag)); return NULL; } *************** *** 267,271 **** tag == TAG_DHCP_RENEWAL_TIME || tag == TAG_DHCP_REBINDING_TIME) { ! ce = create_cache_entry(tag, dhcp_option_string_get(tag), string); return ce; } --- 267,271 ---- tag == TAG_DHCP_RENEWAL_TIME || tag == TAG_DHCP_REBINDING_TIME) { ! ce = create_cache_entry(tag, dhcp_option_printable_string_get(tag), string); return ce; } *************** *** 278,282 **** cache_entry_t *ce; ! ce = create_cache_entry(tag, dhcp_option_string_get(tag), string); return ce; } --- 278,282 ---- cache_entry_t *ce; ! ce = create_cache_entry(tag, dhcp_option_printable_string_get(tag), string); return ce; } *************** *** 351,355 **** } ! fprintf(fp, "%d=\"%s\" # %s\n", opt->tag, val, dhcp_option_string_get(opt->tag)); xfree(val); } --- 351,355 ---- } ! fprintf(fp, "%d=\"%s\" # %s\n", opt->tag, val, dhcp_option_printable_string_get(opt->tag)); xfree(val); } Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-client-conf.c 24 Nov 2002 01:10:00 -0000 1.6 --- dhcp-client-conf.c 16 Dec 2002 07:20:41 -0000 1.7 *************** *** 32,35 **** --- 32,36 ---- #include "dhcp-librawnet.h" + #include "dhcp-conf.h" #include "dhcp-client-conf.h" #include "dhcp-cache-entry.h" *************** *** 37,74 **** #include "dhcp-options-strings.h" ! /* Basic network configuration. ! * Here we keep the options we want by default. */ static const int default_config_options[] = { ! TAG_DHCP_SUBNET_MASK, /* Subnet Mask */ ! TAG_DHCP_ROUTER, /* Routers. */ ! TAG_DHCP_INTERFACE_MTU, /* Interface MTU */ ! TAG_DHCP_DOMAIN_NAME_SERVER, /* Domain Name Servers. */ ! TAG_DHCP_DOMAIN_NAME, /* Domain Name. */ ! TAG_DHCP_REQUESTED_IP_ADDRESS, /* Requested IP Address. */ TAG_DHCP_IP_ADDRESS_LEASE_TIME, /* IP Address lease time. */ ! TAG_DHCP_RENEWAL_TIME, /* Renewal time. */ ! TAG_DHCP_REBINDING_TIME, /* Rebinding time. */ ! TAG_DHCP_SERVER_IDENTIFIER, /* Server Identifier. */ }; ! static void client_conf_reset_options(client_conf_t *cc) { ! memset(cc->options, 0, sizeof(cc->options)); } ! client_conf_t *create_client_conf(const char *interface) { ! client_conf_t *cc; ! cc = xmalloc(sizeof(client_conf_t)); ! client_conf_reset_options(cc); ! cc->interface = interface; ! return cc; } ! void client_conf_destroy(client_conf_t *cc) { ! xfree(cc); } --- 38,199 ---- #include "dhcp-options-strings.h" ! ! /* * * * * * * * * * * * * * * * * * * ! * configuration grammar structures. * ! * * * * * * * * * * * * * * * * * * */ ! ! /* string arrays for commands. */ ! ! /* variables the client will accept to be set. */ ! static const char *var_strings[] = { ! "hostname", ! "dhcp-retries", ! "icmp-retries", ! "do-icmp-router-discovery", ! }; ! ! /* symbol arrays. */ ! ! /* symbols for string substitution. */ ! static const arg_symbol_t var_symbols[] = { ! CLIENT_VAR_HOSTNAME, ! CLIENT_VAR_DHCP_RETRIES, ! CLIENT_VAR_ICMP_RETRIES, ! CLIENT_VAR_DO_ICMP_ROUTER_DISCOVERY, ! }; ! ! /* argument types, string array pointers, and symbol array pointers */ ! ! static const arg_type_t var_arg_types[] = { CONF_IDENTIFIER, CONF_ASSIGNMENT, CONF_STRING }; ! static const char **var_arg_strings[] = { var_strings, NULL, NULL }; ! static const arg_symbol_t *var_arg_symbols[] = { var_symbols, NULL, NULL }; ! ! static const arg_type_t request_arg_types[] = { CONF_STRING_LIST }; ! static const char **request_arg_strings[] = { NULL }; ! static const arg_symbol_t *request_arg_symbols[] = { NULL }; ! ! /* command structures. */ ! ! /* set command. */ ! static const command_t command_set = { ! DIRECTIVE_SET, ! "set", ! 3, ! var_arg_strings, ! var_arg_types, ! var_arg_symbols, ! }; ! ! /* request command. */ ! static const command_t command_request = { ! DIRECTIVE_REQUEST, ! "request", ! 1, ! request_arg_strings, ! request_arg_types, ! request_arg_symbols, ! }; ! ! static const command_t *commands[] = { ! &command_set, ! &command_request, ! NULL, ! }; ! ! /* Basic network configuration. Here we keep the options we want ! * by default. We always want these and will override the config ! * passed us by the user. */ ! static const int default_config_options[] = { ! TAG_DHCP_SUBNET_MASK, /* Subnet Mask */ ! TAG_DHCP_ROUTER, /* Routers. */ ! TAG_DHCP_INTERFACE_MTU, /* Interface MTU */ ! TAG_DHCP_REQUESTED_IP_ADDRESS, /* Requested IP Address. */ TAG_DHCP_IP_ADDRESS_LEASE_TIME, /* IP Address lease time. */ ! TAG_DHCP_RENEWAL_TIME, /* Renewal time. */ ! TAG_DHCP_REBINDING_TIME, /* Rebinding time. */ ! TAG_DHCP_SERVER_IDENTIFIER, /* Server Identifier. */ }; ! /* forward declaration of directive handlers. */ ! ! static int directive_group_handler(client_conf_t *cc, directive_t *directive, directive_group_t group_type, void *group_data); ! static int directive_set_handler(client_conf_t *cc, directive_t *directive, directive_group_t group_type, void *group_data); ! static int directive_request_handler(client_conf_t *cc, directive_t *directive, directive_group_t group_type, void *group_data); ! ! /* indexed by directive types in dhcp-client-conf.h . */ ! directive_handler_t directive_handlers[] = { ! directive_group_handler, ! directive_set_handler, ! directive_request_handler, ! }; ! ! /* * * * * * * ! * accessors * ! * * * * * * */ ! ! uint8_t *client_conf_get_opt_bit_array(client_conf_t *cc) { ! return cc->options; } ! int client_conf_get_dhcp_retries(client_conf_t *cc) { ! return cc->dhcp_retries; ! } ! int client_conf_get_icmp_retries(client_conf_t *cc) ! { ! return cc->icmp_retries; } ! const char *client_conf_get_hostname(client_conf_t *cc) { ! return cc->client_hostname; ! } ! ! /* * * * * * * * * * * ! * utility routines * ! * * * * * * * * * * */ ! ! static int client_conf_set_variable(client_conf_t *cc, arg_symbol_t var_symbol, const char *var_value) ! { ! ! /* FIXME: insert sanity checks on data. */ ! switch(var_symbol) { ! ! case CLIENT_VAR_HOSTNAME: ! ! if(cc->client_hostname != NULL) { ! xfree(cc->client_hostname); ! cc->client_hostname = NULL; ! } ! ! cc->client_hostname = xstrdup(var_value); ! break; ! ! ! case CLIENT_VAR_DHCP_RETRIES: ! ! cc->dhcp_retries = atoi(var_value); ! break; ! ! case CLIENT_VAR_ICMP_RETRIES: ! ! cc->icmp_retries = atoi(var_value); ! break; ! ! default: ! return 1; ! } ! ! return 0; ! } ! ! /* reset requested options. */ ! static void client_conf_reset_options(client_conf_t *cc) ! { ! memset(cc->options, 0, sizeof(cc->options)); } *************** *** 77,81 **** char *fname; stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, "opts"); fname = xstrdup(stringbuffer_getstring(sb)); --- 202,206 ---- char *fname; stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, "conf"); fname = xstrdup(stringbuffer_getstring(sb)); *************** *** 85,223 **** } ! static int dump_config_options(client_conf_t *cc, char *fname) { ! int i; ! FILE *fp; ! ! fp = file_open_or_create_safe(fname, "a+"); ! if(fp == NULL) ! return -1; ! for(i = 0; i < NELMS(default_config_options); i++) { ! if(fprintf(fp, "\"%s\"\n", dhcp_option_string_get(i)) < 0) { ! WARN_MESSAGE("could not dump options to file. I'm going to continue anyway."); ! fclose(fp); ! return -1; ! } } - fclose(fp); return 0; } ! static void use_default_options(client_conf_t *cc) { ! int i; ! for(i = 0; i < NELMS(default_config_options); i++) { ! cc->options[default_config_options[i]] = 1; ! } ! return; ! } ! static int client_conf_load_options(client_conf_t *cc, char *fname) ! { ! varfile_t *varfile; ! int i; ! unsigned char match; ! int retval; ! varfile = create_varfile(fname, VARFILE_VARNAMES_MODE); ! if(varfile == NULL) { ! ERROR_MESSAGE("could not open varfile: %s", fname); ! return -1; } ! while(1) { ! retval = varfile_get_next_var(varfile); ! switch (retval) { ! case VARFILE_SUCCESS: ! match = 0; ! for(i = 0; i < MAX_OPTIONS_HANDLED; i++) { ! /* as long as no error was returned from file_parse_string ! * we can just do a file_get_var_name() safely. */ ! if(string_matches(dhcp_option_string_get(i), varfile_get_name(varfile))) { ! cc->options[i] = 1; ! match = 1; ! break; ! } ! } ! if(match != 1) ! WARN_MESSAGE("encountered illegal DHCP option in %s: %s : %d", fname, ! varfile_get_name(varfile), varfile_get_lineno(varfile)); ! break; ! case VARFILE_EOF: ! destroy_varfile(varfile); ! return 0; ! case VARFILE_PARSE_ERROR: ! ERROR_MESSAGE("parse error in opts file: %s : %d", ! varfile_get_filename(varfile), varfile_get_lineno(varfile)); ! return -1; ! default: ! FATAL_MESSAGE("client-conf: load_options: internal error -- please report this."); ! } ! } ! } ! /* load configuration file or call applicable default setter, ! also call dump_defaults if file does not exist */ ! static int load_client_conf_proc(char *fname, ! client_conf_t *cc, int (*load_conf) (client_conf_t *cc, ! char *fname), ! void (*use_defaults) (client_conf_t *cc), ! int (*dump_defaults) (client_conf_t *cc, char *fname)) ! { ! int retval; ! if(!file_exists(fname)) { ! /* it doesn't exist. strap default. */ ! use_defaults(cc); ! /* and dump to file. */ ! retval = dump_config_options(cc, fname); ! } else { ! /* read conf data from file. */ ! retval = load_conf(cc, fname); } ! return retval; } ! int load_client_conf(client_conf_t *cc) ! { ! ! char *fname; ! int retval; ! /* load up options file. */ client_conf_reset_options(cc); - /* check for options file. */ - fname = get_conf_options_fname(cc); - retval = load_client_conf_proc(fname, cc, client_conf_load_options, - use_default_options, dump_config_options); - xfree(fname); ! return (retval); } ! /* return the bit array indexing the options we want. */ ! uint8_t *client_conf_get_opt_bit_array(client_conf_t *cc) { ! return cc->options; } --- 210,337 ---- } ! static int client_conf_apply_directives(client_conf_t *cc, list_t *directives) { ! list_t *directive_list_ptr; ! directive_t *directive; ! for(directive_list_ptr = directives; directive_list_ptr; ! directive_list_ptr = directive_list_ptr->next) { ! directive = directive_list_ptr->data; ! if(directive_handlers[directive->command_code](cc, directive, GROUP_DIRECTIVE_NULL, NULL)) ! return 1; } return 0; } ! static int client_conf_load_options(client_conf_t *cc) { ! char *fname; ! conf_t *conf; ! list_t *directives; ! fname = get_conf_options_fname(cc); ! conf = conf_create(commands, fname); ! if(conf_compile_directives(conf) == CONF_ERROR) { ! conf_destroy(conf); ! return 1; ! } ! directives = conf_get_directives(conf); ! /* read compiled directives. */ ! ! if(client_conf_apply_directives(cc, conf->directives)) { ! conf_destroy(conf); ! return 1; } ! return 0; ! } ! /* * * * * * * * * * * * ! * directive handlers. * ! * * * * * * * * * * * */ ! static int directive_group_handler(client_conf_t *cc, directive_t *directive, directive_group_t group_type, void *group_data) ! { ! /* we ignore group_type and group_data for now. we don't support nested groups just yet. */ ! /* FIXME: todo. */ ! return 0; ! } ! static int directive_set_handler(client_conf_t *cc, directive_t *directive, directive_group_t group_type, void *group_data) ! { ! list_t *args; ! arg_symbol_t *var_symbol; ! char *var_value; ! args = directive->arguments; ! var_symbol = args->data; ! var_value = args->next->next->data; ! if(client_conf_set_variable(cc, *var_symbol, var_value)) { ! return 1; ! } ! return 0; ! } ! static int directive_request_handler(client_conf_t *cc, directive_t *directive, directive_group_t group_type, void *group_data) ! { ! list_t *args; ! list_t *string_list; ! const char **option_strings = dhcp_option_conf_string_get_array(); ! char *option_requested; ! uint8_t i; ! args = directive->arguments; ! for(string_list = args->data; string_list; string_list = string_list->next) { ! option_requested = string_list->data; ! for(i = 0; i <= MAX_OPTIONS_HANDLED; i++) { ! if(!strcmp(option_strings[i], option_requested)) { ! cc->options[i] = 1; ! break; ! } ! } ! if(i == MAX_OPTIONS_HANDLED) ! return 1; } ! return 0; } ! /* * * * * * * * * * * * * * * ! * constructors/destructors * ! * * * * * * * * * * * * * * */ ! client_conf_t *create_client_conf(const char *interface) ! { ! client_conf_t *cc; + cc = xmalloc(sizeof(client_conf_t)); + cc->interface = interface; client_conf_reset_options(cc); ! if(client_conf_load_options(cc)) { ! client_conf_destroy(cc); ! return NULL; ! } ! ! return cc; } ! void client_conf_destroy(client_conf_t *cc) { ! xfree(cc); } Index: dhcp-client-conf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-client-conf.h 19 Nov 2002 19:44:44 -0000 1.3 --- dhcp-client-conf.h 16 Dec 2002 07:20:41 -0000 1.4 *************** *** 26,29 **** --- 26,33 ---- #define DHCP_CLIENT_CONF_H + /* typdefs. */ + + typedef uint8_t directive_group_t; + /* data structures. */ *************** *** 35,44 **** unsigned char options[MAX_OPTIONS_HANDLED]; /* which options should we handle. */ } client_conf_t; extern client_conf_t *create_client_conf(const char *interface); extern void client_conf_destroy(client_conf_t *cc); ! extern int load_client_conf(client_conf_t *cc); extern uint8_t *client_conf_get_opt_bit_array(client_conf_t *cc); #endif /* DHCP_CLIENT_CONF_H */ --- 39,70 ---- unsigned char options[MAX_OPTIONS_HANDLED]; /* which options should we handle. */ + + /* the option variables. */ + + char *client_hostname; /* setting for the hostname option. */ + int dhcp_retries; /* amount of times we should retry dhcp operations. */ + int icmp_retries; /* amount of times we should retry icmp operations. */ + uint8_t do_icmp_router_discovery; /* perform router discovery via icmp. */ + } client_conf_t; + typedef int (*directive_handler_t)(client_conf_t *cc, directive_t *directive, directive_group_t group_type, void *group_data); + + enum directive_types { DIRECTIVE_GROUP = 0, DIRECTIVE_SET, DIRECTIVE_REQUEST}; + + /* symbols for variable substitution. */ + enum var_symbols { CLIENT_VAR_HOSTNAME = 0, CLIENT_VAR_DHCP_RETRIES, CLIENT_VAR_ICMP_RETRIES, + CLIENT_VAR_DO_ICMP_ROUTER_DISCOVERY }; + + enum directive_group_t { GROUP_DIRECTIVE_NULL = 0, DIRECTIVE_GROUP_IP_ADDRESS, DIRECTIVE_GROUP_ETH_ADDRESS }; + + /* prototypes. */ extern client_conf_t *create_client_conf(const char *interface); extern void client_conf_destroy(client_conf_t *cc); ! extern uint8_t *client_conf_get_opt_bit_array(client_conf_t *cc); + extern int client_conf_get_dhcp_retries(client_conf_t *cc); + extern int client_conf_get_icmp_retries(client_conf_t *cc); + extern const char *client_conf_get_hostname(client_conf_t *cc); #endif /* DHCP_CLIENT_CONF_H */ Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-control.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-client-control.c 19 Nov 2002 19:44:44 -0000 1.5 --- dhcp-client-control.c 16 Dec 2002 07:20:41 -0000 1.6 *************** *** 34,38 **** #include "dhcp-client.h" #include "dhcp-client-conf.h" - #include "dhcp-globconf.h" /* Utility routines to update counters and time stamps. */ --- 34,37 ---- *************** *** 61,68 **** int dhcp_client_discover_offer_can_retry(dhcp_client_control_t *dc) { ! uint32_t *discover_offer_retries = glob_conf_get_val(CLIENT_DHCP_RETRIES); dc->discover_offer_retries++; ! if(dc->discover_offer_retries > *(discover_offer_retries)) return 1; --- 60,67 ---- int dhcp_client_discover_offer_can_retry(dhcp_client_control_t *dc) { ! uint32_t discover_offer_retries = client_conf_get_dhcp_retries(dc->conf); dc->discover_offer_retries++; ! if(dc->discover_offer_retries > discover_offer_retries); return 1; *************** *** 139,147 **** dc->state = 0; dc->interface = xstrdup(interface); - dc->conf = create_client_conf(dc->interface); dc->cache = client_cache_create(dc->interface); dc->timer = create_timer(); ! if(load_client_conf(dc->conf) < 0) { ERROR_MESSAGE("could not read client conf."); destroy_dhcp_client_control(dc); --- 138,146 ---- dc->state = 0; dc->interface = xstrdup(interface); dc->cache = client_cache_create(dc->interface); dc->timer = create_timer(); ! dc->conf = create_client_conf(dc->interface); ! if(dc->conf == NULL) { ERROR_MESSAGE("could not read client conf."); destroy_dhcp_client_control(dc); Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-client-states.c 24 Nov 2002 01:12:12 -0000 1.7 --- dhcp-client-states.c 16 Dec 2002 07:20:41 -0000 1.8 *************** *** 37,41 **** #include "dhcp-client-cache.h" #include "dhcp-client.h" - #include "dhcp-globconf.h" #include "dhcp-sysconf.h" --- 37,40 ---- *************** *** 67,71 **** list_t *options = NULL; dhcp_option_t *option; ! char *hostname; /* dhcp max DHCP message size: --- 66,70 ---- list_t *options = NULL; dhcp_option_t *option; ! const char *hostname; /* dhcp max DHCP message size: *************** *** 83,87 **** /* hostname if available */ ! hostname = glob_conf_get_val(CLIENT_HOSTNAME); if(hostname != NULL) { /* if we have one set it. */ --- 82,86 ---- /* hostname if available */ ! hostname = client_conf_get_hostname(dc->conf); if(hostname != NULL) { /* if we have one set it. */ *************** *** 163,167 **** static int client_check_requested_options(dhcp_client_control_t *dc) { ! const char *policy = glob_conf_get_val(CLIENT_OPTION_POLICY); return 1; --- 162,167 ---- static int client_check_requested_options(dhcp_client_control_t *dc) { ! /* FIXME: we default to at least. we need an actual policy in client_conf though. */ ! const char *policy = NULL; return 1; Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-client.c 15 Dec 2002 00:22:02 -0000 1.8 --- dhcp-client.c 16 Dec 2002 07:20:42 -0000 1.9 *************** *** 34,38 **** #include "dhcp-client-cache.h" #include "dhcp-client.h" - #include "dhcp-globconf.h" #include "dhcp-daemon.h" --- 34,37 ---- *************** *** 105,125 **** /* Utility routines. */ - /* read up on our global conf. */ - static void read_global_conf(const char *interface) - { - stringbuffer *sb; - - sb = create_stringbuffer(); - stringbuffer_aprintf(sb, "%s.%s", interface, "conf"); - - if(init_glob_conf(stringbuffer_getstring(sb))) { - FATAL_MESSAGE("could not read nor create global configuration file: %s", - stringbuffer_getstring(sb)); - } - - destroy_stringbuffer(sb); - return; - } - /* initialize state per contents of cache. */ static int initialize_client_state(dhcp_client_control_t *dc) --- 104,107 ---- *************** *** 151,155 **** pid_t pid; ! if(!get_pid_file(interface, &pid)) return 0; /* no pid file -- therefore no process. */ --- 133,137 ---- pid_t pid; ! if(get_pid_file(interface, &pid)) return 0; /* no pid file -- therefore no process. */ *************** *** 388,394 **** INFO_MESSAGE("starting for interface %s", interface); - /* We need to read our global configuration right after we change to work directory. */ - read_global_conf(interface); - /* Now see if another client is running on the same interface. */ --- 370,373 ---- *************** *** 535,539 **** /* dhcp options which can be set on the command line. */ case 'H': ! glob_conf_set_val(optarg, CLIENT_HOSTNAME); break; --- 514,520 ---- /* dhcp options which can be set on the command line. */ case 'H': ! /* glob_conf_set_val(optarg, CLIENT_HOSTNAME); */ ! /* heh no more globconf -- FIXME: set this in client_conf later. */ ! break; Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-com.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-com.c 19 Nov 2002 19:44:44 -0000 1.4 --- dhcp-com.c 16 Dec 2002 07:20:42 -0000 1.5 *************** *** 394,398 **** int dhcp_option_is_valid(unsigned char tag, unsigned char tag_len) { ! if(tag_len < 1 || tag >= MAX_OPTIONS_HANDLED) return 0; else --- 394,398 ---- int dhcp_option_is_valid(unsigned char tag, unsigned char tag_len) { ! if(tag_len < 1 || tag > MAX_OPTIONS_HANDLED) return 0; else *************** *** 464,468 **** int i; ! for(i = 0; i < MAX_OPTIONS_HANDLED; i++) { if(options[i] && !dhcp_have_option(dhcp, i)) return 1; --- 464,468 ---- int i; ! for(i = 0; i <= MAX_OPTIONS_HANDLED; i++) { if(options[i] && !dhcp_have_option(dhcp, i)) return 1; *************** *** 476,480 **** int i; ! for(i = 0; i < MAX_OPTIONS_HANDLED; i++) { if(options[i] && !dhcp_have_option(dhcp, i)) return 1; --- 476,480 ---- int i; ! for(i = 0; i <= MAX_OPTIONS_HANDLED; i++) { if(options[i] && !dhcp_have_option(dhcp, i)) return 1; *************** *** 521,525 **** /* Grab length so we can just malloc all at once. */ ! for(i = 0; i < MAX_OPTIONS_HANDLED; i++) { if(requested_options[i]) len++; --- 521,525 ---- /* Grab length so we can just malloc all at once. */ ! for(i = 0; i <= MAX_OPTIONS_HANDLED; i++) { if(requested_options[i]) len++; *************** *** 537,541 **** j = 0; ! for(i = 0; i < MAX_OPTIONS_HANDLED; i++) { if(requested_options[i]) { option->data[j] = i; --- 537,541 ---- j = 0; ! for(i = 0; i <= MAX_OPTIONS_HANDLED; i++) { if(requested_options[i]) { option->data[j] = i; *************** *** 581,585 **** } ! dhcp_option_t *dhcp_build_hostname(char *hostname) { return (create_dhcp_option --- 581,585 ---- } ! dhcp_option_t *dhcp_build_hostname(const char *hostname) { return (create_dhcp_option Index: dhcp-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-conf.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-conf.c 15 Dec 2002 05:15:44 -0000 1.2 --- dhcp-conf.c 16 Dec 2002 07:20:42 -0000 1.3 *************** *** 144,148 **** } ! conf_t *conf_create(command_t **commands, const char *filename) { conf_t *conf; --- 144,148 ---- } ! conf_t *conf_create(const command_t **commands, const char *filename) { conf_t *conf; *************** *** 351,355 **** /* compile the command. follow the command argument types and store them. */ ! static directive_t *compile_command(conf_t *conf, command_t *command) { directive_t *directive; --- 351,355 ---- /* compile the command. follow the command argument types and store them. */ ! static directive_t *compile_command(conf_t *conf, const command_t *command) { directive_t *directive; *************** *** 395,399 **** const char *token_string; directive_t *directive; ! command_t *command; int i; --- 395,399 ---- const char *token_string; directive_t *directive; ! const command_t *command; int i; Index: dhcp-conf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-conf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-conf.h 15 Dec 2002 05:15:44 -0000 1.2 --- dhcp-conf.h 16 Dec 2002 07:20:42 -0000 1.3 *************** *** 26,64 **** #define DHCP_CONF_H - /* native types. */ - - typedef uint32_t command_code_t; - typedef uint32_t arg_len_t; - typedef uint32_t arg_type_t; - typedef uint32_t arg_symbol_t; - - /* compiled directive. */ - typedef struct { - command_code_t command_code; /* the command code. */ - list_t *argument_types; /* type of argument: need this to free up arguments later. */ - list_t *arguments; /* argument data. */ - } directive_t; - - /* command syntax object. */ - typedef struct { - - const command_code_t command_code; - const char *command_name; - - const arg_len_t argument_len; - const char ***argument_strings; - const arg_type_t *argument_types; - const arg_symbol_t **argument_symbols; - - } command_t; - - /* conf object. */ - typedef struct { - char *filename; - parser_t *parser; - command_t **commands; /* list of permissible commands. */ - list_t *directives; - } conf_t; - /* typedef of configuration drivers. */ typedef void *(*argument_compiler_t)(conf_t *conf, const char **argument_strings, const arg_symbol_t *argument_symbols); --- 26,29 ---- *************** *** 72,83 **** CONF_ASSIGNMENT, CONF_BOOLEAN, CONF_STRING, CONF_STRING_LIST, CONF_GROUP }; - - /* prototypes. */ - - extern conf_t *conf_create(command_t **commands, const char *filename); - extern void conf_destroy(conf_t *conf); - - extern int conf_compile_directives(conf_t *conf); - extern list_t *conf_get_directives(conf_t *conf); - #endif /* DHCP_CONF_H */ --- 37,39 ---- Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-convert.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-convert.c 24 Nov 2002 01:10:00 -0000 1.4 --- dhcp-convert.c 16 Dec 2002 07:20:42 -0000 1.5 *************** *** 237,243 **** , /* 59 *//* Rebinding time. */ {NULL, NULL, NULL, NULL} ! , /* 60 *//* Server identifier */ {NULL, NULL, NULL, NULL} ! , /* 61 *//* Client identifier */ }; --- 237,269 ---- , /* 59 *//* Rebinding time. */ {NULL, NULL, NULL, NULL} ! , /* 60 *//* Class ID */ {NULL, NULL, NULL, NULL} ! , /* 61 *//* Client ID */ ! {NULL, NULL, NULL, NULL} ! , /* 62 NIS+ Domain */ ! {NULL, NULL, NULL, NULL} ! , /* 63 NIS+ Servers */ ! {NULL, NULL, NULL, NULL} ! , /* 64 TFTP Servers */ ! {NULL, NULL, NULL, NULL} ! , /* 65 Boot File Name */ ! {NULL, NULL, NULL, NULL} ! , /* 66 IP Home Agent */ ! {NULL, NULL, NULL, NULL} ! , /* 67 SMTP Server */ ! {NULL, NULL, NULL, NULL} ! , /* 69 POP Server */ ! {NULL, NULL, NULL, NULL} ! , /* 69 NNTP Server */ ! {NULL, NULL, NULL, NULL} ! , /* 70 Default WWW Server */ ! {NULL, NULL, NULL, NULL} ! , /* 71 Default Finger Server */ ! {NULL, NULL, NULL, NULL} ! , /* 72 Default IRC Server */ ! {NULL, NULL, NULL, NULL} ! , /* 73 Default ST Server */ ! {NULL, NULL, NULL, NULL} ! , /* 74 Default STDA Server */ }; Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-librawnet.h 19 Nov 2002 19:44:44 -0000 1.4 --- dhcp-librawnet.h 16 Dec 2002 07:20:42 -0000 1.5 *************** *** 442,446 **** extern dhcp_option_t *dhcp_build_requested_ip_address(uint32_t address); extern dhcp_option_t *dhcp_build_server_identifier(uint32_t address); ! extern dhcp_option_t *dhcp_build_hostname(char *hostname); --- 442,446 ---- extern dhcp_option_t *dhcp_build_requested_ip_address(uint32_t address); extern dhcp_option_t *dhcp_build_server_identifier(uint32_t address); ! extern dhcp_option_t *dhcp_build_hostname(const char *hostname); Index: dhcp-libutil.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-libutil.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-libutil.h 15 Dec 2002 00:22:02 -0000 1.10 --- dhcp-libutil.h 16 Dec 2002 07:20:42 -0000 1.11 *************** *** 29,32 **** --- 29,39 ---- #define DHCP_LIBUTIL_H + /* types. */ + + typedef uint32_t command_code_t; + typedef uint32_t arg_len_t; + typedef uint32_t arg_type_t; + typedef uint8_t arg_symbol_t; + /* * * * * * * * * * * * Data structures. * *************** *** 86,89 **** --- 93,124 ---- } varfile_t; + /* compiled directive. */ + typedef struct { + command_code_t command_code; /* the command code. */ + list_t *argument_types; /* type of argument: need this to free up arguments later. */ + list_t *arguments; /* argument data. */ + } directive_t; + + /* command syntax object. */ + typedef struct { + + const command_code_t command_code; + const char *command_name; + + const arg_len_t argument_len; + const char ***argument_strings; + const arg_type_t *argument_types; + const arg_symbol_t **argument_symbols; + + } command_t; + + /* conf object. */ + typedef struct { + char *filename; + parser_t *parser; + const command_t **commands; /* list of permissible commands. */ + list_t *directives; + } conf_t; + /* prototypes. */ *************** *** 228,231 **** --- 263,272 ---- extern RETSIGTYPE handle_shutdown(int i); extern int got_interrupt_type(void); + + /* configuration grammar parser */ + extern conf_t *conf_create(const command_t **commands, const char *filename); + extern void conf_destroy(conf_t *conf); + extern int conf_compile_directives(conf_t *conf); + extern list_t *conf_get_directives(conf_t *conf); /* constants. */ Index: dhcp-limits.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-limits.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-limits.h 16 Nov 2002 00:23:43 -0000 1.2 --- dhcp-limits.h 16 Dec 2002 07:20:42 -0000 1.3 *************** *** 50,55 **** /* max options handled. */ ! #define MAX_OPTIONS_HANDLED 62 ! #endif /* DHCP_LIMITS_H */ --- 50,54 ---- /* max options handled. */ ! #define MAX_OPTIONS_HANDLED 74 /* including 0 for PAD which we never care about. */ #endif /* DHCP_LIMITS_H */ Index: dhcp-options-strings.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-options-strings.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-options-strings.c 22 Nov 2002 15:30:38 -0000 1.4 --- dhcp-options-strings.c 16 Dec 2002 07:20:42 -0000 1.5 *************** *** 27,31 **** #define MODULE_NAME "dhcp-option-strings" ! static char *dhcp_options_strings[] = { "Pad", /* 0 */ "Subnet Mask", /* 1 */ --- 27,32 ---- #define MODULE_NAME "dhcp-option-strings" ! /* these we use to print out with. */ ! static const char *dhcp_options_printable_strings[] = { "Pad", /* 0 */ "Subnet Mask", /* 1 */ *************** *** 85,97 **** "Parameter Request List", /* 55 */ "Message", /* 56 */ ! "Max DHP Message Size", /* 57 */ "Renewal Time", /* 58 */ "Rebinding Time", /* 59 */ "Class ID", /* 60 */ "Client ID", /* 61 */ }; ! const char *dhcp_option_string_get(int index) { ! return dhcp_options_strings[index]; } --- 86,203 ---- "Parameter Request List", /* 55 */ "Message", /* 56 */ ! "Max DHCP Message Size", /* 57 */ "Renewal Time", /* 58 */ "Rebinding Time", /* 59 */ "Class ID", /* 60 */ "Client ID", /* 61 */ + "NIS+ Domain" , /* 62 */ + "NIS+ Servers", /* 63 */ + "TFTP Servers", /* 64 */ + "Boot File Name", /* 65 */ + "IP Home Agent", /* 66 */ + "SMTP Server", /* 67 */ + "POP Server", /* 68 */ + "NNTP Server", /* 69 */ + "Default WWW Server", /* 70 */ + "Default Finger Server", /* 71 */ + "Default IRC Server", /* 72 */ + "Default ST Server", /* 73 */ + "Default STDA Server" /* 74 */ }; ! /* these we use for configuration: lowercase with hyphen. */ ! static const char *dhcp_options_conf_strings[] = { ! "pad", /* 0 */ ! "subnet-mask", /* 1 */ ! "time-offset", /* 2 */ ! "routers", /* 3 */ ! "time-servers", /* 4 */ ! "name-servers", /* 5 */ ! "domain-name-servers", /* 6 */ ! "log-servers", /* 7 */ ! "cookie-servers", /* 8 */ ! "lpr-servers", /* 9 */ ! "impress-servers", /* 10 */ ! "rl-servers", /* 11 */ ! "hostname", /* 12 */ ! "boot-file-size", /* 13 */ ! "merit-dump-file", /* 14 */ ! "domain-name", /* 15 */ ! "swap-server", /* 16 */ ! "root-path", /* 17 */ ! "extensions-path", /* 18 */ ! "ip-forwarding", /* 19 */ ! "source-routing", /* 20 */ ! "policy-filter", /* 21 */ ! "maximum-dgram-reassmbly", /* 22 */ ! "default-ip-time-to-live", /* 23 */ ! "path-mtu-aging-timeout", /* 24 */ ! "path-mtu-plateau-table", /* 25 */ ! "interface-mtu", /* 26 */ ! "all-subnets", /* 27 */ ! "broadcast-address", /* 28 */ ! "perform-mask-discovery", /* 29 */ ! "mask-supplier", /* 30 */ ! "perform-router-discovery", /* 31 */ ! "router-solicitation-address", /* 32 */ ! "static-route", /* 33 */ ! "trailer-encapsulation", /* 34 */ ! "arp-cache-timeout", /* 35 */ ! "ethernet-encapsulation", /* 36 */ ! "tcp-default-ttl", /* 37 */ ! "tcp-keepalive-interval", /* 38 */ ! "tcp-keepalive-garbage", /* 39 */ ! "network-information-service-domain", /* 40 */ ! "network-information-servers", /* 41 */ ! "network-time-protocol-servers", /* 42 */ ! "vendor-specific-information", /* 43 */ ! "netbios-over-tcp-name servers", /* 44 */ ! "netbios-over-tcp-datagram-distribution-servers", /* 45 */ ! "netbios-over-tcp-node-type", /* 46 */ ! "netbios-over-tcp-scope", /* 47 */ ! "x-windows-font-servers", /* 48 */ ! "x-windows-system-display-manager", /* 49 */ ! "request-ip-address", /* 50 */ ! "ip-address-lease-time", /* 51 */ ! "option-overload", /* 52 */ ! "dhcp-message-type", /* 53 */ ! "server-identifier", /* 54 */ ! "parameter-request-list", /* 55 */ ! "message", /* 56 */ ! "max-dhcp-message-size", /* 57 */ ! "renewal-time", /* 58 */ ! "rebinding-time", /* 59 */ ! "class-id", /* 60 */ ! "client-id", /* 61 */ ! "nisplus-domain", /* 62 */ ! "nisplus-servers", /* 63 */ ! "tftp-server", /* 64 */ ! "boot-file-name", /* 65 */ ! "ip-home-agent", /* 66 */ ! "smtp-server", /* 67 */ ! "pop-server", /* 68 */ ! "nntp-server", /* 69 */ ! "default-www-server", /* 70 */ ! "default-finger-server", /* 71 */ ! "default-irc-server", /* 72 */ ! "default-st-server", /* 73 */ ! "default-stda-server" /* 74 */ ! }; ! ! /* accessors. */ ! ! const char *dhcp_option_printable_string_get(int index) { ! return dhcp_options_printable_strings[index]; ! } ! ! const char *dhcp_option_conf_string_get(int index) ! { ! return dhcp_options_conf_strings[index]; ! } ! ! /* retrieve entire array for configuration strings. */ ! const char **dhcp_option_conf_string_get_array(void) ! { ! return dhcp_options_conf_strings; } Index: dhcp-options-strings.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-options-strings.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-options-strings.h 22 Nov 2002 15:30:38 -0000 1.3 --- dhcp-options-strings.h 16 Dec 2002 07:20:42 -0000 1.4 *************** *** 26,30 **** #define DHCP_OPTION_STRINGS_H ! extern const char *dhcp_option_string_get(int index); #endif /* DHCP_OPTION_STRINGS_H */ --- 26,32 ---- #define DHCP_OPTION_STRINGS_H ! extern const char *dhcp_option_printable_string_get(int index); ! extern const char *dhcp_option_conf_string_get(int index); ! extern const char **dhcp_option_conf_string_get_array(void); #endif /* DHCP_OPTION_STRINGS_H */ Index: dhcp-print.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-print.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-print.c 16 Nov 2002 00:23:43 -0000 1.3 --- dhcp-print.c 16 Dec 2002 07:20:42 -0000 1.4 *************** *** 279,283 **** for(i = 0; i < len; i++) { ! if(data[i] >= MAX_OPTIONS_HANDLED) continue; --- 279,283 ---- for(i = 0; i < len; i++) { ! if(data[i] > MAX_OPTIONS_HANDLED) continue; Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-sysconf.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-sysconf.c 24 Nov 2002 01:12:12 -0000 1.8 --- dhcp-sysconf.c 16 Dec 2002 07:20:42 -0000 1.9 *************** *** 39,43 **** #include "dhcp-convert.h" #include "dhcp-sysconf.h" - #include "dhcp-globconf.h" #include "dhcp-options-strings.h" --- 39,42 ---- *************** *** 183,189 **** , /* 59 Rebind Time (T2). */ {NULL, NULL, SYSCONF_UNSET,} ! , /* 60 */ {NULL, NULL, SYSCONF_UNSET,} ! , /* 61 */ }; --- 182,214 ---- , /* 59 Rebind Time (T2). */ {NULL, NULL, SYSCONF_UNSET,} ! , /* 60 Class ID */ {NULL, NULL, SYSCONF_UNSET,} ! , /* 61 Client ID */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 62 NIS+ Domain */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 63 NIS+ Servers */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 64 TFTP Servers */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 65 Boot File Name */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 66 IP Home Agent */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 67 SMTP Server */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 69 POP Server */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 69 NNTP Server */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 70 Default WWW Server */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 71 Default Finger Server */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 72 Default IRC Server */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 73 Default ST Server */ ! {NULL, NULL, SYSCONF_UNSET,} ! , /* 74 Default STDA Server */ }; *************** *** 225,237 **** int lowest_latency; int *latency; ! int *sends; memset(&r_entry.route_dst, 0, sizeof(r_entry.route_dst)); memset(&r_entry.route_gw, 0, sizeof(r_entry.route_gw)); ! sends = glob_conf_get_val(CLIENT_ICMP_RETRIES); routers = value; ! average_latencies = icmp_rtt_discovery(dc->rawnet, routers, *sends); /* Even if all routers fail to respond to the ICMP echo query, --- 250,262 ---- int lowest_latency; int *latency; ! int sends; memset(&r_entry.route_dst, 0, sizeof(r_entry.route_dst)); memset(&r_entry.route_gw, 0, sizeof(r_entry.route_gw)); ! sends = client_conf_get_icmp_retries(dc->conf); routers = value; ! average_latencies = icmp_rtt_discovery(dc->rawnet, routers, sends); /* Even if all routers fail to respond to the ICMP echo query, *************** *** 364,368 **** ce = list_ptr->data; ! if(string_matches(dhcp_option_string_get(TAG_DHCP_REQUESTED_IP_ADDRESS), ce->name)) { data = --- 389,393 ---- ce = list_ptr->data; ! if(TAG_DHCP_REQUESTED_IP_ADDRESS == ce->tag) { data = *************** *** 376,380 **** } ! if(string_matches(dhcp_option_string_get(TAG_DHCP_SUBNET_MASK), ce->name)) { data = option_convert_handlers[TAG_DHCP_SUBNET_MASK].serialize_to_internal(ce->value); --- 401,405 ---- } ! if(TAG_DHCP_SUBNET_MASK == ce->tag) { data = option_convert_handlers[TAG_DHCP_SUBNET_MASK].serialize_to_internal(ce->value); *************** *** 386,390 **** } ! if(string_matches(dhcp_option_string_get(TAG_DHCP_INTERFACE_MTU), ce->name)) { data = option_convert_handlers[TAG_DHCP_INTERFACE_MTU].serialize_to_internal(ce->value); --- 411,415 ---- } ! if(TAG_DHCP_INTERFACE_MTU == ce->tag) { data = option_convert_handlers[TAG_DHCP_INTERFACE_MTU].serialize_to_internal(ce->value); *************** *** 449,457 **** (sysconf_handlers[ce->tag].flag & SYSCONF_DO_CLEANUP) == 1) { ! INFO_MESSAGE("cleanup option: %s", dhcp_option_string_get(ce->tag)); if(sysconf_handlers[ce->tag].cleanup(data, dc)) WARN_MESSAGE("sysconf: error cleaning up option: %s", ! dhcp_option_string_get(ce->tag)); } --- 474,482 ---- (sysconf_handlers[ce->tag].flag & SYSCONF_DO_CLEANUP) == 1) { ! INFO_MESSAGE("cleanup option: %s", dhcp_option_printable_string_get(ce->tag)); if(sysconf_handlers[ce->tag].cleanup(data, dc)) WARN_MESSAGE("sysconf: error cleaning up option: %s", ! dhcp_option_conf_string_get(ce->tag)); } *************** *** 459,468 **** * cleanup. */ ! INFO_MESSAGE("setup option: %s", dhcp_option_string_get(ce->tag)); if(sysconf_handlers[ce->tag].setup(data, dc)) { sysconf_handlers[ce->tag].flag &= ~SYSCONF_DO_CLEANUP; ! WARN_MESSAGE("unable to setup option: %s", dhcp_option_string_get(ce->tag)); } else { --- 484,493 ---- * cleanup. */ ! INFO_MESSAGE("setup option: %s", dhcp_option_printable_string_get(ce->tag)); if(sysconf_handlers[ce->tag].setup(data, dc)) { sysconf_handlers[ce->tag].flag &= ~SYSCONF_DO_CLEANUP; ! WARN_MESSAGE("unable to setup option: %s", dhcp_option_printable_string_get(ce->tag)); } else { *************** *** 508,516 **** data = option_convert_handlers[ce->tag].serialize_to_internal(ce->value); ! INFO_MESSAGE("cleanup option: %s", dhcp_option_string_get(ce->tag)); if(sysconf_handlers[ce->tag].cleanup(data, dc)) WARN_MESSAGE("sysconf: error cleaning up option: %s", ! dhcp_option_string_get(ce->tag)); option_convert_handlers[ce->tag].free_internal(data); --- 533,541 ---- data = option_convert_handlers[ce->tag].serialize_to_internal(ce->value); ! INFO_MESSAGE("cleanup option: %s", dhcp_option_printable_string_get(ce->tag)); if(sysconf_handlers[ce->tag].cleanup(data, dc)) WARN_MESSAGE("sysconf: error cleaning up option: %s", ! dhcp_option_printable_string_get(ce->tag)); option_convert_handlers[ce->tag].free_internal(data); --- dhcp-globconf.c DELETED --- --- dhcp-globconf.h DELETED --- |