dhcp-agent-commits Mailing List for dhcp-agent (Page 27)
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...> - 2002-07-02 17:09:18
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8152 Modified Files: dhcp-util.c Log Message: added is_seven_bit_clean; fixed messaging :| Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dhcp-util.c 2 Jul 2002 16:45:37 -0000 1.22 --- dhcp-util.c 2 Jul 2002 17:09:15 -0000 1.23 *************** *** 29,33 **** static char msgbuff[MSG_BUFFER_SIZE]; ! static int verbosity_level = WARNING_VERBOSITY_LEVEL; /* set the verbosity level. */ --- 29,33 ---- static char msgbuff[MSG_BUFFER_SIZE]; ! static int verbosity_level = MAX_VERBOSITY_LEVEL; /* set the verbosity level. */ *************** *** 137,146 **** va_list ap; ! if(verbosity_level >= NORMAL_VERBOSITY_LEVEL) return; va_start(ap, fmt); ! message_proc("fatal error", fmt, ap); va_end(ap); --- 137,146 ---- va_list ap; ! if(get_verbosity_level() <= NORMAL_VERBOSITY_LEVEL) return; va_start(ap, fmt); ! message_proc("info", fmt, ap); va_end(ap); *************** *** 154,158 **** va_list ap; ! if(get_verbosity_level() >= WARNING_VERBOSITY_LEVEL) return; --- 154,158 ---- va_list ap; ! if(get_verbosity_level() <= WARNING_VERBOSITY_LEVEL) return; *************** *** 172,176 **** va_list ap; ! if(get_verbosity_level() >= DEBUG_VERBOSITY_LEVEL) return; --- 172,176 ---- va_list ap; ! if(get_verbosity_level() <= DEBUG_VERBOSITY_LEVEL) return; *************** *** 590,624 **** } ! /* sigio handling routine and variable. ! * we only need to use this on *BSD ! * with broken BPF which can't handle a select(). */ ! ! /* wrap for volatine integers, or proper sig_atomic_t types. */ ! ! #ifdef HAVE_SIG_ATOMIC_T ! ! static sig_atomic_t have_io = 0; ! ! #else /* HAVE_SIG_ATOMIC_T */ ! ! static volatile int have_io = 0; ! ! #endif ! ! static RETSIGTYPE handle_sigio(int i) { ! have_io = 1; ! } ! void track_sigio(void) ! { ! have_io = 0; ! add_interrupt_handler(SIGIO, handle_sigio); ! return; ! } ! int had_io(void) ! { ! return have_io; } --- 590,604 ---- } ! int is_seven_bit_clean(const char *data, int len) { ! int i; ! const unsigned char *ptr = data; ! for(i = 0;i < len;i++) { ! if(ptr[i] >= 128) ! return 0; ! } ! return 1; } |
From: <act...@us...> - 2002-07-02 16:46:14
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv1332 Modified Files: dhcp-client-states.c Log Message: minor fix to use string_matches Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** dhcp-client-states.c 30 Jun 2002 21:22:15 -0000 1.34 --- dhcp-client-states.c 2 Jul 2002 16:46:11 -0000 1.35 *************** *** 44,48 **** if(string_matches(policy, "exact")) return(dhcp_have_exact_requested_options(dc->rawnet->dhcp_p, dc->conf->options)); ! else if(!strcmp(policy, "atleast")) return(dhcp_have_atleast_requested_options(dc->rawnet->dhcp_p, dc->conf->options)); else /* bad policy : warn and use atleast */ { --- 44,48 ---- if(string_matches(policy, "exact")) return(dhcp_have_exact_requested_options(dc->rawnet->dhcp_p, dc->conf->options)); ! else if(string_matches(policy, "atleast")) return(dhcp_have_atleast_requested_options(dc->rawnet->dhcp_p, dc->conf->options)); else /* bad policy : warn and use atleast */ { |
From: <act...@us...> - 2002-07-02 16:45:40
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv1153 Modified Files: dhcp-util.c Log Message: message routines procified Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dhcp-util.c 30 Jun 2002 08:23:45 -0000 1.21 --- dhcp-util.c 2 Jul 2002 16:45:37 -0000 1.22 *************** *** 47,50 **** --- 47,65 ---- } + /* message proc workhorse */ + static void message_proc(char *prefix, char *fmt, va_list ap) + { + + vsnprintf(msgbuff, sizeof(msgbuff), fmt, ap); + + if(interactive == 1) { + fprintf(stderr, "%s: %s: %s", getprogname(), prefix, msgbuff); + fprintf(stderr,"\n"); + } else + error_log(msgbuff); + + return; + } + /* send error message. */ void error_message(char *fmt, ...) *************** *** 52,69 **** va_list ap; ! if(verbosity_level == QUIET_VERBOSITY_LEVEL) return; va_start(ap, fmt); ! vsnprintf(msgbuff, sizeof(msgbuff), fmt, ap); ! ! if(interactive == 1) { ! fprintf(stderr, "%s: error: %s", getprogname(), msgbuff); ! fprintf(stderr,"\n"); ! } else ! error_log(msgbuff); va_end(ap); } --- 67,80 ---- va_list ap; ! if(get_verbosity_level() == QUIET_VERBOSITY_LEVEL) return; va_start(ap, fmt); ! message_proc("error", fmt, ap); va_end(ap); + + return; } *************** *** 73,91 **** va_list ap; ! if(verbosity_level == QUIET_VERBOSITY_LEVEL) return; ! va_start(ap, fmt); ! vsnprintf(msgbuff, sizeof(msgbuff), fmt, ap); ! ! if(interactive == 1) { ! fprintf(stderr, "%s: fatal error: %s", getprogname(), msgbuff); ! fprintf(stderr,"\n"); ! } else ! error_log(msgbuff); ! exit(1); } --- 84,97 ---- va_list ap; ! if(get_verbosity_level() == QUIET_VERBOSITY_LEVEL) return; ! va_start(ap, fmt); ! message_proc("fatal error", fmt, ap); ! va_end(ap); + exit(1); } *************** *** 94,98 **** { char *c = NULL; ! if(verbosity_level == QUIET_VERBOSITY_LEVEL) return; --- 100,104 ---- { char *c = NULL; ! if(get_verbosity_level() == QUIET_VERBOSITY_LEVEL) return; *************** *** 131,148 **** va_list ap; ! if(!(verbosity_level >= NORMAL_VERBOSITY_LEVEL)) return; va_start(ap, fmt); ! vsnprintf(msgbuff, sizeof(msgbuff), fmt, ap); ! ! if(interactive == 1) { ! fprintf(stdout, "%s: %s", getprogname(), msgbuff); ! fprintf(stdout,"\n"); ! } else ! info_log(msgbuff); va_end(ap); } --- 137,150 ---- va_list ap; ! if(verbosity_level >= NORMAL_VERBOSITY_LEVEL) return; va_start(ap, fmt); ! message_proc("fatal error", fmt, ap); va_end(ap); + + return; } *************** *** 152,169 **** va_list ap; ! if(!(verbosity_level >= WARNING_VERBOSITY_LEVEL)) return; va_start(ap, fmt); ! vsnprintf(msgbuff, sizeof(msgbuff), fmt, ap); ! ! if(interactive == 1) { ! fprintf(stdout, "%s warning: %s", getprogname(), msgbuff); ! fprintf(stdout,"\n"); ! } else ! info_log(msgbuff); va_end(ap); } --- 154,167 ---- va_list ap; ! if(get_verbosity_level() >= WARNING_VERBOSITY_LEVEL) return; va_start(ap, fmt); ! message_proc("warning", fmt, ap); va_end(ap); + + return; } *************** *** 171,190 **** void debug_message(char *fmt, ...) { va_list ap; ! if(!(verbosity_level >= DEBUG_VERBOSITY_LEVEL)) return; va_start(ap, fmt); ! vsnprintf(msgbuff, sizeof(msgbuff), fmt, ap); ! ! if(interactive == 1) { ! fprintf(stdout, "%s: debug: %s", getprogname(), msgbuff); ! fprintf(stdout,"\n"); ! } else ! info_log(msgbuff); va_end(ap); } --- 169,185 ---- void debug_message(char *fmt, ...) { + va_list ap; ! if(get_verbosity_level() >= DEBUG_VERBOSITY_LEVEL) return; va_start(ap, fmt); ! message_proc("debug", fmt, ap); va_end(ap); + + return; } |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv1355 Modified Files: dhcp-agent.h dhcp-client-states.c dhcp-com.c dhcp-convert.h dhcp-globconf.c dhcp-globconf.h Log Message: added atleast/exact option for client options retrieval Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** dhcp-agent.h 30 Jun 2002 08:23:45 -0000 1.62 --- dhcp-agent.h 30 Jun 2002 21:22:15 -0000 1.63 *************** *** 579,582 **** --- 579,583 ---- extern int dhcp_option_is_valid(unsigned char tag, unsigned char tag_len); extern int dhcp_have_atleast_requested_options(dhcp_obj *dhcp, unsigned char *option); + extern int dhcp_have_exact_requested_options(dhcp_obj *dhcp, unsigned char *options); extern int dhcp_have_option(dhcp_obj *dhcp, unsigned char tag); extern int dhcp_is_file_overload(dhcp_obj *dhcp); Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** dhcp-client-states.c 30 Jun 2002 08:23:45 -0000 1.33 --- dhcp-client-states.c 30 Jun 2002 21:22:15 -0000 1.34 *************** *** 32,35 **** --- 32,57 ---- #include <dhcp-net.h> + /* Check the requested options. + * We use the globconf option. */ + + static int client_check_requested_options(dhcp_client_control_t *dc) + { + const char *policy = glob_conf_get_val(CLIENT_OPTION_POLICY); + + if(policy == NULL) + policy = "atleast"; + + if(string_matches(policy, "exact")) + return(dhcp_have_exact_requested_options(dc->rawnet->dhcp_p, dc->conf->options)); + else if(!strcmp(policy, "atleast")) + return(dhcp_have_atleast_requested_options(dc->rawnet->dhcp_p, dc->conf->options)); + else /* bad policy : warn and use atleast */ { + warn_message("%s : set to bad value %s", CLIENT_OPTION_POLICY_S, policy); + warn_message("going to use \"atleast\""); + return(dhcp_have_atleast_requested_options(dc->rawnet->dhcp_p, dc->conf->options)); + } + + } + /* Along with the parameter request list we always build these options * upon creating new dhcp packets. */ *************** *** 102,106 **** if(client_check_dhcp(dc) || dhcp_is_type(dc->rawnet->dhcp_p, DHCP_OFFER_TM) || ! dhcp_have_atleast_requested_options(dc->rawnet->dhcp_p, dc->conf->options)) return 1; else --- 124,128 ---- if(client_check_dhcp(dc) || dhcp_is_type(dc->rawnet->dhcp_p, DHCP_OFFER_TM) || ! client_check_requested_options(dc)) return 1; else Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-com.c 30 Jun 2002 08:23:45 -0000 1.10 --- dhcp-com.c 30 Jun 2002 21:22:15 -0000 1.11 *************** *** 459,463 **** for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { if(options[i] && !dhcp_have_option(dhcp, i)) ! return 1; } --- 459,477 ---- for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { if(options[i] && !dhcp_have_option(dhcp, i)) ! return 1; ! } ! ! return 0; ! } ! ! int dhcp_have_exact_requested_options(dhcp_obj *dhcp, unsigned char *options) ! { ! int i; ! ! for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { ! if(options[i] && !dhcp_have_option(dhcp, i)) ! return 1; ! if(!options[i] && dhcp_have_option(dhcp, i)) ! return 1; } Index: dhcp-convert.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-convert.h 17 Jun 2002 13:23:08 -0000 1.2 --- dhcp-convert.h 30 Jun 2002 21:22:15 -0000 1.3 *************** *** 89,92 **** --- 89,93 ---- extern char *validate_network_string_to_string(const unsigned char *data, int len); + extern char *validate_string_to_string(const unsigned char *data, int len); extern void *strdup_wrap(const char *s); extern void *strdup_wrap_net(const char *s, unsigned char *ret_len); Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-globconf.c 30 Jun 2002 08:23:45 -0000 1.10 --- dhcp-globconf.c 30 Jun 2002 21:22:15 -0000 1.11 *************** *** 37,41 **** /* change this before... */ ! #define GLOBAL_OPTIONS_LEN 3 /* ... changing size of this */ --- 37,41 ---- /* change this before... */ ! #define GLOBAL_OPTIONS_LEN 4 /* ... changing size of this */ *************** *** 43,49 **** * do not change order unless you change defines in dhcp-globconf.h! */ static glob_conf_t global_config_options[] = { ! { "client-dhcp-retries", string_to_int32, int32_to_string, sizeof(int32_t), DHCP_CLIENT_RETRIES_S, NULL }, ! { "client-icmp-retries", string_to_int32, int32_to_string, sizeof(int32_t), DHCP_CLIENT_RETRIES_S, NULL }, ! { "client-hostname", strdup_wrap, validate_network_string_to_string, 0, NULL, NULL }, }; --- 43,50 ---- * do not change order unless you change defines in dhcp-globconf.h! */ static glob_conf_t global_config_options[] = { ! { "client-dhcp-retries", string_to_int32, int32_to_string, sizeof(int32_t), CLIENT_RETRIES_S, NULL }, ! { "client-icmp-retries", string_to_int32, int32_to_string, sizeof(int32_t), CLIENT_RETRIES_S, NULL }, ! { "client-hostname", strdup_wrap, validate_string_to_string, 0, NULL, NULL }, ! { "client-options-policy", strdup_wrap, validate_string_to_string, 0, CLIENT_OPTION_POLICY_S, NULL }, }; Index: dhcp-globconf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-globconf.h 17 Jun 2002 13:23:08 -0000 1.4 --- dhcp-globconf.h 30 Jun 2002 21:22:15 -0000 1.5 *************** *** 43,52 **** /* indexes to values. */ ! #define CLIENT_DHCP_RETRIES 0 ! #define CLIENT_ICMP_RETRIES 1 ! #define CLIENT_HOSTNAME 2 /* default string values. */ ! #define DHCP_CLIENT_RETRIES_S "3" /* governs all retries. */ #endif /* GLOBAL_CONF_H */ --- 43,54 ---- /* indexes to values. */ ! #define CLIENT_DHCP_RETRIES 0 ! #define CLIENT_ICMP_RETRIES 1 ! #define CLIENT_HOSTNAME 2 ! #define CLIENT_OPTION_POLICY 3 /* default string values. */ ! #define CLIENT_RETRIES_S "3" /* governs all retries. */ ! #define CLIENT_OPTION_POLICY_S "atleast" /* default policy on accepting options. */ #endif /* GLOBAL_CONF_H */ |
From: <act...@us...> - 2002-06-30 20:43:14
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv20983 Modified Files: dhcp-client.c dhcp-files.c dhcp-parser.c dhcp-sysconf.c dhcp-sysconf.h Log Message: parser now accepts \\ for newline; disabled cleanup except on do_sysconf (will fix up later); Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** dhcp-client.c 30 Jun 2002 18:27:12 -0000 1.37 --- dhcp-client.c 30 Jun 2002 20:43:10 -0000 1.38 *************** *** 134,138 **** if(dc) { /* only do clean up if we can. */ ! do_sysconf_cleanup(dc); client_release(dc); delete_pid_file(dc->interface); --- 134,138 ---- if(dc) { /* only do clean up if we can. */ ! // do_sysconf_cleanup(dc); client_release(dc); delete_pid_file(dc->interface); Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-files.c 30 Jun 2002 08:23:45 -0000 1.13 --- dhcp-files.c 30 Jun 2002 20:43:10 -0000 1.14 *************** *** 141,150 **** char *fname = get_pid_file_name(name); ! if(delete_file(fname) < 0) { ! push_exception("files", "delete_pid_file", ! "could not delete pid file: %s : %s", fname, strerror(errno)); ! xfree(fname); ! return 1; ! } xfree(fname); --- 141,145 ---- char *fname = get_pid_file_name(name); ! delete_file(fname); /* ignore any errors. */ xfree(fname); Index: dhcp-parser.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-parser.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-parser.c 17 Jun 2002 13:23:08 -0000 1.2 --- dhcp-parser.c 30 Jun 2002 20:43:10 -0000 1.3 *************** *** 42,45 **** --- 42,48 ---- static int is_valid_string_char(int c) { + if(c == '\\') + return 0; + if(ispunct(c) || isalnum(c)) return 1; *************** *** 81,85 **** static token_t parse_get_quoted_string(parser_t *input) { ! int c; while(1) { --- 84,88 ---- static token_t parse_get_quoted_string(parser_t *input) { ! int c, c2; while(1) { *************** *** 98,103 **** return PARSER_TOKEN_ERROR; /* error to have newline in string constant. */ ! case ' ': ! case '\t': default: if(is_valid_string_char(c) || c == ' ' || c == '\t') --- 101,120 ---- return PARSER_TOKEN_ERROR; /* error to have newline in string constant. */ ! case '\\': ! c2 = getc(input->fp); ! if(c2 != '\\') { ! ! ungetc(c2, input->fp); ! ! if(parse_gobble_line(input) != PARSER_TOKEN_NEWLINE) ! return PARSER_TOKEN_ERROR; ! else ! break; ! } else ! ungetc(c2, input->fp); ! ! /* otherwise put it back and fall through. */ ! ungetc(c, input->fp); ! /* fall through */ default: if(is_valid_string_char(c) || c == ' ' || c == '\t') *************** *** 150,154 **** atom_t get_next_atom(parser_t *input) { ! int c; token_t token; --- 167,171 ---- atom_t get_next_atom(parser_t *input) { ! int c, c2; token_t token; *************** *** 193,196 **** --- 210,228 ---- return PARSER_ATOM_STRING; + + case '\\': + c2 = getc(input->fp); + if(c2 != '\\') { + + ungetc(c2, input->fp); + + if(parse_gobble_line(input) != PARSER_TOKEN_NEWLINE) + return PARSER_ATOM_ERROR; + else + break; + } else + ungetc(c2, input->fp); + + /* fall through */ default: Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dhcp-sysconf.c 30 Jun 2002 08:23:45 -0000 1.24 --- dhcp-sysconf.c 30 Jun 2002 20:43:10 -0000 1.25 *************** *** 436,468 **** } ! void do_sysconf_cleanup(dhcp_client_control_t *dc) { int i; void *data; /* Walk through the sysconf_handlers array. */ - for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { ! /* Perform cleanup only if we're supposed to, and if there's a ! * cleanup function for the option. */ ! if(sysconf_handlers[i].flag & SYSCONF_DO_CLEANUP && ! sysconf_handlers[i].cleanup != NULL) { ! data = option_convert_handlers[i].serialize_to_internal(dhcp_options_strings[i]); - info_message("cleanup option: %s", dhcp_options_strings[i]); ! if(sysconf_handlers[i].cleanup(data, dc)) ! warn_message("cleanup option: %s: %s", dhcp_options_strings[i]); ! else ! sysconf_handlers[i].flag &= ~SYSCONF_DO_CLEANUP; ! option_convert_handlers[i].free_internal(data); ! } } } --- 436,481 ---- } ! void do_sysconf_cleanup(list_t *options, dhcp_client_control_t *dc) { int i; void *data; + cache_entry_t *ce; + list_t *list_ptr; /* Walk through the sysconf_handlers array. */ ! for(list_ptr = options;list_ptr;list_ptr = list_ptr->next) { ! ce = list_ptr->data; ! ! for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { ! if(string_matches(dhcp_options_strings[i], ce->name)) { ! /* Perform cleanup only if we're supposed to, and if there's a ! * cleanup function for the option. */ ! if(sysconf_handlers[i].flag & SYSCONF_DO_CLEANUP && ! sysconf_handlers[i].cleanup != NULL) { ! ! ! data = option_convert_handlers[i].serialize_to_internal(ce->value); ! ! info_message("cleanup option: %s", ! dhcp_options_strings[i]); + if(sysconf_handlers[i].cleanup(data, dc)) + warn_message("sysconf: error cleaning up option: %s", dhcp_options_strings[i]); + + option_convert_handlers[i].free_internal(data); + } + } + } } + return; } + Index: dhcp-sysconf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-sysconf.h 24 Jun 2002 02:04:56 -0000 1.3 --- dhcp-sysconf.h 30 Jun 2002 20:43:10 -0000 1.4 *************** *** 45,49 **** extern int sysconf_setup_domain_name(void *value, dhcp_client_control_t *dc); extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); ! extern void do_sysconf_cleanup(dhcp_client_control_t *dc); #endif /* SYSCONF_H */ --- 45,49 ---- extern int sysconf_setup_domain_name(void *value, dhcp_client_control_t *dc); extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); ! extern void do_sysconf_cleanup(list_t *options, dhcp_client_control_t *dc); #endif /* SYSCONF_H */ |
From: <bk...@us...> - 2002-06-30 20:22:30
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv12403 Modified Files: dhcp-net.c Log Message: gcc compels me to add some parentheses. Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** dhcp-net.c 30 Jun 2002 08:23:45 -0000 1.30 --- dhcp-net.c 30 Jun 2002 20:22:26 -0000 1.31 *************** *** 141,145 **** * set the descriptor non blocking with BIOCIMMEDIATE. */ ! if(fd = pcap_fileno(pcap) < 0) { push_exception("rawnet", "initialize_pcap_device", "could not obtain pcap descriptor: %s", --- 141,145 ---- * set the descriptor non blocking with BIOCIMMEDIATE. */ ! if((fd = pcap_fileno(pcap)) < 0) { push_exception("rawnet", "initialize_pcap_device", "could not obtain pcap descriptor: %s", |
From: <act...@us...> - 2002-06-30 18:27:15
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv6492 Modified Files: Makefile.in dhcp-arp-discovery.c dhcp-client.c Log Message: lowercased error messages; small indentation fix; this finishes up exception addition -- watch out breaks in flow Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Makefile.in 30 Jun 2002 08:23:45 -0000 1.26 --- Makefile.in 30 Jun 2002 18:27:12 -0000 1.27 *************** *** 70,75 **** CFLAGS = -Wall -g - AUTOMAKE_OPTIONS = foreign - INCLUDES = -I. @PCAP_INC@ @DNET_INC@ DEFS = @DEFS@ --- 70,73 ---- *************** *** 92,95 **** --- 90,95 ---- man_MANS = dhcpsniff.1 dhcpclient.1 + + AUTOMAKE_OPTIONS = foreign EXTRA_DIST = $(man_MANS) TODO LICENSE CAVEATS UPGRADING Index: dhcp-arp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp-discovery.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-arp-discovery.c 30 Jun 2002 08:23:45 -0000 1.7 --- dhcp-arp-discovery.c 30 Jun 2002 18:27:12 -0000 1.8 *************** *** 72,77 **** arg_list = add_to_list(arg_list, net); ! build_arp_request(net, net->ip_addr, address, net->hw_addr); /* 0 for source ip, address to discover for dest, ! * our hardware address so we get a reply back. */ while(retries--) { --- 72,80 ---- arg_list = add_to_list(arg_list, net); ! /* 0 for source ip, address to discover for dest, our ! * hardware address so we get a reply back. */ ! ! build_arp_request(net, net->ip_addr, address, net->hw_addr); ! while(retries--) { Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** dhcp-client.c 30 Jun 2002 08:23:45 -0000 1.36 --- dhcp-client.c 30 Jun 2002 18:27:12 -0000 1.37 *************** *** 277,281 **** if(get_pid_file(interface, &pid)) { ! push_exception("main", "do_kill_client", "Could not get PID for client %s. Maybe it's not running?", interface); exception_errors = unroll_exceptions(); --- 277,281 ---- if(get_pid_file(interface, &pid)) { ! push_exception("main", "do_kill_client", "could not get PID for client %s. maybe it's not running?", interface); exception_errors = unroll_exceptions(); *************** *** 285,289 **** if(kill(pid, SIGTERM) < 0) { ! push_exception("main", "do_kill_client", "Could not send signal to client on %s. Maybe it's not running?", interface); exception_errors = unroll_exceptions(); --- 285,290 ---- if(kill(pid, SIGTERM) < 0) { ! push_exception("main", "do_kill_client", ! "could not send signal to client on %s. maybe it's not running?", interface); exception_errors = unroll_exceptions(); *************** *** 465,469 **** if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { push_exception("main", "do_client", ! "Encountered a fatal error. I'm exiting.", interface); exception_errors = unroll_exceptions(); error_exception(exception_errors); --- 466,470 ---- if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { push_exception("main", "do_client", ! "encountered a fatal error. I'm exiting.", interface); exception_errors = unroll_exceptions(); error_exception(exception_errors); *************** *** 473,477 **** if(create_pid_file(interface)) { push_exception("main", "do_client", ! "Could not create PID file for interface: %s"); exception_errors = unroll_exceptions(); error_exception(exception_errors); --- 474,478 ---- if(create_pid_file(interface)) { push_exception("main", "do_client", ! "could not create PID file for interface: %s"); exception_errors = unroll_exceptions(); error_exception(exception_errors); |
From: <act...@us...> - 2002-06-30 08:24:55
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv17276 Modified Files: Makefile.am Log Message: removed wrong AUTOMAKE_OPTIONS Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Makefile.am 30 Jun 2002 08:23:45 -0000 1.27 --- Makefile.am 30 Jun 2002 08:24:53 -0000 1.28 *************** *** 1,4 **** CFLAGS = -Wall -g - AUTOMAKE_OPTIONS = foriegn INCLUDES = -I. @PCAP_INC@ @DNET_INC@ --- 1,3 ---- |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv16896 Modified Files: Makefile.am Makefile.in dhcp-agent.h dhcp-arp-discovery.c dhcp-client-cache.c dhcp-client-conf.c dhcp-client-control.c dhcp-client-states.c dhcp-client.c dhcp-com.c dhcp-daemon.c dhcp-exception.c dhcp-exception.h dhcp-files.c dhcp-files.h dhcp-globconf.c dhcp-icmp-discovery.c dhcp-interface.c dhcp-net.c dhcp-net.h dhcp-print.c dhcp-route.c dhcp-sniff.c dhcp-stringbuffer.c dhcp-sysconf.c dhcp-util.c dhcp-util.h Log Message: new exception code _mostly_ integrated; propogation is broken in several places; Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Makefile.am 24 Jun 2002 02:07:21 -0000 1.26 --- Makefile.am 30 Jun 2002 08:23:45 -0000 1.27 *************** *** 10,14 **** dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c \ ! dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcp-stringbuffer.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ --- 10,15 ---- dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c \ ! dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcp-stringbuffer.c \ ! dhcp-exception.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Makefile.in 24 Jun 2002 02:07:21 -0000 1.25 --- Makefile.in 30 Jun 2002 08:23:45 -0000 1.26 *************** *** 1,5 **** ! # Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ! # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, --- 1,5 ---- ! # Makefile.in generated automatically by automake 1.4-p4 from Makefile.am ! # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, *************** *** 77,81 **** bin_PROGRAMS = dhcpsniff dhcpclient ! dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcp-stringbuffer.c --- 77,81 ---- bin_PROGRAMS = dhcpsniff dhcpclient ! dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcp-stringbuffer.c dhcp-exception.c *************** *** 107,111 **** dhcp-arp.o dhcp-icmp.o dhcp-log.o dhcp-snprintf.o \ dhcp-sniffer-ohandlers.o dhcp-rtt.o dhcp-interface.o \ ! dhcp-stringbuffer.o dhcpsniff_DEPENDENCIES = dhcpsniff_LDFLAGS = --- 107,111 ---- dhcp-arp.o dhcp-icmp.o dhcp-log.o dhcp-snprintf.o \ dhcp-sniffer-ohandlers.o dhcp-rtt.o dhcp-interface.o \ ! dhcp-stringbuffer.o dhcp-exception.o dhcpsniff_DEPENDENCIES = dhcpsniff_LDFLAGS = *************** *** 168,172 **** cd $(srcdir) && $(ACLOCAL) ! config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) --- 168,172 ---- cd $(srcdir) && $(ACLOCAL) ! config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** dhcp-agent.h 22 Jun 2002 01:47:57 -0000 1.61 --- dhcp-agent.h 30 Jun 2002 08:23:45 -0000 1.62 *************** *** 269,273 **** } interface_control_t; - /* * DHCP raw network object. --- 269,272 ---- Index: dhcp-arp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp-discovery.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-arp-discovery.c 22 Jun 2002 01:47:57 -0000 1.6 --- dhcp-arp-discovery.c 30 Jun 2002 08:23:45 -0000 1.7 *************** *** 67,70 **** --- 67,71 ---- list_t *arg_list = NULL; unsigned char *sender_addr; + int retval; arg_list = add_to_list(arg_list, &address); *************** *** 75,94 **** while(retries--) { ! if(rawnet_packet_transact(net, arg_list, NULL, check_for_arp_reply)) ! continue; ! /* Yummy! We got a valid reply! */ ! sender_addr = arp_get_sender_hardware_address(net->arp_p); ! memcpy(mac_addr->data, sender_addr, ETH_ADDR_LEN); ! /* just free up pair. FIXME: this isn't good because we're ! * breaking the list blackbox. we need a better way to do this. ! * the datums don't need to be freed since we keep them on the stack. */ ! xfree(arg_list->next); ! xfree(arg_list); - return 0; } --- 76,114 ---- while(retries--) { ! retval = rawnet_packet_transact(net, arg_list, NULL, check_for_arp_reply); ! ! switch(retval) { ! ! case RAWNET_TIMEOUT: ! /* we timed out. retry. */ ! break; ! ! case RAWNET_OK: ! /* Yummy! We got a valid reply! */ ! sender_addr = arp_get_sender_hardware_address(net->arp_p); ! memcpy(mac_addr->data, sender_addr, ETH_ADDR_LEN); ! /* just free up pair. FIXME: this isn't good because we're ! * breaking the list blackbox. we need a better way to do this. ! * the datums don't need to be freed since we keep them on the stack. */ ! xfree(arg_list->next); ! xfree(arg_list); ! ! return 0; ! ! case RAWNET_ERROR: ! /* wops error. This is bad. */ ! push_exception("arp-discovery", "arp_discover_hardware_address", ! "received error from raw network handler."); ! return 1; ! ! default: ! /* not good. */ ! fatal_error("arp-discovery: invalid return from rawnet_transact -- this a bug report it."); ! } } *************** *** 97,101 **** --- 117,125 ---- xfree(arg_list); + push_exception("arp-discovery", "arp_discover_hardware_address", + "timeout on discovery."); + /* no response, return error. */ return 1; + } Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-client-cache.c 22 Jun 2002 18:11:25 -0000 1.13 --- dhcp-client-cache.c 30 Jun 2002 08:23:45 -0000 1.14 *************** *** 84,89 **** case VARFILE_PARSE_ERROR: ! fatal_error("client-cache: parse error in cache: %s : line %d", ! varfile_get_filename(varfile), varfile_get_lineno(varfile)); case VARFILE_EOF: --- 84,91 ---- case VARFILE_PARSE_ERROR: ! push_exception("client-cache", "read_next_cache_var", ! "parser error in cache: %s : line %d", ! varfile_get_filename(varfile), varfile_get_lineno(varfile)); ! return NULL; /* XXX needs to return an error value. */ case VARFILE_EOF: *************** *** 109,115 **** varfile = create_varfile(filename, VARFILE_VARVAL_MODE); ! if(varfile == NULL) ! return -1; ! /* Read up any vars. */ --- 111,120 ---- varfile = create_varfile(filename, VARFILE_VARVAL_MODE); ! if(varfile == NULL) { ! push_exception("client-cache", "load_client_cache_proc", ! "unable to create varfile"); ! return -1; ! } ! /* Read up any vars. */ Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-client-conf.c 22 Jun 2002 18:11:25 -0000 1.12 --- dhcp-client-conf.c 30 Jun 2002 08:23:45 -0000 1.13 *************** *** 113,118 **** varfile = create_varfile(fname, VARFILE_VARNAMES_MODE); ! if(varfile == NULL) return -1; while(1) { --- 113,121 ---- varfile = create_varfile(fname, VARFILE_VARNAMES_MODE); ! if(varfile == NULL) { ! push_exception("client-conf", "client_conf_load_options", ! "could not open varfile: %s", fname); return -1; + } while(1) { *************** *** 149,154 **** case VARFILE_PARSE_ERROR: ! fatal_error("client-conf: parse error in opts file: %s : %d", ! varfile_get_filename(varfile), varfile_get_lineno(varfile)); default: fatal_error("client-conf: load_options: internal error -- please report this."); --- 152,160 ---- case VARFILE_PARSE_ERROR: ! push_exception("client-conf", "read_next_cache_var", ! "parse error in opts file: %s : %d", ! varfile_get_filename(varfile), varfile_get_lineno(varfile)); ! return -1; ! default: fatal_error("client-conf: load_options: internal error -- please report this."); *************** *** 191,195 **** /* check for options file. */ fname = get_conf_options_fname(cc); ! retval = load_client_conf_proc(fname, cc, client_conf_load_options, use_default_options, dump_config_options); xfree(fname); --- 197,202 ---- /* check for options file. */ fname = get_conf_options_fname(cc); ! retval = load_client_conf_proc(fname, cc, client_conf_load_options, ! use_default_options, dump_config_options); xfree(fname); Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dhcp-client-control.c 22 Jun 2002 01:47:57 -0000 1.22 --- dhcp-client-control.c 30 Jun 2002 08:23:45 -0000 1.23 *************** *** 70,75 **** s++; ! if(hex_string_to_value(mac_string, mac_add)) ! fatal_error("malformed mac_string for fake_client_id. please check mac address."); memcpy(s, mac_add, ETH_ADDR_LEN); --- 70,79 ---- s++; ! if(hex_string_to_value(mac_string, mac_add)) { ! push_exception("client-control", "create_fake_client_id", ! "malformed mac string: %s: -- please try another one", ! mac_string); ! return NULL; ! } memcpy(s, mac_add, ETH_ADDR_LEN); *************** *** 130,134 **** dc->cache = create_client_cache(dc); ! if((load_client_conf(dc->conf) < 0) || (load_client_cache(dc->cache, 0) < 0)) { destroy_dhcp_client_control(dc); return NULL; --- 134,147 ---- dc->cache = create_client_cache(dc); ! if(load_client_conf(dc->conf) < 0) { ! push_exception("client-control", "create_dhcp_client_control", ! "could not read client conf."); ! destroy_dhcp_client_control(dc); ! return NULL; ! } ! ! if(load_client_cache(dc->cache, 0) < 0) { ! push_exception("client-control", "create_dhcp_client_control", ! "could not read client cache."); destroy_dhcp_client_control(dc); return NULL; *************** *** 159,162 **** --- 172,177 ---- if((dc->rawnet = rawnet_create(interface, filter_buff, sport, dport, promiscuous)) == NULL) { + push_exception("client-control", "create_dhcp_client_control", + "could acquire rawnet handler."); destroy_dhcp_client_control(dc); return NULL; *************** *** 183,187 **** if(rawnet_get_hw_addr(dc->rawnet, &interface_addr)) { ! error_message("could not acquire interface address"); destroy_dhcp_client_control(dc); return NULL; --- 198,203 ---- if(rawnet_get_hw_addr(dc->rawnet, &interface_addr)) { ! push_exception("client-control", "create_dhcp_client_control", ! "could not acquire interface address."); destroy_dhcp_client_control(dc); return NULL; Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** dhcp-client-states.c 24 Jun 2002 14:32:25 -0000 1.32 --- dhcp-client-states.c 30 Jun 2002 08:23:45 -0000 1.33 *************** *** 128,132 **** */ ! static void client_broadcast_arp_reply(dhcp_client_control_t *dc) { ip_addr_t client_ip_addr; --- 128,132 ---- */ ! static int client_broadcast_arp_reply(dhcp_client_control_t *dc) { ip_addr_t client_ip_addr; *************** *** 137,147 **** build_arp_reply_broadcast(dc->rawnet, client_ip_addr, client_hw_addr); ! rawnet_send_packet(dc->rawnet); ! return; } /* UNARP (rfc 1868). This makes us more network friendly. */ ! static void client_broadcast_unarp(dhcp_client_control_t *dc) { ip_addr_t client_ip_addr; --- 137,151 ---- build_arp_reply_broadcast(dc->rawnet, client_ip_addr, client_hw_addr); ! if(rawnet_send_packet(dc->rawnet) < 0) { ! push_exception("dhcp-client-states", "client_broadcast_arp_reply", ! "could not transmit arp reply"); ! return -1; ! } ! return 0; } /* UNARP (rfc 1868). This makes us more network friendly. */ ! static int client_broadcast_unarp(dhcp_client_control_t *dc) { ip_addr_t client_ip_addr; *************** *** 152,158 **** build_unarp(dc->rawnet, client_ip_addr, client_hw_addr); ! rawnet_send_packet(dc->rawnet); ! ! return; } --- 156,166 ---- build_unarp(dc->rawnet, client_ip_addr, client_hw_addr); ! if(rawnet_send_packet(dc->rawnet) < 0) { ! push_exception("dhcp-client-states", "client_broadcast_unarp", ! "could not transmit unarp"); ! return -1; ! } ! ! return 0; } *************** *** 171,174 **** --- 179,183 ---- { list_t *options = NULL; + int retval; options = client_build_option_list(dc->conf->options, DHCP_DISCOVER_TM, *************** *** 186,194 **** build_dhcp_discover(dc->rawnet, dc->xid, dc->secs, options); ! ! if(rawnet_packet_transact(dc->rawnet, dc, client_update_packet, ! client_check_discover)) { ! error_message("timeout on DHCP DISCOVER."); ! return STATE_FATAL_ERROR; } --- 195,219 ---- build_dhcp_discover(dc->rawnet, dc->xid, dc->secs, options); ! ! retval = rawnet_packet_transact(dc->rawnet, dc, client_update_packet, ! client_check_discover); ! ! switch(retval) { ! ! case RAWNET_TIMEOUT: ! push_exception("client-states", "client_discover_offer", ! "timeout on DHCP discover."); ! return STATE_FATAL_ERROR; ! ! case RAWNET_OK: ! break; ! ! case RAWNET_ERROR: ! push_exception("client-states", "client_discover_offer", ! "received error from raw network handler."); ! return STATE_FATAL_ERROR; ! ! default: ! fatal_error("dhcp-client-states: invalid return value from raw network handler -- this a bug report it."); } *************** *** 208,212 **** /* dump cache file. */ if(client_cache_dump_options(dc->cache, dc->rawnet->dhcp_p->options)) { ! error_message("could not create temporary cache"); return STATE_FATAL_ERROR; } --- 233,238 ---- /* dump cache file. */ if(client_cache_dump_options(dc->cache, dc->rawnet->dhcp_p->options)) { ! push_exception("client-states", "client_discover_offer", ! "could not create temporary cache."); return STATE_FATAL_ERROR; } *************** *** 221,224 **** --- 247,251 ---- { list_t *options, *cache_options; + int retval; /* Build options along with the options in our cache. */ *************** *** 228,232 **** if(cache_options == NULL) { ! error_message("Could not load cache! This is not good!"); return STATE_FATAL_ERROR; } --- 255,260 ---- if(cache_options == NULL) { ! push_exception("client-states", "client_request_ack", ! "could not load cache."); return STATE_FATAL_ERROR; } *************** *** 239,245 **** build_dhcp_request(dc->rawnet, dc->xid, dc->secs, options); ! if(rawnet_packet_transact(dc->rawnet, dc, NULL, client_check_request)) { ! error_message("timeout on DHCP REQUEST."); ! return STATE_FATAL_ERROR; } --- 267,289 ---- build_dhcp_request(dc->rawnet, dc->xid, dc->secs, options); ! retval = rawnet_packet_transact(dc->rawnet, dc, NULL, client_check_request); ! ! switch(retval) { ! ! case RAWNET_TIMEOUT: ! push_exception("client-states", "client_request_ack", ! "timeout on DHCP discover."); ! return STATE_FATAL_ERROR; ! ! case RAWNET_OK: ! break; ! ! case RAWNET_ERROR: ! push_exception("client-states", "client_request_ack", ! "received error from raw network handler."); ! return STATE_FATAL_ERROR; ! ! default: ! fatal_error("dhcp-client-states: invalid return value from raw network handler -- this a bug report it."); } *************** *** 261,265 **** options = client_cache_load_option_string_list(dc->cache, 0); if(options == NULL) { ! error_message("received empty configuration cache! cannot configure host"); return STATE_FATAL_ERROR; } --- 305,310 ---- options = client_cache_load_option_string_list(dc->cache, 0); if(options == NULL) { ! push_exception("client-states", "client_setup", ! "received empty configuration cache! cannot configure host"); return STATE_FATAL_ERROR; } *************** *** 275,279 **** cache_entry_purge_list(options); ! client_broadcast_arp_reply(dc); return STATE_WAIT; --- 320,326 ---- cache_entry_purge_list(options); ! if(client_broadcast_arp_reply(dc) < 0) { ! return STATE_FATAL_ERROR; ! } return STATE_WAIT; *************** *** 335,339 **** if(rawnet_send_packet(dc->rawnet) < 0) { ! error_message("could not send packet: %s", strerror(errno)); return STATE_FATAL_ERROR; } --- 382,387 ---- if(rawnet_send_packet(dc->rawnet) < 0) { ! push_exception("client-states", "client_release", ! "could not send release."); return STATE_FATAL_ERROR; } *************** *** 344,348 **** * bringing it down later. */ ! client_broadcast_unarp(dc); /* since we're releasing the lease we should down the interface */ --- 392,398 ---- * bringing it down later. */ ! if(client_broadcast_unarp(dc) < 0) { ! return STATE_FATAL_ERROR; ! } /* since we're releasing the lease we should down the interface */ Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** dhcp-client.c 24 Jun 2002 14:32:25 -0000 1.35 --- dhcp-client.c 30 Jun 2002 08:23:45 -0000 1.36 *************** *** 84,87 **** --- 84,90 ---- static int promiscuous = 0; /* whether or not we're running in promiscious mode. */ + /* stringbuffer pointer to unroll exceptions. */ + static stringbuffer *exception_errors; + /* Utility routines. */ *************** *** 92,98 **** filename = splice_string(interface, ".conf"); ! if(init_glob_conf(filename)) ! fatal_error("could not read nor create global configuration file: %s", filename); return; } --- 95,106 ---- filename = splice_string(interface, ".conf"); ! if(init_glob_conf(filename)) { ! push_exception("main", "read_global_conf", ! "could not read nor create global configuration file: %s", filename); ! exception_errors = unroll_exceptions(); ! fatal_error_exception(exception_errors); ! } + xfree(filename); return; } *************** *** 226,231 **** case STATE_FATAL_ERROR: ! info_message("I've encountered a fatal error. I'm giving up."); ! do_shutdown(dc); case STATE_DISCOVER_OFFER: --- 234,242 ---- case STATE_FATAL_ERROR: ! push_exception("main", "do_dhcp_client_loop", ! "encountered fatal error. I'm giving up."); ! exception_errors = unroll_exceptions(); ! error_exception(exception_errors); ! do_shutdown(dc); case STATE_DISCOVER_OFFER: *************** *** 266,277 **** if(get_pid_file(interface, &pid)) { ! error_message("could not get %s PID.", getprogname()); ! error_message("maybe it's not running?"); return; } if(kill(pid, SIGTERM) < 0) { ! error_message("could not send signal to %s process.", getprogname()); ! error_message("maybe it's not running?"); return; } --- 277,292 ---- if(get_pid_file(interface, &pid)) { ! push_exception("main", "do_kill_client", "Could not get PID for client %s. Maybe it's not running?", ! interface); ! exception_errors = unroll_exceptions(); ! error_exception(exception_errors); return; } if(kill(pid, SIGTERM) < 0) { ! push_exception("main", "do_kill_client", "Could not send signal to client on %s. Maybe it's not running?", ! interface); ! exception_errors = unroll_exceptions(); ! error_exception(exception_errors); return; } *************** *** 287,298 **** if(get_pid_file(interface, &pid)) { ! error_message("could not get %s PID.", getprogname()); ! error_message("maybe it's not running?"); return; } if(kill(pid, SIGALRM) < 0) { ! error_message("could not send signal to %s process.", getprogname()); ! error_message("maybe it's not running?"); return; } --- 302,319 ---- if(get_pid_file(interface, &pid)) { ! push_exception("main", "do_wake_client", ! "Could not get PID for client %s. Maybe it's not running?", ! interface); ! exception_errors = unroll_exceptions(); ! error_exception(exception_errors); return; } if(kill(pid, SIGALRM) < 0) { ! push_exception("main", "do_wait_client", ! "Could not send signal to client on %s. Maybe it's not running?", ! interface); ! exception_errors = unroll_exceptions(); ! error_exception(exception_errors); return; } *************** *** 312,317 **** /* A race condition exists between the discover and request state. * And we can't hup the client and tell it the cache has been deleted. */ ! error_message("%s already running.", getprogname()); ! error_message("I won't delete cache until it's shutdown."); return; } --- 333,341 ---- /* A race condition exists between the discover and request state. * And we can't hup the client and tell it the cache has been deleted. */ ! push_exception("main", "do_clear_cache", ! "%s already is running on %s. I won't delete the cache until it shuts down.", ! getprogname(), interface); ! exception_errors = unroll_exceptions(); ! error_exception(exception_errors); return; } *************** *** 376,381 **** if(client_process_exists(interface)) { ! error_message("dhcpclient already exists on interface %s use -k to kill it", interface); ! exit(1); } --- 400,407 ---- if(client_process_exists(interface)) { ! push_exception("main", "do_client", ! "dhcpclient already exists on interface %s use -k to kill it", interface); ! exception_errors = unroll_exceptions(); ! fatal_error_exception(exception_errors); } *************** *** 405,409 **** if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { ! error_message("encountered fatal error. cannot continue. exiting"); do_shutdown(NULL); } --- 431,438 ---- if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { ! push_exception("main", "do_client", ! "Encountered a fatal error. I'm exiting."); ! exception_errors = unroll_exceptions(); ! error_exception(exception_errors); do_shutdown(NULL); } *************** *** 435,443 **** if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { ! error_message("encountered a fatal error. cannot continue. exiting"); do_shutdown(NULL); } ! create_pid_file(interface); if(fake_hw_addr) /* Marla, you liar, you big tourist, I need this. Now get out! */ --- 464,481 ---- if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { ! push_exception("main", "do_client", ! "Encountered a fatal error. I'm exiting.", interface); ! exception_errors = unroll_exceptions(); ! error_exception(exception_errors); do_shutdown(NULL); } ! if(create_pid_file(interface)) { ! push_exception("main", "do_client", ! "Could not create PID file for interface: %s"); ! exception_errors = unroll_exceptions(); ! error_exception(exception_errors); ! do_shutdown(NULL); ! } if(fake_hw_addr) /* Marla, you liar, you big tourist, I need this. Now get out! */ *************** *** 534,543 **** } ! if(interface == NULL && command_code != DO_VERSION) { ! /* if we were unable to attain an interface. */ ! error_message("unable to retrieve suitable interface"); ! error_message("for this operation: %s", command_string[command_code]); ! exit(1); /* can't use fatal_error for multiline error message. */ ! /* fixme: this stupidity will go with exception stack. */ } --- 572,582 ---- } ! if(interface == NULL && command_code != DO_VERSION) { ! ! push_exception("main", "main", ! "unable to retrieve suitable interface for this operation: %s", ! command_string[command_code]); ! exception_errors = unroll_exceptions(); ! fatal_error_exception(exception_errors); } Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-com.c 17 Jun 2002 13:23:07 -0000 1.9 --- dhcp-com.c 30 Jun 2002 08:23:45 -0000 1.10 *************** *** 506,510 **** if(len == 0) { ! error_message("error building parameter request: no options!"); return NULL; } --- 506,510 ---- if(len == 0) { ! warn_message("empty parameter list built!"); return NULL; } Index: dhcp-daemon.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-daemon.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-daemon.c 17 Jun 2002 13:23:08 -0000 1.7 --- dhcp-daemon.c 30 Jun 2002 08:23:45 -0000 1.8 *************** *** 95,99 **** /* Not good. */ /* Also we haven't opened logging yet, so do it now and exit. */ ! init_log(binname); fatal_error("initialization: fork: %s", strerror(errno)); --- 95,99 ---- /* Not good. */ /* Also we haven't opened logging yet, so do it now and exit. */ ! init_log(getprogname()); fatal_error("initialization: fork: %s", strerror(errno)); Index: dhcp-exception.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-exception.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-exception.c 24 Jun 2002 14:32:25 -0000 1.2 --- dhcp-exception.c 30 Jun 2002 08:23:45 -0000 1.3 *************** *** 28,32 **** #include <dhcp-agent.h> #include <dhcp-util.h> - #include <dhcp-exception.h> static exception_t exceptions; --- 28,31 ---- *************** *** 91,93 **** --- 90,102 ---- return unrolled_exception; + } + + void clear_exceptions(void) + { + int i; + + for(i = 0; i < exceptions.cur_index; i++) + destroy_stringbuffer(exceptions.exception_message[i]); + + exceptions.cur_index = 0; } Index: dhcp-exception.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-exception.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-exception.h 24 Jun 2002 14:32:25 -0000 1.2 --- dhcp-exception.h 30 Jun 2002 08:23:45 -0000 1.3 *************** *** 36,39 **** char *fmt, ...); extern stringbuffer *unroll_exceptions(void); ! ! #define THROW_EXCEPTION(module_name, func_name, msg, return_val) { (push_exception(module_name, func_name, msg); return return_val;) } --- 36,38 ---- char *fmt, ...); extern stringbuffer *unroll_exceptions(void); ! extern void clear_exceptions(void); Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-files.c 17 Jun 2002 13:23:08 -0000 1.12 --- dhcp-files.c 30 Jun 2002 08:23:45 -0000 1.13 *************** *** 36,40 **** if((fd = open(filename, flags, mode)) < 0) { ! error_message("cannot open or create file: %s : %s", filename, strerror(errno)); return NULL; } --- 36,41 ---- if((fd = open(filename, flags, mode)) < 0) { ! push_exception("files", "file_open_proc", ! "cannot open or create file: %s : %s", filename, strerror(errno)); return NULL; } *************** *** 42,46 **** if((fp = fdopen(fd, cmode)) == NULL) { close(fd); ! error_message("cannot fdopen: %s : %s", filename, strerror(errno)); return NULL; } --- 43,48 ---- if((fp = fdopen(fd, cmode)) == NULL) { close(fd); ! push_exception("files", "file_open_proc", ! "cannot fdopen file: %s : %s", filename, strerror(errno)); return NULL; } *************** *** 64,70 **** /* delete a file. */ ! void delete_file(char *fname) { ! unlink(fname); } --- 66,72 ---- /* delete a file. */ ! int delete_file(char *fname) { ! return(unlink(fname)); } *************** *** 109,114 **** } /* create a pid file <name>.pid */ ! void create_pid_file(char *name) { FILE *fp; --- 111,117 ---- } + /* XXX - check return val. */ /* create a pid file <name>.pid */ ! int create_pid_file(char *name) { FILE *fp; *************** *** 117,122 **** fname = get_pid_file_name(name); fp = file_create_and_truncate_safe(fname, "a"); ! if(fp == NULL) ! fatal_error("could not create pid file"); fprintf(fp, "%u", getpid()); --- 120,130 ---- fname = get_pid_file_name(name); fp = file_create_and_truncate_safe(fname, "a"); ! if(fp == NULL) { ! push_exception("files", "create_pid_file", ! "cannot open or create file: %s : %s", fname, strerror(errno)); ! xfree(fname); ! return -1; ! } ! fprintf(fp, "%u", getpid()); *************** *** 124,139 **** fclose(fp); xfree(fname); ! return; } /* delete a pid file <name>.pid */ ! void delete_pid_file(char *name) { char *fname = get_pid_file_name(name); ! unlink(fname); xfree(fname); ! return; } --- 132,153 ---- fclose(fp); xfree(fname); ! return 0; } + /* XXX -- handle return val */ /* delete a pid file <name>.pid */ ! int delete_pid_file(char *name) { char *fname = get_pid_file_name(name); ! if(delete_file(fname) < 0) { ! push_exception("files", "delete_pid_file", ! "could not delete pid file: %s : %s", fname, strerror(errno)); ! xfree(fname); ! return 1; ! } xfree(fname); ! return 0; } *************** *** 150,155 **** fp = file_open_or_create_safe(fname, "r"); ! if(fp == NULL) ! fatal_error("could not open pid file"); fscanf(fp, "%u", pid); --- 164,173 ---- fp = file_open_or_create_safe(fname, "r"); ! if(fp == NULL) { ! push_exception("files", "get_pid_file", ! "could not open pid file"); ! xfree(fname); ! return 1; ! } fscanf(fp, "%u", pid); Index: dhcp-files.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-files.h 17 Jun 2002 13:23:08 -0000 1.4 --- dhcp-files.h 30 Jun 2002 08:23:45 -0000 1.5 *************** *** 32,39 **** extern int file_exists(char *fname); extern void move_file(char *fname, char *dest); ! extern void delete_file(char *fname); extern void make_file_public_read(char *fname); ! extern void create_pid_file(char *name); ! extern void delete_pid_file(char *name); extern int get_pid_file(char *name, pid_t *pid); --- 32,39 ---- extern int file_exists(char *fname); extern void move_file(char *fname, char *dest); ! extern int delete_file(char *fname); extern void make_file_public_read(char *fname); ! extern int create_pid_file(char *name); ! extern int delete_pid_file(char *name); extern int get_pid_file(char *name, pid_t *pid); Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-globconf.c 22 Jun 2002 18:11:25 -0000 1.9 --- dhcp-globconf.c 30 Jun 2002 08:23:45 -0000 1.10 *************** *** 57,62 **** fp = file_open_or_create_safe(filename, "w"); ! if(fp == NULL) return -1; for(i = 0;i < GLOBAL_OPTIONS_LEN; i++) { --- 57,65 ---- fp = file_open_or_create_safe(filename, "w"); ! if(fp == NULL) { ! push_exception("glob-conf", "glob_conf_dump", ! "cannot open or create file: %s : %s", filename, strerror(errno)); return -1; + } for(i = 0;i < GLOBAL_OPTIONS_LEN; i++) { *************** *** 65,69 **** continue; ! var_string = global_config_options[i].convert_option_to_string(global_config_options[i].val, global_config_options[i].size); if(var_string == NULL) fatal_error("could not convert option to string -- this is a bug report it."); --- 68,73 ---- continue; ! var_string = global_config_options[i]. ! convert_option_to_string(global_config_options[i].val, global_config_options[i].size); if(var_string == NULL) fatal_error("could not convert option to string -- this is a bug report it."); *************** *** 87,91 **** if(global_config_options[i].val == NULL) { ! global_config_options[i].val = global_config_options[i].convert_option_to_internal(global_config_options[i].default_val); if(global_config_options[i].val == NULL) fatal_error("glob-conf: unable to convert value for option %s -- default! this is a bug. report it!"); --- 91,96 ---- if(global_config_options[i].val == NULL) { ! global_config_options[i].val = global_config_options[i]. ! convert_option_to_internal(global_config_options[i].default_val); if(global_config_options[i].val == NULL) fatal_error("glob-conf: unable to convert value for option %s -- default! this is a bug. report it!"); *************** *** 114,119 **** varfile = create_varfile(filename, VARFILE_VARVAL_MODE); ! if(varfile == NULL) ! fatal_error("glob-conf: could not open configuration file: %s: %s", filename, strerror(errno)); while(1) { --- 119,127 ---- varfile = create_varfile(filename, VARFILE_VARVAL_MODE); ! if(varfile == NULL) { ! push_exception("glob-conf", "init_globconf", ! "cannot acquire varfile: %s", filename); ! return -1; ! } while(1) { *************** *** 140,146 **** global_config_options[i].convert_option_to_internal(varfile_get_val(varfile)); ! if(global_config_options[i].val == NULL) ! fatal_error("glob-conf: unable to convert value for option %s : line no: %d -- munged variable?", ! varfile_get_name(varfile), varfile_get_lineno(varfile)); break; } --- 148,158 ---- global_config_options[i].convert_option_to_internal(varfile_get_val(varfile)); ! if(global_config_options[i].val == NULL) { ! push_exception("glob-conf", "init_globconf", ! "unable to convert value for option %s : line no: %d -- munged variable?", ! varfile_get_name(varfile), varfile_get_lineno(varfile)); ! return -1; ! } ! break; } Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-icmp-discovery.c 22 Jun 2002 01:47:57 -0000 1.16 --- dhcp-icmp-discovery.c 30 Jun 2002 08:23:45 -0000 1.17 *************** *** 54,57 **** --- 54,58 ---- { uint32_t reply_mask; + int retval; /* Build ICMP mask request packet. We don't actually care *************** *** 63,85 **** if(retries <= 0) /* let's not get hosed shall we? */ { ! error_message("icmp mask discovery: bad number of retries"); return -1; } while(retries--) { - if(rawnet_packet_transact(net, net, NULL, icmp_check_mask_reply)) { - error_message("icmp mask discovery: timeout on discovery"); - return -1; - } - } ! /* A reply should contain the subnet mask. If we're actually ! * doing subnet mask discovery we assume any subnet mask ! * returned is valid. */ ! reply_mask = icmp_mask_get_mask(net->icmp_p); ! memcpy(subnet_mask, &reply_mask, IP_ADDR_LEN); ! return 0; } --- 64,105 ---- if(retries <= 0) /* let's not get hosed shall we? */ { ! push_exception("icmp-discovery", "icmp_subnet_mask_discovery", ! "bad number of retries: %d", retries); return -1; } while(retries--) { ! retval = rawnet_packet_transact(net, net, NULL, icmp_check_mask_reply); ! ! switch(retval) { ! ! case RAWNET_TIMEOUT: ! break; ! ! case RAWNET_ERROR: ! push_exception("icmp-discovery", "icmp_subnet_mask_discovery", ! "received error from raw network handler."); ! return -1; ! ! case RAWNET_OK: ! ! /* A reply should contain the subnet mask. If we're actually ! * doing subnet mask discovery we assume any subnet mask ! * returned is valid. */ ! reply_mask = icmp_mask_get_mask(net->icmp_p); ! memcpy(subnet_mask, &reply_mask, IP_ADDR_LEN); ! return 0; ! ! default: ! fatal_error("dhcp-client-states: invalid return value from raw network handler -- this a bug report it."); ! } ! } ! ! push_exception("icmp-discovery", "icmp_subnet_mask_discovery", ! "timeout on icmp subnet discovery."); ! return -1; } *************** *** 160,164 **** if(route_find(net, *host_addr, &dest_mac)) { ! error_message("icmp_rtt_discovery: could not find route for address for %s -- skipping", network_address_to_string_static(*host_addr)); continue; } --- 180,185 ---- if(route_find(net, *host_addr, &dest_mac)) { ! warn_message("icmp_rtt_discovery: could not find route for address for %s -- skipping", ! network_address_to_string_static(*host_addr)); continue; } Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-interface.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dhcp-interface.c 22 Jun 2002 01:47:57 -0000 1.19 --- dhcp-interface.c 30 Jun 2002 08:23:45 -0000 1.20 *************** *** 34,43 **** { ! if(intf_get(ic->interface_handle, ic->interface_entry) < 0) { ! error_message("interface_control: could not lookup interface %s : %s", ic->interface_entry->intf_name, ! strerror(errno)); return -1; } - return 0; } --- 34,42 ---- { ! if(intf_get(ic->interface_handle, ic->interface_entry) < 0) { ! push_exception("interface", "interface_get_info", "could not lookup interface %s : %s", ! ic->interface_entry->intf_name, strerror(errno)); return -1; } return 0; } *************** *** 47,52 **** { if(intf_set(ic->interface_handle, ic->interface_entry) < 0) { ! error_message("interface_control: could not lookup interface %s : %s", ic->interface_entry->intf_name, ! strerror(errno)); return -1; } --- 46,52 ---- { if(intf_set(ic->interface_handle, ic->interface_entry) < 0) { ! push_exception("interface", "interface_get_info", ! "could not lookup interface %s : %s", ! ic->interface_entry->intf_name, strerror(errno)); return -1; } *************** *** 64,69 **** ic->interface_handle = intf_open(); ! if(ic->interface_handle == NULL) /* XXX -- update to dnet's error strings when dnet has some */ ! fatal_error("interface_control: could not acquire interface handler"); buf = xcalloc(1024); --- 64,72 ---- ic->interface_handle = intf_open(); ! if(ic->interface_handle == NULL) { /* XXX -- update to dnet's error strings when dnet has some */ ! push_exception("interface", "interface_get_info", ! "could not acquire interface handler"); ! return NULL; ! } buf = xcalloc(1024); *************** *** 96,101 **** int mtu) { ! if(interface_get_info(ic)) return -1; /* Set address if needed. */ --- 99,108 ---- int mtu) { ! if(interface_get_info(ic)) { ! push_exception("interface", "interface_up", ! "could not bring up interface %s : %s", ! ic->interface_entry->intf_name, strerror(errno)); return -1; + } /* Set address if needed. */ *************** *** 117,122 **** ic->interface_entry->intf_flags |= INTF_FLAG_UP; ! if(interface_set_info(ic)) return -1; return 0; --- 124,133 ---- ic->interface_entry->intf_flags |= INTF_FLAG_UP; ! if(interface_set_info(ic)) { ! push_exception("interface", "interface_up", ! "could not bring up interface %s : %s", ! ic->interface_entry->intf_name, strerror(errno)); return -1; + } return 0; *************** *** 127,137 **** { ! if(interface_get_info(ic)) return -1; ! ic->interface_entry->intf_flags &= ~INTF_FLAG_UP; ! if(interface_set_info(ic)) return -1; return 0; --- 138,156 ---- { ! if(interface_get_info(ic)) { ! push_exception("interface", "interface_up", ! "could not bring down interface %s : %s", ! ic->interface_entry->intf_name, strerror(errno)); return -1; ! } ! ic->interface_entry->intf_flags &= ~INTF_FLAG_UP; ! if(interface_set_info(ic)) { ! push_exception("interface", "interface_up", ! "could not bring down interface %s : %s", ! ic->interface_entry->intf_name, strerror(errno)); return -1; + } return 0; *************** *** 141,146 **** int interface_get_ip_addr(interface_control_t *ic, uint32_t *addr) { ! if(interface_get_info(ic)) return -1; memcpy(addr, &ic->interface_entry->intf_addr.addr_ip, IP_ADDR_LEN); --- 160,169 ---- int interface_get_ip_addr(interface_control_t *ic, uint32_t *addr) { ! if(interface_get_info(ic)) { ! push_exception("interface", "interface_up", ! "could not get interface IP address %s : %s", ! ic->interface_entry->intf_name, strerror(errno)); return -1; + } memcpy(addr, &ic->interface_entry->intf_addr.addr_ip, IP_ADDR_LEN); *************** *** 212,222 **** interfaces = intf_open(); if(interfaces == NULL) { - - error_message("dhcp-interface: interfaces_get_available: could not obtain interface handle: %s\n", strerror(errno)); /* yes it's too long -- need exception stack. */ - xfree(interface_list); /* fixme: this isn't really * good. we should have a way to destroy a list but not its * datums if we want to. */ intf_close(interfaces); return NULL; } --- 235,244 ---- interfaces = intf_open(); if(interfaces == NULL) { xfree(interface_list); /* fixme: this isn't really * good. we should have a way to destroy a list but not its * datums if we want to. */ intf_close(interfaces); + push_exception("interface", "interface_get_proc", + "could not obtain interface handle: %s\n", strerror(errno)); return NULL; } *************** *** 241,243 **** return(interfaces_get_proc(check_interface_down)); } - --- 263,264 ---- Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** dhcp-net.c 23 Jun 2002 03:29:13 -0000 1.29 --- dhcp-net.c 30 Jun 2002 08:23:45 -0000 1.30 *************** *** 109,140 **** #endif /* HAVE_BPF_IMMEDIATE */ - /* If interface not specificed get - * a suitable one from pcap_lookupdev */ - - if(interface_name == NULL) - interface_name = pcap_lookupdev(errbuf); - - if(interface_name == NULL) { - error_message("rawnet: pcap_lookupdev: %s", errbuf); - return NULL; - } - /* Open packet capturing device. */ pcap = pcap_open_live(interface_name, SNAPLEN, promiscuous, 0, errbuf); if(pcap == NULL) { ! error_message("rawnet: pcap_openlive: %s", errbuf); return NULL; } if(pcap_compile(pcap, &filter, filter_string, 1, mask) == -1) { pcap_close(pcap); - error_message("rawnet: pcap_compile: %s",pcap_geterr(pcap)); return NULL; } if(pcap_setfilter(pcap, &filter) == -1) { pcap_close(pcap); - error_message("rawnet: pcap_setfilter: %s", pcap_geterr(pcap)); return NULL; } --- 109,135 ---- #endif /* HAVE_BPF_IMMEDIATE */ /* Open packet capturing device. */ pcap = pcap_open_live(interface_name, SNAPLEN, promiscuous, 0, errbuf); if(pcap == NULL) { ! push_exception("rawnet", "initialize_pcap_device", ! "could not open pcap device: %s", ! pcap_geterr(pcap)); return NULL; } if(pcap_compile(pcap, &filter, filter_string, 1, mask) == -1) { + push_exception("rawnet", "initialize_pcap_device", + "could not compile pcap filter: %s", + pcap_geterr(pcap)); pcap_close(pcap); return NULL; } if(pcap_setfilter(pcap, &filter) == -1) { + push_exception("rawnet", "initialize_pcap_device", + "could not compile pcap filter: %s", + pcap_geterr(pcap)); pcap_close(pcap); return NULL; } *************** *** 143,151 **** #if defined(HAVE_BPF_IMMEDIATE) ! /* FreeBSD (others too?) need us to set the descriptor non ! * blocking and do a bogus read. This starts the timer. */ ! fd = pcap_fileno(pcap); ! ioctl(fd, BIOCIMMEDIATE, &on); #endif /* HAVE_BPF_IMMEDIATE */ --- 138,159 ---- #if defined(HAVE_BPF_IMMEDIATE) ! /* FreeBSD, and possibly other flavors with BPF need us to ! * set the descriptor non blocking with BIOCIMMEDIATE. */ ! if(fd = pcap_fileno(pcap) < 0) { ! push_exception("rawnet", "initialize_pcap_device", ! "could not obtain pcap descriptor: %s", ! pcap_geterr(pcap)); ! pcap_close(pcap); ! return NULL; ! } ! ! if(ioctl(fd, BIOCIMMEDIATE, &on) < 0) { ! push_exception("rawnet", "initialize_pcap_device", ! "could not set BIOCIMMEDIATE: %s", ! strerror(errno)); ! pcap_close(pcap); ! return NULL; ! } #endif /* HAVE_BPF_IMMEDIATE */ *************** *** 160,166 **** if(interface_up(net->intf_handle, addr, netmask, mtu)) { ! error_message("rawnet: could not bring up interface: %s: %s", net->device, strerror(errno)); ! rawnet_destroy(net); ! return 1; } --- 168,174 ---- if(interface_up(net->intf_handle, addr, netmask, mtu)) { ! push_exception("rawnet", "interface_up", ! "could not bring interface up."); ! return -1; } *************** *** 173,179 **** { if(interface_down(net->intf_handle)) { ! error_message("rawnet: could not bring down interface: %s: %s", net->device, strerror(errno)); ! rawnet_destroy(net); ! return 1; } --- 181,187 ---- { if(interface_down(net->intf_handle)) { ! push_exception("rawnet", "interface_up", ! "could not bring interface down."); ! return -1; } *************** *** 189,192 **** --- 197,201 ---- { rawnet_t *net; + int retval; net = xcalloc(sizeof(rawnet_t)); *************** *** 201,204 **** --- 210,214 ---- net->intf_handle = create_interface_control(net->device); if(net->intf_handle == NULL) { + push_exception("rawnet", "rawnet_create", "could not acquire interface handle"); rawnet_destroy(net); return NULL; *************** *** 206,212 **** /* Is the interface up? */ ! if(!interface_is_up(net->intf_handle)) { ! /* then bring it up with dum values. */ if(rawnet_interface_up(net, 0, 0xffffff, -1)) { rawnet_destroy(net); return NULL; --- 216,235 ---- /* Is the interface up? */ ! retval = interface_is_up(net->intf_handle); ! ! if(retval == -1) { ! /* error on interface detection */ ! push_exception("rawnet", "rawnet_create", ! "error on interface detection for device: %s", device); ! rawnet_destroy(net); ! return NULL; ! } ! ! if(retval == 0) { ! /* interface down */ ! /* bring it up with dum values. */ if(rawnet_interface_up(net, 0, 0xffffff, -1)) { + push_exception("rawnet", "rawnet_create", NULL, + "error trying to bring device up: %s", device); rawnet_destroy(net); return NULL; *************** *** 214,217 **** --- 237,242 ---- } + /* any other value of retval and the interface is already up. */ + /* Get the interface and make sure its an ethernet interface or * else we're hosed. */ *************** *** 219,223 **** net->eth = eth_open(device); if(net->eth == NULL) { ! error_message("rawnet: device not supported or unavailable: %s: %s", device, strerror(errno)); rawnet_destroy(net); return NULL; --- 244,249 ---- net->eth = eth_open(device); if(net->eth == NULL) { ! push_exception("rawnet", "rawnet_create", NULL, ! "device not available or supported: %s : %s", device, strerror(errno)); rawnet_destroy(net); return NULL; *************** *** 228,231 **** --- 254,259 ---- if(net->pcap == NULL) { rawnet_destroy(net); + push_exception("rawnet", "rawnet_create", NULL, + "could not initialize pcap device for: %s", device); return NULL; } *************** *** 233,237 **** net->pcap_fd = pcap_fileno(net->pcap); if(net->pcap_fd < 0) { ! error_message("rawnet: cannot get descriptor for %s, this system may is not supported.", device); rawnet_destroy(net); return NULL; --- 261,266 ---- net->pcap_fd = pcap_fileno(net->pcap); if(net->pcap_fd < 0) { ! push_exception("rawnet", "rawnet_create", NULL, ! "could not get pcap descriptor for: %s: %s", device, pcap_geterr(net->pcap)); rawnet_destroy(net); return NULL; *************** *** 266,276 **** * address. */ ! void rawnet_use_fake_hw_addr(rawnet_t *net, char *mac_string) { unsigned char mac_addr[ETH_ADDR_LEN]; net->fake_hw_addr = xmalloc(sizeof(eth_addr_t)); ! if(hex_string_to_value(mac_string, mac_addr)) ! fatal_error("malformed mac_string for fake client hw addr. please check mac address."); memcpy(net->hw_addr.data, mac_addr, ETH_ADDR_LEN); --- 295,311 ---- * address. */ ! int rawnet_use_fake_hw_addr(rawnet_t *net, char *mac_string) { unsigned char mac_addr[ETH_ADDR_LEN]; net->fake_hw_addr = xmalloc(sizeof(eth_addr_t)); ! if(hex_string_to_value(mac_string, mac_addr)) { ! push_exception("rawnet", "rawnet_use_fake_hw_addr", ! "malformed mac address: %s", mac_string); ! xfree(net->fake_hw_addr); ! net->fake_hw_addr = NULL; ! return -1; ! } ! memcpy(net->hw_addr.data, mac_addr, ETH_ADDR_LEN); *************** *** 278,282 **** reinitialize_rawnet(net, 1); ! return; } --- 313,317 ---- reinitialize_rawnet(net, 1); ! return 0; } *************** *** 330,352 **** void rawnet_down(rawnet_t *net) { ! pcap_close(net->pcap); ! net->pcap = NULL; ! eth_close(net->eth); ! net->eth = NULL; return; } int rawnet_up(rawnet_t *net) { net->pcap = initialize_pcap_device(net->device, net->pcap_filter, net->promiscuous); if(net->pcap == NULL) { return -1; } - net->pcap_fd = pcap_fileno(net->pcap); net->eth = eth_open(net->device); ! if(net->eth == NULL) return -1; return 0; --- 365,407 ---- void rawnet_down(rawnet_t *net) { ! if(net->pcap != NULL) { ! pcap_close(net->pcap); ! net->pcap = NULL; ! } ! ! if(net->eth != NULL) { ! eth_close(net->eth); ! net->eth = NULL; ! } return; } + /* XXX -- if we fail we should rawnet down it. */ int rawnet_up(rawnet_t *net) { net->pcap = initialize_pcap_device(net->device, net->pcap_filter, net->promiscuous); if(net->pcap == NULL) { + push_exception("rawnet", "rawnet_up", + "could not initialize pcap on device: %s", net->device); + return -1; + } + + if((net->pcap_fd = pcap_fileno(net->pcap)) < 0) { + push_exception("rawnet", "rawnet_create", + "could not get pcap descriptor for: %s: %s", net->device, + pcap_geterr(net->pcap)); + rawnet_down(net); return -1; } net->eth = eth_open(net->device); ! if(net->eth == NULL) { ! push_exception("rawnet", "rawnet_up", ! "could not get ethernet handler on device: %s", ! net->device); ! rawnet_down(net); return -1; + } return 0; *************** *** 498,513 **** int rawnet_send_packet(rawnet_t *net) { ! if(eth_send(net->eth, net->packet_data, net->packet_len) != net->packet_len) ! return 1; ! else ! return 0; ! } ! char *rawnet_strerror(rawnet_t *net) ! { ! return(pcap_geterr(net->pcap)); } - /* Just update the seconds field. * --- 553,565 ---- int rawnet_send_packet(rawnet_t *net) { ! if(eth_send(net->eth, net->packet_data, net->packet_len) != net->packet_len) { ! push_exception("rawnet", "rawnet_send_packet", ! "could not write to device: %s : %s", net->device, strerror(errno)); ! return -1; ! } ! return 0; } /* Just update the seconds field. * *************** *** 570,573 **** --- 622,627 ---- */ ... [truncated message content] |
From: <bk...@us...> - 2002-06-27 19:10:15
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv11393 Modified Files: dhcp-sysconf.c Log Message: After successfully cleaning up an option, unflag it. Pointed out by tmh. Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dhcp-sysconf.c 24 Jun 2002 06:10:54 -0000 1.22 --- dhcp-sysconf.c 27 Jun 2002 19:10:05 -0000 1.23 *************** *** 452,455 **** --- 452,457 ---- error_message("cleanup option: %s: %s", dhcp_options_strings[i], strerror(errno)); + else + sysconf_handlers[i].flag &= ~SYSCONF_DO_CLEANUP; option_convert_handlers[i].free_internal(data); |
From: <act...@us...> - 2002-06-24 14:32:28
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv14150 Modified Files: CAVEATS Changelog README THANKS TODO configure configure.in dhcp-client-states.c dhcp-client.c dhcp-exception.c dhcp-exception.h Log Message: updates for new 0.37 version -- mostly textual changes Index: CAVEATS =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/CAVEATS,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CAVEATS 11 Feb 2002 18:02:24 -0000 1.3 --- CAVEATS 24 Jun 2002 14:32:24 -0000 1.4 *************** *** 13,14 **** --- 13,18 ---- -- dhcpclient's icmp mask discovery has not been tested. Please report success if you use this feature (send me a patch too for any bugs). + + -- *BSD folks may find serious issues if they're using a BPF + device without the select() fix. We've tested this on + OpenBSD-3.1, and FreeBSD-4.6 Index: Changelog =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Changelog,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Changelog 31 Jan 2002 14:43:22 -0000 1.8 --- Changelog 24 Jun 2002 14:32:24 -0000 1.9 *************** *** 1,57 **** ! -- 31/01/2001 ! ! added -m option to fake MAC address. this is useful ! for diagnostics when you want to see if one machine ! can't physically get its boot parameters or not. ! ! added INADDR_NONE definition to build properly ! on Solaris ! ! dhcpclient now logs renew and wait messages. ! ! dhcpsniff now outputs timestamps unix style. ! ! Fixed up automake. ! ! Fixed dhcp secs bug. Wasn't being set properly. ! ! -- release 0.35a (alpha) ! ! -- 30/01/2001 ! ! Fixed up configure script, although it still needs ! more work. Needs a proper revamp. ! ! dhcpclient should now correctly send RELEASE when ! shutting down, and deleting the cache and pid file. ! ! dhcpclient should now correctly go from WAIT state ! to REQUEST state to renew, instead of previous ! behaviour of reverting back to DISCOVER. ! ! dhcpclient now can wake a running client if passed -w flag. ! ! dhcpclient will now check for an existing client and refuse ! to start up if it exists. ! ! -- tmh ! ! -- 29/01/2001 ! ! Added check to client_cache_dump_options to skip possible ! malformed options. ! Fixed do_sysconf to stop jumping hoops. It now gets the ! data in serialized state as a cache entry. ! ! -- tmh ! ! -- 28/01/2001 ! ! Fixed small memory leak. No apparent memory leaks anymore. ! Some code clean up. ! Added rtt mechanism as defined in RFC2131 ! PID filename is now "<interface-name>.pid" ! Added man page for dhcpclient. ! Added -k option for killing current dhcpclient daemon process. ! -- tmh --- 1,3 ---- ! -- Changelog ! \ No newline at end of file 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 18 May 2002 18:17:59 -0000 1.6 --- README 24 Jun 2002 14:32:24 -0000 1.7 *************** *** 20,27 **** ----------------------- ! The current distribution has only been tested on Linux 2.2.x. I will ! be porting it to other systems in future releases. Also it will only ! work on ethernet interfaces, which is most likely the only type of ! interface people will want to use it on. dhcp-agent relies on two portable networking libraries: libpcap and --- 20,30 ---- ----------------------- ! Although the current distribution is in alpha state, we are ! porting it about. You can help too. Tests have been run ! successfully on: ! ! Linux 2.2.x (Heavily pillaged Slackware 8.0) ! FreeBSD-4.6 (Stock installation with dhclient killed) ! OpenBSD-3.1 (Stock installation with dhclient killed) dhcp-agent relies on two portable networking libraries: libpcap and *************** *** 47,58 **** See the CAVEATS file for more known issues. ! Building ! -------- ! To build simply: "configure; make; make install;" ! Before installing please uninstall any previous distribution, or ! dhcp suite package. Make sure you have also disabled any dhcp client ! or server running on the host. Uninstalling --- 50,63 ---- See the CAVEATS file for more known issues. ! Building and Installing ! ----------------------- ! To build simply: "./configure; make;" ! To install: "make install;" ! ! Before installing please uninstall any previous distribution of ! dhcp-agent, or dhcp suite package. Make sure you have also ! disabled any dhcp client or server running on the host. Uninstalling *************** *** 66,73 **** Read the man page for dhcpsniff for command line options. ! Simply run dhcpsniff with no arguments to have it sniff the default ! interface pcap chooses. You need to run this as root since it needs ! access to a packet capturing device. If the interface is down, you ! need to bring it up (even if your settings are bogus). Using dhcpclient --- 71,77 ---- Read the man page for dhcpsniff for command line options. ! Simply run dhcpsniff with no arguments to have it sniff the first ! ethernet interface it finds. You need to run this as root since ! it needs access to a packet capturing device. Using dhcpclient *************** *** 75,83 **** Read the man page for dhcpclient for command line options. - (No really, read it) dhcpclient currently only sets up the interface, routing, and domain name system if the appropriate DHCP options are received. More options will be added later. Support --- 79,94 ---- Read the man page for dhcpclient for command line options. dhcpclient currently only sets up the interface, routing, and domain name system if the appropriate DHCP options are received. More options will be added later. + + dhcpclient is still a pit finnicky about which interface it + picks. Use the -i option to force it to choose an interface. Or + down the ethernet interface you wish to use and it will + automatically detect a downed ethernet interface. + + We're still working on a nicer way of making things + automagic. Feel free to offer your suggestions. Support Index: THANKS =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/THANKS,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** THANKS 11 Jun 2002 01:50:27 -0000 1.8 --- THANKS 24 Jun 2002 14:32:24 -0000 1.9 *************** *** 17,18 **** --- 17,20 ---- -- Brian J. Kifiak for assisting in development. + + -- Chris Keelan for some spare PC133 RAM. Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** TODO 23 Jun 2002 03:29:12 -0000 1.30 --- TODO 24 Jun 2002 14:32:24 -0000 1.31 *************** *** 93,94 **** --- 93,101 ---- create_dhcp_option(data, len, tag) -- document output from dhcpsniff -- especially how brief mode is layed out. + -- dhcpclient startup needs a more clever way of detecting interfaces: + + -- detect which interfaces already have clients on them + -- accept a list from globconf + -- apply only to a specific interface. + + more importantly though we need Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** configure 23 Jun 2002 03:29:12 -0000 1.22 --- configure 24 Jun 2002 14:32:25 -0000 1.23 *************** *** 1,5 **** #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated by Autoconf 2.50 for dhcp-agent 0.36. # # Report bugs to <tm...@wh...>. --- 1,5 ---- #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated by Autoconf 2.50 for dhcp-agent 0.37. # # Report bugs to <tm...@wh...>. *************** *** 145,150 **** PACKAGE_NAME='dhcp-agent' PACKAGE_TARNAME='dhcp-agent' ! PACKAGE_VERSION='0.36' ! PACKAGE_STRING='dhcp-agent 0.36' PACKAGE_BUGREPORT='tm...@wh...' --- 145,150 ---- PACKAGE_NAME='dhcp-agent' PACKAGE_TARNAME='dhcp-agent' ! PACKAGE_VERSION='0.37' ! PACKAGE_STRING='dhcp-agent 0.37' PACKAGE_BUGREPORT='tm...@wh...' *************** *** 554,558 **** # This message is too long to be a string in the A/UX 3.1 sh. cat <<EOF ! \`configure' configures dhcp-agent 0.36 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... --- 554,558 ---- # This message is too long to be a string in the A/UX 3.1 sh. cat <<EOF ! \`configure' configures dhcp-agent 0.37 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... *************** *** 616,620 **** if test -n "$ac_init_help"; then case $ac_init_help in ! short | recursive ) echo "Configuration of dhcp-agent 0.36:";; esac cat <<\EOF --- 616,620 ---- if test -n "$ac_init_help"; then case $ac_init_help in ! short | recursive ) echo "Configuration of dhcp-agent 0.37:";; esac cat <<\EOF *************** *** 682,686 **** if $ac_init_version; then cat <<\EOF ! dhcp-agent configure 0.36 generated by GNU Autoconf 2.50 --- 682,686 ---- if $ac_init_version; then cat <<\EOF ! dhcp-agent configure 0.37 generated by GNU Autoconf 2.50 *************** *** 697,701 **** running configure, to aid debugging if configure makes a mistake. ! It was created by dhcp-agent $as_me 0.36, which was generated by GNU Autoconf 2.50. Invocation command line was --- 697,701 ---- running configure, to aid debugging if configure makes a mistake. ! It was created by dhcp-agent $as_me 0.37, which was generated by GNU Autoconf 2.50. Invocation command line was *************** *** 1103,1107 **** PACKAGE=dhcp-agent ! VERSION=0.36 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then --- 1103,1107 ---- PACKAGE=dhcp-agent ! VERSION=0.37 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then *************** *** 3350,3354 **** cat >>$CONFIG_STATUS <<EOF ac_cs_version="\\ ! dhcp-agent config.status 0.36 configured by $0, generated by GNU Autoconf 2.50, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" --- 3350,3354 ---- cat >>$CONFIG_STATUS <<EOF ac_cs_version="\\ ! dhcp-agent config.status 0.37 configured by $0, generated by GNU Autoconf 2.50, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" *************** *** 3438,3442 **** ## ----------------------- ## ! This file was extended by $as_me (dhcp-agent 0.36) 2.50, executed with > $ac_cs_invocation on `(hostname || uname -n) 2>/dev/null | sed 1q` --- 3438,3442 ---- ## ----------------------- ## ! This file was extended by $as_me (dhcp-agent 0.37) 2.50, executed with > $ac_cs_invocation on `(hostname || uname -n) 2>/dev/null | sed 1q` Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** configure.in 23 Jun 2002 03:29:12 -0000 1.22 --- configure.in 24 Jun 2002 14:32:25 -0000 1.23 *************** *** 5,10 **** dnl init ! AC_INIT(dhcp-agent, 0.36, tm...@wh...) ! AM_INIT_AUTOMAKE(dhcp-agent, 0.36) AM_CONFIG_HEADER(config.h) --- 5,10 ---- dnl init ! AC_INIT(dhcp-agent, 0.37, tm...@wh...) ! AM_INIT_AUTOMAKE(dhcp-agent, 0.37) AM_CONFIG_HEADER(config.h) Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** dhcp-client-states.c 22 Jun 2002 01:47:57 -0000 1.31 --- dhcp-client-states.c 24 Jun 2002 14:32:25 -0000 1.32 *************** *** 312,316 **** return STATE_REQUEST_ACK; /* if we didn't an ALARM get it it's probably a HUP * or a TERM. in either case we can ! * return STATE_REQUEST here. */ } --- 312,316 ---- return STATE_REQUEST_ACK; /* if we didn't an ALARM get it it's probably a HUP * or a TERM. in either case we can ! * return STATE_REQUEST_ACK here. */ } Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** dhcp-client.c 24 Jun 2002 02:04:56 -0000 1.34 --- dhcp-client.c 24 Jun 2002 14:32:25 -0000 1.35 *************** *** 161,164 **** --- 161,167 ---- } + /* wrapper around interface retrieval routines. */ + + /* get active or inactive interfaces. */ static char *interface_get_proc(int active) { *************** *** 179,182 **** --- 182,186 ---- } + /* get interface which is active. */ static char *interface_get_active(void) { *************** *** 184,187 **** --- 188,192 ---- } + /* get interface which is inactive. */ static char *interface_get_inactive(void) { *************** *** 189,193 **** } ! /* main loop: if only_setup is called we exit after setup. */ static int do_client_dhcp_loop(int only_setup, dhcp_client_control_t *dc, int state) { --- 194,200 ---- } ! /* main loop: if only_setup is called we exit after setup -- ! * this is useful for running through the loop only long ! * enough to setup the interface. */ static int do_client_dhcp_loop(int only_setup, dhcp_client_control_t *dc, int state) { *************** *** 291,294 **** --- 298,302 ---- } + info_message("woke client on pid %u : for interface: %s", pid, interface); return; } *************** *** 329,332 **** --- 337,341 ---- } + /* change int our working directory. */ static void do_change_work_dir(void) { *************** *** 353,356 **** --- 362,366 ---- } + /* do client: perform dhcp client proper functions. */ static void do_client(char *interface) { Index: dhcp-exception.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-exception.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-exception.c 22 Jun 2002 18:11:25 -0000 1.1 --- dhcp-exception.c 24 Jun 2002 14:32:25 -0000 1.2 *************** *** 54,57 **** --- 54,63 ---- exceptions.cur_index++; + + if(exceptions.cur_index == MAX_EXCEPTION_STACK) { + fatal_error("push_exception: ran out of exception stack space!"); + exit(1); + } + } Index: dhcp-exception.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-exception.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-exception.h 22 Jun 2002 18:11:25 -0000 1.1 --- dhcp-exception.h 24 Jun 2002 14:32:25 -0000 1.2 *************** *** 36,37 **** --- 36,39 ---- char *fmt, ...); extern stringbuffer *unroll_exceptions(void); + + #define THROW_EXCEPTION(module_name, func_name, msg, return_val) { (push_exception(module_name, func_name, msg); return return_val;) } |
From: <bk...@us...> - 2002-06-24 06:10:57
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv31742 Modified Files: dhcp-sysconf.c Log Message: Avoid potential confusion with the Name servers option (in the comment). Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dhcp-sysconf.c 24 Jun 2002 02:04:56 -0000 1.21 --- dhcp-sysconf.c 24 Jun 2002 06:10:54 -0000 1.22 *************** *** 48,52 **** /* 4 Time server. */ { NULL, NULL, SYSCONF_UNSET, }, ! /* 5 Name servers. */ { NULL, NULL, SYSCONF_UNSET, }, /* 6 Domain name servers. */ --- 48,52 ---- /* 4 Time server. */ { NULL, NULL, SYSCONF_UNSET, }, ! /* 5 Name servers (old -- IEN 116). */ { NULL, NULL, SYSCONF_UNSET, }, /* 6 Domain name servers. */ |
From: <bk...@us...> - 2002-06-24 02:07:24
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv23330 Modified Files: Makefile.am Makefile.in Log Message: Nuke the dhcp-test stuff that crept in. Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Makefile.am 22 Jun 2002 18:11:25 -0000 1.25 --- Makefile.am 24 Jun 2002 02:07:21 -0000 1.26 *************** *** 5,9 **** DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcptest dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ --- 5,9 ---- DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ *************** *** 24,38 **** dhcp-parser.c dhcp-varfile.c dhcp-exception.c - dhcptest_SOURCES = dhcp-test.c dhcp-util.c \ - dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ - dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c \ - dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c \ - dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c \ - dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ - dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ - dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c \ - dhcp-parser.c dhcp-varfile.c dhcp-exception.c - - dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ --- 24,27 ---- Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Makefile.in 22 Jun 2002 18:11:25 -0000 1.24 --- Makefile.in 24 Jun 2002 02:07:21 -0000 1.25 *************** *** 1,5 **** ! # Makefile.in generated automatically by automake 1.4-p4 from Makefile.am ! # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, --- 1,5 ---- ! # Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ! # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, *************** *** 75,79 **** DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcptest dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcp-stringbuffer.c --- 75,79 ---- DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcp-stringbuffer.c *************** *** 85,92 **** - dhcptest_SOURCES = dhcp-test.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c dhcp-parser.c dhcp-varfile.c dhcp-exception.c - - - dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ --- 85,88 ---- *************** *** 125,139 **** dhcpclient_DEPENDENCIES = dhcpclient_LDFLAGS = - dhcptest_OBJECTS = dhcp-test.o dhcp-util.o dhcp-align.o dhcp-net.o \ - dhcp-list.o dhcp-com.o dhcp-eth.o dhcp-ip.o dhcp-udp.o dhcp-arp.o \ - dhcp-icmp.o dhcp-log.o dhcp-daemon.o dhcp-client-cache.o \ - dhcp-cache-entry.o dhcp-client-control.o dhcp-interface.o \ - dhcp-client-conf.o dhcp-snprintf.o dhcp-files.o dhcp-client-states.o \ - dhcp-options-strings.o dhcp-convert.o dhcp-sysconf.o dhcp-rtt.o \ - dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ - dhcp-route.o dhcp-globconf.o dhcp-stringbuffer.o dhcp-parser.o \ - dhcp-varfile.o dhcp-exception.o - dhcptest_DEPENDENCIES = - dhcptest_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) --- 121,124 ---- *************** *** 166,173 **** .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ .deps/dhcp-snprintf.P .deps/dhcp-stringbuffer.P .deps/dhcp-sysconf.P \ ! .deps/dhcp-test.P .deps/dhcp-udp.P .deps/dhcp-util.P \ ! .deps/dhcp-varfile.P ! SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) $(dhcptest_SOURCES) ! OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) $(dhcptest_OBJECTS) all: all-redirect --- 151,157 ---- .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ .deps/dhcp-snprintf.P .deps/dhcp-stringbuffer.P .deps/dhcp-sysconf.P \ ! .deps/dhcp-udp.P .deps/dhcp-util.P .deps/dhcp-varfile.P ! SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) ! OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) all: all-redirect *************** *** 184,188 **** cd $(srcdir) && $(ACLOCAL) ! config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) --- 168,172 ---- cd $(srcdir) && $(ACLOCAL) ! config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) *************** *** 265,272 **** @rm -f dhcpclient $(LINK) $(dhcpclient_LDFLAGS) $(dhcpclient_OBJECTS) $(dhcpclient_LDADD) $(LIBS) - - dhcptest: $(dhcptest_OBJECTS) $(dhcptest_DEPENDENCIES) - @rm -f dhcptest - $(LINK) $(dhcptest_LDFLAGS) $(dhcptest_OBJECTS) $(dhcptest_LDADD) $(LIBS) install-man1: --- 249,252 ---- |
From: <bk...@us...> - 2002-06-24 02:04:59
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv22556 Modified Files: dhcp-client.c dhcp-sysconf.c dhcp-sysconf.h Log Message: Implement framework for sysconf_*_cleanup functions. A default route cleanup is here too. And the client calls do_sysconf_cleanup() when shutting down. Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** dhcp-client.c 23 Jun 2002 22:50:19 -0000 1.33 --- dhcp-client.c 24 Jun 2002 02:04:56 -0000 1.34 *************** *** 25,28 **** --- 25,29 ---- #include <dhcp-agent.h> #include <dhcp-util.h> + #include <dhcp-sysconf.h> #include <dhcp-globconf.h> #include <dhcp-files.h> *************** *** 125,128 **** --- 126,130 ---- if(dc) { /* only do clean up if we can. */ + do_sysconf_cleanup(dc); client_release(dc); delete_pid_file(dc->interface); Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-sysconf.c 22 Jun 2002 01:47:57 -0000 1.20 --- dhcp-sysconf.c 24 Jun 2002 02:04:56 -0000 1.21 *************** *** 38,105 **** sysconf_handler sysconf_handlers[] = { ! { NULL, }, /* 0 */ /* Pad -- don't handle here. */ ! { NULL, }, /* 1 */ /* Subnet mask -- don't handle here.*/ ! { NULL, }, /* 2 */ /* time offset. */ ! { sysconf_routers, }, /* 3 */ /* routers. */ ! { NULL, }, /* 4 */ /* time server. */ ! { NULL, }, /* 5 */ /* name server (old). */ ! { sysconf_domain_name_servers, }, /* 6 */ /* domain name servers. */ ! { NULL, }, /* 7 */ /* mit-lcs log server. */ ! { NULL, }, /* 8 */ /* cookie servers. */ ! { NULL, }, /* 9 */ /* lpr servers. */ ! { NULL, }, /* 10 */ /* impress server. */ ! { NULL, }, /* 11 */ /* resource location server. */ ! { NULL, }, /* 12 */ /* host name option. */ ! { NULL, }, /* 13 */ /* boot file size option. */ ! { NULL, }, /* 14 */ /* merit dump file. */ ! { sysconf_domain_name, }, /* 15 */ /* domain name. */ ! { NULL, }, /* 16 */ /* swap server. */ ! { NULL, }, /* 17 */ /* root path. */ ! { NULL, }, /* 18 */ /* extension path */ ! { NULL, }, /* 19 */ /* ip forwarding. */ ! { NULL, }, /* 20 */ /* non local source routing. */ ! { NULL, }, /* 21 */ /* policy filter option. */ ! { NULL, }, /* 23 */ /* maximum dgram reassembly. */ ! { NULL, }, /* 24 */ /* mtu aging timeout. */ ! { NULL, }, /* 25 */ /* mtu plateau table. */ ! { NULL, }, /* 26 */ /* interface mtu */ ! { NULL, }, /* 27 */ /* subnets are local. */ ! { NULL, }, /* 28 */ /* broadcast address. */ ! { NULL, }, /* 29 */ /* perform mask discovery. */ ! { NULL, }, /* 30 */ /* mask supplier. */ ! { NULL, }, /* 31 */ /* perform router discovery. */ ! { NULL, }, /* 32 */ /* router soliciation address. */ ! { NULL, }, /* 33 */ /* static route. */ ! { NULL, }, /* 34 */ /* trailer encapsulation. */ ! { NULL, }, /* 35 */ /* arp cache timeout. */ ! { NULL, }, /* 36 */ /* ethernet encapsulation. */ ! { NULL, }, /* 37 */ /* tcp default ttl. */ ! { NULL, }, /* 38 */ /* tcp keepalive garbage option. */ ! { NULL, }, /* 39 */ /* network information service domain. */ ! { NULL, }, /* 40 */ /* network time protocol servers. */ ! { NULL, }, /* 41 */ /* vendor specific. */ ! { NULL, }, /* 42 */ /* netbios over TCP/IP name server. */ ! { NULL, }, /* 43 */ /* netbios over tcp/ip */ ! { NULL, }, /* 44 */ ! { NULL, }, /* 45 */ ! { NULL, }, /* 46 */ ! { NULL, }, /* 47 */ ! { NULL, }, /* 48 */ ! { NULL, }, /* 49 */ ! { NULL, }, /* 50 */ ! { NULL, }, /* 51 */ ! { NULL, }, /* 52 */ ! { NULL, }, /* 53 */ ! { NULL, }, /* 54 */ ! { NULL, }, /* 55 */ ! { NULL, }, /* 56 */ ! { NULL, }, /* 57 */ ! { NULL, }, /* 58 */ ! { NULL, }, /* 59 */ ! { NULL, }, /* 60 */ ! { NULL, }, /* 61 */ }; ! int sysconf_routers(void *value, dhcp_client_control_t *dc) { struct route_entry r_entry; --- 38,168 ---- sysconf_handler sysconf_handlers[] = { ! /* 0 Pad -- not handled here. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 1 Subnet mask -- not handled here. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 2 Time offset. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 3 Routers. */ ! { sysconf_setup_routers, sysconf_cleanup_routers, SYSCONF_UNSET, }, ! /* 4 Time server. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 5 Name servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 6 Domain name servers. */ ! { sysconf_setup_domain_name_servers, NULL, SYSCONF_UNSET, }, ! /* 7 MIT LCS log servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 8 Cookie servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 9 LPR servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 10 Impress server. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 11 Resource location servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 12 Hostname. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 13 Boot file size. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 14 Merit dump file. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 15 Domain name. */ ! { sysconf_setup_domain_name, NULL, SYSCONF_UNSET, }, ! /* 16 Swap server. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 17 Root path. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 18 Extensions path. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 19 IP forwarding. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 20 Source routing. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 21 Policy filter. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 22 Maximum DGRAM reassembly. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 23 Default IP time-to-live. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 24 Path MTU aging timeout. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 25 Path MTU plateau table. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 26 Interface MTU. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 27 All subnets. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 28 Broadcast address. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 29 Perform mask discovery. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 30 Mask supplier. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 31 Perform router discovery. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 32 Router solicitation address. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 33 Static route. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 34 Trailer encapsulation. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 35 ARP cache timeout. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 36 Ethernet encapsulation. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 37 TCP default TTL. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 38 TCP keepalive interval. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 39 TCP keepalive garbage. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 40 Network Information Service domain. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 41 Network Information servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 42 Network Time Protocol servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 43 Vendor Specific information. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 44 NetBIOS over TCP/IP name servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 45 NetBIOS over TCP/IP datagram distribution servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 46 NetBIOS over TCP/IP node type. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 47 NetBIOS over TCP/IP scope. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 48 X-Windows font servers. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 49 X-Windows system display manager. */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 50 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 51 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 52 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 53 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 54 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 55 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 56 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 57 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 58 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 59 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 60 */ ! { NULL, NULL, SYSCONF_UNSET, }, ! /* 61 */ ! { NULL, NULL, SYSCONF_UNSET, }, }; ! int sysconf_setup_routers(void *value, dhcp_client_control_t *dc) { struct route_entry r_entry; *************** *** 159,163 **** } ! int sysconf_domain_name_servers(void *value, dhcp_client_control_t *dc) { FILE *fp; --- 222,253 ---- } ! int sysconf_cleanup_routers(void *value, dhcp_client_control_t *dc) ! { ! struct route_entry r_entry; ! route_t *rt; ! ! memset(&r_entry.route_dst, 0, sizeof(r_entry.route_dst)); ! memset(&r_entry.route_gw, 0, sizeof(r_entry.route_gw)); ! ! rt = route_open(); ! if(rt == NULL) { ! return -1; ! } ! ! r_entry.route_dst.addr_type = ADDR_TYPE_IP; ! r_entry.route_dst.addr_bits = 0; ! r_entry.route_dst.addr_ip = 0; ! ! if(route_delete(rt, &r_entry) < 0) { ! warn_message("couldn't delete default route entry"); ! route_close(rt); ! return -1; ! } ! ! route_close(rt); ! return 0; ! } ! ! int sysconf_setup_domain_name_servers(void *value, dhcp_client_control_t *dc) { FILE *fp; *************** *** 178,182 **** } ! int sysconf_domain_name(void *value, dhcp_client_control_t *dc) { FILE *fp; --- 268,272 ---- } ! int sysconf_setup_domain_name(void *value, dhcp_client_control_t *dc) { FILE *fp; *************** *** 267,276 **** sysconf_cleanup_files(); ! /* Setup our interface it. */ sysconf_setup_interface(options, dc); ! /* we need to setup the interface ourselves before ! * anything (route won't work otherwise.) */ for(list_ptr = options;list_ptr;list_ptr = list_ptr->next) { --- 357,367 ---- sysconf_cleanup_files(); ! /* Setup our interface. Put before the others as it ! * is likely required for the others to work. */ sysconf_setup_interface(options, dc); ! /* Now walk through the other options, performing setup and ! * cleanup operations as necessary. */ for(list_ptr = options;list_ptr;list_ptr = list_ptr->next) { *************** *** 282,300 **** if(string_matches(dhcp_options_strings[i], ce->name)) { ! /* We have a match now check for sysconf and serialize_to_internal ! * handler. */ ! if(sysconf_handlers[i].sysconf_handler == NULL || option_convert_handlers[i].serialize_to_internal == NULL) break; - info_message("configuring for option %s", dhcp_options_strings[i]); - data = option_convert_handlers[i].serialize_to_internal(ce->value); ! if(sysconf_handlers[i].sysconf_handler(data, dc)) ! error_message("error configuring for option %s: %s", dhcp_options_strings[i], strerror(errno)); option_convert_handlers[i].free_internal(data); } --- 373,415 ---- if(string_matches(dhcp_options_strings[i], ce->name)) { ! /* Make sure we know how to setup this option. */ ! if(sysconf_handlers[i].setup == NULL || option_convert_handlers[i].serialize_to_internal == NULL) break; data = option_convert_handlers[i].serialize_to_internal(ce->value); ! /* Cleanup first, if we're supposed to. */ ! ! if(sysconf_handlers[i].cleanup != NULL && ! (sysconf_handlers[i].flag & SYSCONF_DO_CLEANUP) == 1) { ! ! info_message("cleanup option: %s", ! dhcp_options_strings[i]); ! ! if(sysconf_handlers[i].cleanup(data, dc)) ! error_message("cleanup option: %s: %s", ! dhcp_options_strings[i], strerror(errno)); ! } ! ! /* Now we can try to setup the option, and flag it for ! * cleanup. */ ! ! info_message("setup option: %s", dhcp_options_strings[i]); ! ! if(sysconf_handlers[i].setup(data, dc)) { ! ! sysconf_handlers[i].flag &= ~SYSCONF_DO_CLEANUP; ! error_message("setup option: %s: %s", dhcp_options_strings[i], strerror(errno)); + } else { + + sysconf_handlers[i].flag |= SYSCONF_DO_CLEANUP; + + } + + option_convert_handlers[i].free_internal(data); } *************** *** 313,315 **** --- 428,461 ---- return; + } + + void do_sysconf_cleanup(dhcp_client_control_t *dc) + { + int i; + void *data; + + /* Walk through the sysconf_handlers array. */ + + for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { + + /* Perform cleanup only if we're supposed to, and if there's a + * cleanup function for the option. */ + + if(sysconf_handlers[i].flag & SYSCONF_DO_CLEANUP && + sysconf_handlers[i].cleanup != NULL) { + + data = option_convert_handlers[i].serialize_to_internal(dhcp_options_strings[i]); + + info_message("cleanup option: %s", dhcp_options_strings[i]); + + if(sysconf_handlers[i].cleanup(data, dc)) + error_message("cleanup option: %s: %s", dhcp_options_strings[i], + strerror(errno)); + + option_convert_handlers[i].free_internal(data); + + } + + } + } Index: dhcp-sysconf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-sysconf.h 17 Jun 2002 13:23:08 -0000 1.2 --- dhcp-sysconf.h 24 Jun 2002 02:04:56 -0000 1.3 *************** *** 29,42 **** typedef struct { ! int (*sysconf_handler)(void *value, dhcp_client_control_t *dc); } sysconf_handler; /* System configuration routines. */ ! extern int sysconf_routers(void *value, dhcp_client_control_t *dc); ! extern int sysconf_domain_name_servers(void *value, dhcp_client_control_t *dc); ! extern int sysconf_domain_name(void *value, dhcp_client_control_t *dc); extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); #endif /* SYSCONF_H */ --- 29,49 ---- typedef struct { ! int (*setup)(void *value, dhcp_client_control_t *dc); ! int (*cleanup)(void *value, dhcp_client_control_t *dc); ! uint8_t flag; } sysconf_handler; + /* Hex macros for sysconf flags. */ + #define SYSCONF_UNSET 0x00 + #define SYSCONF_DO_CLEANUP 0x01 /* System configuration routines. */ ! extern int sysconf_setup_routers(void *value, dhcp_client_control_t *dc); ! extern int sysconf_cleanup_routers(void *value, dhcp_client_control_t *dc); ! extern int sysconf_setup_domain_name_servers(void *value, dhcp_client_control_t *dc); ! extern int sysconf_setup_domain_name(void *value, dhcp_client_control_t *dc); extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); + extern void do_sysconf_cleanup(dhcp_client_control_t *dc); #endif /* SYSCONF_H */ |
From: <bk...@us...> - 2002-06-23 22:50:23
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv20543 Modified Files: dhcp-client.c Log Message: Destroy dc only after we've finished using it. Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** dhcp-client.c 23 Jun 2002 03:29:12 -0000 1.32 --- dhcp-client.c 23 Jun 2002 22:50:19 -0000 1.33 *************** *** 126,131 **** if(dc) { /* only do clean up if we can. */ client_release(dc); - destroy_dhcp_client_control(dc); delete_pid_file(dc->interface); } --- 126,131 ---- if(dc) { /* only do clean up if we can. */ client_release(dc); delete_pid_file(dc->interface); + destroy_dhcp_client_control(dc); } |
From: <act...@us...> - 2002-06-23 03:29:16
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8341 Modified Files: TODO acconfig.h acinclude.m4 aclocal.m4 config.h.in configure configure.in dhcp-client.c dhcp-net.c dhcp-net.h dhcp-sniff.c Log Message: bsd BPF polling fix; we're now at the mercy of select(); Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** TODO 18 Jun 2002 04:33:40 -0000 1.29 --- TODO 23 Jun 2002 03:29:12 -0000 1.30 *************** *** 92,94 **** the applicable dhcp-convert and then build the option wirh create_dhcp_option(data, len, tag) ! -- document output from dhcpsniff -- especially how brief mode is layed out. \ No newline at end of file --- 92,94 ---- the applicable dhcp-convert and then build the option wirh create_dhcp_option(data, len, tag) ! -- document output from dhcpsniff -- especially how brief mode is layed out. Index: acconfig.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acconfig.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** acconfig.h 10 Jun 2002 23:15:20 -0000 1.6 --- acconfig.h 23 Jun 2002 03:29:12 -0000 1.7 *************** *** 2,5 **** --- 2,8 ---- * our own pri macros. */ + /* have bpf IMMEDIATE ioctl */ + #undef HAVE_BPF_IMMEDIATE + /* have __progname var */ #undef HAVE_PROGNAME Index: acinclude.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acinclude.m4,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** acinclude.m4 11 Jun 2002 01:58:53 -0000 1.8 --- acinclude.m4 23 Jun 2002 03:29:12 -0000 1.9 *************** *** 203,204 **** --- 203,219 ---- } ], [AC_DEFINE(KILL_SIGNAL_DETECT) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) + + + AC_DEFUN(AC_WF_CHECK_BPF_IMMEDIATE, + [AC_MSG_CHECKING(for bpf immediate ioctl) + AC_TRY_COMPILE([#include <stdio.h> + #include <stdlib.h> + #include <sys/types.h> + #include <sys/time.h> + #include <sys/ioctl.h> + #include <net/bpf.h> + #include <net/bpfdesc.h> + ], [ ioctl(0, BIOCIMMEDIATE, NULL);], + [AC_MSG_RESULT(found) + AC_DEFINE(HAVE_BPF_IMMEDIATE)], + AC_MSG_RESULT(not found))]) Index: aclocal.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/aclocal.m4,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** aclocal.m4 11 Jun 2002 01:58:53 -0000 1.8 --- aclocal.m4 23 Jun 2002 03:29:12 -0000 1.9 *************** *** 216,219 **** --- 216,234 ---- ], [AC_DEFINE(KILL_SIGNAL_DETECT) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) + + AC_DEFUN(AC_WF_CHECK_BPF_IMMEDIATE, + [AC_MSG_CHECKING(for bpf immediate ioctl) + AC_TRY_COMPILE([#include <stdio.h> + #include <stdlib.h> + #include <sys/types.h> + #include <sys/time.h> + #include <sys/ioctl.h> + #include <net/bpf.h> + #include <net/bpfdesc.h> + ], [ ioctl(0, BIOCIMMEDIATE, NULL);], + [AC_MSG_RESULT(found) + AC_DEFINE(HAVE_BPF_IMMEDIATE)], + AC_MSG_RESULT(not found))]) + # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** config.h.in 15 Jun 2002 14:59:20 -0000 1.12 --- config.h.in 23 Jun 2002 03:29:12 -0000 1.13 *************** *** 3,6 **** --- 3,9 ---- * our own pri macros. */ + /* have bpf IMMEDIATE ioctl */ + #undef HAVE_BPF_IMMEDIATE + /* have __progname var */ #undef HAVE_PROGNAME Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** configure 15 Jun 2002 14:59:20 -0000 1.21 --- configure 23 Jun 2002 03:29:12 -0000 1.22 *************** *** 2706,2711 **** rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi ! echo "$as_me:2709: checking for struct bpf_timeval" >&5 echo $ECHO_N "checking for struct bpf_timeval... $ECHO_C" >&6 if test "${ac_cv_type_struct_bpf_timeval+set}" = set; then --- 2706,2757 ---- rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi + echo "$as_me:2708: checking for bpf immediate ioctl" >&5 + echo $ECHO_N "checking for bpf immediate ioctl... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line 2711 "configure" + #include "confdefs.h" + #include <stdio.h> + #include <stdlib.h> + #include <sys/types.h> + #include <sys/time.h> + #include <sys/ioctl.h> + #include <net/bpf.h> + #include <net/bpfdesc.h> ! int ! main () ! { ! ioctl(0, BIOCIMMEDIATE, NULL); ! ; ! return 0; ! } ! _ACEOF ! rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2730: \"$ac_compile\"") >&5 ! (eval $ac_compile) 2>&5 ! ac_status=$? ! echo "$as_me:2733: \$? = $ac_status" >&5 ! (exit $ac_status); } && ! { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2736: \"$ac_try\"") >&5 ! (eval $ac_try) 2>&5 ! ac_status=$? ! echo "$as_me:2739: \$? = $ac_status" >&5 ! (exit $ac_status); }; }; then ! echo "$as_me:2741: result: found" >&5 ! echo "${ECHO_T}found" >&6 ! cat >>confdefs.h <<\EOF ! #define HAVE_BPF_IMMEDIATE 1 ! EOF ! ! else ! echo "$as_me: failed program was:" >&5 ! cat conftest.$ac_ext >&5 ! echo "$as_me:2750: result: not found" >&5 ! echo "${ECHO_T}not found" >&6 ! fi ! rm -f conftest.$ac_objext conftest.$ac_ext ! ! echo "$as_me:2755: checking for struct bpf_timeval" >&5 echo $ECHO_N "checking for struct bpf_timeval... $ECHO_C" >&6 if test "${ac_cv_type_struct_bpf_timeval+set}" = set; then *************** *** 2713,2717 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2715 "configure" #include "confdefs.h" #include <sys/types.h> --- 2759,2763 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2761 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2732,2745 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2734: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2737: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2740: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2743: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_struct_bpf_timeval=yes --- 2778,2791 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2780: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2783: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2786: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2789: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_struct_bpf_timeval=yes *************** *** 2751,2755 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2753: result: $ac_cv_type_struct_bpf_timeval" >&5 echo "${ECHO_T}$ac_cv_type_struct_bpf_timeval" >&6 if test $ac_cv_type_struct_bpf_timeval = yes; then --- 2797,2801 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2799: result: $ac_cv_type_struct_bpf_timeval" >&5 echo "${ECHO_T}$ac_cv_type_struct_bpf_timeval" >&6 if test $ac_cv_type_struct_bpf_timeval = yes; then *************** *** 2760,2767 **** fi ! echo "$as_me:2762: checking for __progname" >&5 echo $ECHO_N "checking for __progname... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF ! #line 2765 "configure" #include "confdefs.h" --- 2806,2813 ---- fi ! echo "$as_me:2808: checking for __progname" >&5 echo $ECHO_N "checking for __progname... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF ! #line 2811 "configure" #include "confdefs.h" *************** *** 2781,2794 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2783: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2786: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2789: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2792: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\EOF --- 2827,2840 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2829: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2832: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2835: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2838: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\EOF *************** *** 2796,2810 **** EOF ! echo "$as_me:2798: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! echo "$as_me:2803: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext; ! echo "$as_me:2808: checking for sig_atomic_t" >&5 echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 if test "${ac_cv_type_sig_atomic_t+set}" = set; then --- 2842,2856 ---- EOF ! echo "$as_me:2844: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! echo "$as_me:2849: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext; ! echo "$as_me:2854: checking for sig_atomic_t" >&5 echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 if test "${ac_cv_type_sig_atomic_t+set}" = set; then *************** *** 2812,2816 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2814 "configure" #include "confdefs.h" #include <signal.h> --- 2858,2862 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2860 "configure" #include "confdefs.h" #include <signal.h> *************** *** 2828,2841 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2830: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2833: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2836: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2839: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes --- 2874,2887 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2876: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2879: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2882: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2885: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes *************** *** 2847,2851 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2849: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then --- 2893,2897 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2895: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then *************** *** 2856,2860 **** fi ! echo "$as_me:2858: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then --- 2902,2906 ---- fi ! echo "$as_me:2904: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then *************** *** 2862,2866 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2864 "configure" #include "confdefs.h" #include <sys/types.h> --- 2908,2912 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2910 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2884,2897 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2886: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2889: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2892: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2895: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void --- 2930,2943 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2932: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2935: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2938: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2941: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void *************** *** 2903,2907 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2905: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 --- 2949,2953 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2951: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 *************** *** 2912,2916 **** if test -z "$pcap_prefix"; then ! echo "$as_me:2914: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" --- 2958,2962 ---- if test -z "$pcap_prefix"; then ! echo "$as_me:2960: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" *************** *** 2923,2927 **** if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2925: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2969,2973 ---- if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2971: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2932,2940 **** fi ! echo "$as_me:2934: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2938: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" --- 2978,2986 ---- fi ! echo "$as_me:2980: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2984: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" *************** *** 2947,2951 **** if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2949: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2993,2997 ---- if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2995: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2956,2960 **** fi ! echo "$as_me:2958: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" --- 3002,3006 ---- fi ! echo "$as_me:3004: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" *************** *** 2973,2977 **** # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:2975: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then --- 3019,3023 ---- # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:3021: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then *************** *** 2990,2994 **** if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2992: found $ac_dir/$ac_word" >&5 break fi --- 3036,3040 ---- if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:3038: found $ac_dir/$ac_word" >&5 break fi *************** *** 3001,3008 **** if test -n "$DNET_PATH"; then ! echo "$as_me:3003: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:3006: result: no" >&5 echo "${ECHO_T}no" >&6 fi --- 3047,3054 ---- if test -n "$DNET_PATH"; then ! echo "$as_me:3049: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:3052: result: no" >&5 echo "${ECHO_T}no" >&6 fi *************** *** 3014,3018 **** if test $DNET_PATH = "no"; then ! echo "$as_me:3016: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then --- 3060,3064 ---- if test $DNET_PATH = "no"; then ! echo "$as_me:3062: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then *************** *** 3022,3026 **** LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 3024 "configure" #include "confdefs.h" --- 3068,3072 ---- LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 3070 "configure" #include "confdefs.h" *************** *** 3041,3054 **** _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:3043: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:3046: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:3049: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:3052: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes --- 3087,3100 ---- _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:3089: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:3092: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:3095: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:3098: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes *************** *** 3061,3070 **** LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:3063: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:3068: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } --- 3107,3116 ---- LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:3109: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:3114: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } *************** *** 3173,3177 **** ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:3175: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF --- 3219,3223 ---- ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:3221: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF *************** *** 3349,3353 **** --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3351: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 --- 3395,3399 ---- --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3397: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 *************** *** 3373,3382 **** # This is an error. ! -*) { { echo "$as_me:3375: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3380: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; --- 3419,3428 ---- # This is an error. ! -*) { { echo "$as_me:3421: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3426: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; *************** *** 3618,3622 **** if test x"$ac_file" != x-; then ! { echo "$as_me:3620: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" --- 3664,3668 ---- if test x"$ac_file" != x-; then ! { echo "$as_me:3666: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" *************** *** 3636,3640 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3638: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3682,3686 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3684: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3649,3653 **** else # /dev/null tree ! { { echo "$as_me:3651: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3695,3699 ---- else # /dev/null tree ! { { echo "$as_me:3697: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3710,3714 **** esac ! test x"$ac_file" != x- && { echo "$as_me:3712: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} --- 3756,3760 ---- esac ! test x"$ac_file" != x- && { echo "$as_me:3758: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} *************** *** 3721,3725 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3723: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3767,3771 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3769: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3734,3738 **** else # /dev/null tree ! { { echo "$as_me:3736: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3780,3784 ---- else # /dev/null tree ! { { echo "$as_me:3782: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3851,3855 **** if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3853: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else --- 3897,3901 ---- if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3899: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** configure.in 15 Jun 2002 14:59:20 -0000 1.21 --- configure.in 23 Jun 2002 03:29:12 -0000 1.22 *************** *** 45,48 **** --- 45,49 ---- AC_WF_CHECK_KILL_SIGNAL_DETECT + AC_WF_CHECK_BPF_IMMEDIATE dnl check for types Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** dhcp-client.c 18 Jun 2002 04:33:40 -0000 1.31 --- dhcp-client.c 23 Jun 2002 03:29:12 -0000 1.32 *************** *** 449,453 **** info_message(" "); ! while((c = getopt(argc, argv, "gcdavi:m:kwh:l:H:")) != -1) { switch(c) { --- 449,453 ---- info_message(" "); ! while((c = getopt(argc, argv, "pgcdavi:m:kwh:l:H:")) != -1) { switch(c) { Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** dhcp-net.c 22 Jun 2002 01:47:57 -0000 1.28 --- dhcp-net.c 23 Jun 2002 03:29:13 -0000 1.29 *************** *** 62,65 **** --- 62,69 ---- #include <dhcp-net.h> + #include <sys/ioctl.h> + #include <sys/uio.h> + #include <net/bpf.h> + /* get interface address. */ int rawnet_get_hw_addr(rawnet_t *net, eth_addr_t *addr) *************** *** 99,103 **** char errbuf[PCAP_ERRBUF_SIZE]; uint32_t mask = 0xffffffff; ! /* If interface not specificed get * a suitable one from pcap_lookupdev */ --- 103,112 ---- char errbuf[PCAP_ERRBUF_SIZE]; uint32_t mask = 0xffffffff; ! ! #if defined(HAVE_BPF_IMMEDIATE) ! int fd; ! u_int on = 1; ! #endif /* HAVE_BPF_IMMEDIATE */ ! /* If interface not specificed get * a suitable one from pcap_lookupdev */ *************** *** 129,138 **** error_message("rawnet: pcap_setfilter: %s", pcap_geterr(pcap)); return NULL; ! } pcap_freecode(&filter); ! /* All done setting up the device. */ return pcap; } --- 138,153 ---- error_message("rawnet: pcap_setfilter: %s", pcap_geterr(pcap)); return NULL; ! } pcap_freecode(&filter); ! #if defined(HAVE_BPF_IMMEDIATE) ! /* FreeBSD (others too?) need us to set the descriptor non ! * blocking and do a bogus read. This starts the timer. */ + fd = pcap_fileno(pcap); + ioctl(fd, BIOCIMMEDIATE, &on); + + #endif /* HAVE_BPF_IMMEDIATE */ return pcap; } *************** *** 357,372 **** */ ! int rawnet_get_packet(rawnet_t *net) { const unsigned char *packet; struct pcap_pkthdr pkthdr; int len; net->type = RAWNET_UNKNOWN; ! packet = pcap_next(net->pcap, &pkthdr); ! if(packet == NULL) { ! info_message("pcap_next: returned NULL"); ! return RAWNET_PCAP_ERROR; } --- 372,405 ---- */ ! int rawnet_get_packet(rawnet_t *net, struct timeval *tm) { const unsigned char *packet; struct pcap_pkthdr pkthdr; int len; + fd_set read_set; + int retval; net->type = RAWNET_UNKNOWN; ! while(1) { ! FD_ZERO(&read_set); ! FD_SET(net->pcap_fd, &read_set); ! ! retval = select((net->pcap_fd + 1), &read_set, NULL, NULL, tm); ! ! if(retval == 0) ! return RAWNET_TIMEOUT; ! ! if(retval < 0) ! return RAWNET_PCAP_ERROR; ! ! packet = pcap_next(net->pcap, &pkthdr); ! if(packet == NULL) ! continue; /* BPF may return 1 when there really isn't any packet for us. ! * is this because we're notified prior to filtering? ! * pcap only returns NULL on EWOULDBLOCK for bpf -- even though ! * in debugging I *never* get that errno value :| */ ! else ! break; } *************** *** 505,530 **** } - /* Wait for next packet. */ - - int rawnet_wait(rawnet_t *net, struct timeval *tm) - { - fd_set read_set; - int retval; - - FD_ZERO(&read_set); - FD_SET(net->pcap_fd, &read_set); - - retval = select((net->pcap_fd + 1), &read_set, NULL, NULL, tm); - - if(retval == 0) - return RAWNET_TIMEOUT; - - if(retval < 0) - return RAWNET_PCAP_ERROR; - - return RAWNET_OK; - - } - /* * We can ask rawnet to validate for us. --- 538,541 ---- *************** *** 588,592 **** timeout = rtt_get_timeout(rtt); ! retval = rawnet_wait(net, &timeout); switch(retval) { --- 599,603 ---- timeout = rtt_get_timeout(rtt); ! retval = rawnet_get_packet(net, &timeout); switch(retval) { *************** *** 613,618 **** case RAWNET_OK: - - rawnet_get_packet(net); if(!check) /* no check? return 0 anyway (we want --- 624,627 ---- *************** *** 629,634 **** break; default: ! error_message("rawnet: invalid return from rawnet_send_packet() -- this is a bug report it please"); break; } --- 638,647 ---- break; + case RAWNET_UNHANDLED: + case RAWNET_MALFORMED_PACKET: + break; + default: ! error_message("rawnet: invalid return from rawnet_get_packet() -- this is a bug report it please"); break; } Index: dhcp-net.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-net.h 22 Jun 2002 01:47:57 -0000 1.1 --- dhcp-net.h 23 Jun 2002 03:29:13 -0000 1.2 *************** *** 46,50 **** extern rawnet_t *rawnet_create(char *device, char *filter, int sport, int dport, int promiscuous); extern void rawnet_destroy(rawnet_t *net); ! extern int rawnet_get_packet(rawnet_t *net); extern int rawnet_get_hw_addr(rawnet_t *net, eth_addr_t *addr); extern int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr); --- 46,50 ---- extern rawnet_t *rawnet_create(char *device, char *filter, int sport, int dport, int promiscuous); extern void rawnet_destroy(rawnet_t *net); ! extern int rawnet_get_packet(rawnet_t *net, struct timeval *tm); extern int rawnet_get_hw_addr(rawnet_t *net, eth_addr_t *addr); extern int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr); *************** *** 67,71 **** extern void rawnet_dhcp_update(rawnet_t *net, time_t seconds); - extern int rawnet_wait(rawnet_t *net, struct timeval *tm); extern int rawnet_is_dhcp_offer(rawnet_t *net); extern int rawnet_is_valid(rawnet_t *net); --- 67,70 ---- Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-sniff.c 22 Jun 2002 02:12:03 -0000 1.12 --- dhcp-sniff.c 23 Jun 2002 03:29:13 -0000 1.13 *************** *** 126,131 **** while(1) { ! rawnet_wait(net, NULL); ! retval = rawnet_get_packet(net); switch(retval) { --- 126,130 ---- while(1) { ! retval = rawnet_get_packet(net, NULL); switch(retval) { |
From: <act...@us...> - 2002-06-22 18:11:28
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv1165 Modified Files: Makefile.am Makefile.in dhcp-client-cache.c dhcp-client-conf.c dhcp-globconf.c dhcp-stringbuffer.c dhcp-stringbuffer.h dhcp-util.c dhcp-util.h dhcp-varfile.c Added Files: dhcp-exception.c dhcp-exception.h Log Message: new exception code; made stringbuffer.h part of dhcp-util.h --- NEW FILE: dhcp-exception.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-exception.c,v 1.1 2002/06/22 18:11:25 actmodern Exp $ * * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Poor man's C exceptions. This type of exception is not meant to be catchable. * Instead it's meant to hold error strings from functions as they progress up * the stack */ #include <dhcp-agent.h> #include <dhcp-util.h> #include <dhcp-exception.h> static exception_t exceptions; /* initialize global exception module. */ void init_exceptions(void) { exceptions.cur_index = 0; return; } void push_exception(const char *module_name, const char *function_name, char *fmt, ...) { va_list ap; exceptions.module_name[exceptions.cur_index] = module_name; exceptions.function_name[exceptions.cur_index] = function_name; exceptions.exception_message[exceptions.cur_index] = create_stringbuffer(); va_start(ap, fmt); stringbuffer_avprintf(exceptions.exception_message[exceptions.cur_index], fmt, ap); va_end(ap); exceptions.cur_index++; } /* returns unrolled full stack trace. * destroys the strings as they're unrolled. */ stringbuffer *unroll_exceptions(void) { int i; stringbuffer *unrolled_exception = create_stringbuffer(); /* format is as follows. * module_name: * function_name: * msg msg msg msg msg msg msg * msg msg msg msg msg msg msg * msg msg msg msg msg msg msg */ for(i = 0; i < exceptions.cur_index; i++) { /* append module name. */ stringbuffer_aprintf(unrolled_exception, "%s:", exceptions.module_name[i]); /* append function name. */ stringbuffer_aprintf(unrolled_exception, " %s():\n", exceptions.function_name[i]); stringbuffer_aprintf_align(unrolled_exception, 4, 50, "%s\n", stringbuffer_getstring(exceptions.exception_message[i])); destroy_stringbuffer(exceptions.exception_message[i]); } exceptions.cur_index = 0; return unrolled_exception; } --- NEW FILE: dhcp-exception.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-exception.h,v 1.1 2002/06/22 18:11:25 actmodern Exp $ * * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #define MAX_EXCEPTION_STACK 64 typedef struct { stringbuffer *exception_message[MAX_EXCEPTION_STACK]; const char *module_name[MAX_EXCEPTION_STACK]; const char *function_name[MAX_EXCEPTION_STACK]; int cur_index; } exception_t; extern void init_exceptions(void); extern void push_exception(const char *module_name, const char *function_name, char *fmt, ...); extern stringbuffer *unroll_exceptions(void); Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Makefile.am 18 Jun 2002 04:33:40 -0000 1.24 --- Makefile.am 22 Jun 2002 18:11:25 -0000 1.25 *************** *** 5,14 **** DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c \ ! dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ --- 5,14 ---- DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcptest dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c \ ! dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcp-stringbuffer.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ *************** *** 22,38 **** dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c \ ! dhcp-parser.c dhcp-varfile.c ! #dhcptest_SOURCES = dhcp-test.c dhcp-util.c \ ! #dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ ! #dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c \ ! #dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c \ ! #dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c \ ! #dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ ! #dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ ! #dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c \ ! #dhcp-parser.c dhcp-varfile.c ! #dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ --- 22,38 ---- dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c \ ! dhcp-parser.c dhcp-varfile.c dhcp-exception.c ! dhcptest_SOURCES = dhcp-test.c dhcp-util.c \ ! dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ ! dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c \ ! dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c \ ! dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c \ ! dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ ! dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ ! dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c \ ! dhcp-parser.c dhcp-varfile.c dhcp-exception.c ! dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Makefile.in 18 Jun 2002 04:33:40 -0000 1.23 --- Makefile.in 22 Jun 2002 18:11:25 -0000 1.24 *************** *** 75,99 **** DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient ! dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ ! dhcpclient_SOURCES = dhcp-client.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c dhcp-parser.c dhcp-varfile.c ! #dhcptest_SOURCES = dhcp-test.c dhcp-util.c \ ! #dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ ! #dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c \ ! #dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c \ ! #dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c \ ! #dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ ! #dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ ! #dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c \ ! #dhcp-parser.c dhcp-varfile.c ! #dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ --- 75,92 ---- DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcptest ! dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcp-stringbuffer.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ ! dhcpclient_SOURCES = dhcp-client.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c dhcp-parser.c dhcp-varfile.c dhcp-exception.c ! dhcptest_SOURCES = dhcp-test.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c dhcp-parser.c dhcp-varfile.c dhcp-exception.c ! ! dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ *************** *** 117,121 **** dhcp-net.o dhcp-list.o dhcp-com.o dhcp-eth.o dhcp-ip.o dhcp-udp.o \ dhcp-arp.o dhcp-icmp.o dhcp-log.o dhcp-snprintf.o \ ! dhcp-sniffer-ohandlers.o dhcp-rtt.o dhcp-interface.o dhcpsniff_DEPENDENCIES = dhcpsniff_LDFLAGS = --- 110,115 ---- dhcp-net.o dhcp-list.o dhcp-com.o dhcp-eth.o dhcp-ip.o dhcp-udp.o \ dhcp-arp.o dhcp-icmp.o dhcp-log.o dhcp-snprintf.o \ ! dhcp-sniffer-ohandlers.o dhcp-rtt.o dhcp-interface.o \ ! dhcp-stringbuffer.o dhcpsniff_DEPENDENCIES = dhcpsniff_LDFLAGS = *************** *** 128,134 **** dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ dhcp-route.o dhcp-globconf.o dhcp-stringbuffer.o dhcp-parser.o \ ! dhcp-varfile.o dhcpclient_DEPENDENCIES = dhcpclient_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) --- 122,139 ---- dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ dhcp-route.o dhcp-globconf.o dhcp-stringbuffer.o dhcp-parser.o \ ! dhcp-varfile.o dhcp-exception.o dhcpclient_DEPENDENCIES = dhcpclient_LDFLAGS = + dhcptest_OBJECTS = dhcp-test.o dhcp-util.o dhcp-align.o dhcp-net.o \ + dhcp-list.o dhcp-com.o dhcp-eth.o dhcp-ip.o dhcp-udp.o dhcp-arp.o \ + dhcp-icmp.o dhcp-log.o dhcp-daemon.o dhcp-client-cache.o \ + dhcp-cache-entry.o dhcp-client-control.o dhcp-interface.o \ + dhcp-client-conf.o dhcp-snprintf.o dhcp-files.o dhcp-client-states.o \ + dhcp-options-strings.o dhcp-convert.o dhcp-sysconf.o dhcp-rtt.o \ + dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ + dhcp-route.o dhcp-globconf.o dhcp-stringbuffer.o dhcp-parser.o \ + dhcp-varfile.o dhcp-exception.o + dhcptest_DEPENDENCIES = + dhcptest_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) *************** *** 154,167 **** .deps/dhcp-client-states.P .deps/dhcp-client.P .deps/dhcp-com.P \ .deps/dhcp-convert.P .deps/dhcp-daemon.P .deps/dhcp-eth.P \ ! .deps/dhcp-files.P .deps/dhcp-globconf.P .deps/dhcp-icmp-discovery.P \ ! .deps/dhcp-icmp.P .deps/dhcp-interface.P .deps/dhcp-ip.P \ ! .deps/dhcp-list.P .deps/dhcp-log.P .deps/dhcp-net.P \ .deps/dhcp-options-strings.P .deps/dhcp-packet-build.P \ .deps/dhcp-parser.P .deps/dhcp-print.P .deps/dhcp-route.P \ .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ .deps/dhcp-snprintf.P .deps/dhcp-stringbuffer.P .deps/dhcp-sysconf.P \ ! .deps/dhcp-udp.P .deps/dhcp-util.P .deps/dhcp-varfile.P ! SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) ! OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) all: all-redirect --- 159,173 ---- .deps/dhcp-client-states.P .deps/dhcp-client.P .deps/dhcp-com.P \ .deps/dhcp-convert.P .deps/dhcp-daemon.P .deps/dhcp-eth.P \ ! .deps/dhcp-exception.P .deps/dhcp-files.P .deps/dhcp-globconf.P \ ! .deps/dhcp-icmp-discovery.P .deps/dhcp-icmp.P .deps/dhcp-interface.P \ ! .deps/dhcp-ip.P .deps/dhcp-list.P .deps/dhcp-log.P .deps/dhcp-net.P \ .deps/dhcp-options-strings.P .deps/dhcp-packet-build.P \ .deps/dhcp-parser.P .deps/dhcp-print.P .deps/dhcp-route.P \ .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ .deps/dhcp-snprintf.P .deps/dhcp-stringbuffer.P .deps/dhcp-sysconf.P \ ! .deps/dhcp-test.P .deps/dhcp-udp.P .deps/dhcp-util.P \ ! .deps/dhcp-varfile.P ! SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) $(dhcptest_SOURCES) ! OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) $(dhcptest_OBJECTS) all: all-redirect *************** *** 259,262 **** --- 265,272 ---- @rm -f dhcpclient $(LINK) $(dhcpclient_LDFLAGS) $(dhcpclient_OBJECTS) $(dhcpclient_LDADD) $(LIBS) + + dhcptest: $(dhcptest_OBJECTS) $(dhcptest_DEPENDENCIES) + @rm -f dhcptest + $(LINK) $(dhcptest_LDFLAGS) $(dhcptest_OBJECTS) $(dhcptest_LDADD) $(LIBS) install-man1: Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-client-cache.c 17 Jun 2002 13:23:07 -0000 1.12 --- dhcp-client-cache.c 22 Jun 2002 18:11:25 -0000 1.13 *************** *** 27,31 **** #include <dhcp-util.h> #include <dhcp-files.h> - #include <dhcp-stringbuffer.h> #include <dhcp-parser.h> #include <dhcp-varfile.h> --- 27,30 ---- Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-client-conf.c 17 Jun 2002 13:23:07 -0000 1.11 --- dhcp-client-conf.c 22 Jun 2002 18:11:25 -0000 1.12 *************** *** 26,30 **** #include <dhcp-util.h> #include <dhcp-files.h> - #include <dhcp-stringbuffer.h> #include <dhcp-parser.h> #include <dhcp-varfile.h> --- 26,29 ---- Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-globconf.c 17 Jun 2002 13:23:08 -0000 1.8 --- dhcp-globconf.c 22 Jun 2002 18:11:25 -0000 1.9 *************** *** 33,37 **** #include <dhcp-files.h> #include <dhcp-convert.h> - #include <dhcp-stringbuffer.h> #include <dhcp-parser.h> #include <dhcp-varfile.h> --- 33,36 ---- Index: dhcp-stringbuffer.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-stringbuffer.c 18 Jun 2002 23:24:30 -0000 1.5 --- dhcp-stringbuffer.c 22 Jun 2002 18:11:25 -0000 1.6 *************** *** 24,28 **** #include <dhcp-agent.h> - #include <dhcp-stringbuffer.h> #include <dhcp-util.h> --- 24,27 ---- *************** *** 387,389 **** --- 386,446 ---- { stringbuffer_avprintf_align(sb, 0, 0, fmt, ap); + } + + /* mark newlines to walk through. + * our sentinel is the null terminator. + * two null terminations marks the end of the string. + * we're guaranteed it is a unique sentinel since + * we never accept null terminators from outside sources + * and never build our own strings (obviously!) with + * null terminators inside of them. + */ + void stringbuffer_marknewlines(stringbuffer *sb) + { + char *c; + + /* first append one null termination to the end + * to act as a proper terminator. */ + stringbuffer_append_c(sb, 0); + + + c = sb->buf; + while(1) { + + if(*c == '\n') + *c = 0; + + c++; + if(*c == 0) + break; + } + + return; + } + + /* called _after_ newlines are marked. */ + char *stringbuffer_getnextline(stringbuffer *sb, char *c) + { + char *ptr; + + if(c == NULL) { + + /* get first line. */ + c = sb->buf; + + } else { + + /* check for end. */ + if(*c == 0 && (*(c + 1)) == 0) + return NULL; + + else { + /* otherwise move to next line and return */ + c++; + for(ptr = c;*ptr != 0;ptr++); + c = ptr + 1; + } + } + + return c; } Index: dhcp-stringbuffer.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-stringbuffer.h 17 Jun 2002 13:23:08 -0000 1.4 --- dhcp-stringbuffer.h 22 Jun 2002 18:11:25 -0000 1.5 *************** *** 45,48 **** --- 45,50 ---- extern void stringbuffer_append_c(stringbuffer *sb, char c); extern void stringbuffer_clear(stringbuffer *sb); + extern char *stringbuffer_getnextline(stringbuffer *sb, char *c); + extern void stringbuffer_marknewlines(stringbuffer *sb); extern void stringbuffer_set(stringbuffer *dest, const char *s); Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dhcp-util.c 22 Jun 2002 01:47:57 -0000 1.19 --- dhcp-util.c 22 Jun 2002 18:11:25 -0000 1.20 *************** *** 90,93 **** --- 90,122 ---- } + /* send error message and exit. (convenience) */ + void fatal_error_exception(stringbuffer *exception_string) + { + char *c = NULL; + if(verbosity_level == QUIET_VERBOSITY_LEVEL) + return; + + stringbuffer_marknewlines(exception_string); + + if(interactive == 1) + fprintf(stderr, "%s: fatal error\n", getprogname()); + + while(1) { + + c = stringbuffer_getnextline(exception_string, c); + if(c == NULL) + break; + + if(interactive == 1) { + fprintf(stderr, "%s: %s", getprogname(), c); + fprintf(stderr,"\n"); + } else + error_log(c); + + } + + exit(1); + } + /* send info message */ void info_message(char *fmt, ...) Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-util.h 22 Jun 2002 01:47:57 -0000 1.6 --- dhcp-util.h 22 Jun 2002 18:11:25 -0000 1.7 *************** *** 26,29 **** --- 26,31 ---- #define DHCP_UTIL_H + #include <dhcp-stringbuffer.h> + /* Utility functions. */ *************** *** 38,41 **** --- 40,44 ---- extern void warn_message(char *fmt, ...); extern void debug_message(char *fmt, ...); + extern void fatal_error_exception(stringbuffer *exception_string); extern int get_verbosity_level(void); Index: dhcp-varfile.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-varfile.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-varfile.c 17 Jun 2002 13:23:08 -0000 1.2 --- dhcp-varfile.c 22 Jun 2002 18:11:25 -0000 1.3 *************** *** 26,30 **** #include <dhcp-agent.h> #include <dhcp-util.h> - #include <dhcp-stringbuffer.h> #include <dhcp-files.h> #include <dhcp-parser.h> --- 26,29 ---- |
From: <act...@us...> - 2002-06-22 02:12:06
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv13997 Modified Files: dhcp-sniff.c Log Message: dhcpsniff now looks for availabel interfaces Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-sniff.c 22 Jun 2002 01:47:57 -0000 1.11 --- dhcp-sniff.c 22 Jun 2002 02:12:03 -0000 1.12 *************** *** 46,50 **** { int c; ! char *interface_name = "eth0"; rawnet_t *net; int retval; --- 46,50 ---- { int c; ! char *interface_name = NULL; rawnet_t *net; int retval; *************** *** 52,55 **** --- 52,56 ---- char filter_buff[GENERIC_BUFFSIZE]; print_packet p_packet = print_dhcp_packet_verbose; + list_t *available_interfaces; #if !defined(HAVE_PROGNAME) *************** *** 79,82 **** --- 80,98 ---- } + if(interface_name == NULL) { + + /* get the first available on. */ + available_interfaces = interface_get_active_interfaces(); + + if(available_interfaces != NULL) { + + interface_name = strdup(available_interfaces->data); + purge_list(available_interfaces, NULL); + + } else { + fatal_error("%s: could not find suitable interface.", getprogname()); + } + } + /* Get port numbers from services db. */ *************** *** 84,92 **** sport = port_for_service("bootpc", "udp"); ! if(dport == -1 || sport == -1) ! fatal_error("could not lookup dhcp services in service db: %s", strerror(errno)); ! dport = ntohs(dport); ! sport = ntohs(sport); snprintf(filter_buff, sizeof(filter_buff), "arp or icmp or (udp and (port %d or port %d))", dport, sport); --- 100,113 ---- sport = port_for_service("bootpc", "udp"); ! if(dport == -1 || sport == -1) { ! dport = BOOTP_CLIENT; ! sport = BOOTP_SERVER; ! ! } else { ! ! dport = ntohs(dport); ! sport = ntohs(sport); ! } snprintf(filter_buff, sizeof(filter_buff), "arp or icmp or (udp and (port %d or port %d))", dport, sport); |
From: <act...@us...> - 2002-06-22 01:48:00
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8595 Modified Files: dhcp-agent.h dhcp-arp-discovery.c dhcp-client-control.c dhcp-client-states.c dhcp-icmp-discovery.c dhcp-interface.c dhcp-net.c dhcp-packet-build.c dhcp-sniff.c dhcp-sysconf.c dhcp-util.c dhcp-util.h Added Files: dhcp-net.h Log Message: fixed up previous additions; moved rawnet into its own header file; some bsd fixes but we're still waiting on libdnet response to bugreport --- NEW FILE: dhcp-net.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.h,v 1.1 2002/06/22 01:47:57 actmodern Exp $ * * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #ifndef DHCP_NET_H #define DHCP_NET_H /* Raw net types for packets. */ #define RAWNET_UNKNOWN 0 #define RAWNET_ARP 1 #define RAWNET_ICMP 2 #define RAWNET_DHCP 3 /* Raw net return types when * receiving packets. */ #define RAWNET_OK 0 #define RAWNET_PCAP_ERROR -1 #define RAWNET_MALFORMED_PACKET -2 #define RAWNET_UNHANDLED -3 #define RAWNET_TIMEOUT -4 /* Net/Rawnet routines. */ extern rawnet_t *rawnet_create(char *device, char *filter, int sport, int dport, int promiscuous); extern void rawnet_destroy(rawnet_t *net); extern int rawnet_get_packet(rawnet_t *net); extern int rawnet_get_hw_addr(rawnet_t *net, eth_addr_t *addr); extern int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr); extern int rawnet_get_ip_addr(rawnet_t *net, ip_addr_t *addr); extern char *rawnet_strerror(rawnet_t *net); extern int rawnet_send_packet(rawnet_t *net); extern void rawnet_use_fake_hw_addr(rawnet_t *raw, char *mac_string); extern void reinitialize_rawnet(rawnet_t *net, int promiscuous); extern int rawnet_up(rawnet_t *net); extern void rawnet_down(rawnet_t *net); extern int rawnet_packet_transact(rawnet_t *net, void *arg, void (*update)(void *arg), int (*check)(void *arg)); extern int rawnet_interface_up(rawnet_t *net, ip_addr_t addr, ip_addr_t netmask, int mtu); extern int rawnet_interface_down(rawnet_t *net); extern void rawnet_dhcp_update(rawnet_t *net, time_t seconds); extern int rawnet_wait(rawnet_t *net, struct timeval *tm); extern int rawnet_is_dhcp_offer(rawnet_t *net); extern int rawnet_is_valid(rawnet_t *net); #endif Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** dhcp-agent.h 18 Jun 2002 04:33:40 -0000 1.60 --- dhcp-agent.h 22 Jun 2002 01:47:57 -0000 1.61 *************** *** 266,270 **** typedef struct { intf_t *interface_handle; ! struct intf_entry interface_entry; } interface_control_t; --- 266,270 ---- typedef struct { intf_t *interface_handle; ! struct intf_entry *interface_entry; } interface_control_t; *************** *** 434,452 **** # define NETBIOS_H_NODE 0x06 - /* Raw net type. */ - - #define RAWNET_UNKNOWN 0 - #define RAWNET_ARP 1 - #define RAWNET_ICMP 2 - #define RAWNET_DHCP 3 - - /* Raw net return types. */ - - #define RAWNET_OK 0 - #define RAWNET_PCAP_ERROR -1 - #define RAWNET_MALFORMED_PACKET -2 - #define RAWNET_UNHANDLED -3 - #define RAWNET_TIMEOUT -4 - /* DHCP states * We use these internally --- 434,437 ---- *************** *** 492,510 **** extern void cache_entry_purge_list(list_t *cache_list); ! /* Net/Rawnet routines. */ ! ! extern int port_for_service(const char *serv, const char *proto); ! extern int resolv(char *address, uint32_t *addr); ! ! extern rawnet_t *rawnet_create(char *device, char *filter, int sport, int dport, int promiscuous); ! extern void rawnet_destroy(rawnet_t *net); ! extern int rawnet_get_packet(rawnet_t *net); ! extern int rawnet_get_hw_addr(rawnet_t *net, eth_addr_t *addr); ! extern int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr); ! extern int rawnet_get_ip_addr(rawnet_t *net, ip_addr_t *addr); ! extern char *rawnet_strerror(rawnet_t *net); ! extern int rawnet_send_packet(rawnet_t *net); ! extern void rawnet_use_fake_hw_addr(rawnet_t *raw, char *mac_string); ! extern void reinitialize_rawnet(rawnet_t *net, int promiscuous); extern void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options); --- 477,481 ---- extern void cache_entry_purge_list(list_t *cache_list); ! /* packet building routines. */ extern void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options); *************** *** 526,535 **** extern void build_unarp(rawnet_t *net, uint32_t source_addr, eth_addr_t source_hw_addr); - - extern void rawnet_dhcp_update(rawnet_t *net, time_t seconds); - extern int rawnet_wait(rawnet_t *net, struct timeval *tm); - extern int rawnet_is_dhcp_offer(rawnet_t *net); - extern int rawnet_is_valid(rawnet_t *net); - extern void build_icmp_mask_request(rawnet_t *net, uint32_t id, uint32_t seq); extern void build_icmp_mask_reply(rawnet_t *net, uint32_t id, uint32_t seq, uint32_t subnet_mask); --- 497,500 ---- *************** *** 537,550 **** eth_addr_t source_mac, eth_addr_t dest_mac, uint32_t id, uint32_t seq); - - extern int rawnet_up(rawnet_t *net); - extern void rawnet_down(rawnet_t *net); - - extern int rawnet_packet_transact(rawnet_t *net, void *arg, - void (*update)(void *arg), - int (*check)(void *arg)); - - extern int rawnet_interface_up(rawnet_t *net, ip_addr_t addr, ip_addr_t netmask, int mtu); - extern int rawnet_interface_down(rawnet_t *net); /* ICMP discovery routines. */ --- 502,505 ---- Index: dhcp-arp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp-discovery.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-arp-discovery.c 17 Jun 2002 13:23:07 -0000 1.5 --- dhcp-arp-discovery.c 22 Jun 2002 01:47:57 -0000 1.6 *************** *** 25,28 **** --- 25,29 ---- #include <dhcp-agent.h> #include <dhcp-util.h> + #include <dhcp-net.h> /* Accept a list of arguments. Will contain rawnet first, and Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dhcp-client-control.c 17 Jun 2002 13:23:07 -0000 1.21 --- dhcp-client-control.c 22 Jun 2002 01:47:57 -0000 1.22 *************** *** 25,28 **** --- 25,29 ---- #include <dhcp-util.h> #include <dhcp-globconf.h> + #include <dhcp-net.h> /* Utility routines to update counters and time stamps. */ Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** dhcp-client-states.c 19 Jun 2002 01:35:46 -0000 1.30 --- dhcp-client-states.c 22 Jun 2002 01:47:57 -0000 1.31 *************** *** 30,33 **** --- 30,34 ---- #include <dhcp-sysconf.h> #include <dhcp-globconf.h> + #include <dhcp-net.h> /* Along with the parameter request list we always build these options Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-icmp-discovery.c 17 Jun 2002 13:23:08 -0000 1.15 --- dhcp-icmp-discovery.c 22 Jun 2002 01:47:57 -0000 1.16 *************** *** 31,34 **** --- 31,35 ---- #include <dhcp-globconf.h> #include <dhcp-convert.h> + #include <dhcp-net.h> /* Check for icmp mask response. */ Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-interface.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-interface.c 17 Jun 2002 13:23:08 -0000 1.18 --- dhcp-interface.c 22 Jun 2002 01:47:57 -0000 1.19 *************** *** 30,38 **** /* Internal utilities */ static int interface_get_info(interface_control_t *ic) { ! if(intf_get(ic->interface_handle, &ic->interface_entry) < 0) { ! error_message("interface_control: could not lookup interface %s : %d", ic->interface_entry.intf_name, strerror(errno)); return -1; --- 30,39 ---- /* Internal utilities */ + /* get interface info. */ static int interface_get_info(interface_control_t *ic) { ! if(intf_get(ic->interface_handle, ic->interface_entry) < 0) { ! error_message("interface_control: could not lookup interface %s : %s", ic->interface_entry->intf_name, strerror(errno)); return -1; *************** *** 42,49 **** } static int interface_set_info(interface_control_t *ic) { ! if(intf_set(ic->interface_handle, &ic->interface_entry) < 0) { ! error_message("interface_control: could not lookup interface %s : %d", ic->interface_entry.intf_name, strerror(errno)); return -1; --- 43,51 ---- } + /* set interface info. */ static int interface_set_info(interface_control_t *ic) { ! if(intf_set(ic->interface_handle, ic->interface_entry) < 0) { ! error_message("interface_control: could not lookup interface %s : %s", ic->interface_entry->intf_name, strerror(errno)); return -1; *************** *** 57,60 **** --- 59,63 ---- { interface_control_t *ic; + void *buf; ic = xcalloc(sizeof(interface_control_t)); *************** *** 64,69 **** fatal_error("interface_control: could not acquire interface handler"); ! strncpy(ic->interface_entry.intf_name, name, sizeof(ic->interface_entry.intf_name) -1); ! ic->interface_entry.intf_name[sizeof(ic->interface_entry.intf_name) -1] = 0; return ic; --- 67,74 ---- fatal_error("interface_control: could not acquire interface handler"); ! buf = xcalloc(1024); ! ic->interface_entry = buf; ! strncpy(ic->interface_entry->intf_name, name, sizeof(ic->interface_entry->intf_name) -1); ! ic->interface_entry->intf_name[sizeof(ic->interface_entry->intf_name) -1] = 0; return ic; *************** *** 73,76 **** --- 78,82 ---- { intf_close(ic->interface_handle); + xfree(ic->interface_entry); xfree(ic); } *************** *** 83,87 **** return -1; ! return(ic->interface_entry.intf_flags&INTF_FLAG_UP); } --- 89,93 ---- return -1; ! return(ic->interface_entry->intf_flags&INTF_FLAG_UP); } *************** *** 94,103 **** /* Set address if needed. */ ! ! if(addr != INADDR_ANY) { ! ic->interface_entry.intf_addr.addr_type = ADDR_TYPE_IP; ! addr_mtob(&netmask, IP_ADDR_LEN, ! &ic->interface_entry.intf_addr.addr_bits); ! memcpy(&ic->interface_entry.intf_addr.addr_ip, &addr, IP_ADDR_LEN); } --- 100,109 ---- /* Set address if needed. */ ! ! if(addr != 0) { ! ic->interface_entry->intf_addr.addr_type = ADDR_TYPE_IP; ! addr_mtob(&netmask, IP_ADDR_LEN, ! &ic->interface_entry->intf_addr.addr_bits); ! memcpy(&ic->interface_entry->intf_addr.addr_ip, &addr, IP_ADDR_LEN); } *************** *** 105,113 **** if(mtu != -1) ! ic->interface_entry.intf_mtu = mtu; else ! ic->interface_entry.intf_mtu = DEFAULT_MTU; ! ic->interface_entry.intf_flags |= INTF_FLAG_UP; if(interface_set_info(ic)) --- 111,119 ---- if(mtu != -1) ! ic->interface_entry->intf_mtu = mtu; else ! ic->interface_entry->intf_mtu = DEFAULT_MTU; ! ic->interface_entry->intf_flags |= INTF_FLAG_UP; if(interface_set_info(ic)) *************** *** 124,128 **** return -1; ! ic->interface_entry.intf_flags &= ~INTF_FLAG_UP; if(interface_set_info(ic)) --- 130,134 ---- return -1; ! ic->interface_entry->intf_flags &= ~INTF_FLAG_UP; if(interface_set_info(ic)) *************** *** 138,142 **** return -1; ! memcpy(addr, &ic->interface_entry.intf_addr.addr_ip, IP_ADDR_LEN); return 0; --- 144,148 ---- return -1; ! memcpy(addr, &ic->interface_entry->intf_addr.addr_ip, IP_ADDR_LEN); return 0; *************** *** 235,236 **** --- 241,243 ---- return(interfaces_get_proc(check_interface_down)); } + Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dhcp-net.c 17 Jun 2002 13:23:08 -0000 1.27 --- dhcp-net.c 22 Jun 2002 01:47:57 -0000 1.28 *************** *** 51,61 **** * to set the destination ethernet header * accordingly. ! * ! * Currently we implement these features by ! * using libpcap for receiving packets, ! * and libdnet for sending them. ! * * The only limitation here is that we can only ! * do DHCP over ethernet which is fine. * */ --- 51,57 ---- * to set the destination ethernet header * accordingly. ! * * The only limitation here is that we can only ! * do DHCP over ethernet which is fine -- for now. * */ *************** *** 64,109 **** #include <dhcp-util.h> #include <dhcp-rtt.h> ! ! /* Get port number for named service. */ ! ! int port_for_service(const char *serv, const char *proto) ! { ! struct servent *sv; ! ! setservent(0); ! ! if((sv = getservbyname(serv, proto)) == NULL) { ! error_message("rawnet: could not get service listing: %d", strerror(errno)); ! return -1; ! } ! ! return(sv->s_port); ! } ! ! /* Returns 0 on success or -1 if error. ! * Fills in addr with 32-bit ipv4 address */ ! ! extern int h_errno; ! ! int resolv(char *address, uint32_t *addr) ! { ! struct hostent *host; ! ! *(addr) = inet_addr(address); ! ! if(*(addr) == INADDR_NONE) { ! ! host = gethostbyname(address); ! ! if(host == NULL) { ! error_message("rawnet: unable to resolv host: %s", hstrerror(h_errno)); ! return -1; ! } ! ! memcpy(&addr, (int *) * &host->h_addr, sizeof(addr)); ! } ! ! return 0; ! } /* get interface address. */ --- 60,64 ---- #include <dhcp-util.h> #include <dhcp-rtt.h> ! #include <dhcp-net.h> /* get interface address. */ *************** *** 228,241 **** net->promiscuous = promiscuous; - /* Get the interface and make sure its an ethernet interface or - * else we're hosed. */ - - net->eth = eth_open(device); - if(net->eth == NULL) { - error_message("rawnet: device not supported or unavailable: %s", device); - rawnet_destroy(net); - return NULL; - } - /* get the interface handle for bringing it up or down and querying it. */ net->intf_handle = create_interface_control(net->device); --- 183,186 ---- *************** *** 246,254 **** /* Is the interface up? */ ! if(!interface_is_up(net->intf_handle)) ! rawnet_interface_up(net, 0, 0xffffff, -1); /* then bring it up with dum values. */ ! /* get pcap handler */ net->pcap = initialize_pcap_device(device, filter, promiscuous); if(net->pcap == NULL) { --- 191,213 ---- /* Is the interface up? */ ! if(!interface_is_up(net->intf_handle)) { ! /* then bring it up with dum values. */ ! if(rawnet_interface_up(net, 0, 0xffffff, -1)) { ! rawnet_destroy(net); ! return NULL; ! } ! } ! /* Get the interface and make sure its an ethernet interface or ! * else we're hosed. */ ! ! net->eth = eth_open(device); ! if(net->eth == NULL) { ! error_message("rawnet: device not supported or unavailable: %s: %s", device, strerror(errno)); ! rawnet_destroy(net); ! return NULL; ! } + /* get pcap handler */ net->pcap = initialize_pcap_device(device, filter, promiscuous); if(net->pcap == NULL) { *************** *** 259,263 **** net->pcap_fd = pcap_fileno(net->pcap); if(net->pcap_fd < 0) { ! error_message("rawnet: cannot get descriptor for %s, this system may not be supported.", device); rawnet_destroy(net); return NULL; --- 218,222 ---- net->pcap_fd = pcap_fileno(net->pcap); if(net->pcap_fd < 0) { ! error_message("rawnet: cannot get descriptor for %s, this system may is not supported.", device); rawnet_destroy(net); return NULL; *************** *** 271,275 **** rawnet_get_ip_addr(net, &net->ip_addr); ! /* Build packet handler objects. * * These exit on failure. --- 230,234 ---- rawnet_get_ip_addr(net, &net->ip_addr); ! /* Packet handler objects. * * These exit on failure. *************** *** 312,318 **** eth_close(net->eth); ! if(net->intf_handle) { destroy_interface_control(net->intf_handle); - } if(net->pcap != NULL) --- 271,276 ---- eth_close(net->eth); ! if(net->intf_handle) destroy_interface_control(net->intf_handle); if(net->pcap != NULL) Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-packet-build.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-packet-build.c 17 Jun 2002 13:23:08 -0000 1.5 --- dhcp-packet-build.c 22 Jun 2002 01:47:57 -0000 1.6 *************** *** 28,31 **** --- 28,32 ---- #include <dhcp-agent.h> #include <dhcp-util.h> + #include <dhcp-net.h> /* constants we need. */ Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-sniff.c 18 Jun 2002 04:33:40 -0000 1.10 --- dhcp-sniff.c 22 Jun 2002 01:47:57 -0000 1.11 *************** *** 28,31 **** --- 28,32 ---- #include <dhcp-util.h> #include <dhcp-print.h> + #include <dhcp-net.h> int interactive = 1; Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dhcp-sysconf.c 17 Jun 2002 13:23:08 -0000 1.19 --- dhcp-sysconf.c 22 Jun 2002 01:47:57 -0000 1.20 *************** *** 30,33 **** --- 30,34 ---- #include <dhcp-convert.h> #include <dhcp-sysconf.h> + #include <dhcp-net.h> /* Only use handlers here which can be done in any order. *************** *** 213,217 **** info_message("configuring interface: %s", dc->interface); ! for(list_ptr = options;list_ptr;list_ptr = list_ptr->next) { --- 214,218 ---- info_message("configuring interface: %s", dc->interface); ! for(list_ptr = options;list_ptr;list_ptr = list_ptr->next) { *************** *** 249,253 **** if(!have_addr && !have_netmask) fatal_error("do not have enough settings for interface configuration!"); - if(rawnet_interface_up(dc->rawnet, addr, netmask, mtu)) fatal_error("could not bring up interface: %s", dc->interface); --- 250,253 ---- *************** *** 273,277 **** /* we need to setup the interface ourselves before * anything (route won't work otherwise.) */ - for(list_ptr = options;list_ptr;list_ptr = list_ptr->next) { --- 273,276 ---- Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-util.c 19 Jun 2002 00:57:16 -0000 1.18 --- dhcp-util.c 22 Jun 2002 01:47:57 -0000 1.19 *************** *** 591,592 **** --- 591,634 ---- return have_io; } + + /* Get port number for named service. */ + + int port_for_service(const char *serv, const char *proto) + { + struct servent *sv; + + setservent(0); + + if((sv = getservbyname(serv, proto)) == NULL) { + error_message("rawnet: could not get service listing: %d", strerror(errno)); + return -1; + } + + return(sv->s_port); + } + + /* Returns 0 on success or -1 if error. + * Fills in addr with 32-bit ipv4 address */ + + extern int h_errno; + + int resolv(char *address, uint32_t *addr) + { + struct hostent *host; + + *(addr) = inet_addr(address); + + if(*(addr) == INADDR_NONE) { + + host = gethostbyname(address); + + if(host == NULL) { + error_message("rawnet: unable to resolv host: %s", hstrerror(h_errno)); + return -1; + } + + memcpy(&addr, (int *) * &host->h_addr, sizeof(addr)); + } + + return 0; + } Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-util.h 19 Jun 2002 00:57:16 -0000 1.5 --- dhcp-util.h 22 Jun 2002 01:47:57 -0000 1.6 *************** *** 66,69 **** --- 66,71 ---- extern void track_sigio(void); extern int had_io(void); + extern int resolv(char *address, uint32_t *addr); + extern int port_for_service(const char *serv, const char *proto); #endif /* DHCP_UTIL_H */ |
From: <act...@us...> - 2002-06-19 01:35:52
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv26819 Modified Files: dhcp-client-states.c Log Message: fix to stupid alarm change Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** dhcp-client-states.c 19 Jun 2002 00:40:12 -0000 1.29 --- dhcp-client-states.c 19 Jun 2002 01:35:46 -0000 1.30 *************** *** 294,307 **** rawnet_down(dc->rawnet); - while(1) { - alarm_time.tv_sec = dc->renewal_time; - alarm_time.tv_usec = 0; ! set_alarm(alarm_time); ! suspend_for_interrupts(); /* if we got a shutdown or HUP it will be caught later. */ ! if(had_alarm()) ! break; /* FIXME: decrement timer. */ ! } rawnet_up(dc->rawnet); --- 294,304 ---- rawnet_down(dc->rawnet); ! alarm_time.tv_sec = dc->renewal_time; ! alarm_time.tv_usec = 0; ! set_alarm(alarm_time); ! ! suspend_for_interrupts(); /* if we got a shutdown or HUP it will be caught later. */ rawnet_up(dc->rawnet); |
From: <act...@us...> - 2002-06-19 00:57:19
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv18809 Modified Files: dhcp-util.c dhcp-util.h Log Message: added remove_alarm Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-util.c 19 Jun 2002 00:40:12 -0000 1.17 --- dhcp-util.c 19 Jun 2002 00:57:16 -0000 1.18 *************** *** 267,270 **** --- 267,289 ---- } + void remove_interrupt(int sig) + { + sigset_t signal_set; + + sigemptyset(&signal_set); + sigaddset(&signal_set, sig); + + if(sigpending(&signal_set)) { + add_interrupt_handler(sig, SIG_IGN); + sigfillset(&signal_set); + sigdelset(&signal_set, SIGALRM); + + sigsuspend(&signal_set); + add_interrupt_handler(sig, SIG_DFL); + } + + return; + } + /* String routines. */ *************** *** 500,508 **** } /* will trigger alarm for one time only. */ void set_alarm(struct timeval alarm_time) { struct itimerval timer; - struct timeval disarm_timer = { 0, 0 }; timer.it_interval = alarm_time; --- 519,528 ---- } + static struct timeval disarm_timer = { 0, 0 }; + /* will trigger alarm for one time only. */ void set_alarm(struct timeval alarm_time) { struct itimerval timer; timer.it_interval = alarm_time; *************** *** 524,527 **** --- 544,562 ---- } + void remove_alarm(void) + { + struct itimerval timer; + + timer.it_interval = disarm_timer; + timer.it_value = disarm_timer; + + setitimer(ITIMER_REAL, &timer, NULL); + + /* now make sure we don't have a pending SIGARLM. */ + remove_interrupt(SIGALRM); + + return; + } + /* sigio handling routine and variable. * we only need to use this on *BSD *************** *** 547,550 **** --- 582,586 ---- void track_sigio(void) { + have_io = 0; add_interrupt_handler(SIGIO, handle_sigio); return; *************** *** 553,560 **** int had_io(void) { ! if(have_io) { ! have_io = 0; ! return 1; ! } else ! return 0; } --- 589,592 ---- int had_io(void) { ! return have_io; } Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-util.h 19 Jun 2002 00:40:12 -0000 1.4 --- dhcp-util.h 19 Jun 2002 00:57:16 -0000 1.5 *************** *** 49,54 **** --- 49,56 ---- extern void block_interrupts(void); extern void add_interrupt_handler(int sigtype, void (*sighandler)(int)); + extern void remove_interrupt(int sig); extern int had_alarm(void); extern void set_alarm(struct timeval alarm_time); + extern void remove_alarm(void); extern void info_message(char *fmt, ...); extern char *splice_string(const char *s1, const char *s2); |
From: <act...@us...> - 2002-06-19 00:40:16
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv14327 Modified Files: dhcp-client-states.c dhcp-util.c dhcp-util.h Log Message: updated dhcp-util.c for BSD SIGIO support on bpf device Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** dhcp-client-states.c 18 Jun 2002 04:33:40 -0000 1.28 --- dhcp-client-states.c 19 Jun 2002 00:40:12 -0000 1.29 *************** *** 31,54 **** #include <dhcp-globconf.h> - /* alarm handling routine and variable. */ - - /* wrap for volatine integers, or proper sig_atomic_t types. */ - - #ifdef HAVE_SIG_ATOMIC_T - - static sig_atomic_t have_alarm = 0; - - #else /* HAVE_SIG_ATOMIC_T */ - - static int have_alarm = 0; - - #endif - - static RETSIGTYPE handle_alarm(int i) - { - have_alarm = 1; - return (RETSIGTYPE) 0; - } - /* Along with the parameter request list we always build these options * upon creating new dhcp packets. */ --- 31,34 ---- *************** *** 302,305 **** --- 282,286 ---- int client_wait(dhcp_client_control_t *dc) { + struct timeval alarm_time; /* * setup signal based on renewal time *************** *** 310,324 **** * FIXME: (check RFC compliance) */ - - add_interrupt_handler(SIGALRM, handle_alarm); rawnet_down(dc->rawnet); ! alarm(dc->renewal_time); ! suspend_for_interrupts(); /* if we got a shutdown or HUP it will be caught later. */ ! if(have_alarm) { ! have_alarm = 0; ! } ! rawnet_up(dc->rawnet); --- 291,308 ---- * FIXME: (check RFC compliance) */ rawnet_down(dc->rawnet); ! while(1) { ! alarm_time.tv_sec = dc->renewal_time; ! alarm_time.tv_usec = 0; ! ! set_alarm(alarm_time); ! ! suspend_for_interrupts(); /* if we got a shutdown or HUP it will be caught later. */ ! if(had_alarm()) ! break; /* FIXME: decrement timer. */ ! } ! rawnet_up(dc->rawnet); Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-util.c 17 Jun 2002 13:23:08 -0000 1.16 --- dhcp-util.c 19 Jun 2002 00:40:12 -0000 1.17 *************** *** 225,229 **** fatal_error("could not set signal handler for: %d", sigtype); - return; } --- 225,228 ---- *************** *** 480,481 **** --- 479,560 ---- #endif /* HAVE_GETPROGNAME */ + + /* alarm handling routine and variable. */ + + /* wrap for volatine integers, or proper sig_atomic_t types. */ + + #ifdef HAVE_SIG_ATOMIC_T + + static sig_atomic_t have_alarm = 0; + + #else /* HAVE_SIG_ATOMIC_T */ + + static volatile int have_alarm = 0; + + #endif + + static RETSIGTYPE handle_alarm(int i) + { + have_alarm = 1; + return (RETSIGTYPE) 0; + } + + /* will trigger alarm for one time only. */ + void set_alarm(struct timeval alarm_time) + { + struct itimerval timer; + struct timeval disarm_timer = { 0, 0 }; + + timer.it_interval = alarm_time; + timer.it_value = disarm_timer; + + have_alarm = 0; + add_interrupt_handler(SIGALRM, handle_alarm); + + /* that's it. after this the timer is ticking. */ + setitimer(ITIMER_REAL, &timer, NULL); + + return; + } + + /* tells us whether we received an alarm or not.*/ + int had_alarm(void) + { + return have_alarm; + } + + /* sigio handling routine and variable. + * we only need to use this on *BSD + * with broken BPF which can't handle a select(). */ + + /* wrap for volatine integers, or proper sig_atomic_t types. */ + + #ifdef HAVE_SIG_ATOMIC_T + + static sig_atomic_t have_io = 0; + + #else /* HAVE_SIG_ATOMIC_T */ + + static volatile int have_io = 0; + + #endif + + static RETSIGTYPE handle_sigio(int i) + { + have_io = 1; + } + + void track_sigio(void) + { + add_interrupt_handler(SIGIO, handle_sigio); + return; + } + + int had_io(void) + { + if(have_io) { + have_io = 0; + return 1; + } else + return 0; + } Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-util.h 17 Jun 2002 13:23:08 -0000 1.3 --- dhcp-util.h 19 Jun 2002 00:40:12 -0000 1.4 *************** *** 49,52 **** --- 49,54 ---- extern void block_interrupts(void); extern void add_interrupt_handler(int sigtype, void (*sighandler)(int)); + extern int had_alarm(void); + extern void set_alarm(struct timeval alarm_time); extern void info_message(char *fmt, ...); extern char *splice_string(const char *s1, const char *s2); *************** *** 60,63 **** --- 62,67 ---- extern struct timeval timeval_diff(struct timeval begin, struct timeval end); extern const char *getprogname(void); + extern void track_sigio(void); + extern int had_io(void); #endif /* DHCP_UTIL_H */ |
From: <act...@us...> - 2002-06-18 23:24:33
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv28582 Modified Files: dhcp-stringbuffer.c Log Message: fixed up stringbuffer Index: dhcp-stringbuffer.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-stringbuffer.c 17 Jun 2002 13:23:08 -0000 1.4 --- dhcp-stringbuffer.c 18 Jun 2002 23:24:30 -0000 1.5 *************** *** 123,126 **** --- 123,127 ---- } + /* clear a string. */ void stringbuffer_clear(stringbuffer *sb) { *************** *** 132,136 **** void stringbuffer_append_c(stringbuffer *sb, char c) { ! if(sb->capacity <= (1 + sb->capacity)) { sb->buf = extend_string(sb->buf, sb->len, 1); sb->len++; --- 133,137 ---- void stringbuffer_append_c(stringbuffer *sb, char c) { ! if(sb->capacity <= (1 + sb->len)) { sb->buf = extend_string(sb->buf, sb->len, 1); sb->len++; *************** *** 177,188 **** /* we do have whitespace in the beginning so find the end. */ ! for(end = &sb->buf[sb->len -1]; *end == ' ' || *end == '\t'; end--); ! ! len = (sb->len + 1); /* save old length. */ /* create a new string */ ! newbuf = xmalloc(len * sizeof(char)); ptr = newbuf; --- 178,188 ---- /* we do have whitespace in the beginning so find the end. */ ! for(end = &sb->buf[sb->len]; *end == ' ' || *end == '\t'; end--); ! len = sb->len; /* save old length. */ /* create a new string */ ! newbuf = allocate_string(len); ptr = newbuf; *************** *** 210,214 **** /* get the last occurance of a specific character. useful for slicing. */ - char *stringbuffer_get_last_occurance(stringbuffer *sb, char c) { --- 210,213 ---- *************** *** 250,253 **** --- 249,253 ---- } + /* set a string into a stringbuffer */ void stringbuffer_set(stringbuffer *dest, const char *s) { *************** *** 256,259 **** --- 256,260 ---- } + /* copy a stringbuffer into another stringbuffer */ void stringbuffer_copy(stringbuffer *dest, stringbuffer *src) { *************** *** 261,264 **** --- 262,284 ---- } + /* replace in stringbuffer occurances of c with replace */ + void stringbuffer_replace_c(stringbuffer *sb, char c, char replace) + { + char *ptr; + + for(ptr = sb->buf; *ptr != 0; ptr++) { + if(*ptr == c) + *ptr = replace; + } + } + + /* zap newlines by placing spaces in their place. + * we use this before aligning. */ + static void stringbuffer_zap_newline(stringbuffer *sb) + { + + stringbuffer_replace_c(sb, '\n', ' '); + stringbuffer_replace_c(sb, '\r', ' '); + } /* align a stringbuffer on begin and end columns. */ *************** *** 269,272 **** --- 289,294 ---- int len, i; + + stringbuffer_zap_newline(sb); aligned_string = create_stringbuffer(); |
From: <act...@us...> - 2002-06-18 04:33:44
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv15249 Modified Files: Makefile.am Makefile.in TODO dhcp-agent.h dhcp-client-states.c dhcp-client.c dhcp-print.c dhcp-sniff.c dhcp-sniffer-ohandlers.c dhcpsniff.1 Added Files: dhcp-print.h Log Message: added brief mode to sniffer; fixed up Makefile.am to always use dhcp-snprintf now; updated dhcpsniff manpage; --- NEW FILE: dhcp-print.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-print.h,v 1.1 2002/06/18 04:33:40 actmodern Exp $ * * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #ifndef DHCP_PRINT_H #define DHCP_PRINT_H /* type for printing packet function. */ typedef void (*print_packet)(rawnet_t *net); /* main printers */ extern void print_dhcp_packet_verbose(rawnet_t *net); extern void print_dhcp_packet_brief(rawnet_t *net); /* Printing functions. */ extern void print_dhcphdr_brief(dhcp_obj *dhcp); extern void print_dhcphdr_verbose(dhcp_obj *dhcp); extern void print_options_verbose(dhcp_obj *dhcp); extern void print_ip_verbose(ip_obj *ip); extern void print_ip_brief(ip_obj *ip); extern void print_magic_cookie_verbose(const char *valid, dhcp_obj *dhcp); extern void print_magic_cookie_brief(const char *valid, dhcp_obj *dhcp); extern void print_timestamp_brief(struct timeval tm); extern void print_timestamp_verbose(struct timeval tm); extern void print_eth_brief(eth_obj *eth); extern void print_eth_verbose(eth_obj *eth); /* Print utility functions. */ extern void print_dhcp_type_message(const unsigned char *data, int len, int printval); extern void print_address_list(const unsigned char *data, int len, int print_val); extern void print_int32(const unsigned char *data, int len, int print_val); extern void print_string(const unsigned char *data, int len, int print_val); extern void print_uint16(const unsigned char *data, int len, int print_val); extern void print_en_bool(const unsigned char *data, int len, int print_val); extern void print_yn_bool(const unsigned char *data, int len, int print_val); extern void print_address_mask_list(const unsigned char *data, int len, int ini_val); extern void print_ubyte(const unsigned char *data, int len, int print_val); extern void print_uint16_list(const unsigned char *data, int len, int print_val); extern void print_uint32(const unsigned char *data, int len, int print_val); extern void print_netbios_node_type(const unsigned char *data, int len, int print_val); extern void print_address_route_list(const unsigned char *data, int len, int ini_val); extern void print_request_options(const unsigned char *data, int len, int printval); extern void dont_handle(const unsigned char *data, int len, int print_val); #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Makefile.am 17 Jun 2002 13:25:22 -0000 1.23 --- Makefile.am 18 Jun 2002 04:33:40 -0000 1.24 *************** *** 9,13 **** dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ ! dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c @DHCP_SNPRINTF@ \ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c --- 9,13 ---- dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ ! dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c \ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c *************** *** 18,22 **** dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c \ dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c \ ! dhcp-interface.c dhcp-client-conf.c @DHCP_SNPRINTF@ dhcp-files.c \ dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ --- 18,22 ---- dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c \ dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c \ ! dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c \ dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ *************** *** 46,48 **** EXTRA_DIST = $(man_MANS) TODO LICENSE CAVEATS UPGRADING - --- 46,47 ---- Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Makefile.in 17 Jun 2002 13:25:22 -0000 1.22 --- Makefile.in 18 Jun 2002 04:33:40 -0000 1.23 *************** *** 77,86 **** bin_PROGRAMS = dhcpsniff dhcpclient ! dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c @DHCP_SNPRINTF@ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ ! dhcpclient_SOURCES = dhcp-client.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c @DHCP_SNPRINTF@ dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c dhcp-parser.c dhcp-varfile.c --- 77,86 ---- bin_PROGRAMS = dhcpsniff dhcpclient ! dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ ! dhcpclient_SOURCES = dhcp-client.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c dhcp-parser.c dhcp-varfile.c *************** *** 116,121 **** dhcpsniff_OBJECTS = dhcp-sniff.o dhcp-print.o dhcp-util.o dhcp-align.o \ dhcp-net.o dhcp-list.o dhcp-com.o dhcp-eth.o dhcp-ip.o dhcp-udp.o \ ! dhcp-arp.o dhcp-icmp.o dhcp-log.o dhcp-sniffer-ohandlers.o dhcp-rtt.o \ ! dhcp-interface.o dhcpsniff_DEPENDENCIES = dhcpsniff_LDFLAGS = --- 116,121 ---- dhcpsniff_OBJECTS = dhcp-sniff.o dhcp-print.o dhcp-util.o dhcp-align.o \ dhcp-net.o dhcp-list.o dhcp-com.o dhcp-eth.o dhcp-ip.o dhcp-udp.o \ ! dhcp-arp.o dhcp-icmp.o dhcp-log.o dhcp-snprintf.o \ ! dhcp-sniffer-ohandlers.o dhcp-rtt.o dhcp-interface.o dhcpsniff_DEPENDENCIES = dhcpsniff_LDFLAGS = *************** *** 124,128 **** dhcp-icmp.o dhcp-log.o dhcp-daemon.o dhcp-client-cache.o \ dhcp-cache-entry.o dhcp-client-control.o dhcp-interface.o \ ! dhcp-client-conf.o dhcp-files.o dhcp-client-states.o \ dhcp-options-strings.o dhcp-convert.o dhcp-sysconf.o dhcp-rtt.o \ dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ --- 124,128 ---- dhcp-icmp.o dhcp-log.o dhcp-daemon.o dhcp-client-cache.o \ dhcp-cache-entry.o dhcp-client-control.o dhcp-interface.o \ ! dhcp-client-conf.o dhcp-snprintf.o dhcp-files.o dhcp-client-states.o \ dhcp-options-strings.o dhcp-convert.o dhcp-sysconf.o dhcp-rtt.o \ dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ *************** *** 160,165 **** .deps/dhcp-parser.P .deps/dhcp-print.P .deps/dhcp-route.P \ .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ ! .deps/dhcp-stringbuffer.P .deps/dhcp-sysconf.P .deps/dhcp-udp.P \ ! .deps/dhcp-util.P .deps/dhcp-varfile.P SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) --- 160,165 ---- .deps/dhcp-parser.P .deps/dhcp-print.P .deps/dhcp-route.P \ .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ ! .deps/dhcp-snprintf.P .deps/dhcp-stringbuffer.P .deps/dhcp-sysconf.P \ ! .deps/dhcp-udp.P .deps/dhcp-util.P .deps/dhcp-varfile.P SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** TODO 17 Jun 2002 02:41:19 -0000 1.28 --- TODO 18 Jun 2002 04:33:40 -0000 1.29 *************** *** 24,29 **** other todo: - -- autoconf script is getting ugly -- methinks its broken and is - barely parsed -- check for duplicates in configure.in and compress them (for example -I and -L flags should not be repeated.) --- 24,27 ---- *************** *** 48,52 **** to be done through it. - -- add a isascii() and a strcasecmp() for portability -- rawnet_is_valid needs more checks. --- 46,49 ---- *************** *** 95,97 **** the applicable dhcp-convert and then build the option wirh create_dhcp_option(data, len, tag) ! --- 92,94 ---- the applicable dhcp-convert and then build the option wirh create_dhcp_option(data, len, tag) ! -- document output from dhcpsniff -- especially how brief mode is layed out. \ No newline at end of file Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** dhcp-agent.h 17 Jun 2002 13:23:07 -0000 1.59 --- dhcp-agent.h 18 Jun 2002 04:33:40 -0000 1.60 *************** *** 569,599 **** extern int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); - /* Printing functions. */ - - extern void print_dhcphdr_verbose(dhcp_obj *dhcp); - extern void print_options_verbose(dhcp_obj *dhcp); - extern void print_ip(ip_obj *ip); - extern void print_magic_cookie(const char *valid, dhcp_obj *dhcp); - extern void print_timestamp(struct timeval tm); - extern void print_eth(eth_obj *eth); - - /* Print utility functions. */ - - extern void print_dhcp_type_message(const unsigned char *data, int len, int printval); - extern void print_address_list(const unsigned char *data, int len, int print_val); - extern void print_int32(const unsigned char *data, int len, int print_val); - extern void print_string(const unsigned char *data, int len, int print_val); - extern void print_uint16(const unsigned char *data, int len, int print_val); - extern void print_en_bool(const unsigned char *data, int len, int print_val); - extern void print_yn_bool(const unsigned char *data, int len, int print_val); - extern void print_address_mask_list(const unsigned char *data, int len, int ini_val); - extern void print_ubyte(const unsigned char *data, int len, int print_val); - extern void print_uint16_list(const unsigned char *data, int len, int print_val); - extern void print_uint32(const unsigned char *data, int len, int print_val); - extern void print_netbios_node_type(const unsigned char *data, int len, int print_val); - extern void print_address_route_list(const unsigned char *data, int len, int ini_val); - extern void print_request_options(const unsigned char *data, int len, int printval); - extern void dont_handle(const unsigned char *data, int len, int print_val); - /* DHCP obj routines. */ --- 569,572 ---- Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dhcp-client-states.c 17 Jun 2002 13:23:07 -0000 1.27 --- dhcp-client-states.c 18 Jun 2002 04:33:40 -0000 1.28 *************** *** 284,291 **** } ! /* Before doing a sysconf, let's make sure no one on the * local subnet is using our address. Do an ARP request * on the local subnet. and check to see if the address ! * is already taken. */ do_sysconf(options, dc); --- 284,293 ---- } ! /* ! * Before doing a sysconf, let's make sure no one on the * local subnet is using our address. Do an ARP request * on the local subnet. and check to see if the address ! * is already taken. FIXME: -- this isn't implemented :-) ! */ do_sysconf(options, dc); Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** dhcp-client.c 17 Jun 2002 13:23:07 -0000 1.30 --- dhcp-client.c 18 Jun 2002 04:33:40 -0000 1.31 *************** *** 533,535 **** exit(0); } - --- 533,534 ---- Index: dhcp-print.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-print.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-print.c 17 Jun 2002 13:23:08 -0000 1.7 --- dhcp-print.c 18 Jun 2002 04:33:40 -0000 1.8 *************** *** 28,31 **** --- 28,138 ---- #include <dhcp-util.h> + /* Print the fixed header briefly.*/ + void print_dhcphdr_brief(dhcp_obj *dhcp) + { + unsigned char op; + struct in_addr in; + unsigned char *hw_ptr; + int i; + + /* op */ + op = dhcp_get_op(dhcp); + printf("op:"); + + switch(op) { + + case DHCP_BOOTP_REQUEST: + printf("req"); + break; + + case DHCP_BOOTP_REPLY: + printf("rpy"); + break; + + default: + printf("%-3d", op); + } + + printf(" "); + + /* Hardware Type field. */ + + printf("hd:"); + switch(dhcp_get_htype(dhcp)) { + + case DLT_NULL: + printf("%s","nul"); + break; + + case DLT_EN10MB: + case DLT_EN3MB: + printf("%s","eth"); + break; + + case DLT_AX25: + printf("%s","ax25"); + break; + + case DLT_PRONET: + printf("%s", "pnet"); + break; + + case DLT_CHAOS: + printf("%s","chas"); + break; + + case DLT_ARCNET: + printf("%s", "slip"); + break; + + case DLT_PPP: + printf("%s", "ppp"); + break; + + case DLT_FDDI: + printf("%s", "fddi"); + break; + + default: + printf("%s", "unkn"); + break; + + } + printf(" "); + + printf("hlen:%d ", dhcp_get_hlen(dhcp)); + printf("hops:%d ", dhcp_get_hops(dhcp)); + printf("xid:%x ", dhcp_get_xid(dhcp)); + printf("secs:%d ", dhcp_get_secs(dhcp)); + + if(dhcp_get_flags(dhcp)) + printf("f:brdcst"); + else + printf("f:none"); + printf(" "); + + in.s_addr = dhcp_get_ciaddr(dhcp); + printf("ciaddr: %s ", inet_ntoa(in)); + + in.s_addr = dhcp_get_yiaddr(dhcp); + printf("yiaddr: %s ", inet_ntoa(in)); + + in.s_addr = dhcp_get_siaddr(dhcp); + printf("siaddr: %s ", inet_ntoa(in)); + + in.s_addr = dhcp_get_giaddr(dhcp); + printf("agaddr: %s ", inet_ntoa(in)); + + printf("chdr: "); + hw_ptr = dhcp_get_chaddr(dhcp); + for(i = 0;i < 16;i++) { + printf("%.2x",*hw_ptr); + hw_ptr++; + } + printf(" "); + fflush(stdout); + } + + /* Print the fixed header verbosely. * *************** *** 593,599 **** } ! /* Print source and destination address. */ ! void print_ip(ip_obj *ip) { struct in_addr in; --- 700,718 ---- } ! /* Print source and destination address (brief). */ ! void print_ip_brief(ip_obj *ip) ! { ! struct in_addr in; ! in.s_addr = ip_get_source_addr(ip); ! printf("srcip: %s ", inet_ntoa(in)); ! ! in.s_addr = ip_get_dest_addr(ip); ! printf("dstip: %s ", inet_ntoa(in)); ! return; ! } ! ! /* Print source and destination address (verbose). */ ! void print_ip_verbose(ip_obj *ip) { struct in_addr in; *************** *** 612,616 **** } ! void print_magic_cookie(const char *status, dhcp_obj *dhcp) { struct in_addr in; --- 731,743 ---- } ! void print_magic_cookie_brief(dhcp_obj *dhcp) ! { ! struct in_addr in; ! ! memcpy(&in.s_addr, &dhcp->magic_cookie, 4); ! printf("cookie: %s ", inet_ntoa(in)); ! return; ! } ! void print_magic_cookie_verbose(const char *status, dhcp_obj *dhcp) { struct in_addr in; *************** *** 624,628 **** } ! void print_timestamp(struct timeval tm) { printf("%lu.%06lu\n", tm.tv_sec, tm.tv_usec); --- 751,761 ---- } ! void print_timestamp_brief(struct timeval tm) ! { ! printf("[%lu.%06lu] ", tm.tv_sec, tm.tv_usec); ! return; ! } ! ! void print_timestamp_verbose(struct timeval tm) { printf("%lu.%06lu\n", tm.tv_sec, tm.tv_usec); *************** *** 630,634 **** } ! void print_eth(eth_obj *eth) { unsigned char *src_eth_addr; --- 763,783 ---- } ! void print_eth_brief(eth_obj *eth) ! { ! unsigned char *src_eth_addr; ! unsigned char *dst_eth_addr; ! ! src_eth_addr = eth_get_src_address(eth); ! dst_eth_addr = eth_get_dst_address(eth); ! ! printf("smac: %x:%x:%x:%x:%x:%x ", src_eth_addr[0], src_eth_addr[1], src_eth_addr[2], ! src_eth_addr[3], src_eth_addr[4], src_eth_addr[5]); ! printf("dmac: %x:%x:%x:%x:%x:%x ", dst_eth_addr[0], dst_eth_addr[1], dst_eth_addr[2], ! dst_eth_addr[3], dst_eth_addr[4], dst_eth_addr[5]); ! ! return; ! } ! ! void print_eth_verbose(eth_obj *eth) { unsigned char *src_eth_addr; *************** *** 644,647 **** --- 793,821 ---- dst_eth_addr[3], dst_eth_addr[4], dst_eth_addr[5]); + return; + } + + void print_dhcp_packet_verbose(rawnet_t *net) + { + print_eth_verbose(net->ether_p); + print_ip_verbose(net->ip_p); + print_dhcphdr_verbose(net->dhcp_p); + if(dhcp_valid_magic_cookie(net->dhcp_p)) + print_magic_cookie_verbose("Good", net->dhcp_p); + else + print_magic_cookie_verbose("Bad", net->dhcp_p); + print_options_verbose(net->dhcp_p); + + return; + } + + void print_dhcp_packet_brief(rawnet_t *net) + { + print_timestamp_brief(net->tstamp); + print_eth_brief(net->ether_p); + print_ip_brief(net->ip_p); + print_dhcphdr_brief(net->dhcp_p); + print_magic_cookie_brief(net->dhcp_p); + return; } Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-sniff.c 17 Jun 2002 13:23:08 -0000 1.9 --- dhcp-sniff.c 18 Jun 2002 04:33:40 -0000 1.10 *************** *** 1,5 **** /* $Header$ - * - * dhcp-tool Sniffing routines. * * Copyright 2002 Thamer Alharbash --- 1,3 ---- *************** *** 23,30 **** --- 21,31 ---- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * + * dhcp-agent sniffer + * */ #include <dhcp-agent.h> #include <dhcp-util.h> + #include <dhcp-print.h> int interactive = 1; *************** *** 49,52 **** --- 50,54 ---- int sport, dport; char filter_buff[GENERIC_BUFFSIZE]; + print_packet p_packet = print_dhcp_packet_verbose; #if !defined(HAVE_PROGNAME) *************** *** 54,58 **** #endif /* HAVE_PROGNAME */ ! while((c = getopt(argc, argv, "vi:")) != -1) { switch(c) { --- 56,60 ---- #endif /* HAVE_PROGNAME */ ! while((c = getopt(argc, argv, "bvi:")) != -1) { switch(c) { *************** *** 66,69 **** --- 68,76 ---- exit(0); + case 'b': + /* brief mode. */ + p_packet = print_dhcp_packet_brief; + break; + default: usage(argv[0]); *************** *** 110,126 **** if(net->type == RAWNET_DHCP) { - - print_timestamp(net->tstamp); - print_eth(net->ether_p); - print_ip(net->ip_p); - print_dhcphdr_verbose(net->dhcp_p); - - if(dhcp_valid_magic_cookie(net->dhcp_p)) - print_magic_cookie("Good", net->dhcp_p); - else - print_magic_cookie("Bad", net->dhcp_p); ! print_options_verbose(net->dhcp_p); ! printf("\n"); fflush(stdout); --- 117,122 ---- if(net->type == RAWNET_DHCP) { ! p_packet(net); printf("\n"); fflush(stdout); Index: dhcp-sniffer-ohandlers.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniffer-ohandlers.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-sniffer-ohandlers.c 17 Jun 2002 13:23:08 -0000 1.2 --- dhcp-sniffer-ohandlers.c 18 Jun 2002 04:33:40 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- #include <dhcp-agent.h> + #include <dhcp-print.h> /* There are 63 DHCP options we handle, Index: dhcpsniff.1 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcpsniff.1,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcpsniff.1 16 Jun 2002 19:55:47 -0000 1.2 --- dhcpsniff.1 18 Jun 2002 04:33:40 -0000 1.3 *************** *** 1,4 **** .\" $Header$ ! .Dd December, 17, 2001 .Dt DHCPSNIFF 1 .Sh NAME --- 1,4 ---- .\" $Header$ ! .Dd June, 17, 2002 .Dt DHCPSNIFF 1 .Sh NAME *************** *** 7,19 **** .Sh SYNOPSIS .Nm .Op Fl i Ar interface .Sh DESCRIPTION .Nm is a DHCP sniffer. ! It observes DHCP packets on the network and outputs diagnostic-quality ! details of said packets. .Pp The options are as follows: .Bl -tag -width Ds .It Fl i Ar interface Sniff for DHCP packets on --- 7,21 ---- .Sh SYNOPSIS .Nm + .Op Fl b .Op Fl i Ar interface .Sh DESCRIPTION .Nm is a DHCP sniffer. ! It sniffs for DHCP packets on an interface and outputs DHCP packet contents. .Pp The options are as follows: .Bl -tag -width Ds + .It Fl b + Use brief mode. .It Fl i Ar interface Sniff for DHCP packets on *************** *** 25,28 **** .Xr dhcpclient 1 .Sh AUTHORS ! Thamer Al-Harbash .Aq tm...@wh... --- 27,32 ---- .Xr dhcpclient 1 .Sh AUTHORS ! .An Thamer Al-Harbash .Aq tm...@wh... + .An Brian J. Kifiak + .Aq bk...@rt... |
From: <act...@us...> - 2002-06-17 13:25:25
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv19180 Modified Files: Makefile.am Makefile.in Log Message: fixed Makefile to be sensible again Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Makefile.am 17 Jun 2002 13:23:07 -0000 1.22 --- Makefile.am 17 Jun 2002 13:25:22 -0000 1.23 *************** *** 1,4 **** ! CFLAGS = -Wall -O2 -s ! AUTOMAKE_OPTIONS = gnu INCLUDES = -I. @PCAP_INC@ @DNET_INC@ --- 1,4 ---- ! CFLAGS = -Wall -g ! AUTOMAKE_OPTIONS = foriegn INCLUDES = -I. @PCAP_INC@ @DNET_INC@ Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Makefile.in 17 Jun 2002 13:23:07 -0000 1.21 --- Makefile.in 17 Jun 2002 13:25:22 -0000 1.22 *************** *** 68,72 **** VERSION = @VERSION@ ! CFLAGS = -Wall -O2 -s AUTOMAKE_OPTIONS = foreign --- 68,72 ---- VERSION = @VERSION@ ! CFLAGS = -Wall -g AUTOMAKE_OPTIONS = foreign |