[dhcp-agent-commits] dhcp-agent/src dhcp-client-states.c,1.31,1.32
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2003-05-25 03:13:36
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv30900/src Modified Files: dhcp-client-states.c Log Message: added reconfigure-interface and code to handle it from rebind/renew Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** dhcp-client-states.c 25 May 2003 02:18:28 -0000 1.31 --- dhcp-client-states.c 25 May 2003 03:01:20 -0000 1.32 *************** *** 204,208 **** } - /****************** * check routines * --- 204,207 ---- *************** *** 482,485 **** --- 481,514 ---- } + /* reconfigure: this should be called from rebind or renew. */ + static void client_reconfigure(dhcp_client_control_t *dc, int state) + { + list_t *dump_options; + + /* before dumping options strip options we never want to dump */ + + dump_options = client_remove_protocol_only_options(dc->rawnet->dhcp_p->options); + + /* dump cache file. */ + if(client_cache_dump_options(dc->cache, dump_options)) { + FATAL_MESSAGE("could not create temporary cache."); + exit(1); /* get rid of compiler warning. */ + } + + /* update from temp to perm cache. */ + client_cache_update(dc->cache); + client_cache_delete_tmp_cache(dc->cache); + + /* set server address in case we just did a rebind. */ + dhcp_client_set_server_ip_address(dc, ip_get_src_addr(dc->rawnet->ip_p)); + dhcp_client_set_server_hw_address(dc, eth_get_src_addr(dc->rawnet->ether_p)); + + client_setup_timers(dc); + do_sysconf(dump_options, dc, state); + + dhcp_opt_destroy_option_list(dump_options); + return; + } + /****************************** * DHCP client state routines * *************** *** 841,845 **** if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! client_setup_timers(dc); return STATE_WAIT; --- 870,874 ---- if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! client_reconfigure(dc, STATE_RENEW); return STATE_WAIT; *************** *** 897,909 **** } ! /* if we got a pack we need to setup our timers. */ if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! client_setup_timers(dc); ! ! /* since we did a rebind our server's ip address and mac address may be different. */ ! dhcp_client_set_server_ip_address(dc, ip_get_src_addr(dc->rawnet->ip_p)); ! dhcp_client_set_server_hw_address(dc, eth_get_src_addr(dc->rawnet->ether_p)); ! return STATE_WAIT; --- 926,933 ---- } ! /* if we got a pack we need to setup our timers and do a reconfigure. */ if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! client_reconfigure(dc, STATE_REBIND); return STATE_WAIT; *************** *** 935,937 **** return 0; } - --- 959,960 ---- |