Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv22585/src
Modified Files:
dhcp-client-states.c
Log Message:
implemented init-reboot
Index: dhcp-client-states.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** dhcp-client-states.c 25 Jun 2003 02:27:42 -0000 1.39
--- dhcp-client-states.c 25 Jun 2003 03:08:09 -0000 1.40
***************
*** 668,687 ****
}
! /* init-reboot state: lease exists, try to acquire it. */
! int client_init_reboot(dhcp_client_control_t *dc)
! {
! /* not implemented. */
! return client_init(dc);
! }
!
! /* inform: we've assigned ourselves an IP address, try to inform a dhcp server. */
! int client_inform(dhcp_client_control_t *dc)
! {
! /* not implemented. */
! return 0;
! }
!
! /* request: request a lease. */
! int client_requesting(dhcp_client_control_t *dc)
{
list_t *options, *cache_options;
--- 668,672 ----
}
! static int client_requesting_proc(dhcp_client_control_t *dc, int state)
{
list_t *options, *cache_options;
***************
*** 700,711 ****
options = client_build_request_option_list(dc);
- cache_options = client_cache_load_options(dc->cache, 1); /* get temporary cache. */
! if(list_get_len(cache_options) == 0) {
!
! ERROR_MESSAGE("could not load cache, or cache is empty.");
! ERROR_MESSAGE("try running with -c option to delete cache.");
! return STATE_FATAL_ERROR;
! }
list_join(options, cache_options); /* destroys cache_options. */
--- 685,693 ----
options = client_build_request_option_list(dc);
! if(state == STATE_INIT_REBOOT)
! cache_options = client_cache_load_options(dc->cache, 0); /* get cache. */
! else
! cache_options = client_cache_load_options(dc->cache, 1); /* get temporary cache. */
list_join(options, cache_options); /* destroys cache_options. */
***************
*** 751,755 ****
if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) {
! client_cache_update(dc->cache);
return STATE_SETUP;
--- 733,745 ----
if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) {
! /* if init-reboot then record the server which replied. */
! if(state == STATE_INIT_REBOOT) {
!
! 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));
!
! } else
! client_cache_update(dc->cache);
!
return STATE_SETUP;
***************
*** 776,779 ****
--- 766,788 ----
return STATE_INIT;
}
+ }
+
+ /* init-reboot state: lease exists, try to acquire it. */
+ int client_init_reboot(dhcp_client_control_t *dc)
+ {
+ return client_requesting_proc(dc, STATE_INIT_REBOOT);
+ }
+
+ /* request: request a lease. */
+ int client_requesting(dhcp_client_control_t *dc)
+ {
+ return client_requesting_proc(dc, STATE_INIT);
+ }
+
+ /* inform: we've assigned ourselves an IP address, try to inform a dhcp server. */
+ int client_inform(dhcp_client_control_t *dc)
+ {
+ /* not implemented. */
+ return 0;
}
|