dhcp-agent-commits Mailing List for dhcp-agent (Page 17)
Status: Alpha
Brought to you by:
actmodern
You can subscribe to this list here.
2002 |
Jan
|
Feb
(33) |
Mar
|
Apr
|
May
(19) |
Jun
(61) |
Jul
(12) |
Aug
|
Sep
(5) |
Oct
(31) |
Nov
(24) |
Dec
(56) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(9) |
Feb
|
Mar
(16) |
Apr
(4) |
May
(68) |
Jun
(70) |
Jul
(100) |
Aug
(54) |
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(7) |
Jun
(12) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(8) |
Oct
(5) |
Nov
(6) |
Dec
(4) |
2008 |
Jan
(9) |
Feb
(20) |
Mar
(32) |
Apr
(18) |
May
(19) |
Jun
(12) |
Jul
(23) |
Aug
(7) |
Sep
(15) |
Oct
(22) |
Nov
(50) |
Dec
(68) |
2009 |
Jan
(63) |
Feb
(23) |
Mar
(43) |
Apr
(50) |
May
(110) |
Jun
(103) |
Jul
(71) |
Aug
(26) |
Sep
(16) |
Oct
(31) |
Nov
(8) |
Dec
(13) |
2010 |
Jan
(6) |
Feb
(6) |
Mar
(36) |
Apr
(57) |
May
(67) |
Jun
(70) |
Jul
(44) |
Aug
(46) |
Sep
(27) |
Oct
(2) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: <act...@us...> - 2003-06-25 01:53:39
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv13792/src Modified Files: Makefile.am Log Message: added option for enable failure on warning Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/Makefile.am,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Makefile.am 17 Jun 2003 07:34:15 -0000 1.24 --- Makefile.am 25 Jun 2003 01:53:36 -0000 1.25 *************** *** 3,7 **** # Main source Makefile.am ! AM_CFLAGS = -Wall -Werror -g INCLUDES = ${PCAP_INC} ${DNET_INC} ${GUILE_INC} CPPFLAGS = -DDHCPSYSCONFDIR=\"${dhcpsysconfdir}\" -DDHCPSYSCONF_CLIENTDIR=\"${dhcpsysconf_clientdir}\" \ --- 3,7 ---- # Main source Makefile.am ! AM_CFLAGS = -Wall INCLUDES = ${PCAP_INC} ${DNET_INC} ${GUILE_INC} CPPFLAGS = -DDHCPSYSCONFDIR=\"${dhcpsysconfdir}\" -DDHCPSYSCONF_CLIENTDIR=\"${dhcpsysconf_clientdir}\" \ |
From: <act...@us...> - 2003-06-25 01:53:39
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv13792 Modified Files: configure.ac Log Message: added option for enable failure on warning Index: configure.ac =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.ac,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** configure.ac 9 Jun 2003 02:01:01 -0000 1.9 --- configure.ac 25 Jun 2003 01:53:36 -0000 1.10 *************** *** 19,28 **** dnl ! dnl enable/disable argument settings dnl dnl allow user to pick HTML documentation AC_ARG_ENABLE(htmldoc, ! [ --enable-htmldoc Create HTML documentation], [case "${enableval}" in yes) htmldoc=true ;; --- 19,40 ---- dnl ! dnl command line options dnl + dnl fail-on-warning option for strict compilation + FAIL_ON_WARNING="no" + + AC_ARG_ENABLE(fail-on-warning, + [ --enable-fail-on-warning fail on compiler warning], + [case "${enableval}" in + yes | y) FAIL_ON_WARNING="yes" ;; + no | n) FAIL_ON_WARNING="no" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-fail-on-warning) ;; + esac]) + + dnl allow user to pick HTML documentation AC_ARG_ENABLE(htmldoc, ! [ --enable-htmldoc Create HTML documentation], [case "${enableval}" in yes) htmldoc=true ;; *************** *** 231,234 **** --- 243,250 ---- AC_SUBST(infodir) AC_SUBST(dhcpdocdir) + + if test x"${FAIL_ON_WARNING}" = "xyes"; then + CFLAGS="${CFLAGS} -Werror" + fi AC_CONFIG_HEADERS([config.h]) |
From: <act...@us...> - 2003-06-23 06:07:26
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv780 Modified Files: TODO Log Message: lots more todo Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TODO 17 Jun 2003 07:34:56 -0000 1.15 --- TODO 23 Jun 2003 06:07:22 -0000 1.16 *************** *** 67,71 **** out of range option is encountered. ! -- by default use 75% of the lease time as the renew time, and ! 85% as the rebind time. also fix so we alert the user of an ! expired lease. --- 67,74 ---- out of range option is encountered. ! -- fix renew/rebind -- it broke again. rfc indicates what options ! need to be in and what need to be out. ! ! -- make sure the timer values passed to us from the server don't ! overflow our internal timer. ! |
From: <act...@us...> - 2003-06-23 06:05:06
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv484/src Modified Files: dhcp-client-control.c dhcp-client-states.c dhcp-client.h dhcp-sysconf.c dhcp-timer.c Log Message: client now handling infinite timer Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-control.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-client-control.c 25 May 2003 02:18:27 -0000 1.17 --- dhcp-client-control.c 23 Jun 2003 06:05:03 -0000 1.18 *************** *** 57,60 **** --- 57,72 ---- } + /* dhcp set lease time to be infinite. */ + void dhcp_client_lease_time_is_infinite(dhcp_client_control_t *dc) + { + dc->lease_time_is_infinite = 1; + } + + /* dhcp set lease time to be finite. */ + void dhcp_client_lease_time_is_finite(dhcp_client_control_t *dc) + { + dc->lease_time_is_infinite = 0; + } + /* dhcp increment and check whether we should give up on discover offer retries. */ int dhcp_client_discover_offer_can_retry(dhcp_client_control_t *dc) *************** *** 220,223 **** --- 232,236 ---- dc->client_id = create_client_id(interface_addr); dc->discover_offer_retries = 0; /* reset discover offer. */ + dc->lease_time_is_infinite = 0; /* reset lease time infinite bit. */ /* create state context */ Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** dhcp-client-states.c 20 Jun 2003 01:37:15 -0000 1.35 --- dhcp-client-states.c 23 Jun 2003 06:05:03 -0000 1.36 *************** *** 380,384 **** INFO_MESSAGE("using ARP to detect address collision"); ! if(!arp_discover_hardware_address(dc->rawnet, 1, 10, *passed_ip, ð_addr)) { ERROR_MESSAGE("DHCP server assigned us a used address. Declining."); --- 380,384 ---- INFO_MESSAGE("using ARP to detect address collision"); ! if(!arp_discover_hardware_address(dc->rawnet, 1, 5, *passed_ip, ð_addr)) { ERROR_MESSAGE("DHCP server assigned us a used address. Declining."); *************** *** 911,916 **** int client_bound(dhcp_client_control_t *dc) { ! uint32_t next_timer; ! time_t time_before, time_after, time_interval; INFO_MESSAGE("entering WAIT stage"); --- 911,917 ---- int client_bound(dhcp_client_control_t *dc) { ! uint32_t next_timer = 0; /* get rid of compiler warnings. */ ! time_t time_before = 0; /* get rid of compiler warnings. */ ! time_t time_after, time_interval; INFO_MESSAGE("entering WAIT stage"); *************** *** 919,936 **** rawnet_down(dc->rawnet); ! /* peek and store our next timer in case we get an interrupt ! * which is not a timer interrupt. */ ! next_timer = timer_peek_next_timer(dc->context->timer); ! time_before = time(NULL); ! /* now fire off the next timer. */ ! if(timer_set_next(dc->context->timer)) { ! FATAL_MESSAGE("no timers set. we should have at least one for lease expiry sent to us from the server."); ! } ! /* wait for any interrupts. */ ! suspend_for_interrupts(); /* at this point we may or may not have received a timer * interrupt. if we have not then setup a timer to go off --- 920,948 ---- rawnet_down(dc->rawnet); ! if(dc->lease_time_is_infinite) { ! INFO_MESSAGE("lease time is infinite. waiting forever."); ! /* wait for any interrupts. */ ! suspend_for_interrupts(); ! } else { ! ! /* peek and store our next timer in case we get an interrupt ! * which is not a timer interrupt. */ ! ! next_timer = timer_peek_next_timer(dc->context->timer); ! time_before = time(NULL); ! ! /* now fire off the next timer. */ ! if(timer_set_next(dc->context->timer)) { ! FATAL_MESSAGE("no timers set. we should have at least one for lease expiry sent to us from the server."); ! } ! ! /* wait for any interrupts. */ ! suspend_for_interrupts(); + } + /* at this point we may or may not have received a timer * interrupt. if we have not then setup a timer to go off *************** *** 938,942 **** * difference. */ ! if(peek_interrupt_type() != INTERRUPT_ALARM) { time_after = time(NULL); --- 950,954 ---- * difference. */ ! if(peek_interrupt_type() != INTERRUPT_ALARM && !dc->lease_time_is_infinite) { time_after = time(NULL); Index: dhcp-client.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-client.h 17 Jun 2003 07:34:16 -0000 1.17 --- dhcp-client.h 23 Jun 2003 06:05:03 -0000 1.18 *************** *** 55,58 **** --- 55,59 ---- int state; /* our current state. */ int discover_offer_retries; /* counter for retries on discover_offer */ + uint8_t lease_time_is_infinite; /* whether or not the lease time is infinite. */ /* use this for validation purposes. */ *************** *** 112,115 **** --- 113,119 ---- extern ip_addr_t dhcp_client_get_server_ip_address(dhcp_client_control_t *dc); extern eth_addr_t dhcp_client_get_server_hw_address(dhcp_client_control_t *dc); + + extern void dhcp_client_lease_time_is_infinite(dhcp_client_control_t *dc); + extern void dhcp_client_lease_time_is_finite(dhcp_client_control_t *dc); /* context information. */ Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-sysconf.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-sysconf.c 20 May 2003 01:43:42 -0000 1.18 --- dhcp-sysconf.c 23 Jun 2003 06:05:03 -0000 1.19 *************** *** 50,54 **** } ! /* setup timers only. this is done internally after rebinding or renewing. */ void do_sysconf_setup_timers(list_t *options, dhcp_client_control_t *dc) { --- 50,56 ---- } ! /* setup timers only. this is done internally after rebinding, ! * renewing or acquiring a new lease. */ ! void do_sysconf_setup_timers(list_t *options, dhcp_client_control_t *dc) { *************** *** 56,59 **** --- 58,68 ---- dhcp_opt_tag_t tag; uint32_t *secs; + uint32_t renew_time = 0; + uint32_t rebind_time = 0; + uint32_t lease_time = 0; + uint8_t have_renew = 0; + uint8_t have_rebind = 0; + uint8_t have_lease_time = 0; + float percent; reinitialize_timer(dc->context->timer); *************** *** 67,71 **** secs = dhcp_opt_get_host_data(option); ! timer_add_trigger(dc->context->timer, *secs, TIMER_RENEW); continue; --- 76,81 ---- secs = dhcp_opt_get_host_data(option); ! have_renew = 1; ! renew_time = *secs; continue; *************** *** 73,77 **** secs = dhcp_opt_get_host_data(option); ! timer_add_trigger(dc->context->timer, *secs, TIMER_REBIND); continue; --- 83,88 ---- secs = dhcp_opt_get_host_data(option); ! have_rebind = 1; ! rebind_time = *secs; continue; *************** *** 79,85 **** secs = dhcp_opt_get_host_data(option); ! timer_add_trigger(dc->context->timer, *secs, TIMER_IP_LEASE); continue; } } --- 90,144 ---- secs = dhcp_opt_get_host_data(option); ! have_lease_time = 1; ! lease_time = *secs; continue; } + } + + if(have_lease_time != 1) { + + /* we don't have an actual lease time. check + * configuration options on what we should do. */ + + WARN_MESSAGE("no lease time passed. assuming lease will never expire."); + lease_time = 0xffffffff; + } + + /* a lease time of 0xffffffff is defined by the RFC2131 as infinite. */ + + if(lease_time == INFINITE_TIME) { + + INFO_MESSAGE("setting infinite lease time."); + dhcp_client_lease_time_is_infinite(dc); + + } else { + + dhcp_client_lease_time_is_finite(dc); + INFO_MESSAGE("setting lease time to: %"PRIu32" seconds", lease_time); + + timer_add_trigger(dc->context->timer, lease_time, TIMER_IP_LEASE); + + if(!have_renew) { + + percent = (float)client_conf_get_renew_percent(dc->conf)/100; + INFO_MESSAGE("no renew time passed. using %%%.2f percent of lease time as renew time.", percent); + + renew_time = lease_time * percent; + + } + + INFO_MESSAGE("setting renew time to: %"PRIu32" seconds", renew_time); + timer_add_trigger(dc->context->timer, renew_time, TIMER_REBIND); + + if(!have_rebind) { + + percent = (float)client_conf_get_rebind_percent(dc->conf)/100; + INFO_MESSAGE("no rebind time passed. using %%%.2f percent of lease time as rebind time.", percent); + + rebind_time = lease_time * percent; + } + + INFO_MESSAGE("setting rebind time to: %"PRIu32" seconds", rebind_time); + timer_add_trigger(dc->context->timer, rebind_time, TIMER_REBIND); } Index: dhcp-timer.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-timer.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-timer.c 23 May 2003 03:30:27 -0000 1.10 --- dhcp-timer.c 23 Jun 2003 06:05:03 -0000 1.11 *************** *** 195,198 **** return timer_copy; } - - --- 195,196 ---- |
From: <act...@us...> - 2003-06-23 06:04:36
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv406/src Modified Files: dhcp-client-conf.h dhcp-client-conf.c dhcp-client-defaults.h Log Message: added default rebind/renew timer percent directive Index: dhcp-client-conf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-client-conf.h 17 Jun 2003 07:34:15 -0000 1.17 --- dhcp-client-conf.h 23 Jun 2003 06:04:33 -0000 1.18 *************** *** 82,86 **** CLIENT_VAR_ICMP_RETRIES, CLIENT_VAR_ARP_RETRIES, CLIENT_VAR_INTERFACE_MTU, CLIENT_VAR_DO_MEASURE_ROUTER_LATENCY_ICMP, CLIENT_VAR_REQUEST_OPTIONS, CLIENT_VAR_REQUIRE_OPTIONS, CLIENT_VAR_CONFIGURE_OPTIONS, CLIENT_VAR_APPEND_OPTIONS, ! CLIENT_VAR_PREPEND_OPTIONS, CLIENT_VAR_OVERRIDE_OPTIONS, CLIENT_VAR_SUBNET_MASK }; /* server symbol substitution. */ --- 82,87 ---- CLIENT_VAR_ICMP_RETRIES, CLIENT_VAR_ARP_RETRIES, CLIENT_VAR_INTERFACE_MTU, CLIENT_VAR_DO_MEASURE_ROUTER_LATENCY_ICMP, CLIENT_VAR_REQUEST_OPTIONS, CLIENT_VAR_REQUIRE_OPTIONS, CLIENT_VAR_CONFIGURE_OPTIONS, CLIENT_VAR_APPEND_OPTIONS, ! CLIENT_VAR_PREPEND_OPTIONS, CLIENT_VAR_OVERRIDE_OPTIONS, CLIENT_VAR_SUBNET_MASK, CLIENT_VAR_RENEW_PERCENT, ! CLIENT_VAR_REBIND_PERCENT }; /* server symbol substitution. */ *************** *** 111,114 **** --- 112,117 ---- extern int client_conf_get_default_mtu(client_conf_t *cc); extern const char *client_conf_get_default_subnet_mask(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr); + extern int client_conf_get_renew_percent(client_conf_t *cc); + extern int client_conf_get_rebind_percent(client_conf_t *cc); #endif /* DHCP_CLIENT_CONF_H */ Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dhcp-client-conf.c 17 Jun 2003 07:34:15 -0000 1.27 --- dhcp-client-conf.c 23 Jun 2003 06:04:33 -0000 1.28 *************** *** 77,80 **** --- 77,85 ---- "default-interface-mtu", "default-subnet-mask", + + /* lease time default percent */ + "default-renew-percent", + "default-rebind-percent", + }; *************** *** 105,108 **** --- 110,115 ---- CLIENT_VAR_INTERFACE_MTU, CLIENT_VAR_SUBNET_MASK, + CLIENT_VAR_RENEW_PERCENT, + CLIENT_VAR_REBIND_PERCENT, }; *************** *** 507,510 **** --- 514,519 ---- break; + case CLIENT_VAR_RENEW_PERCENT: + case CLIENT_VAR_REBIND_PERCENT: case CLIENT_VAR_INTERFACE_MTU: *************** *** 827,830 **** --- 836,849 ---- client_conf_params_t *params = find_best_params_for(cc, ip_addr, eth_addr); return get_conf_string_val(params, CLIENT_VAR_SUBNET_MASK, CLIENT_DEFAULT_SUBNET_MASK); + } + + int client_conf_get_renew_percent(client_conf_t *cc) + { + return get_conf_uint16_val(cc->params, CLIENT_VAR_RENEW_PERCENT, CLIENT_DEFAULT_RENEW_PERCENT); + } + + int client_conf_get_rebind_percent(client_conf_t *cc) + { + return get_conf_uint16_val(cc->params, CLIENT_VAR_REBIND_PERCENT, CLIENT_DEFAULT_REBIND_PERCENT); } Index: dhcp-client-defaults.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-defaults.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-client-defaults.h 20 Jun 2003 01:37:15 -0000 1.5 --- dhcp-client-defaults.h 23 Jun 2003 06:04:33 -0000 1.6 *************** *** 88,90 **** --- 88,98 ---- #define CLIENT_DEFAULT_SUBNET_MASK "255.255.255.0" + /* Percent of lease time to use as renew. */ + + #define CLIENT_DEFAULT_RENEW_PERCENT 50 + + /* Percent of lease time to use as rebind. */ + + #define CLIENT_DEFAULT_REBIND_PERCENT 80 + #endif /* DHCP_CLIENT_DEFAULTS_H */ |
From: <act...@us...> - 2003-06-23 04:30:43
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv20678/src Modified Files: dhcp-snprintf.c Log Message: fixed up snprintf code for gcc 3 Index: dhcp-snprintf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-snprintf.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-snprintf.c 11 Jun 2003 03:08:49 -0000 1.4 --- dhcp-snprintf.c 23 Jun 2003 04:30:40 -0000 1.5 *************** *** 264,268 **** case 'i': if(cflags == DP_C_SHORT) ! value = va_arg(args, short int); else if(cflags == DP_C_LONG) value = va_arg(args, long int); --- 264,268 ---- case 'i': if(cflags == DP_C_SHORT) ! value = va_arg(args, int); else if(cflags == DP_C_LONG) value = va_arg(args, long int); *************** *** 274,278 **** flags |= DP_F_UNSIGNED; if(cflags == DP_C_SHORT) ! value = va_arg(args, unsigned short int); else if(cflags == DP_C_LONG) value = va_arg(args, unsigned long int); --- 274,278 ---- flags |= DP_F_UNSIGNED; if(cflags == DP_C_SHORT) ! value = va_arg(args, unsigned int); else if(cflags == DP_C_LONG) value = va_arg(args, unsigned long int); *************** *** 284,288 **** flags |= DP_F_UNSIGNED; if(cflags == DP_C_SHORT) ! value = va_arg(args, unsigned short int); else if(cflags == DP_C_LONG) value = va_arg(args, unsigned long int); --- 284,288 ---- flags |= DP_F_UNSIGNED; if(cflags == DP_C_SHORT) ! value = va_arg(args, unsigned int); else if(cflags == DP_C_LONG) value = va_arg(args, unsigned long int); *************** *** 296,300 **** flags |= DP_F_UNSIGNED; if(cflags == DP_C_SHORT) ! value = va_arg(args, unsigned short int); else if(cflags == DP_C_LONG) value = va_arg(args, unsigned long int); --- 296,300 ---- flags |= DP_F_UNSIGNED; if(cflags == DP_C_SHORT) ! value = va_arg(args, unsigned int); else if(cflags == DP_C_LONG) value = va_arg(args, unsigned long int); |
From: <act...@us...> - 2003-06-20 01:37:19
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv1150/src Modified Files: dhcp-client-defaults.h dhcp-client-states.c Log Message: fixed issues with default timeouts and timeout conf hooks Index: dhcp-client-defaults.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-defaults.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-client-defaults.h 8 Jun 2003 22:14:51 -0000 1.4 --- dhcp-client-defaults.h 20 Jun 2003 01:37:15 -0000 1.5 *************** *** 48,64 **** /* amount of retry for dhcp DISCOVER messages. */ ! #define CLIENT_DEFAULT_DHCP_DISCOVER_RETRIES RECOMMENDED_MAX_SECS_WAIT /* amount of retry for dhcp REQUEST messages. */ ! #define CLIENT_DEFAULT_DHCP_REQUEST_RETRIES RECOMMENDED_MAX_SECS_WAIT /* amount of retry for ICMP messages. */ ! #define CLIENT_DEFAULT_ICMP_RETRIES RECOMMENDED_MAX_SECS_WAIT /* amount of retry for ARP messages. */ ! #define CLIENT_DEFAULT_ARP_RETRIES RECOMMENDED_MAX_SECS_WAIT /* default MTU to use on interface during initialization --- 48,64 ---- /* amount of retry for dhcp DISCOVER messages. */ ! #define CLIENT_DEFAULT_DHCP_DISCOVER_RETRIES 3 /* amount of retry for dhcp REQUEST messages. */ ! #define CLIENT_DEFAULT_DHCP_REQUEST_RETRIES 3 /* amount of retry for ICMP messages. */ ! #define CLIENT_DEFAULT_ICMP_RETRIES 3 /* amount of retry for ARP messages. */ ! #define CLIENT_DEFAULT_ARP_RETRIES 3 /* default MTU to use on interface during initialization Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** dhcp-client-states.c 17 Jun 2003 07:34:15 -0000 1.34 --- dhcp-client-states.c 20 Jun 2003 01:37:15 -0000 1.35 *************** *** 388,392 **** } ! do_sysconf_setup_timers(options, dc); do_sysconf(options, dc, STATE_SETUP); --- 388,392 ---- } ! client_setup_timers(dc); do_sysconf(options, dc, STATE_SETUP); *************** *** 615,619 **** /* get the number of retries we will attempt. */ retries = client_conf_get_dhcp_discovery_retries(dc->conf); ! timeout = client_conf_get_dhcp_request_retries(dc->conf); /* build discovery option list. */ --- 615,619 ---- /* get the number of retries we will attempt. */ retries = client_conf_get_dhcp_discovery_retries(dc->conf); ! timeout = client_conf_get_dhcp_discover_timeout(dc->conf); /* build discovery option list. */ |
From: <act...@us...> - 2003-06-17 07:35:06
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv15512 Modified Files: README Log Message: fixed up README Index: README =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/README,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** README 9 Jun 2003 02:02:15 -0000 1.6 --- README 17 Jun 2003 07:35:03 -0000 1.7 *************** *** 24,31 **** dhcp-agent has been tested on: ! Linux 2.4.x ! FreeBSD 4.x NetBSD-1.6.1 (i386) ! Solaris 2.8 (SPARC) Support --- 24,31 ---- dhcp-agent has been tested on: ! Linux 2.4.x (i386) ! FreeBSD 4.x (i386) NetBSD-1.6.1 (i386) ! Solaris 2.8 (SPARC) Support |
From: <act...@us...> - 2003-06-17 07:34:58
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv15446 Modified Files: TODO Log Message: more TODO Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TODO 9 Jun 2003 02:00:42 -0000 1.14 --- TODO 17 Jun 2003 07:34:56 -0000 1.15 *************** *** 62,63 **** --- 62,71 ---- -- stringbuffer might be more useful it allowed marking of arbitrary characters with sentinels. + + -- fix dhcp-com.c to ignore options which are not within the + handled option range, but not stop processing packets when an + out of range option is encountered. + + -- by default use 75% of the lease time as the renew time, and + 85% as the rebind time. also fix so we alert the user of an + expired lease. |
From: <act...@us...> - 2003-06-17 07:34:39
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf In directory sc8-pr-cvs1:/tmp/cvs-serv15379/conf Modified Files: default.sysconf Log Message: revamped sysconf code Index: default.sysconf =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/conf/default.sysconf,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** default.sysconf 8 Jun 2003 22:15:24 -0000 1.6 --- default.sysconf 17 Jun 2003 07:34:36 -0000 1.7 *************** *** 11,17 **** (define configure-interface #f) ! (define reconfigure-interface #f) ! (let* ((configured-ip-address #f)) (set! configure-interface --- 11,17 ---- (define configure-interface #f) ! ; XXX -- no need for unconfigure interface, client will handle that internally. ! (let ((configured-ip-address #f)) (set! configure-interface *************** *** 37,51 **** (if (not (client-interface-up client-control dhcp-requested-ip-address subnet-mask mtu)) (client-fatal-message "could not bring up interface... exiting.") ! (set! configured-ip-address dhcp-requested-ip-address)))))) ! ! (set! reconfigure-interface ! (lambda () ! ! (if configured-ip-address ! (if (not (string=? configured-ip-address dhcp-requested-ip-address)) ! (begin ! (client-info-message "ip address changed during reconfiguration:") ! (client-info-message (string-append "using new address: " dhcp-requested-ip-address)) ! (configure-interface))))))) ; XXX --- 37,41 ---- (if (not (client-interface-up client-control dhcp-requested-ip-address subnet-mask mtu)) (client-fatal-message "could not bring up interface... exiting.") ! (set! configured-ip-address dhcp-requested-ip-address))))))) ; XXX *************** *** 54,69 **** ; All configure-* functions are placed inside of closures. This ; allows seemless persistantance of old values and thus ! ; reconfigure-* can be written easily. ; - ; reconfigure-* is called during rebind or renew. ; Domain and domain-name servers - ; (define configure-dns #f) - (define reconfigure-dns #f) (define unconfigure-dns #f) ! (let* ((configured-domain-name #f) (configured-domain-name-servers #f) --- 44,56 ---- ; All configure-* functions are placed inside of closures. This ; allows seemless persistantance of old values and thus ! ; unconfigure-* can be written easily. ; ; Domain and domain-name servers (define configure-dns #f) (define unconfigure-dns #f) ! (let ((configured-domain-name #f) (configured-domain-name-servers #f) *************** *** 74,96 **** (client-configure? client-control 'dhcp-domain-name) (defined? 'dhcp-domain-name-servers) ! (defined? 'dhcp-domain-name)))) ; define this here since we'll be calling it from reconfigure as well. - (real-configure-dns - (lambda() - (let ((resolv-conf-file-port (open "/etc/resolv.conf" O_WRONLY 0644))) - (client-info-message "configuring resolver") - (map-in-order - (lambda (dns-server) - (simple-format resolv-conf-file-port "nameserver ~A\n" dns-server)) dhcp-domain-name-servers) - (simple-format resolv-conf-file-port "search ~A\n" dhcp-domain-name) - (close-port resolv-conf-file-port) - - ; now setup the options so we can use them again. - (set! configured-domain-name dhcp-domain-name) - (set! configured-domain-name-servers dhcp-domain-name-servers))))) - - ; configure dns options (set! configure-dns --- 61,68 ---- (client-configure? client-control 'dhcp-domain-name) (defined? 'dhcp-domain-name-servers) ! (defined? 'dhcp-domain-name))))) ; define this here since we'll be calling it from reconfigure as well. ; configure dns options (set! configure-dns *************** *** 98,104 **** (lambda () (if (do-configure) ! (real-configure-dns)))) ! ; unconfigure dns options (set! unconfigure-dns (lambda() --- 70,86 ---- (lambda () (if (do-configure) ! (let ((resolv-conf-file-port (open "/etc/resolv.conf" O_WRONLY 0644))) ! (client-info-message "configuring resolver") ! (map-in-order ! (lambda (dns-server) ! (simple-format resolv-conf-file-port "nameserver ~A\n" dns-server)) dhcp-domain-name-servers) ! (simple-format resolv-conf-file-port "search ~A\n" dhcp-domain-name) ! (close-port resolv-conf-file-port) ! ; now setup the options so we can use them again in unconfigure. ! (set! configured-domain-name dhcp-domain-name) ! (set! configured-domain-name-servers dhcp-domain-name-servers))))) ! ! ; unconfigure dns options (set! unconfigure-dns (lambda() *************** *** 107,209 **** ; is a good server :-) ! #t)) ! ! (set! reconfigure-dns ! (lambda() ! (if (do-configure) ! (if (and configured-domain-name configured-domain-name-servers) ! (if (not (or (string=? configured-domain-name dhcp-domain-name) ! (string=? configured-domain-name-servers dhcp-domain-name-servers))) ! (begin ! (client-info-message "domain name options have changed. reconfiguring...") ! (real-configure-dns)))) ! ! ; otherwise this is the first time we've received this option ! (real-configure-dns))))) ; Routers. We use client-set-default-route to add the route. - ; (define configure-default-route #f) (define unconfigure-default-route #f) - (define reconfigure-default-route #f) ! (let* ((configured-default-route #f) ; check to see if really need to configure ! (do-configure ! (lambda() ! (and (client-configure? client-control 'dhcp-routers) ! (defined? 'dhcp-routers)))) ! ! (real-configure-default-route ! (lambda() ! ! ; we need to check for latency so we can call client-discovery-icmp-latency ! ; which sends out icmp echo messages and the latency value associated with it ! ; ! ! (let ((routers (sort (client-discover-icmp-latency client-control dhcp-routers) ! (lambda (x y) (< (car x) (car y)))))) ! ! (if (null? routers) ! (begin ! (client-error-message "default routes not responding. defaulting to first one in list") ! (client-set-default-route client-control (car (dhcp-routers))) ! (set! configured-default-route (car dhcp-routers))) ! ! (let ((default-route (car (cdr (car routers))))) ! (display default-route) ! (newline) ! (client-info-message (string-append "adding default route to: " default-route)) ! (client-set-default-route client-control default-route) ! (set! configured-default-route default-route)))))) ! ! (real-unconfigure-default-route ! (lambda() ! (begin ! (client-info-message (string-append "removing default route to: " configured-default-route)) ! (client-remove-default-route client-control configured-default-route))))) (set! configure-default-route (lambda() (if (do-configure) ! (real-configure-default-route)))) ! (set! reconfigure-default-route (lambda() (if (do-configure) (if configured-default-route (begin ! (real-unconfigure-default-route) ! (real-configure-default-route)))))) ! ! (set! unconfigure-default-route ! (lambda() ! (if configured-default-route ! (real-unconfigure-default-route))))) ; After everything is defined set to hooks ; ! ; We have four hooks. dhcp-bound-hook, dhcp-rebind-hook, ! ; dhcp-renew-hook, dhcp-release-hook ! ; ! ! ; setup options on dhcp-bound ! ! (add-hook! dhcp-bound-hook configure-dns) ! (add-hook! dhcp-bound-hook configure-default-route) ! (add-hook! dhcp-bound-hook configure-interface) ! ! ; on rebind and renew call reconfigure to check if ! ; reconfiguration is necessary. ! (add-hook! dhcp-rebind-hook reconfigure-dns) ! (add-hook! dhcp-rebind-hook reconfigure-default-route) ! (add-hook! dhcp-renew-hook reconfigure-dns) ! (add-hook! dhcp-renew-hook reconfigure-default-route) ! (add-hook! dhcp-renew-hook reconfigure-interface) ; unconfigure options on dhcp-release-hook --- 89,143 ---- ; is a good server :-) ! #t))) ; Routers. We use client-set-default-route to add the route. (define configure-default-route #f) (define unconfigure-default-route #f) ! (let ((configured-default-route #f) ; check to see if really need to configure ! (do-configure ! (lambda() ! (and (client-configure? client-control 'dhcp-routers) ! (defined? 'dhcp-routers))))) (set! configure-default-route (lambda() (if (do-configure) ! (let ((routers (sort (client-discover-icmp-latency client-control dhcp-routers) ! (lambda (x y) (< (car x) (car y)))))) + (if (null? routers) + (begin + (client-error-message "default routes not responding. defaulting to first one in list") + (client-set-default-route client-control (car dhcp-routers)) + (set! configured-default-route (car dhcp-routers))) ! (let ((default-route (car (cdr (car routers))))) ! (display default-route) ! (newline) ! (client-info-message (string-append "adding default route to: " default-route)) ! (client-set-default-route client-control default-route) ! (set! configured-default-route default-route))))))) ! ! (set! unconfigure-default-route (lambda() (if (do-configure) (if configured-default-route (begin ! (client-info-message (string-append "removing default route to: " configured-default-route)) ! (client-remove-default-route client-control configured-default-route))))))) ; After everything is defined set to hooks ; ! ; We have two hooks. dhcp-bind-hook, dhcp-release-hook, ! ; setup options on dhcp-bind ! (add-hook! dhcp-bind-hook configure-dns) ! (add-hook! dhcp-bind-hook configure-default-route) ! (add-hook! dhcp-bind-hook configure-interface) ; unconfigure options on dhcp-release-hook *************** *** 211,213 **** (add-hook! dhcp-release-hook unconfigure-dns) (add-hook! dhcp-release-hook unconfigure-default-route) - (add-hook! dhcp-release-hook reconfigure-interface) --- 145,146 ---- |
From: <act...@us...> - 2003-06-17 07:34:22
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv15241/src Modified Files: Makefile.am dhcp-client-conf.c dhcp-client-conf.h dhcp-client-guile.c dhcp-client-states.c dhcp-client.c dhcp-client.h dhcp-librawnet.h dhcp-option-convert.c dhcp-option.c dhcp-option.h Log Message: revamped client state machine Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/Makefile.am,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Makefile.am 8 Jun 2003 22:18:00 -0000 1.23 --- Makefile.am 17 Jun 2003 07:34:15 -0000 1.24 *************** *** 3,7 **** # Main source Makefile.am ! AM_CFLAGS = -Wall -Werror INCLUDES = ${PCAP_INC} ${DNET_INC} ${GUILE_INC} CPPFLAGS = -DDHCPSYSCONFDIR=\"${dhcpsysconfdir}\" -DDHCPSYSCONF_CLIENTDIR=\"${dhcpsysconf_clientdir}\" \ --- 3,7 ---- # Main source Makefile.am ! AM_CFLAGS = -Wall -Werror -g INCLUDES = ${PCAP_INC} ${DNET_INC} ${GUILE_INC} CPPFLAGS = -DDHCPSYSCONFDIR=\"${dhcpsysconfdir}\" -DDHCPSYSCONF_CLIENTDIR=\"${dhcpsysconf_clientdir}\" \ Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dhcp-client-conf.c 8 Jun 2003 22:14:51 -0000 1.26 --- dhcp-client-conf.c 17 Jun 2003 07:34:15 -0000 1.27 *************** *** 771,774 **** --- 771,786 ---- } + /* get timeout threshold for dhcp discover operations. */ + int client_conf_get_dhcp_discover_timeout(client_conf_t *cc) + { + return get_conf_int_var(cc->params, CLIENT_VAR_DHCP_DISCOVER_TIMEOUT, CLIENT_DEFAULT_DHCP_DISCOVER_TIMEOUT); + } + + /* get timeout threshold for dhcp request operations. */ + int client_conf_get_dhcp_request_timeout(client_conf_t *cc) + { + return get_conf_int_var(cc->params, CLIENT_VAR_DHCP_REQUEST_TIMEOUT, CLIENT_DEFAULT_DHCP_REQUEST_TIMEOUT); + } + /* get timeout threshold for arp operations. */ int client_conf_get_arp_timeout(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr) Index: dhcp-client-conf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-client-conf.h 8 Jun 2003 22:14:51 -0000 1.16 --- dhcp-client-conf.h 17 Jun 2003 07:34:15 -0000 1.17 *************** *** 104,107 **** --- 104,109 ---- extern int client_conf_get_icmp_echo_timeout(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr); extern int client_conf_get_icmp_subnet_timeout(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr); + extern int client_conf_get_dhcp_discover_timeout(client_conf_t *cc); + extern int client_conf_get_dhcp_request_timeout(client_conf_t *cc); extern int client_conf_get_arp_timeout(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr); extern const char *client_conf_get_hostname(client_conf_t *cc); Index: dhcp-client-guile.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-guile.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-client-guile.c 8 Jun 2003 22:15:24 -0000 1.7 --- dhcp-client-guile.c 17 Jun 2003 07:34:15 -0000 1.8 *************** *** 385,389 **** dc = client_control_smob->dc; ! client_do_shutdown(dc); /* never really returns but to avoid compiler warning. */ --- 385,389 ---- dc = client_control_smob->dc; ! client_shutdown(dc); /* never really returns but to avoid compiler warning. */ *************** *** 692,711 **** case STATE_SETUP: ! hook = scm_c_eval_string("dhcp-bound-hook"); ! scm_c_run_hook(hook, SCM_EOL); ! break; ! ! case STATE_REBIND: ! ! hook = scm_c_eval_string("dhcp-rebind-hook"); ! scm_c_run_hook(hook, SCM_EOL); ! break; ! ! case STATE_RENEW: ! hook = scm_c_eval_string("dhcp-renew-hook"); scm_c_run_hook(hook, SCM_EOL); break; ! case STATE_DO_SHUTDOWN: hook = scm_c_eval_string("dhcp-release-hook"); scm_c_run_hook(hook, SCM_EOL); --- 692,700 ---- case STATE_SETUP: ! hook = scm_c_eval_string("dhcp-bind-hook"); scm_c_run_hook(hook, SCM_EOL); break; ! case STATE_SHUTDOWN: hook = scm_c_eval_string("dhcp-release-hook"); scm_c_run_hook(hook, SCM_EOL); *************** *** 784,796 **** /* bound hook. */ hook = scm_make_hook(SCM_MAKINUM(0)); ! scm_c_define("dhcp-bound-hook", hook); ! ! /* rebind. */ ! hook = scm_make_hook(SCM_MAKINUM(0)); ! scm_c_define("dhcp-rebind-hook", hook); ! ! /* renew. */ ! hook = scm_make_hook(SCM_MAKINUM(0)); ! scm_c_define("dhcp-renew-hook", hook); /* release. */ --- 773,777 ---- /* bound hook. */ hook = scm_make_hook(SCM_MAKINUM(0)); ! scm_c_define("dhcp-bind-hook", hook); /* release. */ Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** dhcp-client-states.c 25 May 2003 03:37:36 -0000 1.33 --- dhcp-client-states.c 17 Jun 2003 07:34:15 -0000 1.34 *************** *** 40,67 **** #include "dhcp-sysconf.h" /*************************** * option list generation * ***************************/ - /* create DHCP RELEASE option list. */ - static list_t *client_build_release_option_list(dhcp_client_control_t *dc) - { - list_t *options; [...1237 lines suppressed...] - client_cache_delete_cache(dc->cache); - - return STATE_DISCOVER_OFFER; - - } else { - - ERROR_MESSAGE("received neither NACK nor ACK -- this should never happen because of higher filters."); - FATAL_MESSAGE("I shouldn't be here. this is a bug report me."); - exit(1); /* get rid of compiler warning. */ - } - } - - /* utility state: call this if reinitializing our client control - * useful when recreating the control (e.g. after a fork). */ - int client_reinitialize(dhcp_client_control_t *dc) - { - client_setup_timers(dc); - return 0; } --- 1040,1042 ---- Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** dhcp-client.c 25 May 2003 16:24:10 -0000 1.29 --- dhcp-client.c 17 Jun 2003 07:34:16 -0000 1.30 *************** *** 78,90 **** /* client state dispatch: index constants in dhcp-client.h */ client_state client_states[] = { ! client_discover_offer, ! client_request_ack, client_setup, ! client_wait, ! client_release, ! client_renew, ! client_rebind, ! client_fatal_error, ! client_do_shutdown, }; --- 78,90 ---- /* client state dispatch: index constants in dhcp-client.h */ client_state client_states[] = { ! client_init, ! client_init_reboot, ! client_requesting, ! client_renewing, ! client_rebinding, client_setup, ! client_bound, ! client_inform, ! client_shutdown, }; *************** *** 108,114 **** { if(client_cache_is_empty(dc->cache)) { ! return STATE_DISCOVER_OFFER; } else /* if not empty we assume we can request the options. */ ! return STATE_REQUEST_ACK; } --- 108,114 ---- { if(client_cache_is_empty(dc->cache)) { ! return STATE_INIT; } else /* if not empty we assume we can request the options. */ ! return STATE_INIT_REBOOT; } *************** *** 214,218 **** case INTERRUPT_TERM: ! state = STATE_DO_SHUTDOWN; break; --- 214,218 ---- case INTERRUPT_TERM: ! state = STATE_SHUTDOWN; break; *************** *** 238,242 **** case TIMER_IP_LEASE: ! state = STATE_DISCOVER_OFFER; break; --- 238,242 ---- case TIMER_IP_LEASE: ! state = STATE_INIT; break; *************** *** 258,265 **** * return here. */ ! if((state == STATE_WAIT) && only_setup) { return state; } state = client_states[state] (dc); --- 258,268 ---- * return here. */ ! if((state == STATE_BOUND) && only_setup) { return state; } + if(state == STATE_USER_INTERRUPT || state == STATE_NO_LEASES || state == STATE_FATAL_ERROR) + state = STATE_SHUTDOWN; + state = client_states[state] (dc); *************** *** 388,392 **** if((dc = dhcp_client_control_create(interface, promiscuous, 1)) == NULL) { ERROR_MESSAGE("encountered a fatal error. I'm exiting."); ! client_states[STATE_DO_SHUTDOWN] (dc); } --- 391,395 ---- if((dc = dhcp_client_control_create(interface, promiscuous, 1)) == NULL) { ERROR_MESSAGE("encountered a fatal error. I'm exiting."); ! client_states[STATE_SHUTDOWN] (dc); } *************** *** 426,430 **** * * The only thing we keep is our state which ought to be ! * STATE_WAIT * * Unfortunately destroying the control means valuable --- 429,433 ---- * * The only thing we keep is our state which ought to be ! * STATE_BOUND * * Unfortunately destroying the control means valuable *************** *** 446,450 **** if((dc = dhcp_client_control_create(interface, promiscuous, 0)) == NULL) { ERROR_MESSAGE("encountered a fatal error. I'm exiting.", interface); ! client_states[STATE_DO_SHUTDOWN] (NULL); } --- 449,453 ---- if((dc = dhcp_client_control_create(interface, promiscuous, 0)) == NULL) { ERROR_MESSAGE("encountered a fatal error. I'm exiting.", interface); ! client_states[STATE_SHUTDOWN] (NULL); } *************** *** 454,458 **** if(file_create_pid(interface)) { ERROR_MESSAGE("could not create PID file for interface: %s", interface); ! client_states[STATE_DO_SHUTDOWN](NULL); } --- 457,461 ---- if(file_create_pid(interface)) { ERROR_MESSAGE("could not create PID file for interface: %s", interface); ! client_states[STATE_SHUTDOWN](NULL); } Index: dhcp-client.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-client.h 25 May 2003 03:37:36 -0000 1.16 --- dhcp-client.h 17 Jun 2003 07:34:16 -0000 1.17 *************** *** 71,93 **** /* client commands. */ ! #define DO_VERSION 0 ! #define DO_KILL 1 ! #define DO_WAKE 2 ! #define DO_CLEAR 3 ! #define DO_CLIENT 4 /* DHCP client states. */ ! #define STATE_DISCOVER_OFFER 0 ! #define STATE_REQUEST_ACK 1 ! #define STATE_SETUP 2 ! #define STATE_WAIT 3 ! #define STATE_RELEASE 4 ! #define STATE_RENEW 5 ! #define STATE_REBIND 6 ! #define STATE_FATAL_ERROR 7 ! #define STATE_DO_SHUTDOWN 8 /* timer IDs. */ - enum client_timer_types { TIMER_IP_LEASE = 1, TIMER_REBIND, TIMER_RENEW }; --- 71,82 ---- /* client commands. */ ! enum client_commands { DO_VERSION = 0, DO_KILL, DO_WAKE, DO_CLEAR, DO_CLIENT }; /* DHCP client states. */ ! enum client_states { STATE_INIT = 0, STATE_INIT_REBOOT, STATE_REQUEST, STATE_RENEW, STATE_REBIND, STATE_SETUP, ! STATE_BOUND, STATE_INFORM, STATE_SHUTDOWN, STATE_RELEASE, ! STATE_DECLINE, STATE_FATAL_ERROR, STATE_NO_LEASES, STATE_USER_INTERRUPT }; /* timer IDs. */ enum client_timer_types { TIMER_IP_LEASE = 1, TIMER_REBIND, TIMER_RENEW }; *************** *** 95,107 **** /* client states. */ ! extern int client_discover_offer(dhcp_client_control_t *dc); ! extern int client_request_ack(dhcp_client_control_t *dc); ! extern int client_wait(dhcp_client_control_t *dc); extern int client_release(dhcp_client_control_t *dc); - extern int client_renew(dhcp_client_control_t *dc); - extern int client_rebind(dhcp_client_control_t *dc); extern int client_setup(dhcp_client_control_t *dc); ! extern int client_fatal_error(dhcp_client_control_t *dc); ! extern int client_do_shutdown(dhcp_client_control_t *dc); extern int client_reinitialize(dhcp_client_control_t *dc); --- 84,97 ---- /* client states. */ ! extern int client_init(dhcp_client_control_t *dc); ! extern int client_init_reboot(dhcp_client_control_t *dc); ! extern int client_inform(dhcp_client_control_t *dc); ! extern int client_requesting(dhcp_client_control_t *dc); ! extern int client_rebinding(dhcp_client_control_t *dc); ! extern int client_renewing(dhcp_client_control_t *dc); ! extern int client_bound(dhcp_client_control_t *dc); extern int client_release(dhcp_client_control_t *dc); extern int client_setup(dhcp_client_control_t *dc); ! extern int client_shutdown(dhcp_client_control_t *dc); extern int client_reinitialize(dhcp_client_control_t *dc); Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-librawnet.h 8 Jun 2003 22:42:45 -0000 1.15 --- dhcp-librawnet.h 17 Jun 2003 07:34:16 -0000 1.16 *************** *** 111,115 **** dhcp_opt_from_string from_internal_string; /* string to internal. */ ! dhcp_opt_data_destroy destroy; /* destroy option datum. */ } dhcp_opt_attr_t; --- 111,115 ---- dhcp_opt_from_string from_internal_string; /* string to internal. */ ! dhcp_opt_data_destroy destroy; /* destroy option datum. */ } dhcp_opt_attr_t; Index: dhcp-option-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option-convert.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-option-convert.c 18 May 2003 02:58:25 -0000 1.4 --- dhcp-option-convert.c 17 Jun 2003 07:34:16 -0000 1.5 *************** *** 28,32 **** #define MODULE_NAME "dhcp-option-convert" - #define DHCP_OPTION_MACROS #include "dhcp-local.h" --- 28,31 ---- Index: dhcp-option.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-option.c 6 May 2003 03:49:16 -0000 1.4 --- dhcp-option.c 17 Jun 2003 07:34:16 -0000 1.5 *************** *** 24,28 **** #define MODULE_NAME "dhcp-option" - #define DHCP_OPTION_MACROS #include "dhcp-local.h" --- 24,27 ---- Index: dhcp-option.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-option.h 6 May 2003 03:49:16 -0000 1.4 --- dhcp-option.h 17 Jun 2003 07:34:16 -0000 1.5 *************** *** 64,68 **** /* convenience macros. this makes accessing what's under the attr structure easier. */ - #ifdef DHCP_OPTION_MACROS #define DHCP_OPT_GET_TYPE(x) (x->opt_attr->type) --- 64,67 ---- *************** *** 79,87 **** #define DHCP_OPT_TO_USER_STRING(x) (x->opt_attr->to_user_string(x)) #define DHCP_OPT_TO_NETWORK_DATA(x) (x->opt_attr->to_network_data(x)) ! #define DHCP_OPT_TO_INTERNAL_DATA(x) (x->opt_attr->to_host_data(x, retlen)) #define DHCP_OPT_DESTROY(x) (x->opt_attr->destroy(x)) - #endif /* DHCP_OPTION_MACROS */ #endif /* DHCP_OPTION_H */ --- 78,85 ---- #define DHCP_OPT_TO_USER_STRING(x) (x->opt_attr->to_user_string(x)) #define DHCP_OPT_TO_NETWORK_DATA(x) (x->opt_attr->to_network_data(x)) ! #define DHCP_OPT_TO_INTERNAL_DATA(x) (dhcp_opt_get_host_data(x)) #define DHCP_OPT_DESTROY(x) (x->opt_attr->destroy(x)) #endif /* DHCP_OPTION_H */ |
From: <act...@us...> - 2003-06-11 03:08:54
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv23366/src Modified Files: dhcp-files.c dhcp-local.h dhcp-snprintf.c Log Message: fixes for solaris Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-files.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-files.c 29 Dec 2002 05:17:49 -0000 1.8 --- dhcp-files.c 11 Jun 2003 03:08:48 -0000 1.9 *************** *** 161,165 **** ! fprintf(fp, "%u", getpid()); fclose(fp); --- 161,165 ---- ! fprintf(fp, "%lu", (unsigned long)getpid()); fclose(fp); *************** *** 181,189 **** /* get pid from file. */ ! int file_get_pid(char *name, pid_t * pid) { FILE *fp; char *fname = get_pid_file_name(name); if(!file_exists(fname)) { xfree(fname); --- 181,191 ---- /* get pid from file. */ ! int file_get_pid(char *name, pid_t *pid) { FILE *fp; + unsigned long pid_value; char *fname = get_pid_file_name(name); + if(!file_exists(fname)) { xfree(fname); *************** *** 198,205 **** } ! fscanf(fp, "%u", pid); fclose(fp); xfree(fname); return 0; } --- 200,209 ---- } ! /* probably a safe cast since we're most likely promoting. */ ! fscanf(fp, "%ld", &pid_value); fclose(fp); xfree(fname); + *pid = pid_value; return 0; } Index: dhcp-local.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-local.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-local.h 9 Jun 2003 02:04:02 -0000 1.6 --- dhcp-local.h 11 Jun 2003 03:08:49 -0000 1.7 *************** *** 53,57 **** #include <sys/time.h> #include <sys/ioctl.h> ! #include <sys/fcntl.h> #include <sys/uio.h> --- 53,57 ---- #include <sys/time.h> #include <sys/ioctl.h> ! #include <fcntl.h> #include <sys/uio.h> *************** *** 107,110 **** --- 107,123 ---- #define INADDR_NONE -1 #endif /* INADDR_NONE */ + + /* Some operating systems don't have SCNu8/SCNd8 but will have + * the other C99 format macros. I guess they expect us just to + * use normal character substitution. So we will. Otherwise + * they're borked. */ + + #ifndef SCNu8 + #define SCNu8 "hhu" + #endif /* SCNu8 */ + + #ifndef SCNi8 + #define SCNi8 "hhi" + #endif /* SCNi8 */ #endif /* DHCP_LOCAL_H */ Index: dhcp-snprintf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-snprintf.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-snprintf.c 16 Nov 2002 00:23:44 -0000 1.3 --- dhcp-snprintf.c 11 Jun 2003 03:08:49 -0000 1.4 *************** *** 6,9 **** --- 6,20 ---- */ + /********************************************************* + * Taken from the mutt project. + * Recent changes: + * + * Thamer Alharbash <tm...@wh...>, June, 2003: + * + * Some minor tweaks to keep it healthy on newer gcc, and + * platforms like Solaris. + * + *********************************************************/ + /************************************************************** * Original: *************** *** 198,202 **** break; case DP_S_MIN: ! if(isdigit(ch)) { min = 10 * min + char_to_int(ch); ch = *format++; --- 209,213 ---- break; case DP_S_MIN: ! if(isdigit((int)ch)) { min = 10 * min + char_to_int(ch); ch = *format++; *************** *** 216,220 **** break; case DP_S_MAX: ! if(isdigit(ch)) { if(max < 0) max = 0; --- 227,231 ---- break; case DP_S_MAX: ! if(isdigit((int)ch)) { if(max < 0) max = 0; |
From: <act...@us...> - 2003-06-09 02:04:51
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv23353/src Modified Files: dhcp-rawnet.c Log Message: if pcap_freecode isn't available then we can't use it Index: dhcp-rawnet.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-rawnet.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-rawnet.c 8 Jun 2003 22:42:45 -0000 1.8 --- dhcp-rawnet.c 9 Jun 2003 02:04:48 -0000 1.9 *************** *** 173,177 **** --- 173,184 ---- } + /* looks like NetBSD ships with a libpcap that does not have + * pcap_freecode there's nothing we can do except not compile + * against it. this unfortunately will probably introduce + * memory leaks :| */ + + #ifdef HAVE_PCAP_FREECODE pcap_freecode(&filter); + #endif /* HAVE_PCAP_FREECODE */ #if defined(HAVE_BPF_IMMEDIATE) |
From: <act...@us...> - 2003-06-09 02:04:05
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv23125/src Modified Files: dhcp-local.h Log Message: INADDR_NONE definition if one is lacking; this actually isn't the right way of doing things Index: dhcp-local.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-local.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-local.h 18 May 2003 02:58:25 -0000 1.5 --- dhcp-local.h 9 Jun 2003 02:04:02 -0000 1.6 *************** *** 101,103 **** --- 101,110 ---- #define MAX_STRING_LEN 256 + /* Solaris is braindead and does not have INADDR_NONE + * defined. Just define it here. */ + + #ifndef INADDR_NONE + #define INADDR_NONE -1 + #endif /* INADDR_NONE */ + #endif /* DHCP_LOCAL_H */ |
From: <act...@us...> - 2003-06-09 02:03:16
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv22894/src Modified Files: dhcp-util.c Log Message: grrr, must use (int) casting when dealing with ctype functions Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-util.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-util.c 25 May 2003 03:16:18 -0000 1.14 --- dhcp-util.c 9 Jun 2003 02:03:12 -0000 1.15 *************** *** 419,423 **** for(ptr = string; *ptr; ptr++) { ! if(!isdigit(*ptr)) return 0; } --- 419,424 ---- for(ptr = string; *ptr; ptr++) { ! ! if(!isdigit((int)*ptr)) return 0; } *************** *** 436,440 **** if(*ptr == '-') break; ! else if(isdigit(*ptr)) break; else --- 437,441 ---- if(*ptr == '-') break; ! else if(isdigit((int)*ptr)) break; else *************** *** 443,447 **** for(; *ptr; ptr++) { ! if(!isdigit(*ptr)) return 0; } --- 444,448 ---- for(; *ptr; ptr++) { ! if(!isdigit((int)*ptr)) return 0; } |
From: <act...@us...> - 2003-06-09 02:02:53
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv22798 Modified Files: INSTALL Log Message: added note on gmake requirement Index: INSTALL =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/INSTALL,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** INSTALL 20 May 2003 00:34:29 -0000 1.1 --- INSTALL 9 Jun 2003 02:02:50 -0000 1.2 *************** *** 47,50 **** --- 47,55 ---- To install: "make install;" + If you are using a system which does not use GNU make by default, + please install GNU make. Usually it is installed as "gmake" + + To install with GNU make explicitly: "gmake install;" + Before installing please uninstall any previous distribution of dhcp-agent, or dhcp suite package. Make sure you also disabled |
From: <act...@us...> - 2003-06-09 02:02:18
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv22605 Modified Files: README Log Message: added Solaris and NetBSD to README Index: README =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/README,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** README 20 May 2003 00:34:29 -0000 1.5 --- README 9 Jun 2003 02:02:15 -0000 1.6 *************** *** 26,30 **** Linux 2.4.x FreeBSD 4.x ! Solaris 2.8 (sparc) Support --- 26,31 ---- Linux 2.4.x FreeBSD 4.x ! NetBSD-1.6.1 (i386) ! Solaris 2.8 (SPARC) Support |
From: <act...@us...> - 2003-06-09 02:01:31
|
Update of /cvsroot/dhcp-agent/dhcp-agent/man In directory sc8-pr-cvs1:/tmp/cvs-serv22383/man Modified Files: Makefile.am Log Message: properly packiging in files Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/man/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 19 May 2003 23:38:50 -0000 1.2 --- Makefile.am 9 Jun 2003 02:01:28 -0000 1.3 *************** *** 6,10 **** AUTOMAKE_OPTIONS = foreign man_MANS = dhcp-sniff.1 dhcp-client.1 ! EXTRA_DIST = $(man_MANS) CLEANFILES = dhcp-sniff.1 dhcp-client.1 --- 6,10 ---- AUTOMAKE_OPTIONS = foreign man_MANS = dhcp-sniff.1 dhcp-client.1 ! EXTRA_DIST = dhcp-sniff.1.in dhcp-client.1.in CLEANFILES = dhcp-sniff.1 dhcp-client.1 |
From: <act...@us...> - 2003-06-09 02:01:04
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv22192 Modified Files: config.h.in configure.ac Log Message: checking for pcap_freecode now; some minor fixes too Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** config.h.in 18 May 2003 02:58:25 -0000 1.5 --- config.h.in 9 Jun 2003 02:01:01 -0000 1.6 *************** *** 31,34 **** --- 31,37 ---- #undef HAVE_MEMORY_H + /* have pcap_freecode() */ + #undef HAVE_PCAP_FREECODE + /* have __progname var */ #undef HAVE_PROGNAME Index: configure.ac =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.ac,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** configure.ac 9 Jun 2003 00:34:48 -0000 1.8 --- configure.ac 9 Jun 2003 02:01:01 -0000 1.9 *************** *** 140,143 **** --- 140,170 ---- fi + dnl check for pcap_freecode + + + AC_MSG_CHECKING([pcap_freecode in pcap]) + LIBS=$PCAP_LIB + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ pcap_freecode(); ]])],[ have_pcap_freecode="yes" ],[ have_pcap_freecode="no" ]) + LIBS= + + if test x$have_pcap_freecode = "xyes"; then + AC_MSG_RESULT([found]) + AC_DEFINE(HAVE_PCAP_FREECODE, 1, [have pcap_freecode()]) + else + AC_MSG_RESULT([not found]) + AC_MSG_WARN([you don't seem to have an up to date libpcap installed. i could not + find pcap_freecode() because of this you may encounter a small + memory leak. please considering updating to the latest pcap + distribution from http://www.tcpdump.org/]) + fi + + AC_MSG_CHECKING(BIOCIMMEDIATE) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> + #include <stdlib.h> + #include <pcap.h> + ]], [[ ioctl(0, BIOCIMMEDIATE, NULL);]])],[AC_MSG_RESULT(found) + AC_DEFINE(HAVE_BPF_IMMEDIATE, 1, [have BPF_IMMEDIATE])],[AC_MSG_RESULT(not found)]) + + dnl dnl libdnet sifting; actually it's a lot more well behaved *************** *** 205,209 **** AC_SUBST(dhcpdocdir) ! AM_CONFIG_HEADER([config.h]) AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile conf/Makefile doc/Makefile]) AC_OUTPUT --- 232,236 ---- AC_SUBST(dhcpdocdir) ! AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile conf/Makefile doc/Makefile]) AC_OUTPUT |
From: <act...@us...> - 2003-06-09 02:00:45
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv22109 Modified Files: TODO Log Message: updated TODO Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TODO 25 May 2003 03:39:46 -0000 1.13 --- TODO 9 Jun 2003 02:00:42 -0000 1.14 *************** *** 62,66 **** -- stringbuffer might be more useful it allowed marking of arbitrary characters with sentinels. - - -- make sure dhcp-client and dhcp-sniff work on 10mbit and - 100mbit data links. --- 62,63 ---- |
From: <act...@us...> - 2003-06-09 00:34:51
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv30176 Modified Files: configure.ac Log Message: fixed bug in checking for htmldoc; works now Index: configure.ac =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.ac,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** configure.ac 20 May 2003 00:32:30 -0000 1.7 --- configure.ac 9 Jun 2003 00:34:48 -0000 1.8 *************** *** 30,34 **** *) AC_MSG_ERROR(bad value ${enableval} for --enable-htmldoc) ;; ! esac],[debug=false]) AM_CONDITIONAL(HTMLDOC, test x$htmldoc = xtrue) --- 30,34 ---- *) AC_MSG_ERROR(bad value ${enableval} for --enable-htmldoc) ;; ! esac],[htmldoc=false]) AM_CONDITIONAL(HTMLDOC, test x$htmldoc = xtrue) *************** *** 172,176 **** fi ! if $htmldoc; then AC_PATH_PROGS(TEXI2HTML_PATH, [texi2html], [no]) --- 172,176 ---- fi ! if test x$htmldoc = "xtrue"; then AC_PATH_PROGS(TEXI2HTML_PATH, [texi2html], [no]) |
From: <act...@us...> - 2003-06-08 22:42:49
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv30142/src Modified Files: dhcp-interface.c dhcp-interface.h dhcp-librawnet.h dhcp-packet-build.c dhcp-rawnet.c Log Message: now correctly set the hardware type in the bootp header Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-interface.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-interface.c 3 Jan 2003 21:29:22 -0000 1.7 --- dhcp-interface.c 8 Jun 2003 22:42:45 -0000 1.8 *************** *** 247,250 **** --- 247,251 ---- } + list_t *interface_get_active_interfaces(void) { *************** *** 255,257 **** --- 256,270 ---- { return (interfaces_get_proc(check_interface_down)); + } + + uint16_t interface_get_type(interface_control_t *ic) + { + if(interface_get_info(ic)) { + ERROR_MESSAGE("could not get interface data link type %s : %s", + ic->interface_entry->intf_name, strerror(errno)); + + return DLT_NULL; /* do our best. */ + } + + return ic->interface_entry->intf_type; } Index: dhcp-interface.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-interface.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-interface.h 27 Dec 2002 02:53:45 -0000 1.3 --- dhcp-interface.h 8 Jun 2003 22:42:45 -0000 1.4 *************** *** 34,37 **** --- 34,38 ---- extern list_t *interface_get_inactive_interfaces(void); extern int interface_is_up(interface_control_t *ic); + extern uint16_t interface_get_type(interface_control_t *ic); #endif /* DHCP_INTERFACE_H */ Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-librawnet.h 8 Jun 2003 22:14:15 -0000 1.14 --- dhcp-librawnet.h 8 Jun 2003 22:42:45 -0000 1.15 *************** *** 391,394 **** --- 391,395 ---- extern int rawnet_is_valid(rawnet_t *net); extern const char *rawnet_get_device_name(rawnet_t *net); + extern int rawnet_get_datalink_type(rawnet_t *net); /* packet building routines. */ Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-packet-build.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-packet-build.c 3 Jan 2003 21:29:22 -0000 1.5 --- dhcp-packet-build.c 8 Jun 2003 22:42:45 -0000 1.6 *************** *** 313,317 **** dhcp_set_op(net->dhcp_p, bootp_type); ! dhcp_set_htype(net->dhcp_p, DLT_EN10MB); dhcp_set_hlen(net->dhcp_p, ETH_ADDR_LEN); dhcp_set_hops(net->dhcp_p, 0); --- 313,317 ---- dhcp_set_op(net->dhcp_p, bootp_type); ! dhcp_set_htype(net->dhcp_p, rawnet_get_datalink_type(net)); dhcp_set_hlen(net->dhcp_p, ETH_ADDR_LEN); dhcp_set_hops(net->dhcp_p, 0); Index: dhcp-rawnet.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-rawnet.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-rawnet.c 25 May 2003 03:37:52 -0000 1.7 --- dhcp-rawnet.c 8 Jun 2003 22:42:45 -0000 1.8 *************** *** 705,714 **** } ! /* * * * * * * * * * * * * ! * Device manipulation. * ! * * * * * * * * * * * * */ ! const char *rawnet_get_device_name(rawnet_t *net) { ! return net->device; } --- 705,718 ---- } ! /* return datalink type: use pcap for now since it seems to be ! * giving us the correct datalink FIXME: find out why dnet is ! * giving us wierd numbers and send in patch. */ ! int rawnet_get_datalink_type(rawnet_t *net) { ! if(net->pcap == NULL) { ! return DLT_NULL; /* we have no datalink. */ ! } ! ! return pcap_datalink(net->pcap); } |
From: <act...@us...> - 2003-06-08 22:18:03
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv23408/src Modified Files: Makefile.am Log Message: now using sbin instead of bin Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Makefile.am 18 May 2003 02:58:39 -0000 1.22 --- Makefile.am 8 Jun 2003 22:18:00 -0000 1.23 *************** *** 10,14 **** # Programs we are compiling. ! bin_PROGRAMS = dhcp-sniff dhcp-client lib_LTLIBRARIES = libdhcputil.la --- 10,14 ---- # Programs we are compiling. ! sbin_PROGRAMS = dhcp-sniff dhcp-client lib_LTLIBRARIES = libdhcputil.la |
From: <act...@us...> - 2003-06-08 22:16:13
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf In directory sc8-pr-cvs1:/tmp/cvs-serv23082/conf Modified Files: default.conf Log Message: better default.conf Index: default.conf =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/conf/default.conf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** default.conf 11 May 2003 17:00:04 -0000 1.1 --- default.conf 8 Jun 2003 22:16:10 -0000 1.2 *************** *** 40,57 **** # - # DHCP -- try to discover/request three times before giving up. - # - - set dhcp-discovery-retries = 3; - - # - # ICMP -- when doing ICMP retry up to three times. - # - - set icmp-retries = 3; - - # # Router discovery -- should we use ICMP to find the best router? # enable do-measure-router-latency = no; --- 40,52 ---- # # Router discovery -- should we use ICMP to find the best router? # enable do-measure-router-latency = no; + + # Default ARP settings are pretty generous. Unless you experience + # problems this should suffice for most networks which don't have + # excessive packet loss + + set arp-retries = 1; + set arp-timeout-threshold = 1; |
From: <act...@us...> - 2003-06-08 22:15:27
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv22796/src Modified Files: dhcp-client-guile.c Log Message: sysconf now does latency checking before adding default route Index: dhcp-client-guile.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-guile.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-client-guile.c 23 May 2003 03:31:16 -0000 1.6 --- dhcp-client-guile.c 8 Jun 2003 22:15:24 -0000 1.7 *************** *** 73,76 **** --- 73,146 ---- } + /* * * * * * * * * * * * * * * * * * * * * * * + * list conversions. we need to do a few * + * of these to support some of the internal * + * routines. * + * * * * * * * * * * * * * * * * * * * * * * */ + + static list_t *guile_address_list_to_internal_list(SCM scm_address_list) + { + char *address_string; + int list_length, i; + SCM scm_list_length; + SCM scm_address_string; + ip_addr_t *ip_address; + list_t *address_list; + + SCM_ASSERT(SCM_CONSP(scm_address_list), scm_address_list, + SCM_ARG1, "guile_address_list_to_internal_list"); + + scm_list_length = scm_length(scm_address_list); + list_length = scm_num2int(scm_list_length, SCM_ARG1, "guile_address_list_to_internal_list"); + + address_list = list_create(); + + for(i = 0;i < list_length;i++) { + scm_address_string = scm_list_ref(scm_address_list, SCM_MAKINUM(i)); + address_string = x_scm_string2newstr(scm_address_string); + + ip_address = string_ip_to_ip_addr(address_string); + list_add_to_end(address_list, ip_address); + xfree(address_string); + + } + + return address_list; + } + + /* take a latency list: a list of integer latency values followed + * by an address, and convert it to a numeric value for integers, + * and a string value for the address. */ + + static SCM internal_latency_list_to_guile_latency_list(list_t *latency_list) + { + int *latency; + ip_addr_t *address; + char *address_string; + SCM scm_inum_latency; + SCM scm_address_string; + SCM scm_latency_list = SCM_EOL; + SCM scm_latency_address_pair = SCM_EOL; + + list_rewind(latency_list); + while((latency = list_next(latency_list)) != NULL) { + + scm_inum_latency = SCM_MAKINUM(*latency); + + address = list_next(latency_list); /* this should always return a value. */ + address_string = ip_addr_to_string(*address); + scm_address_string = scm_makfrom0str(address_string); + + scm_latency_address_pair = scm_cons(scm_address_string, scm_latency_address_pair); + scm_latency_address_pair = scm_cons(scm_inum_latency, scm_latency_address_pair); + + scm_latency_list = scm_cons(scm_latency_address_pair, scm_latency_list); + scm_latency_address_pair = SCM_EOL; + + xfree(address_string); + } + return scm_latency_list; + } + /* * * * * * * * * * * * * * * * * * * * * guile interface to utility routines * *************** *** 239,242 **** --- 309,314 ---- SCM_ARG2, "client-set-default-route"); + SCM_ASSERT(SCM_BOOLP(set_route), set_route, SCM_ARG3, "client-set-default-route"); + /* if string change to number first. */ if(SCM_STRINGP(scm_default_router)) { *************** *** 309,313 **** scm_dc, SCM_ARG1, "client-shutdown"); ! /* interface handle. */ client_control_smob = (client_control_smob_t *)SCM_SMOB_DATA(scm_dc); dc = client_control_smob->dc; --- 381,385 ---- scm_dc, SCM_ARG1, "client-shutdown"); ! /* client control. */ client_control_smob = (client_control_smob_t *)SCM_SMOB_DATA(scm_dc); dc = client_control_smob->dc; *************** *** 319,322 **** --- 391,444 ---- } + SCM scm_client_discover_icmp_latency(SCM scm_dc, SCM scm_address_list) + { + client_control_smob_t *client_control_smob; + dhcp_client_control_t *dc; + list_t *address_list; + list_t *latency_list; + SCM scm_latency_list; + int retries; + int timeout; + int arp_retries; + int arp_timeout; + + /* do assertions */ + SCM_ASSERT(SCM_SMOB_PREDICATE(client_control_tag, scm_dc), + scm_dc, SCM_ARG1, "client-discover-icmp-latency"); + + SCM_ASSERT(SCM_CONSP(scm_address_list), scm_address_list, SCM_ARG2, + "client-discover-icmp-latency"); + + /* client control. */ + client_control_smob = (client_control_smob_t *)SCM_SMOB_DATA(scm_dc); + dc = client_control_smob->dc; + + /* get number of retries. */ + retries = client_conf_get_icmp_retries(dc->conf, dhcp_client_get_server_ip_address(dc), + dhcp_client_get_server_hw_address(dc)); + + /* get timeout threshold. */ + timeout = client_conf_get_icmp_echo_timeout(dc->conf, dhcp_client_get_server_ip_address(dc), + dhcp_client_get_server_hw_address(dc)); + + /* get arp timeout. */ + arp_timeout = client_conf_get_arp_timeout(dc->conf, dhcp_client_get_server_ip_address(dc), + dhcp_client_get_server_hw_address(dc)); + + /* get arp retries. */ + arp_retries = client_conf_get_arp_retries(dc->conf, dhcp_client_get_server_ip_address(dc), + dhcp_client_get_server_hw_address(dc)); + + address_list = guile_address_list_to_internal_list(scm_address_list); + latency_list = icmp_rtt_discovery(dc->rawnet, timeout, retries, arp_retries, arp_timeout, address_list); + + scm_latency_list = internal_latency_list_to_guile_latency_list(latency_list); + + list_destroy(address_list, xfree); + list_destroy(latency_list, xfree); + + return scm_latency_list; + } + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * info message, error message, and fatal message wrappers. * *************** *** 656,659 **** --- 778,782 ---- scm_c_define_gsubr("client-fatal-error-message", 1, 0, 0, scm_client_fatal_error_message); scm_c_define_gsubr("client-shutdown", 1, 0, 0, scm_client_shutdown); + scm_c_define_gsubr("client-discover-icmp-latency", 2, 0, 0, scm_client_discover_icmp_latency); /* create hooks. */ |