[dhcp-agent-commits] dhcp-agent/src dhcp-client-guile.c,1.5,1.6 dhcp-client-states.c,1.29,1.30
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2003-05-23 03:31:18
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv3864/src Modified Files: dhcp-client-guile.c dhcp-client-states.c Log Message: redid sysconf to use closures; hooks now in place for reconfigure and unconfigure Index: dhcp-client-guile.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-guile.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-client-guile.c 20 May 2003 01:43:40 -0000 1.5 --- dhcp-client-guile.c 23 May 2003 03:31:16 -0000 1.6 *************** *** 140,144 **** } ! /* get the default subnet mask. FIXME: todo. */ static SCM dhcp_scm_get_default_subnet_mask(SCM scm_dc) { --- 140,144 ---- } ! /* get the default subnet mask. */ static SCM dhcp_scm_get_default_subnet_mask(SCM scm_dc) { *************** *** 222,227 **** } ! /* add a default route. */ ! static SCM dhcp_scm_client_set_default_route(SCM scm_dc, SCM scm_default_router) { client_control_smob_t *client_control_smob; --- 222,227 ---- } ! /* add or remove a default route depending on set_route. */ ! static SCM dhcp_scm_client_default_route_proc(SCM scm_dc, SCM scm_default_router, SCM set_route) { client_control_smob_t *client_control_smob; *************** *** 267,274 **** } ! if(route_add(rt, &r_entry) < 0) { ! ERROR_MESSAGE("unable to add route: %s", strerror(errno)); ! route_close(rt); ! return SCM_BOOL_F; } --- 267,285 ---- } ! if(SCM_NFALSEP(set_route)) { ! ! if(route_add(rt, &r_entry) < 0) { ! ERROR_MESSAGE("unable to add route: %s", strerror(errno)); ! route_close(rt); ! return SCM_BOOL_F; ! } ! ! } else { ! ! if(route_delete(rt, &r_entry) < 0) { ! ERROR_MESSAGE("unable to add remove: %s", strerror(errno)); ! route_close(rt); ! return SCM_BOOL_F; ! } } *************** *** 277,280 **** --- 288,303 ---- } + /* add a default route. */ + static SCM dhcp_scm_client_set_default_route(SCM scm_dc, SCM scm_default_router) + { + return dhcp_scm_client_default_route_proc(scm_dc, scm_default_router, SCM_BOOL_T); + } + + /* remove a default route. */ + static SCM dhcp_scm_client_remove_default_route(SCM scm_dc, SCM scm_default_router) + { + return dhcp_scm_client_default_route_proc(scm_dc, scm_default_router, SCM_BOOL_F); + } + SCM scm_client_shutdown(SCM scm_dc) { *************** *** 625,628 **** --- 648,652 ---- scm_c_define_gsubr("client-interface-up", 4, 0, 0, dhcp_scm_interface_up); scm_c_define_gsubr("client-set-default-route", 2, 0, 0, dhcp_scm_client_set_default_route); + scm_c_define_gsubr("client-remove-default-route", 2, 0, 0, dhcp_scm_client_remove_default_route); scm_c_define_gsubr("client-get-default-mtu", 1, 0, 0, dhcp_scm_get_default_mtu); scm_c_define_gsubr("client-get-default-subnet-mask", 1, 0, 0, dhcp_scm_get_default_subnet_mask); Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** dhcp-client-states.c 20 May 2003 01:43:41 -0000 1.29 --- dhcp-client-states.c 23 May 2003 03:31:16 -0000 1.30 *************** *** 630,633 **** --- 630,641 ---- } + /* create an empty list of options since this is a release. */ + options = list_create(); + + /* run the release hook. */ + do_sysconf(options, dc, STATE_DO_SHUTDOWN); + + list_destroy(options, NULL); + /* since we're releasing the lease we should down the interface */ dhcp_client_interface_down(dc); |