[dhcp-agent-commits] dhcp-agent/src dhcp-client-cache.c,1.4,1.5 dhcp-sysconf.c,1.5,1.6
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2002-11-22 00:53:20
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv27754/src Modified Files: dhcp-client-cache.c dhcp-sysconf.c Log Message: fix to client cache not correctly reporting if its empty bug Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-cache.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-client-cache.c 19 Nov 2002 19:44:44 -0000 1.4 --- dhcp-client-cache.c 22 Nov 2002 00:53:17 -0000 1.5 *************** *** 160,166 **** fname = get_fname(cc); if(file_exists(fname)) - retval = 1; - else retval = 0; xfree(fname); --- 160,166 ---- fname = get_fname(cc); if(file_exists(fname)) retval = 0; + else + retval = 1; xfree(fname); *************** *** 224,228 **** } ! /* load cache (interface) */ static int client_cache_load(client_cache_t *cc, unsigned char use_tmp) { --- 224,228 ---- } ! /* load cache */ static int client_cache_load(client_cache_t *cc, unsigned char use_tmp) { *************** *** 246,251 **** * Conversion work horses: * * * * * * * * * * * * * * */ ! ! /* convert to internal datums. */ static void *convert_to_internal(unsigned char tag, char *string) { --- 246,251 ---- * Conversion work horses: * * * * * * * * * * * * * * */ ! ! /* convert to internal datums. */ static void *convert_to_internal(unsigned char tag, char *string) { *************** *** 292,295 **** --- 292,303 ---- } + static void *convert_to_cache_entry(unsigned char tag, char *string) + { + cache_entry_t *ce; + + ce = create_cache_entry(dhcp_options_strings[tag], string); + return ce; + } + /* * Convert options from cache serialized form to whatever form convert_func, returns. *************** *** 302,307 **** list_t *options = NULL; list_t *cache; ! cache_entry_t *ce, *copy; ! unsigned char i; void *data; --- 310,314 ---- list_t *options = NULL; list_t *cache; ! cache_entry_t *ce; void *data; *************** *** 309,331 **** ce = cache->data; ! ! for(i = 0; i < MAX_OPTIONS_HANDLED; i++) { ! ! if(string_matches(dhcp_options_strings[i], ce->name)) { ! ! if(convert_func) { ! data = convert_func(i, ce->value); ! if(data == NULL) ! break; /* break out of for loop since we have a match and we're ! * done even if we couldn't get the data. */ ! options = add_to_list(options, data); ! break; ! } else { ! copy = create_cache_entry(ce->name, ce->value); ! options = add_to_list(options, copy); ! break; ! } ! } } } --- 316,324 ---- ce = cache->data; ! data = convert_func(atoi(ce->name), ce->value); ! if(data != NULL) { /* we need to silently ignore nulls here so that the timer only converter works. */ ! options = add_to_list(options, data); } + } *************** *** 337,340 **** --- 330,334 ---- * file. the list should contain pointers to dhcp_option_t datums * in network byte order. */ + int client_cache_dump_options(client_cache_t *cc, list_t *options) { *************** *** 362,366 **** continue; - name = dhcp_options_strings[opt->tag]; val = option_convert_handlers[opt->tag].serialize(opt->data, opt->len); --- 356,359 ---- *************** *** 376,380 **** } ! fprintf(fp, "\"%s\"=%s\n", name, val); xfree(val); } --- 369,373 ---- } ! fprintf(fp, "\"%d\"=%s\n", opt->tag, val); xfree(val); } *************** *** 421,425 **** list_t *client_cache_load_option_string_list(client_cache_t *cc, unsigned char use_tmp) { ! return (client_cache_load_options_list_proc(cc, use_tmp, NULL)); } --- 414,418 ---- list_t *client_cache_load_option_string_list(client_cache_t *cc, unsigned char use_tmp) { ! return (client_cache_load_options_list_proc(cc, use_tmp, convert_to_cache_entry)); } Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-sysconf.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-sysconf.c 19 Nov 2002 19:44:44 -0000 1.5 --- dhcp-sysconf.c 22 Nov 2002 00:53:17 -0000 1.6 *************** *** 188,191 **** --- 188,195 ---- }; + /* * * * * * * * * * * * * * * * * * * * + * Sysconf functions. These do setup. * + * * * * * * * * * * * * * * * * * * * */ + static int client_setup_lease_time(void *value, dhcp_client_control_t *dc) { *************** *** 405,409 **** } ! /* XXX - handle return value elsewhere. */ void do_sysconf(list_t *options, dhcp_client_control_t *dc, uint8_t do_interface) { --- 409,416 ---- } ! /* * * * * * * * * * * * ! * Sysconf interface. * ! * * * * * * * * * * * */ ! void do_sysconf(list_t *options, dhcp_client_control_t *dc, uint8_t do_interface) { |