dhcp-agent-commits Mailing List for dhcp-agent (Page 26)
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-10-25 17:35:24
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv15084 Modified Files: dhcp-list.c dhcp-agent.h Log Message: fixed list sifting routine :) Index: dhcp-list.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-list.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-list.c 25 Oct 2002 12:52:19 -0000 1.6 --- dhcp-list.c 25 Oct 2002 12:58:20 -0000 1.7 *************** *** 127,131 **** } ! list_t *find_datum_by(list_t *first, int (*find_func(void *)), void *arg) { list_t *ptr; --- 127,131 ---- } ! list_t *find_datum_by(list_t *list, int (*find_func(void *, void *)), void *arg) { list_t *ptr; Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** dhcp-agent.h 25 Oct 2002 12:52:19 -0000 1.73 --- dhcp-agent.h 25 Oct 2002 12:58:20 -0000 1.74 *************** *** 788,792 **** extern void purge_list_internal(void *head); extern list_t *join_lists(list_t *first_list, list_t *second_list); ! extern list_t *find_datum_by(list_t *first, int (*find_func(void *)), void *arg); /* Logging functions. */ --- 788,792 ---- extern void purge_list_internal(void *head); extern list_t *join_lists(list_t *first_list, list_t *second_list); ! extern list_t *find_datum_by(list_t *first, int (*find_func(void *, void *)), void *arg); /* Logging functions. */ |
From: <act...@us...> - 2002-10-25 17:23:41
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8932 Modified Files: dhcp-agent.h dhcp-list.c Log Message: added list sifting routine Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** dhcp-agent.h 23 Oct 2002 23:43:34 -0000 1.72 --- dhcp-agent.h 25 Oct 2002 12:52:19 -0000 1.73 *************** *** 788,791 **** --- 788,792 ---- extern void purge_list_internal(void *head); extern list_t *join_lists(list_t *first_list, list_t *second_list); + extern list_t *find_datum_by(list_t *first, int (*find_func(void *)), void *arg); /* Logging functions. */ Index: dhcp-list.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-list.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-list.c 12 Oct 2002 22:54:50 -0000 1.5 --- dhcp-list.c 25 Oct 2002 12:52:19 -0000 1.6 *************** *** 126,127 **** --- 126,141 ---- return first_list; } + + list_t *find_datum_by(list_t *first, int (*find_func(void *)), void *arg) + { + list_t *ptr; + + for(ptr = list; ptr; ptr = ptr->next) { + if(find_func(ptr, arg)) + return ptr; + } + + return NULL; + } + + |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv1699 Modified Files: dhcp-agent.h dhcp-arp-discovery.c dhcp-client-states.c dhcp-icmp-discovery.c dhcp-net.c dhcp-net.h dhcp-rtt.c dhcp-rtt.h Log Message: rtt mechanism update: now allows upper cap Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** dhcp-agent.h 22 Oct 2002 00:46:14 -0000 1.71 --- dhcp-agent.h 23 Oct 2002 23:43:34 -0000 1.72 *************** *** 155,158 **** --- 155,163 ---- #define MESSAGE_LINE_LENGTH 60 + /* as mentioned in rfc2131, 64 seconds is the recommended upper + * limit of waiting time for ethernet. */ + + #define RECOMMENDED_MAX_SECS_WAIT 10 + /* * * * * * * * * * * * Data structures. * Index: dhcp-arp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp-discovery.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-arp-discovery.c 21 Oct 2002 01:02:48 -0000 1.10 --- dhcp-arp-discovery.c 23 Oct 2002 23:43:34 -0000 1.11 *************** *** 84,88 **** while(retries--) { ! retval = rawnet_packet_transact(net, arg_list, NULL, check_for_arp_reply); switch(retval) { --- 84,88 ---- while(retries--) { ! retval = rawnet_packet_transact(net, arg_list, NULL, check_for_arp_reply, RECOMMENDED_MAX_SECS_WAIT); switch(retval) { Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** dhcp-client-states.c 21 Oct 2002 01:02:48 -0000 1.41 --- dhcp-client-states.c 23 Oct 2002 23:43:34 -0000 1.42 *************** *** 292,296 **** retval = rawnet_packet_transact(dc->rawnet, dc, client_update_packet, ! client_check_discover); switch(retval) { --- 292,296 ---- retval = rawnet_packet_transact(dc->rawnet, dc, client_update_packet, ! client_check_discover, RECOMMENDED_MAX_SECS_WAIT); switch(retval) { *************** *** 359,363 **** build_dhcp_request_broadcast(dc->rawnet, dc->xid, dc->secs, options); ! retval = rawnet_packet_transact(dc->rawnet, dc, NULL, client_check_request); switch(retval) { --- 359,363 ---- build_dhcp_request_broadcast(dc->rawnet, dc->xid, dc->secs, options); ! retval = rawnet_packet_transact(dc->rawnet, dc, NULL, client_check_request, RECOMMENDED_MAX_SECS_WAIT); switch(retval) { Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-icmp-discovery.c 21 Oct 2002 01:02:48 -0000 1.20 --- dhcp-icmp-discovery.c 23 Oct 2002 23:43:34 -0000 1.21 *************** *** 72,76 **** while(retries--) { ! retval = rawnet_packet_transact(net, net, NULL, icmp_check_mask_reply); switch(retval) { --- 72,76 ---- while(retries--) { ! retval = rawnet_packet_transact(net, net, NULL, icmp_check_mask_reply, RECOMMENDED_MAX_SECS_WAIT); switch(retval) { *************** *** 129,133 **** gettimeofday(&before, NULL); ! if(rawnet_packet_transact(net, net, NULL, icmp_check_echo_reply)) { /* on a timeout we set the latency to -1 */ return -1; --- 129,133 ---- gettimeofday(&before, NULL); ! if(rawnet_packet_transact(net, net, NULL, icmp_check_echo_reply, RECOMMENDED_MAX_SECS_WAIT)) { /* on a timeout we set the latency to -1 */ return -1; Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** dhcp-net.c 21 Oct 2002 01:02:48 -0000 1.35 --- dhcp-net.c 23 Oct 2002 23:43:34 -0000 1.36 *************** *** 68,71 **** --- 68,75 ---- #include <net/bpf.h> + /************************ + * Address Manipulation.* + ************************/ + /* get interface address. */ int rawnet_get_hw_addr(rawnet_t *net, eth_addr_t *addr) *************** *** 367,371 **** } - /* XXX -- if we fail we should rawnet down it. */ int rawnet_up(rawnet_t *net) { --- 371,374 ---- *************** *** 607,614 **** */ - /* FIXME --: this needs to return a fatal error, timeout, or OK status */ - int rawnet_packet_transact(rawnet_t *net, void *arg, void (*update)(void *arg), ! int (*check)(void *arg)) { rtt_t *rtt; --- 610,615 ---- */ int rawnet_packet_transact(rawnet_t *net, void *arg, void (*update)(void *arg), ! int (*check)(void *arg), time_t max_timeout) { rtt_t *rtt; *************** *** 618,622 **** /* create rtt mechanism. */ ! rtt = rtt_create(); /* We loop here and re-send packets if we timeout, or fail a --- 619,623 ---- /* create rtt mechanism. */ ! rtt = rtt_create(max_timeout); /* We loop here and re-send packets if we timeout, or fail a Index: dhcp-net.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-net.h 14 Oct 2002 15:52:33 -0000 1.4 --- dhcp-net.h 23 Oct 2002 23:43:34 -0000 1.5 *************** *** 61,65 **** 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); --- 61,66 ---- extern int rawnet_packet_transact(rawnet_t *net, void *arg, void (*update)(void *arg), ! int (*check)(void *arg), ! time_t max_timeout); extern int rawnet_interface_up(rawnet_t *net, ip_addr_t addr, ip_addr_t netmask, int mtu); Index: dhcp-rtt.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-rtt.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-rtt.c 12 Oct 2002 22:54:50 -0000 1.8 --- dhcp-rtt.c 23 Oct 2002 23:43:34 -0000 1.9 *************** *** 33,49 **** tm.tv_sec = MSECS_TO_SECS(milliseconds); ! tm.tv_usec = MSECS_TO_MSECS_REM(milliseconds); return tm; } ! rtt_t *rtt_create(void) { rtt_t *rtt; - time_t milliseconds; rtt = xmalloc(sizeof(rtt_t)); ! milliseconds = MILLISECOND_TIMEOUT + rand()%MILLISECOND_RAND_TIMEOUT; ! rtt->timeout = make_timeval(milliseconds); return rtt; --- 33,58 ---- tm.tv_sec = MSECS_TO_SECS(milliseconds); ! tm.tv_usec = MSECS_TO_SECS_REM(milliseconds); return tm; } ! static struct timeval init_timeout(void) ! { ! struct timeval timeout; ! ! timeout = make_timeval(MILLISECOND_TIMEOUT + rand()%MILLISECOND_RAND_TIMEOUT); ! return timeout; ! } ! ! rtt_t *rtt_create(time_t max_timeout) { rtt_t *rtt; rtt = xmalloc(sizeof(rtt_t)); ! rtt->timeout = init_timeout(); ! rtt->max_timeout = max_timeout; ! rtt->start_time = time(NULL); ! rtt->elapsed_time = 0; /* we hope :-) */ return rtt; *************** *** 71,75 **** else { /* we're not safe subtracting. don't go below 0. */ ! if(rand_value < milliseconds) milliseconds -= rand_value; else --- 80,84 ---- else { /* we're not safe subtracting. don't go below 0. */ ! if(rand_value <= milliseconds) milliseconds -= rand_value; else *************** *** 84,99 **** { time_t milliseconds; - - milliseconds = SECS_TO_MSECS(rtt->timeout.tv_sec); - milliseconds += rtt->timeout.tv_usec; ! if(milliseconds == 0) /* should never happen but let's check here ! * for safe divide. */ return 0; ! if(milliseconds >= (SECS_TO_MSECS(MAX_SECS_WAIT))) ! return 0; ! else ! return 1; } --- 93,120 ---- { time_t milliseconds; ! rtt->elapsed_time = time(NULL) - rtt->start_time; ! ! if(rtt->elapsed_time >= rtt->max_timeout) { return 0; + } + + milliseconds = SECS_TO_MSECS(rtt->timeout.tv_sec); + milliseconds += rtt->timeout.tv_usec; ! if((milliseconds >= (SECS_TO_MSECS(RECOMMENDED_MAX_SECS_WAIT))) || ! (milliseconds >= (rtt->max_timeout - rtt->elapsed_time))) { ! ! /* It's perfectly possible for this to put us over the top ! * of our max_timeout but it's no big deal since our initial ! * timeout is pretty small anyway. */ ! ! rtt->timeout = init_timeout(); ! ! } else { ! rtt->timeout = make_timeval(milliseconds); ! } ! ! return 1; } Index: dhcp-rtt.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-rtt.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-rtt.h 17 Jun 2002 13:23:08 -0000 1.2 --- dhcp-rtt.h 23 Oct 2002 23:43:34 -0000 1.3 *************** *** 30,35 **** #define MILLISECOND_TIMEOUT 4000 #define MILLISECOND_RAND_TIMEOUT 1000 - #define MAX_SECS_WAIT 64 /* as mentioned in rfc2131, - * 64 seconds is the upper limit of waiting time. */ /* Utility macros. */ --- 30,33 ---- *************** *** 37,41 **** #define SECS_TO_MSECS(x) (x * 1000) #define MSECS_TO_SECS(x) (x/1000) ! #define MSECS_TO_MSECS_REM(x) (x%1000) /* rtt struct. */ --- 35,39 ---- #define SECS_TO_MSECS(x) (x * 1000) #define MSECS_TO_SECS(x) (x/1000) ! #define MSECS_TO_SECS_REM(x) (x%1000) /* rtt struct. */ *************** *** 43,51 **** typedef struct rtt { struct timeval timeout; } rtt_t; /* prototypes. */ ! extern rtt_t *rtt_create(void); extern struct timeval rtt_get_timeout(rtt_t *rtt); extern void rtt_timeout(rtt_t *rtt); --- 41,52 ---- typedef struct rtt { struct timeval timeout; + time_t max_timeout; + time_t start_time; + time_t elapsed_time; } rtt_t; /* prototypes. */ ! extern rtt_t *rtt_create(time_t max_timeout); extern struct timeval rtt_get_timeout(rtt_t *rtt); extern void rtt_timeout(rtt_t *rtt); |
From: <act...@us...> - 2002-10-23 23:42:38
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv711 Modified Files: dhcp-util.c Log Message: debug message fix Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** dhcp-util.c 23 Oct 2002 16:27:49 -0000 1.29 --- dhcp-util.c 23 Oct 2002 23:42:34 -0000 1.30 *************** *** 30,34 **** #include <dhcp-util.h> ! static int verbosity_level = MAX_VERBOSITY_LEVEL; /* set the verbosity level. */ --- 30,34 ---- #include <dhcp-util.h> ! static int verbosity_level = DEBUG_VERBOSITY_LEVEL; /* set the verbosity level. */ |
From: <act...@us...> - 2002-10-23 16:44:56
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv600 Modified Files: dhcp-util.c dhcp-util.h Log Message: bug fix to messaging Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** dhcp-util.c 22 Oct 2002 00:46:14 -0000 1.28 --- dhcp-util.c 23 Oct 2002 16:27:49 -0000 1.29 *************** *** 60,64 **** /* message proc workhorse */ static void message_proc(const char *prefix, const char *module_name, const char *func_name, ! const char *file, const char *line, const char *fmt, va_list ap) { static stringbuffer *prefix_sb = NULL; --- 60,64 ---- /* message proc workhorse */ static void message_proc(const char *prefix, const char *module_name, const char *func_name, ! const char *file, const char *fmt, va_list ap) { static stringbuffer *prefix_sb = NULL; *************** *** 81,85 **** message_append_colon_sep(prefix_sb, func_name); message_append_colon_sep(prefix_sb, file); - message_append_colon_sep(prefix_sb, line); stringbuffer_avprintf(msg_sb, fmt, ap); --- 81,84 ---- *************** *** 108,112 **** va_start(ap, fmt); ! message_proc("error", NULL, func_name, NULL, NULL, fmt, ap); va_end(ap); --- 107,111 ---- va_start(ap, fmt); ! message_proc("error", NULL, func_name, NULL, fmt, ap); va_end(ap); *************** *** 125,129 **** va_start(ap, fmt); ! message_proc("fatal", NULL, func_name, NULL, NULL, fmt, ap); va_end(ap); --- 124,128 ---- va_start(ap, fmt); ! message_proc("fatal", NULL, func_name, NULL, fmt, ap); va_end(ap); *************** *** 142,146 **** va_start(ap, fmt); ! message_proc(NULL, NULL, NULL, NULL, NULL, fmt, ap); va_end(ap); --- 141,145 ---- va_start(ap, fmt); ! message_proc(NULL, NULL, NULL, NULL, fmt, ap); va_end(ap); *************** *** 159,163 **** va_start(ap, fmt); ! message_proc("warning", NULL, NULL, NULL, NULL, fmt, ap); va_end(ap); --- 158,162 ---- va_start(ap, fmt); ! message_proc("warning", NULL, NULL, NULL, fmt, ap); va_end(ap); *************** *** 167,181 **** /* send debug message. */ ! void debug_message(const char *module_name, const char *func, const char *file, const char *line, const char *fmt, ...) { va_list ap; ! if(get_verbosity_level() <= DEBUG_VERBOSITY_LEVEL) return; va_start(ap, fmt); ! message_proc("debug", module_name, func, file, line, fmt, ap); va_end(ap); --- 166,180 ---- /* send debug message. */ ! void debug_message(const char *module_name, const char *func, const char *file, const char *fmt, ...) { va_list ap; ! if(get_verbosity_level() < DEBUG_VERBOSITY_LEVEL) return; va_start(ap, fmt); ! message_proc("debug", module_name, func, file, fmt, ap); va_end(ap); Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-util.h 13 Oct 2002 16:29:42 -0000 1.13 --- dhcp-util.h 23 Oct 2002 16:27:49 -0000 1.14 *************** *** 41,45 **** extern void info_message(const char *fmt, ...); extern void warn_message(char *fmt, ...); ! extern void debug_message(const char *module_name, const char *func, const char *file, const char *line, const char *fmt, ...); /* verbosity levels. */ --- 41,45 ---- extern void info_message(const char *fmt, ...); extern void warn_message(char *fmt, ...); ! extern void debug_message(const char *module_name, const char *func, const char *file, const char *fmt, ...); /* verbosity levels. */ *************** *** 98,102 **** #define WARN_MESSAGE(...) { warn_message(__VA_ARGS__); } #define FATAL_MESSAGE(...) { fatal_message(__func__, __VA_ARGS__); } ! #define DEBUG_MESSAGE(...) { debug_message(MODULE_NAME,___func__, __VA_ARGS__); } #endif /* DHCP_UTIL_H */ --- 98,102 ---- #define WARN_MESSAGE(...) { warn_message(__VA_ARGS__); } #define FATAL_MESSAGE(...) { fatal_message(__func__, __VA_ARGS__); } ! #define DEBUG_MESSAGE(...) { debug_message(MODULE_NAME, __func__, __FILE__, __VA_ARGS__); } #endif /* DHCP_UTIL_H */ |
From: <act...@us...> - 2002-10-22 00:59:44
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8002 Modified Files: dhcp-client.c Log Message: improved and updated usage output Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** dhcp-client.c 14 Oct 2002 15:52:33 -0000 1.46 --- dhcp-client.c 22 Oct 2002 00:59:41 -0000 1.47 *************** *** 115,119 **** static void usage(char *s) { ! printf("usage: %s [-cpavkwt] [-d directory] [-i interface name] [ -m mac address ]\n", s); exit(0); } --- 115,121 ---- static void usage(char *s) { ! printf("usage: %s [-cpavkwt] [-l verbosity level] [-d directory]\n", s); ! printf("usage: %-*s [-i interface name] [ -m mac address ]\n", strlen(s), " "); ! printf("usage: %-*s [-H hostname]\n", strlen(s), " "); exit(0); } *************** *** 241,246 **** case STATE_FATAL_ERROR: ! ERROR_MESSAGE("encountered fatal error. I'm giving up."); ! do_shutdown(dc); case STATE_DISCOVER_OFFER: --- 243,247 ---- case STATE_FATAL_ERROR: ! FATAL_MESSAGE("encountered fatal error. I'm giving up."); case STATE_DISCOVER_OFFER: |
From: <act...@us...> - 2002-10-22 00:46:17
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv27045 Modified Files: dhcp-util.c dhcp-agent.h Log Message: added constant for output mesage line length Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dhcp-util.c 13 Oct 2002 16:29:42 -0000 1.27 --- dhcp-util.c 22 Oct 2002 00:46:14 -0000 1.28 *************** *** 84,88 **** stringbuffer_avprintf(msg_sb, fmt, ap); ! stringbuffer_align(msg_sb, 0, 60 - stringbuffer_getlen(prefix_sb)); stringbuffer_marknewlines(msg_sb); --- 84,88 ---- stringbuffer_avprintf(msg_sb, fmt, ap); ! stringbuffer_align(msg_sb, 0, MESSAGE_LINE_LENGTH - stringbuffer_getlen(prefix_sb)); stringbuffer_marknewlines(msg_sb); Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** dhcp-agent.h 21 Oct 2002 01:02:48 -0000 1.70 --- dhcp-agent.h 22 Oct 2002 00:46:14 -0000 1.71 *************** *** 151,154 **** --- 151,158 ---- WARNING_VERBOSITY_LEVEL, DEBUG_VERBOSITY_LEVEL, MAX_VERBOSITY_LEVEL }; + /* Line length for messages before breaking into a new line. */ + + #define MESSAGE_LINE_LENGTH 60 + /* * * * * * * * * * * * Data structures. * |
From: <act...@us...> - 2002-10-21 01:02:52
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv9994 Modified Files: Makefile.am Makefile.in dhcp-agent.h dhcp-arp-discovery.c dhcp-client-control.c dhcp-client-states.c dhcp-com.c dhcp-eth.c dhcp-icmp-discovery.c dhcp-net.c dhcp-packet-build.c dhcp-print.c Log Message: first stab at incorporating proper unicast support -- needs more work Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Makefile.am 13 Oct 2002 16:29:42 -0000 1.30 --- Makefile.am 21 Oct 2002 01:02:48 -0000 1.31 *************** *** 23,27 **** dhcp-parser.c dhcp-varfile.c ! dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ -lefence noinst_HEADERS = dhcp-agent.h config.h --- 23,30 ---- dhcp-parser.c dhcp-varfile.c ! dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ ! ! # Use this to include efence (dev only). ! #LDADD=-lefence noinst_HEADERS = dhcp-agent.h config.h Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Makefile.in 13 Oct 2002 16:29:42 -0000 1.32 --- Makefile.in 21 Oct 2002 01:02:48 -0000 1.33 *************** *** 106,111 **** ! dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ -lefence noinst_HEADERS = dhcp-agent.h config.h --- 106,114 ---- ! dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ ! + # Use this to include efence (dev only). + #LDADD=-lefence noinst_HEADERS = dhcp-agent.h config.h Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** dhcp-agent.h 14 Oct 2002 15:52:32 -0000 1.69 --- dhcp-agent.h 21 Oct 2002 01:02:48 -0000 1.70 *************** *** 122,125 **** --- 122,129 ---- */ + /* Max message size option default. */ + + # define MAX_MESSAGE_SIZE 576 + /* max options handled. */ *************** *** 144,153 **** /* Verbosity levels. */ ! #define QUIET_VERBOSITY_LEVEL 0 ! #define ERROR_VERBOSITY_LEVEL 1 ! #define NORMAL_VERBOSITY_LEVEL 2 ! #define WARNING_VERBOSITY_LEVEL 3 ! #define DEBUG_VERBOSITY_LEVEL 4 ! #define MAX_VERBOSITY_LEVEL DEBUG_VERBOSITY_LEVEL /* * * * * * * * * * * --- 148,153 ---- /* Verbosity levels. */ ! enum verbosity { QUIET_VERBOSITY_LEVEL = 0, ERROR_VERBOSITY_LEVEL, NORMAL_VERBOSITY_LEVEL, ! WARNING_VERBOSITY_LEVEL, DEBUG_VERBOSITY_LEVEL, MAX_VERBOSITY_LEVEL }; /* * * * * * * * * * * *************** *** 278,285 **** struct timeval tstamp; /* timestamp. */ ! eth_addr_t hw_addr; /* our hardware address. */ ! eth_addr_t *fake_hw_addr; /* our fake hardware address. */ ! ip_addr_t ip_addr; /* our ip address. */ ! int promiscuous; /* run in promiscuous mode flag. */ interface_control_t *intf_handle; /* interface control handle. */ --- 278,287 ---- struct timeval tstamp; /* timestamp. */ ! eth_addr_t chw_addr; /* our hardware address. */ ! ip_addr_t cip_addr; /* our ip address. */ ! ! eth_addr_t *fake_hw_addr; /* our fake hardware address. */ ! ! int promiscuous; /* run in promiscuous mode flag. */ interface_control_t *intf_handle; /* interface control handle. */ *************** *** 336,346 **** rawnet_t *rawnet; /* raw network handle */ ! client_cache_t *cache; /* cache */ ! client_conf_t *conf; /* configuration. */ ! uint32_t xid; /* unique xid */ ! time_t started; /* the amount of milliseconds since we started. */ ! time_t secs; /* secs -- used to save secs value. */ ! uint32_t renewal_time; /* when to renew lease (secs). */ char *interface; /* interface name. */ --- 338,348 ---- rawnet_t *rawnet; /* raw network handle */ ! client_cache_t *cache; /* cache */ ! client_conf_t *conf; /* configuration. */ ! uint32_t xid; /* unique xid */ ! time_t started; /* the amount of milliseconds since we started. */ ! time_t secs; /* secs -- used to save secs value. */ ! uint32_t renewal_time; /* when to renew lease (secs). */ char *interface; /* interface name. */ *************** *** 348,351 **** --- 350,357 ---- int state; /* our current state. */ int discover_offer_retries; /* counter for retries on discover_offer */ + + ip_addr_t sip_addr; /* server's ip address. */ + eth_addr_t shw_addr; /* server's hardware address. */ + } dhcp_client_control_t; *************** *** 529,534 **** /* packet building routines. */ extern void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options); ! extern void build_dhcp_request(rawnet_t *net, uint32_t xid, time_t secs, list_t *options); extern void build_arp_reply_broadcast(rawnet_t *net, uint32_t source_addr, eth_addr_t source_hw_addr); --- 535,546 ---- /* packet building routines. */ + /* dhcp packet routines. */ extern void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options); ! extern void build_dhcp_request_unicast(rawnet_t *net, uint32_t xid, time_t secs, list_t *options, ! ip_addr_t sip_addr, eth_addr_t shw_addr); ! extern void build_dhcp_request_broadcast(rawnet_t *net, uint32_t xid, time_t secs, list_t *options); ! extern void build_dhcp_release(rawnet_t *net, uint32_t xid, list_t *options, ip_addr_t sip_addr, eth_addr_t shw_addr); ! ! /* arp packet routines. */ extern void build_arp_reply_broadcast(rawnet_t *net, uint32_t source_addr, eth_addr_t source_hw_addr); *************** *** 547,550 **** --- 559,564 ---- extern void build_unarp(rawnet_t *net, uint32_t source_addr, eth_addr_t source_hw_addr); + + /* icmp packet routines. */ 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); *************** *** 606,609 **** --- 620,624 ---- extern void dhcp_set_secs(dhcp_obj *dhcp, uint16_t secs); extern void dhcp_set_flag_broadcast(dhcp_obj *dhcp); + extern void dhcp_unset_flag_broadcast(dhcp_obj *dhcp); extern void dhcp_set_ciaddr(dhcp_obj *dhcp, uint32_t ciaddr); extern void dhcp_set_yiaddr(dhcp_obj *dhcp, uint32_t yiaddr); *************** *** 634,637 **** --- 649,653 ---- extern int dhcp_is_file_overload(dhcp_obj *dhcp); extern int dhcp_is_sname_overload(dhcp_obj *dhcp); + extern uint32_t dhcp_gen_xid(void); extern dhcp_option_t *dhcp_build_parameter_request_list_option(unsigned char *requested_options); *************** *** 643,647 **** extern dhcp_option_t *dhcp_build_server_identifier(uint32_t address); extern dhcp_option_t *dhcp_build_hostname(char *hostname); ! extern uint32_t dhcp_gen_xid(void); /* Ether obj routines. */ --- 659,663 ---- extern dhcp_option_t *dhcp_build_server_identifier(uint32_t address); extern dhcp_option_t *dhcp_build_hostname(char *hostname); ! /* Ether obj routines. */ *************** *** 652,657 **** extern void eth_write_packet_image(eth_obj *eth, unsigned char *packet); ! extern unsigned char *eth_get_src_address(eth_obj *eth); ! extern unsigned char *eth_get_dst_address(eth_obj *eth); extern uint16_t eth_get_type(eth_obj *eth); --- 668,673 ---- extern void eth_write_packet_image(eth_obj *eth, unsigned char *packet); ! extern eth_addr_t eth_get_src_address(eth_obj *eth); ! extern eth_addr_t eth_get_dst_address(eth_obj *eth); extern uint16_t eth_get_type(eth_obj *eth); *************** *** 782,785 **** --- 798,804 ---- extern void dhcp_client_interface_down(dhcp_client_control_t *dc); extern void dhcp_client_update_xid(dhcp_client_control_t *dc); + + extern void dhcp_client_set_server_hw_address(dhcp_client_control_t *dc, eth_addr_t eth_addr); + extern void dhcp_client_set_server_ip_address(dhcp_client_control_t *dc, ip_addr_t ip_addr); /* dhcp client conf */ Index: dhcp-arp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp-discovery.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-arp-discovery.c 12 Oct 2002 22:54:50 -0000 1.9 --- dhcp-arp-discovery.c 21 Oct 2002 01:02:48 -0000 1.10 *************** *** 80,84 **** * hardware address so we get a reply back. */ ! build_arp_request(net, net->ip_addr, address, net->hw_addr); while(retries--) { --- 80,84 ---- * hardware address so we get a reply back. */ ! build_arp_request(net, net->cip_addr, address, net->chw_addr); while(retries--) { Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dhcp-client-control.c 14 Oct 2002 15:52:33 -0000 1.27 --- dhcp-client-control.c 21 Oct 2002 01:02:48 -0000 1.28 *************** *** 239,247 **** if(dc->client_id) xfree(dc->client_id); ! xfree(dc); } ! /* Utility routines to bring down interface. * we need this because we have to be explicit * about it. We can't do this at the time we --- 239,247 ---- if(dc->client_id) xfree(dc->client_id); ! xfree(dc); } ! /* Utility routine to bring down interface. * we need this because we have to be explicit * about it. We can't do this at the time we *************** *** 256,259 **** --- 256,276 ---- { rawnet_interface_down(dc->rawnet); + return; + } + + /* set and clear server address. + * this is useful for unicasting and for RELEASE. */ + + void dhcp_client_set_server_ip_address(dhcp_client_control_t *dc, ip_addr_t ip_addr) + { + memcpy(&dc->sip_addr, &ip_addr, sizeof(ip_addr_t)); + + return; + } + + void dhcp_client_set_server_hw_address(dhcp_client_control_t *dc, eth_addr_t eth_addr) + { + memcpy(&dc->shw_addr, ð_addr, sizeof(eth_addr_t)); + return; } Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** dhcp-client-states.c 14 Oct 2002 15:52:33 -0000 1.40 --- dhcp-client-states.c 21 Oct 2002 01:02:48 -0000 1.41 *************** *** 34,64 **** #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); ! return 1; ! 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(string_matches(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 : 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. */ ! ! static list_t *client_build_option_list(unsigned char *opts, unsigned char message_type, ! unsigned char *client_id, unsigned char *class_id) { list_t *options = NULL; --- 34,61 ---- #include <dhcp-net.h> ! /*************************** ! * Option List Generation. * ! ***************************/ ! /* Create DHCP RELEASE option list. */ ! static list_t *client_build_release_option_list(dhcp_client_control_t *dc) { ! list_t *options = NULL; ! dhcp_option_t *option; ! /* client_id: RFC2131 says we MAY */ ! option = dhcp_build_client_id(dc->client_id, (ETH_ADDR_LEN + 1)); ! options = add_to_list(options, option); ! ! /* dhcp message type. */ ! option = dhcp_build_message_type(DHCP_RELEASE_TM); ! options = add_to_list(options, option); ! return options; } ! /* This is used for both requests and discovery. */ ! static list_t *client_build_option_list(unsigned char *opts, dhcp_client_control_t *dc) { list_t *options = NULL; *************** *** 70,92 **** option = dhcp_build_parameter_request_list_option(opts); options = add_to_list(options, option); ! } ! ! /* dhcp max DHCP message size. */ ! /* FIXME: when overloading and the mtu is fixed ! * we also need to fix this magic number. */ ! option = dhcp_build_max_message_size_option(576); options = add_to_list(options, option); - /* dhcp message type. */ - option = dhcp_build_message_type(message_type); - options = add_to_list(options, option); - /* client_id */ ! option = dhcp_build_client_id(client_id, (ETH_ADDR_LEN + 1)); options = add_to_list(options, option); /* class_id */ ! option = dhcp_build_class_id(class_id); options = add_to_list(options, option); --- 67,83 ---- option = dhcp_build_parameter_request_list_option(opts); options = add_to_list(options, option); ! } ! /* dhcp max DHCP message size: ! * should go into globconf. */ ! option = dhcp_build_max_message_size_option(MAX_MESSAGE_SIZE); options = add_to_list(options, option); /* client_id */ ! option = dhcp_build_client_id(dc->client_id, (ETH_ADDR_LEN + 1)); options = add_to_list(options, option); /* class_id */ ! option = dhcp_build_class_id(dc->class_id); options = add_to_list(options, option); *************** *** 102,105 **** --- 93,156 ---- } + /* Create DHCP DISCOVER option list. */ + static list_t *client_build_discover_option_list(unsigned char *opts, dhcp_client_control_t *dc) + { + list_t *options = NULL; + list_t *requested_options = NULL; + dhcp_option_t *option; + + /* dhcp message type. */ + option = dhcp_build_message_type(DHCP_DISCOVER_TM); + options = add_to_list(options, option); + + requested_options = client_build_option_list(opts, dc); + options = join_lists(options, requested_options); + + return options; + } + + /* Create DHCP REQUEST option list. */ + static list_t *client_build_request_option_list(unsigned char *opts, dhcp_client_control_t *dc) + { + list_t *options = NULL; + list_t *requested_options = NULL; + dhcp_option_t *option; + + /* dhcp message type. */ + option = dhcp_build_message_type(DHCP_REQUEST_TM); + options = add_to_list(options, option); + + requested_options = client_build_option_list(opts, dc); + options = join_lists(options, requested_options); + + return options; + } + + /* 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); + + return 1; + 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(string_matches(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 : going to use \"atleast\""); + return(dhcp_have_atleast_requested_options(dc->rawnet->dhcp_p, dc->conf->options)); + } + + } + + /****************** + * Check Routines * + ******************/ + /* Basic DHCP test on incoming rawnet packet. */ static int client_check_dhcp(dhcp_client_control_t *dc) *************** *** 124,129 **** --- 175,188 ---- dhcp_client_control_t *dc = arg; + /* check for a valid dhcp packet. */ + if(client_check_dhcp(dc) && + + /* check that the type is an offer. */ + dhcp_is_type(dc->rawnet->dhcp_p, DHCP_OFFER_TM) && + + /* check if the requested options match what we want. */ + client_check_requested_options(dc)) return 1; *************** *** 145,148 **** --- 204,225 ---- } + /************* + * Utilities.* + *************/ + + /* update secs field. */ + static void client_update_packet(void *arg) + { + dhcp_client_control_t *dc = arg; + + dhcp_client_update_secs(dc); + rawnet_dhcp_update(dc->rawnet, (uint16_t)dc->secs); + return; + } + + /************* + * ARP/UNARP.* + *************/ + /* * Use this to send out a broadcast reply claiming that we own the *************** *** 187,199 **** } ! /* update secs field. */ ! static void client_update_packet(void *arg) ! { ! dhcp_client_control_t *dc = arg; ! ! dhcp_client_update_secs(dc); ! rawnet_dhcp_update(dc->rawnet, (uint16_t)dc->secs); ! return; ! } /* do discover/offer transaction. */ --- 264,270 ---- } ! /****************************** ! * DHCP client state routines.* ! ******************************/ /* do discover/offer transaction. */ *************** *** 203,208 **** int retval; ! options = client_build_option_list(dc->conf->options, DHCP_DISCOVER_TM, ! dc->client_id, dc->class_id); /* when we begin transmitting discover_offer we setup our secs field. --- 274,278 ---- int retval; ! options = client_build_discover_option_list(dc->conf->options, dc); /* when we begin transmitting discover_offer we setup our secs field. *************** *** 241,245 **** FATAL_MESSAGE("invalid return value from raw network handler -- this a bug report it."); } ! /* Check for two options before inserting them ourselves. * The server may have decided to be nice to us. */ --- 311,315 ---- FATAL_MESSAGE("invalid return value from raw network handler -- this a bug report it."); } ! /* Check for two options before inserting them ourselves. * The server may have decided to be nice to us. */ *************** *** 274,278 **** /* Build options along with the options in our cache. */ ! options = client_build_option_list(NULL, DHCP_REQUEST_TM, dc->client_id, dc->class_id); cache_options = client_cache_load_option_network_list(dc->cache, 0); --- 344,348 ---- /* Build options along with the options in our cache. */ ! options = client_build_request_option_list(NULL, dc); cache_options = client_cache_load_option_network_list(dc->cache, 0); *************** *** 286,291 **** /* Our options cleared by build_* since they are passed * down and later purged. */ ! ! build_dhcp_request(dc->rawnet, dc->xid, dc->secs, options); retval = rawnet_packet_transact(dc->rawnet, dc, NULL, client_check_request); --- 356,361 ---- /* Our options cleared by build_* since they are passed * down and later purged. */ ! ! build_dhcp_request_broadcast(dc->rawnet, dc->xid, dc->secs, options); retval = rawnet_packet_transact(dc->rawnet, dc, NULL, client_check_request); *************** *** 311,321 **** * then we need to revert to discover/offer state. */ ! if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) return STATE_SETUP; ! else return STATE_DISCOVER_OFFER; } /* do setup (call do_sysconf) */ int client_setup(dhcp_client_control_t *dc) --- 381,426 ---- * then we need to revert to discover/offer state. */ ! if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! ! /* save hardware and ip address of server. we need these later. */ ! dhcp_client_set_server_ip_address(dc, ip_get_source_addr(dc->rawnet->ip_p)); ! dhcp_client_set_server_hw_address(dc, eth_get_src_address(dc->rawnet->ether_p)); ! return STATE_SETUP; ! } else { return STATE_DISCOVER_OFFER; + } } + /* release lease. */ + int client_release(dhcp_client_control_t *dc) + { + list_t *options; + + options = client_build_release_option_list(dc); + + build_dhcp_release(dc->rawnet, dc->xid, options, dc->sip_addr, dc->shw_addr); + + if(rawnet_send_packet(dc->rawnet) < 0) { + ERROR_MESSAGE("could not send release."); + return STATE_FATAL_ERROR; + } + + client_cache_delete_cache(dc->cache); + + /* We should still have our interface up, so go ahead and send UNARP before + * 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 */ + dhcp_client_interface_down(dc); + + return 0; /* called from do_shutdown() so no real state returned */ + } + /* do setup (call do_sysconf) */ int client_setup(dhcp_client_control_t *dc) *************** *** 379,420 **** * or a TERM. in either case we can * return STATE_REQUEST_ACK here. */ - } - - /* release lease. */ - int client_release(dhcp_client_control_t *dc) - { - list_t *options, *cache_options; - - options = client_build_option_list(NULL, DHCP_RELEASE_TM, dc->client_id, dc->class_id); - cache_options = client_cache_load_option_network_list(dc->cache, 0); - if(cache_options == NULL) - /* if we have no cache we probably timed out - * somewhere. Just return. */ - return STATE_FATAL_ERROR; - - options = join_lists(options, cache_options); - - /* Our options cleared by build_* since they are passed - * down and later purged. */ - - build_dhcp_request(dc->rawnet, dc->xid, dc->secs, options); - - if(rawnet_send_packet(dc->rawnet) < 0) { - ERROR_MESSAGE("could not send release."); - return STATE_FATAL_ERROR; - } - - client_cache_delete_cache(dc->cache); - - /* We should still have our interface up, so go ahead and send UNARP before - * 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 */ - dhcp_client_interface_down(dc); - - return 0; /* called from do_shutdown() so no real state returned */ } --- 484,486 ---- Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-com.c 12 Oct 2002 22:54:50 -0000 1.13 --- dhcp-com.c 21 Oct 2002 01:02:48 -0000 1.14 *************** *** 626,629 **** --- 626,636 ---- } + /* dhcp flags: do conversion */ + void dhcp_unset_flag_broadcast(dhcp_obj *dhcp) + { + dhcp->fixedheader.flags = 0; + return; + } + /* dhcp ciaddr: no conversion necessary */ void dhcp_set_ciaddr(dhcp_obj *dhcp, uint32_t ciaddr) Index: dhcp-eth.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-eth.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-eth.c 12 Oct 2002 22:54:50 -0000 1.6 --- dhcp-eth.c 21 Oct 2002 01:02:48 -0000 1.7 *************** *** 45,56 **** } ! unsigned char *eth_get_src_address(eth_obj *eth) { ! return(eth->header.eth_src.data); } ! unsigned char *eth_get_dst_address(eth_obj *eth) { ! return(eth->header.eth_dst.data); } --- 45,56 ---- } ! eth_addr_t eth_get_src_address(eth_obj *eth) { ! return(eth->header.eth_src); } ! eth_addr_t eth_get_dst_address(eth_obj *eth) { ! return(eth->header.eth_dst); } Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dhcp-icmp-discovery.c 13 Oct 2002 22:17:14 -0000 1.19 --- dhcp-icmp-discovery.c 21 Oct 2002 01:02:48 -0000 1.20 *************** *** 126,130 **** seq = 1; ! build_icmp_echo_request(net, net->ip_addr, dest_addr, net->hw_addr, dest_mac, id, seq); gettimeofday(&before, NULL); --- 126,130 ---- seq = 1; ! build_icmp_echo_request(net, net->cip_addr, dest_addr, net->chw_addr, dest_mac, id, seq); gettimeofday(&before, NULL); Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** dhcp-net.c 14 Oct 2002 15:52:33 -0000 1.34 --- dhcp-net.c 21 Oct 2002 01:02:48 -0000 1.35 *************** *** 170,174 **** } ! memcpy(&net->ip_addr, &addr, IP_ADDR_LEN); /* set our IP address. */ return 0; } --- 170,174 ---- } ! memcpy(&net->cip_addr, &addr, IP_ADDR_LEN); /* set our IP address. */ return 0; } *************** *** 182,186 **** } ! memset(&net->ip_addr, 0, IP_ADDR_LEN); /* clear our IP address -- this isn't very useful though. */ return 0; } --- 182,186 ---- } ! memset(&net->cip_addr, 0, IP_ADDR_LEN); /* clear our IP address -- this isn't very useful though. */ return 0; } *************** *** 261,266 **** * address if the system supports it. */ ! rawnet_get_hw_addr(net, &net->hw_addr); ! rawnet_get_ip_addr(net, &net->ip_addr); /* Packet handler objects. --- 261,266 ---- * address if the system supports it. */ ! rawnet_get_hw_addr(net, &net->chw_addr); ! rawnet_get_ip_addr(net, &net->cip_addr); /* Packet handler objects. *************** *** 297,301 **** } ! memcpy(net->hw_addr.data, mac_addr, ETH_ADDR_LEN); /* now reinitialize in promiscuous mode */ --- 297,301 ---- } ! memcpy(net->chw_addr.data, mac_addr, ETH_ADDR_LEN); /* now reinitialize in promiscuous mode */ Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-packet-build.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-packet-build.c 13 Oct 2002 22:22:11 -0000 1.10 --- dhcp-packet-build.c 21 Oct 2002 01:02:48 -0000 1.11 *************** *** 309,322 **** * * * * * * * * * */ ! static void build_dhcp(rawnet_t *net, ! uint32_t xid, ! uint16_t secs, ! eth_addr_t client_hw_addr, ! uint32_t ciaddr, ! uint32_t yiaddr, ! uint32_t siaddr, ! uint32_t giaddr, ! list_t *options, ! unsigned char bootp_type) { --- 309,323 ---- * * * * * * * * * */ ! static void build_dhcp_proc(rawnet_t *net, ! uint32_t xid, ! uint16_t secs, ! eth_addr_t client_hw_addr, ! uint32_t ciaddr, ! uint32_t yiaddr, ! uint32_t siaddr, ! uint32_t giaddr, ! list_t *options, ! unsigned char broadcast, ! unsigned char bootp_type) { *************** *** 328,332 **** dhcp_set_secs(net->dhcp_p, secs); ! dhcp_set_flag_broadcast(net->dhcp_p); dhcp_set_ciaddr(net->dhcp_p, ciaddr); dhcp_set_yiaddr(net->dhcp_p, yiaddr); --- 329,337 ---- dhcp_set_secs(net->dhcp_p, secs); ! if(broadcast) ! dhcp_set_flag_broadcast(net->dhcp_p); ! else ! dhcp_unset_flag_broadcast(net->dhcp_p); ! dhcp_set_ciaddr(net->dhcp_p, ciaddr); dhcp_set_yiaddr(net->dhcp_p, yiaddr); *************** *** 335,339 **** dhcp_clear_chaddr(net->dhcp_p); ! dhcp_set_chaddr(net->dhcp_p, (unsigned char *)&client_hw_addr, ETH_ADDR_LEN); dhcp_clear_sname(net->dhcp_p); --- 340,344 ---- dhcp_clear_chaddr(net->dhcp_p); ! dhcp_set_chaddr(net->dhcp_p, client_hw_addr.data, ETH_ADDR_LEN); dhcp_clear_sname(net->dhcp_p); *************** *** 346,352 **** } ! static void build_dhcp_proc(rawnet_t *net, uint32_t xid, time_t secs, ! uint32_t ciaddr, uint32_t yiaddr, uint32_t siaddr, ! uint32_t giaddr, list_t *options, unsigned char bootp_type) { uint16_t ip_len, udp_len; --- 351,359 ---- } ! static void build_dhcp(rawnet_t *net, uint32_t xid, time_t secs, ! uint32_t ciaddr, uint32_t yiaddr, uint32_t siaddr, ! uint32_t giaddr, ip_addr_t server_ip_addr, eth_addr_t server_hw_addr, ! unsigned char broadcast, list_t *options, ! unsigned char bootp_type) { uint16_t ip_len, udp_len; *************** *** 381,388 **** FATAL_MESSAGE("Outgoing DHCP packet too large. I'm currently not implementing this properly so I'll have to exit!"); ! build_eth_broadcast(net, net->hw_addr, ETH_TYPE_IP); ! build_ip_broadcast(net, ip_len, IP_PROTO_UDP, 0); build_udp(net, udp_len); ! build_dhcp(net, xid, secs, net->hw_addr, ciaddr, yiaddr, siaddr, giaddr, options, bootp_type); /* Write packet. */ --- 388,403 ---- FATAL_MESSAGE("Outgoing DHCP packet too large. I'm currently not implementing this properly so I'll have to exit!"); ! if(broadcast) ! build_eth_broadcast(net, net->chw_addr, ETH_TYPE_IP); ! else ! build_eth(net, net->chw_addr, server_hw_addr, ETH_TYPE_IP); ! ! if(broadcast) ! build_ip_broadcast(net, ip_len, IP_PROTO_UDP, 0); ! else ! build_ip(net, ip_len, IP_PROTO_UDP, net->cip_addr, server_ip_addr); ! build_udp(net, udp_len); ! build_dhcp_proc(net, xid, secs, net->chw_addr, ciaddr, yiaddr, siaddr, giaddr, options, broadcast, bootp_type); /* Write packet. */ *************** *** 396,411 **** } - /* Create a dhcp discover message. */ void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options) { ! build_dhcp_proc(net, xid, secs, 0, 0, 0, 0, options, DHCP_BOOTP_REQUEST); } ! /* Create dhcp request message. */ ! void build_dhcp_request(rawnet_t *net, uint32_t xid, time_t secs, list_t *options) { ! build_dhcp_proc(net, xid, secs, net->ip_addr, 0, 0, 0, options, DHCP_BOOTP_REQUEST); } /* Create icmp packet: procify this so we can use it for all other icmp building. */ --- 411,442 ---- } /* Create a dhcp discover message. */ void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options) { ! build_dhcp(net, xid, secs, 0, 0, 0, 0, (ip_addr_t)0, eth_null, 1, options, DHCP_BOOTP_REQUEST); } ! /* Create dhcp request message: unicast */ ! void build_dhcp_request_unicast(rawnet_t *net, uint32_t xid, time_t secs, list_t *options, ip_addr_t sip_addr, ! eth_addr_t shw_addr) { ! build_dhcp(net, xid, secs, net->cip_addr, 0, 0, 0, sip_addr, shw_addr, 0, options, DHCP_BOOTP_REQUEST); } + /* Create dhcp request message: broadcast */ + void build_dhcp_request_broadcast(rawnet_t *net, uint32_t xid, time_t secs, list_t *options) + { + build_dhcp(net, xid, secs, net->cip_addr, 0, 0, 0, (ip_addr_t)0, eth_null, 1, options, DHCP_BOOTP_REQUEST); + } + + /* Create dhcp release message. */ + void build_dhcp_release(rawnet_t *net, uint32_t xid, list_t *options, ip_addr_t sip_addr, eth_addr_t shw_addr) + { + build_dhcp(net, xid, 0, net->cip_addr, 0, 0, 0, + sip_addr, shw_addr, 1, options, DHCP_BOOTP_REQUEST); + } + + /* * * * * * * * * * + * ICMP routines. * + * * * * * * * * * */ /* Create icmp packet: procify this so we can use it for all other icmp building. */ *************** *** 438,442 **** int ip_len = ICMP_HDR_LEN + 12 + IP_HDR_LEN; /* 12 bytes for the mask request. */ ! build_eth_broadcast(net, net->hw_addr, ETH_TYPE_IP); build_ip_broadcast(net, ip_len, IP_PROTO_ICMP, 0); build_icmp_mask_proc(net, ICMP_MASK, id, seq, 0); --- 469,473 ---- int ip_len = ICMP_HDR_LEN + 12 + IP_HDR_LEN; /* 12 bytes for the mask request. */ ! build_eth_broadcast(net, net->chw_addr, ETH_TYPE_IP); build_ip_broadcast(net, ip_len, IP_PROTO_ICMP, 0); build_icmp_mask_proc(net, ICMP_MASK, id, seq, 0); *************** *** 453,457 **** int ip_len = IP_HDR_LEN + ICMP_HDR_LEN + 12; /* 12 bytes for the mask reply. */ ! build_eth_broadcast(net, net->hw_addr, ETH_TYPE_IP); build_ip_broadcast(net, ip_len, IP_PROTO_ICMP, 0); build_icmp_mask_proc(net, ICMP_MASK, id, seq, subnet_mask); --- 484,488 ---- int ip_len = IP_HDR_LEN + ICMP_HDR_LEN + 12; /* 12 bytes for the mask reply. */ ! build_eth_broadcast(net, net->chw_addr, ETH_TYPE_IP); build_ip_broadcast(net, ip_len, IP_PROTO_ICMP, 0); build_icmp_mask_proc(net, ICMP_MASK, id, seq, subnet_mask); Index: dhcp-print.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-print.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-print.c 12 Oct 2002 22:54:50 -0000 1.10 --- dhcp-print.c 21 Oct 2002 01:02:48 -0000 1.11 *************** *** 767,780 **** 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; --- 767,780 ---- void print_eth_brief(eth_obj *eth) { ! eth_addr_t src_eth_addr; ! eth_addr_t 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.data[0], src_eth_addr.data[1], src_eth_addr.data[2], ! src_eth_addr.data[3], src_eth_addr.data[4], src_eth_addr.data[5]); ! printf("dmac: %x:%x:%x:%x:%x:%x ", dst_eth_addr.data[0], dst_eth_addr.data[1], dst_eth_addr.data[2], ! dst_eth_addr.data[3], dst_eth_addr.data[4], dst_eth_addr.data[5]); return; *************** *** 783,797 **** void print_eth_verbose(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("--------------------------Ethernet Header-----------------------------\n"); ! printf("SRC MAC: %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(" DST MAC: %x:%x:%x:%x:%x:%x\n", 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; --- 783,795 ---- void print_eth_verbose(eth_obj *eth) { ! eth_addr_t src_eth_addr, dst_eth_addr; src_eth_addr = eth_get_src_address(eth); dst_eth_addr = eth_get_dst_address(eth); printf("--------------------------Ethernet Header-----------------------------\n"); ! printf("SRC MAC: %x:%x:%x:%x:%x:%x", src_eth_addr.data[0], src_eth_addr.data[1], src_eth_addr.data[2], ! src_eth_addr.data[3], src_eth_addr.data[4], src_eth_addr.data[5]); ! printf(" DST MAC: %x:%x:%x:%x:%x:%x\n", dst_eth_addr.data[0], dst_eth_addr.data[1], dst_eth_addr.data[2], ! dst_eth_addr.data[3], dst_eth_addr.data[4], dst_eth_addr.data[5]); return; |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv6203 Modified Files: README dhcp-agent.h dhcp-client-control.c dhcp-client-states.c dhcp-client.c dhcp-net.c dhcp-net.h dhcp-sniff.c Log Message: got rid of some static buffers in favor of stringbuffer Index: README =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/README,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** README 11 Sep 2002 23:55:16 -0000 1.8 --- README 14 Oct 2002 15:52:32 -0000 1.9 *************** *** 38,42 **** http://www.tcpdump.org/ ! You will also need Dug Song's libdnet (1.4 or above). http://libdnet.sourceforge.net/ --- 38,42 ---- http://www.tcpdump.org/ ! You will also need Dug Song's libdnet (1.5 or above). http://libdnet.sourceforge.net/ Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** dhcp-agent.h 13 Oct 2002 22:17:13 -0000 1.68 --- dhcp-agent.h 14 Oct 2002 15:52:32 -0000 1.69 *************** *** 108,115 **** # define GENERIC_BUFFSIZE 256 - /* log string buffer */ - - # define MSG_BUFFER_SIZE 256 - /* Snaplen. Use the largest size since DHCP packets could * get pretty big with all the additional options. --- 108,111 ---- Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dhcp-client-control.c 12 Oct 2002 22:54:50 -0000 1.26 --- dhcp-client-control.c 14 Oct 2002 15:52:33 -0000 1.27 *************** *** 120,124 **** dhcp_client_control_t *dc; int dport, sport; ! char filter_buff[GENERIC_BUFFSIZE]; eth_addr_t interface_addr; --- 120,124 ---- dhcp_client_control_t *dc; int dport, sport; ! stringbuffer *filter; eth_addr_t interface_addr; *************** *** 164,176 **** /* Create filter. */ ! snprintf(filter_buff, sizeof(filter_buff), ! "arp or icmp or (udp and (src port %d or dst port %d))", ! dport, sport); ! if((dc->rawnet = rawnet_create(interface, filter_buff, sport, dport, promiscuous)) == NULL) { ERROR_MESSAGE("could not acquire rawnet handler."); destroy_dhcp_client_control(dc); return NULL; } /* Additional fields. */ --- 164,178 ---- /* Create filter. */ ! filter = create_stringbuffer(); ! stringbuffer_aprintf(filter, "arp or icmp or (udp and (src port %d or dst port %d))", ! dport, sport); ! if((dc->rawnet = rawnet_create(interface, stringbuffer_getstring(filter), sport, dport, promiscuous)) == NULL) { ERROR_MESSAGE("could not acquire rawnet handler."); destroy_dhcp_client_control(dc); return NULL; } + + destroy_stringbuffer(filter); /* Additional fields. */ Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** dhcp-client-states.c 12 Oct 2002 22:54:50 -0000 1.39 --- dhcp-client-states.c 14 Oct 2002 15:52:33 -0000 1.40 *************** *** 294,298 **** case RAWNET_TIMEOUT: ! ERROR_MESSAGE("timeouton DHCP discover."); return STATE_FATAL_ERROR; --- 294,298 ---- case RAWNET_TIMEOUT: ! ERROR_MESSAGE("timeout on DHCP discover."); return STATE_FATAL_ERROR; Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** dhcp-client.c 13 Oct 2002 22:17:14 -0000 1.45 --- dhcp-client.c 14 Oct 2002 15:52:33 -0000 1.46 *************** *** 415,419 **** * semicolons) */ ! // setup_interrupt_handlers(); /* setup signal handling */ if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { --- 415,419 ---- * semicolons) */ ! setup_interrupt_handlers(); /* setup signal handling */ if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { *************** *** 480,484 **** switch(c) { ! /* check for command codes. */ case 'v': /* print version. */ --- 480,484 ---- switch(c) { ! /* check for command codes. */ case 'v': /* print version. */ Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** dhcp-net.c 12 Oct 2002 22:54:50 -0000 1.33 --- dhcp-net.c 14 Oct 2002 15:52:33 -0000 1.34 *************** *** 188,192 **** /* Create the workhorse network module. */ ! rawnet_t *rawnet_create(char *device, char *filter, int dhcp_src_port, int dhcp_dst_port, int promiscuous) --- 188,192 ---- /* Create the workhorse network module. */ ! rawnet_t *rawnet_create(const char *device, const char *filter, int dhcp_src_port, int dhcp_dst_port, int promiscuous) *************** *** 244,248 **** /* get pcap handler */ ! net->pcap = initialize_pcap_device(device, filter, promiscuous); if(net->pcap == NULL) { ERROR_MESSAGE("could not initialize pcap device for: %s", device); --- 244,248 ---- /* get pcap handler */ ! net->pcap = initialize_pcap_device(net->device, net->pcap_filter, promiscuous); if(net->pcap == NULL) { ERROR_MESSAGE("could not initialize pcap device for: %s", device); Index: dhcp-net.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-net.h 30 Jun 2002 08:23:45 -0000 1.3 --- dhcp-net.h 14 Oct 2002 15:52:33 -0000 1.4 *************** *** 45,49 **** /* 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, struct timeval *tm); --- 45,49 ---- /* Net/Rawnet routines. */ ! extern rawnet_t *rawnet_create(const char *device, const 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); Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-sniff.c 12 Oct 2002 22:54:50 -0000 1.16 --- dhcp-sniff.c 14 Oct 2002 15:52:34 -0000 1.17 *************** *** 52,56 **** int retval; int sport, dport; ! char filter_buff[GENERIC_BUFFSIZE]; print_packet p_packet = print_dhcp_packet_verbose; list_t *available_interfaces; --- 52,56 ---- int retval; int sport, dport; ! stringbuffer *filter; print_packet p_packet = print_dhcp_packet_verbose; list_t *available_interfaces; *************** *** 113,120 **** } ! snprintf(filter_buff, sizeof(filter_buff), "arp or icmp or (udp and (port %d or port %d))", dport, sport); /* It's ok not to set ports since we're not writing any packets. */ ! net = rawnet_create(interface_name, filter_buff, 0, 0, 1); if(net == NULL) { --- 113,123 ---- } ! filter = create_stringbuffer(); ! stringbuffer_aprintf(filter, "arp or icmp or (udp and (port %d or port %d))", dport, sport); /* It's ok not to set ports since we're not writing any packets. */ ! net = rawnet_create(interface_name, stringbuffer_getstring(filter), 0, 0, 1); ! ! destroy_stringbuffer(filter); if(net == NULL) { |
From: <act...@us...> - 2002-10-13 22:22:14
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv30209 Modified Files: dhcp-packet-build.c Log Message: we now release properly Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-packet-build.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-packet-build.c 13 Oct 2002 22:17:14 -0000 1.9 --- dhcp-packet-build.c 13 Oct 2002 22:22:11 -0000 1.10 *************** *** 406,410 **** void build_dhcp_request(rawnet_t *net, uint32_t xid, time_t secs, list_t *options) { ! build_dhcp_proc(net, xid, secs, 0, 0, 0, 0, options, DHCP_BOOTP_REQUEST); } --- 406,410 ---- void build_dhcp_request(rawnet_t *net, uint32_t xid, time_t secs, list_t *options) { ! build_dhcp_proc(net, xid, secs, net->ip_addr, 0, 0, 0, options, DHCP_BOOTP_REQUEST); } |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv29039 Modified Files: dhcp-agent.h dhcp-client.c dhcp-icmp-discovery.c dhcp-icmp.c dhcp-packet-build.c dhcp-sysconf.c Log Message: fixed icmp echo stupidity -- now uses proper dest mac address Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** dhcp-agent.h 12 Oct 2002 22:54:50 -0000 1.67 --- dhcp-agent.h 13 Oct 2002 22:17:13 -0000 1.68 *************** *** 554,559 **** extern void build_icmp_mask_reply(rawnet_t *net, uint32_t id, uint32_t seq, uint32_t subnet_mask); extern void build_icmp_echo_request(rawnet_t *net, ip_addr_t source_addr, ip_addr_t dest_addr, ! eth_addr_t source_mac, eth_addr_t dest_mac, uint32_t id, ! uint32_t seq); /* ICMP discovery routines. */ --- 554,559 ---- extern void build_icmp_mask_reply(rawnet_t *net, uint32_t id, uint32_t seq, uint32_t subnet_mask); extern void build_icmp_echo_request(rawnet_t *net, ip_addr_t source_addr, ip_addr_t dest_addr, ! eth_addr_t source_mac, eth_addr_t dest_mac, uint16_t id, ! uint16_t seq); /* ICMP discovery routines. */ *************** *** 739,744 **** extern void icmp_mask_set_seq(icmp_obj *icmp, uint32_t seq); extern void icmp_mask_set_mask(icmp_obj *icmp, uint32_t mask); ! extern void icmp_echo_set_id(icmp_obj *icmp, uint32_t id); ! extern void icmp_echo_set_seq(icmp_obj *icmp, uint32_t seq); extern uint8_t icmp_get_type(icmp_obj *icmp); --- 739,744 ---- extern void icmp_mask_set_seq(icmp_obj *icmp, uint32_t seq); extern void icmp_mask_set_mask(icmp_obj *icmp, uint32_t mask); ! extern void icmp_echo_set_id(icmp_obj *icmp, uint16_t id); ! extern void icmp_echo_set_seq(icmp_obj *icmp, uint16_t seq); extern uint8_t icmp_get_type(icmp_obj *icmp); Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** dhcp-client.c 13 Oct 2002 16:29:42 -0000 1.44 --- dhcp-client.c 13 Oct 2002 22:17:14 -0000 1.45 *************** *** 33,37 **** /* forward declarations of do_ routines. */ - static void do_version(char *interface); static void do_kill_client(char *interface); --- 33,36 ---- *************** *** 416,420 **** * semicolons) */ ! setup_interrupt_handlers(); /* setup signal handling */ if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { --- 415,419 ---- * semicolons) */ ! // setup_interrupt_handlers(); /* setup signal handling */ if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-icmp-discovery.c 12 Oct 2002 22:54:50 -0000 1.18 --- dhcp-icmp-discovery.c 13 Oct 2002 22:17:14 -0000 1.19 *************** *** 119,128 **** int icmp_do_echo(rawnet_t *net, ip_addr_t dest_addr, eth_addr_t dest_mac) { ! uint32_t id, seq; struct timeval before, after, difference; int latency; ! id = get_random_uint32(); ! seq = get_random_uint32(); build_icmp_echo_request(net, net->ip_addr, dest_addr, net->hw_addr, dest_mac, id, seq); --- 119,128 ---- int icmp_do_echo(rawnet_t *net, ip_addr_t dest_addr, eth_addr_t dest_mac) { ! uint16_t id, seq; struct timeval before, after, difference; int latency; ! id = get_random_uint16(); ! seq = 1; build_icmp_echo_request(net, net->ip_addr, dest_addr, net->hw_addr, dest_mac, id, seq); Index: dhcp-icmp.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-icmp.c 12 Oct 2002 22:54:50 -0000 1.9 --- dhcp-icmp.c 13 Oct 2002 22:17:14 -0000 1.10 *************** *** 84,95 **** } ! void icmp_echo_set_id(icmp_obj *icmp, uint32_t id) { ! icmp->icmp_msg.echo.icmp_id = htonl(id); } ! void icmp_echo_set_seq(icmp_obj *icmp, uint32_t seq) { ! icmp->icmp_msg.echo.icmp_seq = htonl(seq); } --- 84,95 ---- } ! void icmp_echo_set_id(icmp_obj *icmp, uint16_t id) { ! icmp->icmp_msg.echo.icmp_id = htons(id); } ! void icmp_echo_set_seq(icmp_obj *icmp, uint16_t seq) { ! icmp->icmp_msg.echo.icmp_seq = htons(seq); } Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-packet-build.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-packet-build.c 12 Oct 2002 22:54:50 -0000 1.8 --- dhcp-packet-build.c 13 Oct 2002 22:17:14 -0000 1.9 *************** *** 159,163 **** static void build_eth(rawnet_t *net, eth_addr_t source_hw_addr, eth_addr_t dest_hw_addr, uint16_t type) { ! build_eth_proc(net, source_hw_addr, eth_broadcast, type); return; } --- 159,163 ---- static void build_eth(rawnet_t *net, eth_addr_t source_hw_addr, eth_addr_t dest_hw_addr, uint16_t type) { ! build_eth_proc(net, source_hw_addr, dest_hw_addr, type); return; } *************** *** 463,469 **** } ! static void build_icmp_echo_request_proc(rawnet_t *net, uint32_t id, uint32_t seq) { ! icmp_echo_set_id(net->icmp_p, seq); icmp_echo_set_seq(net->icmp_p, seq); --- 463,469 ---- } ! static void build_icmp_echo_request_proc(rawnet_t *net, uint16_t id, uint16_t seq) { ! icmp_echo_set_id(net->icmp_p, id); icmp_echo_set_seq(net->icmp_p, seq); *************** *** 473,478 **** /* build icmp echo request. */ void build_icmp_echo_request(rawnet_t *net, ip_addr_t source_addr, ip_addr_t dest_addr, ! eth_addr_t source_mac, eth_addr_t dest_mac, uint32_t id, ! uint32_t seq) { int ip_len = IP_HDR_LEN + --- 473,478 ---- /* build icmp echo request. */ void build_icmp_echo_request(rawnet_t *net, ip_addr_t source_addr, ip_addr_t dest_addr, ! eth_addr_t source_mac, eth_addr_t dest_mac, uint16_t id, ! uint16_t seq) { int ip_len = IP_HDR_LEN + Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** dhcp-sysconf.c 12 Oct 2002 22:54:50 -0000 1.29 --- dhcp-sysconf.c 13 Oct 2002 22:17:14 -0000 1.30 *************** *** 155,162 **** --- 155,164 ---- rt = route_open(); if(rt == NULL) { + ERROR_MESSAGE("unable to open routing table: %s", strerror(errno)); return -1; } if(route_add(rt, &r_entry) < 0) { + ERROR_MESSAGE("unable to add route: %s", strerror(errno)); route_close(rt); return -1; *************** *** 356,360 **** sysconf_handlers[i].flag &= ~SYSCONF_DO_CLEANUP; ! WARN_MESSAGE("setup option: %s: %s", dhcp_options_strings[i]); } else { --- 358,362 ---- sysconf_handlers[i].flag &= ~SYSCONF_DO_CLEANUP; ! WARN_MESSAGE("unable to setup option: %s", dhcp_options_strings[i]); } else { |
From: <act...@us...> - 2002-09-13 03:24:47
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv5475 Modified Files: configure.in Log Message: new configure.in with better layout Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** configure.in 11 Sep 2002 23:52:28 -0000 1.24 --- configure.in 13 Sep 2002 01:18:47 -0000 1.25 *************** *** 1,15 **** dnl $Header$ ! dnl Ok here's another shot at writing ! dnl a proper configure.in dnl dnl -- tm...@wh... dnl init AC_PREREQ(2.53) AC_INIT(dhcp-agent, 0.38, tm...@wh...) AM_INIT_AUTOMAKE(dhcp-agent, 0.38) - AM_CONFIG_HEADER(config.h) AC_CONFIG_SRCDIR(dhcp-client.c) AC_ARG_WITH(libdnet-prefix,[ --with-libdnet-prefix=PREFIX Prefix where libdnet is installed (optional)], dnet_prefix="$withval", dnet_prefix="") --- 1,25 ---- dnl $Header$ ! dnl ! dnl Second try at writing a more coherent configure script. ! dnl We've layed it out per the gnu autoconf manual ! dnl Please look at: ! dnl http://www.gnu.org/manual/autoconf/html_node/configure.ac-Layout.html#configure.ac%20Layout ! dnl before making any changes. dnl dnl -- tm...@wh... + dnl dnl init + dnl + AC_PREREQ(2.53) AC_INIT(dhcp-agent, 0.38, tm...@wh...) AM_INIT_AUTOMAKE(dhcp-agent, 0.38) AC_CONFIG_SRCDIR(dhcp-client.c) + dnl + dnl additional arguments to autoconf + dnl + AC_ARG_WITH(libdnet-prefix,[ --with-libdnet-prefix=PREFIX Prefix where libdnet is installed (optional)], dnet_prefix="$withval", dnet_prefix="") *************** *** 25,36 **** AC_PROG_MAKE_SET ! dnl check stdc AC_HEADER_STDC - - dnl check for inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h - AC_CHECK_HEADERS(inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h) dnl try finding or generating our own C99 stdint macros --- 35,56 ---- AC_PROG_MAKE_SET ! dnl check header files we should have AC_HEADER_STDC AC_CHECK_HEADERS(inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h) + dnl + dnl check for types + dnl + + + AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, [have sigatomic_t])], [], [#include <signal.h>]) + + AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL, 1, [have struct bpf_timeval])], [], + [#include <sys/types.h> + #include <sys/time.h> + #include <sys/ioctl.h> + #include <net/bpf.h> ]) + dnl try finding or generating our own C99 stdint macros *************** *** 44,47 **** --- 64,69 ---- fi + AC_TYPE_SIGNAL + dnl check for functions *************** *** 53,65 **** AC_WF_CHECK_KILL_SIGNAL_DETECT - AC_WF_CHECK_BPF_IMMEDIATE ! dnl check for types ! AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL, 1, [have struct bpf_timeval])], [], ! [#include <sys/types.h> ! #include <sys/time.h> ! #include <sys/ioctl.h> ! #include <net/bpf.h> ]) AC_MSG_CHECKING(for __progname) --- 75,84 ---- AC_WF_CHECK_KILL_SIGNAL_DETECT ! dnl check for BPF_IMMEDIATE flag ! AC_WF_CHECK_BPF_IMMEDIATE ! ! dnl check for __progname AC_MSG_CHECKING(for __progname) *************** *** 80,87 **** fi - - AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, [have sigatomic_t])], [], [#include <signal.h>]) - AC_TYPE_SIGNAL - dnl pcap sifting --- 99,102 ---- *************** *** 93,97 **** PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" - AC_WF_CHECK_PCAP_HEADER_DIR PCAP_INC="-I$ac_pcap_header_dir" --- 108,111 ---- *************** *** 148,151 **** --- 162,167 ---- DEFS="" AC_SUBST(DEFS) + + AM_CONFIG_HEADER(config.h) AC_OUTPUT([Makefile]) |
From: <act...@us...> - 2002-09-12 00:18:35
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv3043 Added Files: depcomp Log Message: more autoconf fun --- NEW FILE: depcomp --- #! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva <ol...@dc...>. if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. This file always lives in the current directory. # Also, the AIX compiler puts `$object:' at the start of each line; # $object doesn't have directory information. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. We will use -o /dev/null later, # however we can't do the remplacement now because # `-o $object' might simply not be used IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; -*) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 |
From: <act...@us...> - 2002-09-12 00:17:10
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv2701 Modified Files: Makefile.in Log Message: acconfig.h no longer needed Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Makefile.in 11 Sep 2002 23:55:16 -0000 1.29 --- Makefile.in 12 Sep 2002 00:17:01 -0000 1.30 *************** *** 203,208 **** DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in THANKS \ ! TODO acconfig.h acinclude.m4 aclocal.m4 config.h.in configure \ ! configure.in depcomp install-sh missing mkinstalldirs SOURCES = $(dhcpclient_SOURCES) $(dhcpsniff_SOURCES) --- 203,208 ---- DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in THANKS \ ! TODO acinclude.m4 aclocal.m4 config.h.in configure configure.in \ ! depcomp install-sh missing mkinstalldirs SOURCES = $(dhcpclient_SOURCES) $(dhcpsniff_SOURCES) *************** *** 239,243 **** cd $(top_builddir) && $(SHELL) ./config.status config.h ! $(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.h.in --- 239,243 ---- cd $(top_builddir) && $(SHELL) ./config.status config.h ! $(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.h.in |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv29892 Modified Files: Makefile.in README TODO config.h.in dhcp-arp.c dhcp-packet-build.c dhcp-stringbuffer.c dhcp-stringbuffer.h Removed Files: acconfig.h Log Message: no need for auxiliary files with new autoconf Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Makefile.in 11 Sep 2002 23:52:28 -0000 1.28 --- Makefile.in 11 Sep 2002 23:55:16 -0000 1.29 *************** *** 203,208 **** DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in THANKS \ ! TODO acinclude.m4 aclocal.m4 config.h.in configure configure.in \ ! depcomp install-sh missing mkinstalldirs SOURCES = $(dhcpclient_SOURCES) $(dhcpsniff_SOURCES) --- 203,208 ---- DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in THANKS \ ! TODO acconfig.h acinclude.m4 aclocal.m4 config.h.in configure \ ! configure.in depcomp install-sh missing mkinstalldirs SOURCES = $(dhcpclient_SOURCES) $(dhcpsniff_SOURCES) *************** *** 239,243 **** cd $(top_builddir) && $(SHELL) ./config.status config.h ! $(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.h.in --- 239,243 ---- cd $(top_builddir) && $(SHELL) ./config.status config.h ! $(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.h.in Index: README =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/README,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** README 24 Jun 2002 14:32:24 -0000 1.7 --- README 11 Sep 2002 23:55:16 -0000 1.8 *************** *** 84,88 **** 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 --- 84,88 ---- options will be added later. ! dhcpclient is still a bit 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 Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** TODO 3 Jul 2002 00:51:39 -0000 1.34 --- TODO 11 Sep 2002 23:55:16 -0000 1.35 *************** *** 68,78 **** --- 68,82 ---- -- other minor optimizations which would be nice are noted in FIXMEs all over the code. + -- the rawnet routines should be a shared library due to too many dependencies. the sniffer for example, only needs the packet parsing routines. + -- get stringbuffer used in places where strings are being manipulated heavily. + -- fix stringbuffer trimwhitespace to use last_occurance routine, and add first occurance for finding initial whitespace too. + -- we may need to change the dhcp_build_* routines to use the dhcp-convert driver to generate the network data. it's not an *************** *** 83,87 **** --- 87,93 ---- 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. + -- dhcpclient startup needs a more clever way of detecting interfaces: *************** *** 89,92 **** -- accept a list from globconf -- apply only to a specific interface. - - more importantly though we need --- 95,96 ---- Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** config.h.in 23 Jun 2002 03:29:12 -0000 1.13 --- config.h.in 11 Sep 2002 23:55:16 -0000 1.14 *************** *** 1,76 **** ! /* config.h.in. Generated automatically from configure.in by autoheader. */ ! /* whether or not we generated ! * our own pri macros. */ ! ! /* have bpf IMMEDIATE ioctl */ ! #undef HAVE_BPF_IMMEDIATE ! /* have __progname var */ ! #undef HAVE_PROGNAME ! /* have PRI* marcos */ ! #undef HAVE_PRIMACROS_H /* have struct bpf_timeval */ #undef HAVE_BPF_TIMEVAL ! /* have sig_atomic_t */ ! #undef HAVE_SIG_ATOMIC_T ! ! /* kill(pid, 0) can be used to detect a process we can signal */ ! #undef KILL_SIGNAL_DETECT ! ! /* default client work directory */ ! #undef CLIENT_WORK_DIR ! ! /* Define if you have the `calloc' function. */ #undef HAVE_CALLOC ! /* Define if you have the `daemon' function. */ #undef HAVE_DAEMON ! /* Define if you have the <getopt.h> header file. */ #undef HAVE_GETOPT_H ! /* Define if you have the `getprogname' function. */ #undef HAVE_GETPROGNAME ! /* Define if you have the `getrusage' function. */ #undef HAVE_GETRUSAGE ! /* Define if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H ! /* Define if you have the `rename' function. */ #undef HAVE_RENAME ! /* Define if you have the <signal.h> header file. */ #undef HAVE_SIGNAL_H ! /* Define if you have the <stdarg.h> header file. */ #undef HAVE_STDARG_H ! /* Define if you have the `strdup' function. */ #undef HAVE_STRDUP ! /* Define if you have the `sysconf' function. */ #undef HAVE_SYSCONF ! /* Define if you have the <sys/utsname.h> header file. */ #undef HAVE_SYS_UTSNAME_H ! /* Define if you have the `uname' function. */ #undef HAVE_UNAME ! /* Define if you have the <varargs.h> header file. */ #undef HAVE_VARARGS_H /* Name of package */ #undef PACKAGE /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE ! /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS --- 1,113 ---- ! /* config.h.in. Generated from configure.in by autoheader. */ ! /* default client work directory */ ! #undef CLIENT_WORK_DIR ! /* have BPF_IMMEDIATE */ ! #undef HAVE_BPF_IMMEDIATE /* have struct bpf_timeval */ #undef HAVE_BPF_TIMEVAL ! /* Define to 1 if you have the `calloc' function. */ #undef HAVE_CALLOC ! /* Define to 1 if you have the `daemon' function. */ #undef HAVE_DAEMON ! /* Define to 1 if you have the <getopt.h> header file. */ #undef HAVE_GETOPT_H ! /* Define to 1 if you have the `getprogname' function. */ #undef HAVE_GETPROGNAME ! /* Define to 1 if you have the `getrusage' function. */ #undef HAVE_GETRUSAGE ! /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H ! /* Define to 1 if you have the <memory.h> header file. */ ! #undef HAVE_MEMORY_H ! ! /* generated our own primacros */ ! #undef HAVE_PRIMACROS_H ! ! /* have __progname var */ ! #undef HAVE_PROGNAME ! ! /* Define to 1 if you have the `rename' function. */ #undef HAVE_RENAME ! /* Define to 1 if you have the <signal.h> header file. */ #undef HAVE_SIGNAL_H ! /* have sigatomic_t */ ! #undef HAVE_SIG_ATOMIC_T ! ! /* Define to 1 if you have the <stdarg.h> header file. */ #undef HAVE_STDARG_H ! /* Define to 1 if you have the <stdint.h> header file. */ ! #undef HAVE_STDINT_H ! ! /* Define to 1 if you have the <stdlib.h> header file. */ ! #undef HAVE_STDLIB_H ! ! /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP ! /* Define to 1 if you have the <strings.h> header file. */ ! #undef HAVE_STRINGS_H ! ! /* Define to 1 if you have the <string.h> header file. */ ! #undef HAVE_STRING_H ! ! /* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF ! /* Define to 1 if you have the <sys/stat.h> header file. */ ! #undef HAVE_SYS_STAT_H ! ! /* Define to 1 if you have the <sys/types.h> header file. */ ! #undef HAVE_SYS_TYPES_H ! ! /* Define to 1 if you have the <sys/utsname.h> header file. */ #undef HAVE_SYS_UTSNAME_H ! /* Define to 1 if you have the `uname' function. */ #undef HAVE_UNAME ! /* Define to 1 if you have the <unistd.h> header file. */ ! #undef HAVE_UNISTD_H ! ! /* Define to 1 if you have the <varargs.h> header file. */ #undef HAVE_VARARGS_H + /* kill(pid, 0) can be used to detect a process we can signal */ + #undef KILL_SIGNAL_DETECT + /* Name of package */ #undef PACKAGE + /* Define to the address where bug reports for this package should be sent. */ + #undef PACKAGE_BUGREPORT + + /* Define to the full name of this package. */ + #undef PACKAGE_NAME + + /* Define to the full name and version of this package. */ + #undef PACKAGE_STRING + + /* Define to the one symbol short name of this package. */ + #undef PACKAGE_TARNAME + + /* Define to the version of this package. */ + #undef PACKAGE_VERSION + /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE ! /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS Index: dhcp-arp.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-arp.c 17 Jun 2002 13:23:07 -0000 1.10 --- dhcp-arp.c 11 Sep 2002 23:55:16 -0000 1.11 *************** *** 178,180 **** return 0; } - --- 178,179 ---- Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-packet-build.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-packet-build.c 22 Jun 2002 01:47:57 -0000 1.6 --- dhcp-packet-build.c 11 Sep 2002 23:55:16 -0000 1.7 *************** *** 135,142 **** * * * * * * * * * * * */ ! static void build_eth(rawnet_t *net, ! eth_addr_t source_hw_addr, ! eth_addr_t dest_hw_addr, ! uint16_t type) { eth_set_dst_address(net->ether_p, dest_hw_addr); --- 135,142 ---- * * * * * * * * * * * */ ! static void build_eth_proc(rawnet_t *net, ! eth_addr_t source_hw_addr, ! eth_addr_t dest_hw_addr, ! uint16_t type) { eth_set_dst_address(net->ether_p, dest_hw_addr); *************** *** 151,155 **** { ! build_eth(net, source_hw_addr, eth_broadcast, type); return; } --- 151,161 ---- { ! build_eth_proc(net, source_hw_addr, eth_broadcast, type); ! return; ! } ! ! static void build_eth(rawnet_t *net, eth_addr_t source_hw_addr, eth_addr_t dest_hw_addr, uint16_t type) ! { ! build_eth_proc(net, source_hw_addr, eth_broadcast, type); return; } Index: dhcp-stringbuffer.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-stringbuffer.c 3 Jul 2002 00:51:39 -0000 1.8 --- dhcp-stringbuffer.c 11 Sep 2002 23:55:16 -0000 1.9 *************** *** 21,24 **** --- 21,32 ---- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * + * Sringbuffer object: + * + * (*) allows printfing into a string, + * (*) fast string manipulation by keeping track of string length. + * (*) alignment of string against columns. + * + * Internally stringbuffer does not count the terminating null as the length. + * Therefore the raw string routines will always assume +1 when given length. */ *************** *** 42,49 **** static char *extend_string(char *str, int cur_len, int ex_len) { - int len = strlen(str); ! str = realloc(str, (sizeof(char) * (len + ex_len + 1))); ! str[len + ex_len] = 0; /* make sure it's null terminated. */ return str; --- 50,56 ---- static char *extend_string(char *str, int cur_len, int ex_len) { ! str = realloc(str, (cur_len * sizeof(char)) * (ex_len * sizeof(char)) + (1 * sizeof(char))); ! str[cur_len] = 0; /* make sure it's null terminated. */ return str; *************** *** 132,144 **** 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++; ! sb->capacity = sb->len; ! } else ! sb->len++; ! sb->buf[sb->len - 1] = c; ! sb->buf[sb->len] = 0; } --- 139,150 ---- void stringbuffer_append_c(stringbuffer *sb, char c) { ! if(sb->capacity <= (sb->len)) { ! sb->buf = extend_string(sb->buf, sb->len, STRINGBUFFER_CHUNKSIZE); ! sb->capacity += STRINGBUFFER_CHUNKSIZE; ! } ! sb->buf[sb->len] = c; ! sb->len++; ! sb->buf[sb->len] = 0; } *************** *** 146,163 **** void stringbuffer_append(stringbuffer *sb, const char *s) { ! int len = strlen(s); ! if(sb->capacity <= (len + sb->len)) { ! sb->buf = extend_string(sb->buf, sb->len, len); ! sb->len += len; ! sb->capacity = sb->len; ! } else ! sb->len += len; - strcat(sb->buf, s); - sb->buf[sb->len] = 0; } ! /* remove whitespace */ stringbuffer *stringbuffer_trim_whitespace(stringbuffer *sb) { --- 152,188 ---- void stringbuffer_append(stringbuffer *sb, const char *s) { ! int len = strlen(s); ! int i, j; ! /* increase capacity. */ ! if(sb->capacity <= (len + sb->len)) { ! ! /* if we're bigger than the chunksize then allocate len. */ ! if(len > STRINGBUFFER_CHUNKSIZE) { ! ! sb->buf = extend_string(sb->buf, sb->len, len); ! sb->capacity += len; ! ! } else { ! ! /* otherwise allocate chunksize. */ ! sb->buf = extend_string(sb->buf, sb->len, STRINGBUFFER_CHUNKSIZE); ! sb->capacity += STRINGBUFFER_CHUNKSIZE; ! } ! ! /* copy new string into place: keep in mind we know all ! * lengths so strcat() would be less effecient. */ ! ! memcpy(&sb->buf[sb->len], s, len); ! ! sb->len += len; ! sb->buf[sb->len] = 0; ! ! return; ! } } ! /* remove whitespace (including tabs) */ stringbuffer *stringbuffer_trim_whitespace(stringbuffer *sb) { *************** *** 166,175 **** char *newbuf; int len; if(sb->len == 0) /* empty string. */ return sb; ! for(begin = &sb->buf[0]; ! *begin != '\0' && (*begin == ' ' || *begin == '\t'); begin++); --- 191,203 ---- char *newbuf; int len; + int i; if(sb->len == 0) /* empty string. */ return sb; ! /* find beginning of string after tabs and whitespaces. */ ! begin = &sb->buf[0]; ! for(i = 0; ! i < sb->len && (*begin == ' ' || *begin == '\t'); begin++); Index: dhcp-stringbuffer.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-stringbuffer.h 22 Jun 2002 18:11:25 -0000 1.5 --- dhcp-stringbuffer.h 11 Sep 2002 23:55:16 -0000 1.6 *************** *** 26,29 **** --- 26,31 ---- #define DHCP_STRINGBUFFER_H + #define STRINGBUFFER_CHUNKSIZE 16 + /* string buffer object. */ typedef struct { --- acconfig.h DELETED --- |
From: <act...@us...> - 2002-09-11 23:52:35
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv28918 Modified Files: Makefile.in configure.in configure aclocal.m4 acinclude.m4 missing Log Message: new autoconf changes Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Makefile.in 30 Jun 2002 18:27:12 -0000 1.27 --- Makefile.in 11 Sep 2002 23:52:28 -0000 1.28 *************** *** 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,7 ---- ! # Makefile.in generated by automake 1.6.3 from Makefile.am. ! # @configure_input@ ! # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 [...994 lines suppressed...] ! mostlyclean-am: mostlyclean-compile mostlyclean-generic ! ! uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man ! ! uninstall-man: uninstall-man1 + .PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic dist dist-all dist-gzip distcheck distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-hdr distclean-tags distcleancheck distdir dvi dvi-am \ + info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-man1 \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am \ + uninstall-man uninstall-man1 # Tell versions [3.59,3.63) of GNU make to not export all variables. Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** configure.in 24 Jun 2002 14:32:25 -0000 1.23 --- configure.in 11 Sep 2002 23:52:28 -0000 1.24 *************** *** 1,2 **** --- 1,3 ---- + dnl $Header$ dnl Ok here's another shot at writing dnl a proper configure.in *************** *** 5,11 **** dnl init ! AC_INIT(dhcp-agent, 0.37, tm...@wh...) ! AM_INIT_AUTOMAKE(dhcp-agent, 0.37) AM_CONFIG_HEADER(config.h) AC_ARG_WITH(libdnet-prefix,[ --with-libdnet-prefix=PREFIX Prefix where libdnet is installed (optional)], --- 6,14 ---- dnl init ! AC_PREREQ(2.53) ! AC_INIT(dhcp-agent, 0.38, tm...@wh...) ! AM_INIT_AUTOMAKE(dhcp-agent, 0.38) AM_CONFIG_HEADER(config.h) + AC_CONFIG_SRCDIR(dhcp-client.c) AC_ARG_WITH(libdnet-prefix,[ --with-libdnet-prefix=PREFIX Prefix where libdnet is installed (optional)], *************** *** 25,32 **** AC_HEADER_STDC ! dnl check for inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h AC_CHECK_HEADERS(inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h) AC_WF_TRY_PRI_MACROS --- 28,38 ---- AC_HEADER_STDC ! dnl check for inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h AC_CHECK_HEADERS(inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h) + + dnl try finding or generating our own C99 stdint macros + AC_WF_TRY_PRI_MACROS *************** *** 34,38 **** echo -n "attempting to generate stdint conversion macros..." AC_WF_GET_PRI_MACROS ! AC_DEFINE(HAVE_PRIMACROS_H) echo " done!" fi --- 40,44 ---- echo -n "attempting to generate stdint conversion macros..." AC_WF_GET_PRI_MACROS ! AC_DEFINE(HAVE_PRIMACROS_H, 1, [ generated our own primacros ]) echo " done!" fi *************** *** 42,45 **** --- 48,53 ---- AC_CHECK_FUNCS(strdup uname calloc daemon rename sysconf getrusage getprogname) + dnl other checks + dnl check if kill(pid, 0) can be used to detect a process *************** *** 49,53 **** dnl check for types ! AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL)], [], [#include <sys/types.h> #include <sys/time.h> --- 57,61 ---- dnl check for types ! AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL, 1, [have struct bpf_timeval])], [], [#include <sys/types.h> #include <sys/time.h> *************** *** 56,69 **** AC_MSG_CHECKING(for __progname) ! AC_TRY_COMPILE([ ! #include <stdlib.h> #include <stdio.h> extern const char *__progname; ! ],[ ! const char *s = __progname; ! ], [ AC_DEFINE(HAVE_PROGNAME) ! AC_MSG_RESULT(yes) ], [AC_MSG_RESULT(no)]); ! AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T)], [], [#include <signal.h>]) AC_TYPE_SIGNAL --- 64,85 ---- AC_MSG_CHECKING(for __progname) ! AC_TRY_LINK([ ! #include <stdlib.h> #include <stdio.h> extern const char *__progname; ! ], ! [ __progname = 0; ], ! [ have_progname="yes" ], ! [ have_progname="no" ]) ! if test $have_progname = "yes"; then ! AC_DEFINE(HAVE_PROGNAME, 1, [have __progname var ]) ! AC_MSG_RESULT(yes) ! else ! AC_MSG_RESULT(no) ! fi ! ! ! AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, [have sigatomic_t])], [], [#include <signal.h>]) AC_TYPE_SIGNAL *************** *** 90,99 **** fi ! ! dnl libdnet sifting; actually it's a lot more well behaved dnl than pcap. dnl begin by looking for dnet-config if we find it, then dnl just use it to get the include and lib dirs. if test -z "$dnet_prefix"; then --- 106,115 ---- fi ! dnl dnl libdnet sifting; actually it's a lot more well behaved dnl than pcap. dnl begin by looking for dnet-config if we find it, then dnl just use it to get the include and lib dirs. + dnl if test -z "$dnet_prefix"; then *************** *** 132,136 **** DEFS="" AC_SUBST(DEFS) ! AC_OUTPUT(Makefile) echo --- 148,152 ---- DEFS="" AC_SUBST(DEFS) ! AC_OUTPUT([Makefile]) echo Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** configure 24 Jun 2002 14:32:25 -0000 1.23 --- configure 11 Sep 2002 23:52:28 -0000 1.24 *************** *** 1,13 **** #! /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...>. # ! # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. [...6154 lines suppressed...] ! _ACEOF ! cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } ! _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. *************** *** 3977,3980 **** --- 5216,5220 ---- $ac_cs_success || { (exit 1); exit 1; } fi + echo Index: aclocal.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/aclocal.m4,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** aclocal.m4 23 Jun 2002 03:29:12 -0000 1.9 --- aclocal.m4 11 Sep 2002 23:52:29 -0000 1.10 *************** *** 1,13 **** ! dnl aclocal.m4 generated automatically by aclocal 1.4-p4 ! dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. ! dnl This file is free software; the Free Software Foundation ! dnl gives unlimited permission to copy and/or distribute it, ! dnl with or without modifications, as long as this notice is preserved. ! dnl This program is distributed in the hope that it will be useful, ! dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without ! dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A [...989 lines suppressed...] ! # ------------------------------------------------------------ ! # We used to try to get a real timestamp in stamp-h. But the fear is that ! # that will cause unnecessary cvs conflicts. ! AC_DEFUN([_AM_CONFIG_HEADER], ! [# Add the stamp file to the list of files AC keeps track of, ! # along with our hook. ! AC_CONFIG_HEADERS([$1], ! [# update the timestamp ! echo 'timestamp for $1' >"_AM_STAMP([$1])" ! $2], ! [$3]) ! ])# _AM_CONFIG_HEADER ! ! ! # AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) ! # -------------------------------------------------------------- ! AC_DEFUN([AM_CONFIG_HEADER], ! [AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) ! ])# AM_CONFIG_HEADER Index: acinclude.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acinclude.m4,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** acinclude.m4 23 Jun 2002 03:29:12 -0000 1.9 --- acinclude.m4 11 Sep 2002 23:52:29 -0000 1.10 *************** *** 41,45 **** AC_DEFUN(AC_WF_TRY_PRI_MACROS, ! [AC_MSG_CHECKING(checking for stdint conversion macros) AC_TRY_COMPILE([#include <stdio.h> #include <stdlib.h> --- 41,45 ---- AC_DEFUN(AC_WF_TRY_PRI_MACROS, ! [AC_MSG_CHECKING(for stdint conversion macros) AC_TRY_COMPILE([#include <stdio.h> #include <stdlib.h> *************** *** 81,85 **** #define SUB_UNSIGNED_INT "du" #define SUB_CHAR "d" /* same -- we're assuming int is always bigger than char */ ! #define SUB_UNSIGNED_CHAR "du" /* which is an OK assumption. */ --- 81,85 ---- #define SUB_UNSIGNED_INT "du" #define SUB_CHAR "d" /* same -- we're assuming int is always bigger than char */ ! #define SUB_UNSIGNED_CHAR "du" /* which is an OK assumption (or is it?). */ *************** *** 106,110 **** fprintf(stderr, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"); ! fprintf(stderr, "* Warning! I couldn't find a suitable type that's sized for uint32_t. *\n"); fprintf(stderr, "* I'm going to go and use the largest I can and hope things work! *\n"); fprintf(stderr, "* Please do report this bug to tm...@wh... *\n"); --- 106,110 ---- fprintf(stderr, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"); ! fprintf(stderr, "* Warning! I couldn't find a suitable type that's size for a type.\n"); fprintf(stderr, "* I'm going to go and use the largest I can and hope things work! *\n"); fprintf(stderr, "* Please do report this bug to tm...@wh... *\n"); *************** *** 202,206 **** exit(1); } ! ], [AC_DEFINE(KILL_SIGNAL_DETECT) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) --- 202,206 ---- exit(1); } ! ], [AC_DEFINE(KILL_SIGNAL_DETECT, 1, [kill(pid, 0) can be used to detect a process we can signal]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) *************** *** 216,219 **** ], [ ioctl(0, BIOCIMMEDIATE, NULL);], [AC_MSG_RESULT(found) ! AC_DEFINE(HAVE_BPF_IMMEDIATE)], AC_MSG_RESULT(not found))]) --- 216,219 ---- ], [ ioctl(0, BIOCIMMEDIATE, NULL);], [AC_MSG_RESULT(found) ! AC_DEFINE(HAVE_BPF_IMMEDIATE, 1, [have BPF_IMMEDIATE])], AC_MSG_RESULT(not found))]) Index: missing =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/missing,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** missing 29 Jan 2002 18:05:07 -0000 1.1.1.1 --- missing 11 Sep 2002 23:52:29 -0000 1.2 *************** *** 1,6 **** #! /bin/sh # Common stub for a few missing GNU programs while installing. ! # Copyright (C) 1996, 1997 Free Software Foundation, Inc. ! # Franc,ois Pinard <pi...@ir...>, 1996. # This program is free software; you can redistribute it and/or modify --- 1,6 ---- #! /bin/sh # Common stub for a few missing GNU programs while installing. ! # Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. ! # Originally by Fran,cois Pinard <pi...@ir...>, 1996. # This program is free software; you can redistribute it and/or modify *************** *** 19,22 **** --- 19,27 ---- # 02111-1307, USA. + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" *************** *** 24,27 **** --- 29,53 ---- fi + run=: + + # In the cases where this matters, `missing' is being run in the + # srcdir already. + if test -f configure.ac; then + configure_ac=configure.ac + else + configure_ac=configure.in + fi + + case "$1" in + --run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; + esac + + # If it does not exist, or fails to run (possibly an outdated version), + # try to emulate it. case "$1" in *************** *** 36,39 **** --- 62,66 ---- -h, --help display this help and exit -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails Supported PROGRAM values: *************** *** 44,54 **** bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) ! echo "missing - GNU libit 0.0" ;; --- 71,83 ---- bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) ! echo "missing 0.4 - GNU automake" ;; *************** *** 59,66 **** ;; ! aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if ! you modified \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." --- 88,100 ---- ;; ! aclocal*) ! if test -z "$run" && ($1 --version) > /dev/null 2>&1; then ! # We have it, but it failed. ! exit 1 ! fi ! echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if ! you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." *************** *** 69,75 **** autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if ! you modified \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." --- 103,114 ---- autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if ! you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." *************** *** 78,87 **** autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if ! you modified \`acconfig.h' or \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." ! files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` test -z "$files" && files="config.h" touch_files= --- 117,131 ---- autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if ! you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." ! files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= *************** *** 96,103 **** ;; ! automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if ! you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." --- 140,152 ---- ;; ! automake*) ! if test -z "$run" && ($1 --version) > /dev/null 2>&1; then ! # We have it, but it failed. ! exit 1 ! fi ! echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if ! you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." *************** *** 107,110 **** --- 156,187 ---- ;; + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ + WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + bison|yacc) echo 1>&2 "\ *************** *** 160,164 **** --- 237,271 ---- ;; + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ + WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if *************** *** 174,177 **** --- 281,323 ---- fi touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ + WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 ;; |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv17346 Modified Files: dhcp-agent.h dhcp-client-conf.c dhcp-client-states.c dhcp-client.c dhcp-com.c dhcp-sysconf.c Log Message: temp fix to option checking; added more option constants Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** dhcp-agent.h 4 Jul 2002 14:02:53 -0000 1.65 --- dhcp-agent.h 16 Jul 2002 03:43:30 -0000 1.66 *************** *** 135,146 **** #define SENSIBLE_DESCRIPTOR_MAX 128 - /* type string limits. */ - - # define UINT32_T_STRING_SIZE 11 - # define INT32_T_STRING_SIZE UINT32_T_STRING_SIZE /* the same. */ - # define UINT16_T_STRING_SIZE 6 - # define INT16_T_STRING_SIZE UINT16_T_STRING_SIZE - # define BYTE_STRING_SIZE 5 - /* Reasonable defaults in case services db isn't up to date. */ --- 135,138 ---- *************** *** 163,170 **** #define MAX_VERBOSITY_LEVEL DEBUG_VERBOSITY_LEVEL - /* default configuration */ - - #define DISCOVER_OFFER_RETRIES 3 - /* * * * * * * * * * * * Data structures. * --- 155,158 ---- *************** *** 406,423 **** /* Option tags. */ ! # define TAG_PAD 0 ! # define TAG_END 255 ! # define TAG_DHCP_SUBNET_MASK 1 ! # define TAG_DHCP_HOSTNAME 12 ! # define TAG_DHCP_INTERFACE_MTU 26 ! # define TAG_DHCP_REQUEST_IP_ADDRESS 50 ! # define TAG_DHCP_OPTION_OVERLOAD 52 ! # define TAG_DHCP_MESSAGE_TYPE 53 ! # define TAG_DHCP_SERVER_IDENTIFIER 54 ! # define TAG_PARAMETERS 55 ! # define TAG_MAX_DHCP_SIZE 57 ! # define TAG_DHCP_CLASS_ID 60 ! # define TAG_DHCP_CLIENT_ID 61 /* DHCP overload option values. */ --- 394,477 ---- /* Option tags. */ ! /* (this is me trying to make constant names out of long option ! * names. let the comedy ensue!) ! */ ! # define TAG_DHCP_PAD 0 ! # define TAG_DHCP_SUBNET_MASK 1 ! # define TAG_DHCP_TIME_OFFSET 2 ! # define TAG_DHCP_ROUTER 3 ! # define TAG_DHCP_TIME_SERVER 4 ! # define TAG_DHCP_NAME_SERVER 5 ! # define TAG_DHCP_DOMAIN_NAME_SERVER 6 ! # define TAG_DHCP_LOG_SERVER 7 ! # define TAG_DHCP_COOKIE_SERVER 8 ! # define TAG_DHCP_LPR_SERVER 9 ! # define TAG_DHCP_IMPRESS_SERVER 10 ! # define TAG_DHCP_RESOURCE_LOCATION_SERVER 11 ! # define TAG_DHCP_HOST_NAME 12 ! # define TAG_DHCP_BOOT_FILE_SIZE 13 ! # define TAG_DHCP_MERIT_DUMP_FILE 14 ! # define TAG_DHCP_DOMAIN_NAME 15 ! # define TAG_DHCP_SWAP_SERVER 16 ! # define TAG_DHCP_ROOT_PATH 17 ! # define TAG_DHCP_EXTENSIONS_PATH 18 ! # define TAG_DHCP_IP_FORWARDING 19 ! # define TAG_DHCP_NON_LOCAL_SOURCE_ROUTING 20 ! # define TAG_DHCP_POLICY_FILTER 21 ! # define TAG_DHCP_MAX_DGRAM_REASSUMBLY_SIZE 22 ! # define TAG_DHCP_IP_TIME_TO_LIVE 23 ! # define TAG_DHCP_MTU_AGING_TIMEOUT 24 ! # define TAG_DHCP_MTU_PLATEAU_TABLE 25 ! # define TAG_DHCP_INTERFACE_MTU 26 ! # define TAG_DHCP_SUBNETS_ARE_LOCAL 27 ! # define TAG_DHCP_BROADCAST_ADDRESS 28 ! # define TAG_DHCP_MASK_DISCOVERY 29 ! # define TAG_DHCP_MASK_SUPPLIER 30 ! # define TAG_DHCP_ROUTER_DISCOVERY 31 ! # define TAG_DHCP_ROUTER_SOLICITATION 32 ! # define TAG_DHCP_STATIC_ROUTE 33 ! # define TAG_DHCP_TRAILER_ENCAPSULATION 34 ! # define TAG_DHCP_ARP_CACHE_TIMEOUT 35 ! # define TAG_DHCP_ETHERNET_ENCAPSULATION 36 ! # define TAG_DHCP_TCP_DEFAULT_TTL 37 ! # define TAG_DHCP_TCP_KEEPALIVE_INTERVAL 38 ! # define TAG_DHCP_TCP_KEEPALIVE_GARBAGE 39 ! # define TAG_DHCP_NIS_DOMAIN_NAME 40 ! # define TAG_DHCP_NIS_SERVERS 41 ! # define TAG_DHCP_NTP_SERVERS 42 ! # define TAG_DHCP_VENDOR_SPECIFIC 43 ! # define TAG_DHCP_NETBIOSOTCP_NAME_SERVER 44 ! # define TAG_DHCP_NETBIOSOTCP_DATAGRAM_SERVER 45 ! # define TAG_DHCP_NETBIOSOTCP_NODE_TYPE 46 ! # define TAG_DHCP_NETBIOSOTCP_SCOPE 47 ! # define TAG_DHCP_XWIN_FONT_SERVER 48 ! # define TAG_DHCP_XWIN_DISP_MANAGER_SERVER 49 ! # define TAG_DHCP_REQUESTED_IP_ADDRESS 50 ! # define TAG_DHCP_IP_ADDRESS_LEASE_TIME 51 ! # define TAG_DHCP_OVERLOAD 52 ! # define TAG_DHCP_MESSAGE_TYPE 53 ! # define TAG_DHCP_SERVER_IDENTIFIER 54 ! # define TAG_DHCP_PARAMETERS 55 ! # define TAG_DHCP_MESSAGE 56 ! # define TAG_DHCP_MAX_DHCP_SIZE 57 ! # define TAG_DHCP_RENEWAL_TIME 58 ! # define TAG_DHCP_REBINDING_TIME 59 ! # define TAG_DHCP_VENDOR_CLASS_ID 60 ! # define TAG_DHCP_CLIENT_ID 61 ! # define TAG_DHCP_NISPLUS_DOMAIN 64 ! # define TAG_DHCP_NISPLUS_SERVERS 65 ! # define TAG_DHCP_TFTP_SERVER 66 ! # define TAG_DHCP_BOOT_FILE_NAME 67 ! # define TAG_DHCP_IP_HOME_AGENT 68 ! # define TAG_DHCP_SMTP_SERVER 69 ! # define TAG_DHCP_POP_SERVER 70 ! # define TAG_DHCP_NNTP_SERVER 71 ! # define TAG_DHCP_DEFAULT_WWW_SERVER 72 ! # define TAG_DHCP_DEFAULT_FINGER_SERVER 73 ! # define TAG_DHCP_DEFAULT_IRC_SERVER 74 ! # define TAG_DHCP_DEFAULT_ST_SERVER 75 ! # define TAG_DHCP_DEFAULT_STDA_SERVER 76 ! # define TAG_DHCP_END 255 /* DHCP overload option values. */ Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-client-conf.c 4 Jul 2002 14:02:53 -0000 1.16 --- dhcp-client-conf.c 16 Jul 2002 03:43:30 -0000 1.17 *************** *** 35,46 **** static const int default_config_options[] = { ! 1, /* Subnet Mask */ ! 3, /* Routers. */ ! 6, /* Domain Name Servers. */ ! 26, /* Interface MTU */ ! 15, /* Domain Name. */ ! 50, /* IP Address lease time. */ ! 54, /* Server Identifier. */ ! 58, /* Renewal time. */ }; --- 35,48 ---- static const int default_config_options[] = { ! TAG_DHCP_SUBNET_MASK, /* Subnet Mask */ ! TAG_DHCP_ROUTER, /* Routers. */ ! TAG_DHCP_INTERFACE_MTU, /* Interface MTU */ ! TAG_DHCP_DOMAIN_NAME_SERVER, /* Domain Name Servers. */ ! TAG_DHCP_DOMAIN_NAME, /* Domain Name. */ ! TAG_DHCP_REQUESTED_IP_ADDRESS, /* Requested IP Address. */ ! TAG_DHCP_IP_ADDRESS_LEASE_TIME, /* IP Address lease time. */ ! TAG_DHCP_RENEWAL_TIME, /* Renewal time. */ ! TAG_DHCP_REBINDING_TIME, /* Rebinding time. */ ! TAG_DHCP_SERVER_IDENTIFIER, /* Server Identifier. */ }; Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** dhcp-client-states.c 2 Jul 2002 18:46:21 -0000 1.37 --- dhcp-client-states.c 16 Jul 2002 03:43:30 -0000 1.38 *************** *** 39,42 **** --- 39,43 ---- const char *policy = glob_conf_get_val(CLIENT_OPTION_POLICY); + return 1; if(policy == NULL) policy = "atleast"; *************** *** 122,127 **** dhcp_client_control_t *dc = arg; ! if(client_check_dhcp(dc) || ! dhcp_is_type(dc->rawnet->dhcp_p, DHCP_OFFER_TM) || client_check_requested_options(dc)) return 1; --- 123,128 ---- dhcp_client_control_t *dc = arg; ! if(client_check_dhcp(dc) && ! dhcp_is_type(dc->rawnet->dhcp_p, DHCP_OFFER_TM) && client_check_requested_options(dc)) return 1; *************** *** 246,250 **** * The server may have decided to be nice to us. */ ! if(!dhcp_have_option(dc->rawnet->dhcp_p, TAG_DHCP_REQUEST_IP_ADDRESS)) dc->rawnet->dhcp_p->options = add_to_list(dc->rawnet->dhcp_p->options, --- 247,251 ---- * The server may have decided to be nice to us. */ ! if(!dhcp_have_option(dc->rawnet->dhcp_p, TAG_DHCP_REQUESTED_IP_ADDRESS)) dc->rawnet->dhcp_p->options = add_to_list(dc->rawnet->dhcp_p->options, Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** dhcp-client.c 3 Jul 2002 01:24:20 -0000 1.41 --- dhcp-client.c 16 Jul 2002 03:43:30 -0000 1.42 *************** *** 121,125 **** static void usage(char *s) { ! printf("usage: %s [-cavkw] [-d directory] [-i interface name] [ -m mac address ]\n", s); exit(0); } --- 121,126 ---- static void usage(char *s) { ! // while((c = getopt(argc, argv, "tpcdavkwi:m:h:l:H:")) != -1) { ! printf("usage: %s [-cpavkwt] [-d directory] [-i interface name] [ -m mac address ]\n", s); exit(0); } *************** *** 442,446 **** * semicolons) */ ! setup_interrupt_handlers(); /* setup signal handling */ if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { --- 443,447 ---- * semicolons) */ ! // setup_interrupt_handlers(); /* setup signal handling */ if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { *************** *** 513,517 **** info_message(" "); ! while((c = getopt(argc, argv, "pgcdavi:m:kwh:l:H:")) != -1) { switch(c) { --- 514,518 ---- info_message(" "); ! while((c = getopt(argc, argv, "tpcdavi:m:kwh:l:H:")) != -1) { switch(c) { Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-com.c 30 Jun 2002 21:22:15 -0000 1.11 --- dhcp-com.c 16 Jul 2002 03:43:31 -0000 1.12 *************** *** 153,157 **** /* Always skip pads */ ! if(*dhcp_packet == TAG_PAD) { dhcp_packet++; len--; --- 153,157 ---- /* Always skip pads */ ! if(*dhcp_packet == TAG_DHCP_PAD) { dhcp_packet++; len--; *************** *** 161,165 **** /* Always stop on end. */ ! if(*dhcp_packet == TAG_END) break; --- 161,165 ---- /* Always stop on end. */ ! if(*dhcp_packet == TAG_DHCP_END) break; *************** *** 415,419 **** while((option = dhcp_get_next_option(dhcp)) != NULL) { ! if(option->tag == TAG_DHCP_OPTION_OVERLOAD) { return *(option->data); } --- 415,419 ---- while((option = dhcp_get_next_option(dhcp)) != NULL) { ! if(option->tag == TAG_DHCP_OVERLOAD) { return *(option->data); } *************** *** 472,476 **** if(options[i] && !dhcp_have_option(dhcp, i)) return 1; ! if(!options[i] && dhcp_have_option(dhcp, i)) return 1; } --- 472,476 ---- if(options[i] && !dhcp_have_option(dhcp, i)) return 1; ! if(dhcp_have_option(dhcp, i) && !options[i]) return 1; } *************** *** 526,530 **** option = xmalloc(sizeof(dhcp_option_t)); option->len = len; ! option->tag = TAG_PARAMETERS; option->data = xmalloc(len); --- 526,530 ---- option = xmalloc(sizeof(dhcp_option_t)); option->len = len; ! option->tag = TAG_DHCP_PARAMETERS; option->data = xmalloc(len); *************** *** 543,547 **** { max = htons(max); ! return(create_dhcp_option((unsigned char *)&max, sizeof(uint16_t), TAG_MAX_DHCP_SIZE)); } --- 543,547 ---- { max = htons(max); ! return(create_dhcp_option((unsigned char *)&max, sizeof(uint16_t), TAG_DHCP_MAX_DHCP_SIZE)); } *************** *** 554,558 **** { unsigned char len = strlen(class_id); ! return(create_dhcp_option(class_id, len, TAG_DHCP_CLASS_ID)); } --- 554,558 ---- { unsigned char len = strlen(class_id); ! return(create_dhcp_option(class_id, len, TAG_DHCP_VENDOR_CLASS_ID)); } *************** *** 564,568 **** dhcp_option_t *dhcp_build_requested_ip_address(uint32_t address) { ! return(create_dhcp_option((unsigned char *)&address, IP_ADDR_LEN, TAG_DHCP_REQUEST_IP_ADDRESS)); } --- 564,568 ---- dhcp_option_t *dhcp_build_requested_ip_address(uint32_t address) { ! return(create_dhcp_option((unsigned char *)&address, IP_ADDR_LEN, TAG_DHCP_REQUESTED_IP_ADDRESS)); } *************** *** 574,578 **** dhcp_option_t *dhcp_build_hostname(char *hostname) { ! return(create_dhcp_option((unsigned char *)hostname, (strlen(hostname) + 1), TAG_DHCP_HOSTNAME)); } --- 574,578 ---- dhcp_option_t *dhcp_build_hostname(char *hostname) { ! return(create_dhcp_option((unsigned char *)hostname, (strlen(hostname) + 1), TAG_DHCP_HOST_NAME)); } *************** *** 734,738 **** } ! *packet = TAG_END; packet += 1; len += 1; --- 734,738 ---- } ! *packet = TAG_DHCP_END; packet += 1; len += 1; *************** *** 742,746 **** if((padding = len%4)) { while(padding--) { ! *packet = TAG_PAD; packet++; } --- 742,746 ---- if((padding = len%4)) { while(padding--) { ! *packet = TAG_DHCP_PAD; packet++; } Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dhcp-sysconf.c 4 Jul 2002 14:02:53 -0000 1.27 --- dhcp-sysconf.c 16 Jul 2002 03:43:31 -0000 1.28 *************** *** 309,316 **** ce = list_ptr->data; ! if(string_matches(dhcp_options_strings[TAG_DHCP_REQUEST_IP_ADDRESS], ce->name)) { ! data = option_convert_handlers[TAG_DHCP_REQUEST_IP_ADDRESS].serialize_to_internal(ce->value); memcpy(&addr, data, IP_ADDR_LEN); xfree(data); --- 309,316 ---- ce = list_ptr->data; ! if(string_matches(dhcp_options_strings[TAG_DHCP_REQUESTED_IP_ADDRESS], ce->name)) { ! data = option_convert_handlers[TAG_DHCP_REQUESTED_IP_ADDRESS].serialize_to_internal(ce->value); memcpy(&addr, data, IP_ADDR_LEN); xfree(data); |
From: <act...@us...> - 2002-07-04 14:02:56
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8293 Modified Files: dhcp-agent.h dhcp-client-conf.c dhcp-sysconf.c Log Message: added mtu to interface setting Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** dhcp-agent.h 2 Jul 2002 18:46:21 -0000 1.64 --- dhcp-agent.h 4 Jul 2002 14:02:53 -0000 1.65 *************** *** 411,414 **** --- 411,415 ---- # define TAG_DHCP_SUBNET_MASK 1 # define TAG_DHCP_HOSTNAME 12 + # define TAG_DHCP_INTERFACE_MTU 26 # define TAG_DHCP_REQUEST_IP_ADDRESS 50 # define TAG_DHCP_OPTION_OVERLOAD 52 Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-client-conf.c 3 Jul 2002 01:24:20 -0000 1.15 --- dhcp-client-conf.c 4 Jul 2002 14:02:53 -0000 1.16 *************** *** 29,32 **** --- 29,34 ---- #include <dhcp-varfile.h> + #define DEFAULT_CONFIG_OPTIONS_LEN 8 + /* Basic network configuration. * Here we keep the options we want by default. */ *************** *** 36,39 **** --- 38,42 ---- 3, /* Routers. */ 6, /* Domain Name Servers. */ + 26, /* Interface MTU */ 15, /* Domain Name. */ 50, /* IP Address lease time. */ *************** *** 42,48 **** }; - - static const int default_config_options_len = 7; - static void client_conf_reset_options(client_conf_t *cc) { --- 45,48 ---- *************** *** 87,91 **** return -1; ! for(i = 0;i < default_config_options_len; i++) { if(fprintf(fp, "\"%s\"\n",dhcp_options_strings[default_config_options[i]]) < 0) { --- 87,91 ---- return -1; ! for(i = 0;i < DEFAULT_CONFIG_OPTIONS_LEN; i++) { if(fprintf(fp, "\"%s\"\n",dhcp_options_strings[default_config_options[i]]) < 0) { *************** *** 104,108 **** int i; ! for(i = 0;i < default_config_options_len; i++) { cc->options[default_config_options[i]] = 1; } --- 104,108 ---- int i; ! for(i = 0;i < DEFAULT_CONFIG_OPTIONS_LEN; i++) { cc->options[default_config_options[i]] = 1; } Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dhcp-sysconf.c 2 Jul 2002 18:41:40 -0000 1.26 --- dhcp-sysconf.c 4 Jul 2002 14:02:53 -0000 1.27 *************** *** 297,303 **** list_t *list_ptr; uint32_t addr, netmask; ! unsigned char have_addr = 0; ! unsigned char have_netmask = 0; ! int mtu = DEFAULT_MTU; cache_entry_t *ce; void *data; --- 297,303 ---- list_t *list_ptr; uint32_t addr, netmask; ! uint8_t have_addr = 0; ! uint8_t have_netmask = 0; ! uint16_t mtu = DEFAULT_MTU; cache_entry_t *ce; void *data; *************** *** 316,322 **** xfree(data); have_addr = 1; - - if(have_addr && have_netmask) /* if we're done finding both, break out. */ - break; continue; --- 316,319 ---- *************** *** 331,336 **** have_netmask = 1; ! if(have_addr && have_netmask) /* if we're done finding both, break out. */ ! break; continue; --- 328,340 ---- have_netmask = 1; ! continue; ! } ! ! if(string_matches(dhcp_options_strings[TAG_DHCP_INTERFACE_MTU], ! ce->name)) { ! ! data = option_convert_handlers[TAG_DHCP_INTERFACE_MTU].serialize_to_internal(ce->value); ! memcpy(&mtu, data, sizeof(uint16_t)); ! xfree(data); continue; *************** *** 344,348 **** } ! if(rawnet_interface_up(dc->rawnet, addr, netmask, mtu)) { push_exception("sysconf", "sysconf_setup_interface", "could not bring interface up: %s", rawnet_get_device_name(dc->rawnet)); --- 348,352 ---- } ! if(rawnet_interface_up(dc->rawnet, addr, netmask, (int)mtu)) { push_exception("sysconf", "sysconf_setup_interface", "could not bring interface up: %s", rawnet_get_device_name(dc->rawnet)); |
From: <act...@us...> - 2002-07-03 03:03:29
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv7402 Modified Files: dhcp-convert.c dhcp-files.c dhcp-util.c dhcp-util.h Log Message: trim_string no longer necessary -- removed; completed move to stringbuffer -- atleast for now Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-convert.c 3 Jul 2002 01:24:20 -0000 1.18 --- dhcp-convert.c 3 Jul 2002 03:03:26 -0000 1.19 *************** *** 297,306 **** void *string_to_addr_list(const char *string) { uint32_t *addr; list_t *addr_list = NULL; ! char *cp, *tmp_string, *orig_string; - tmp_string = xstrdup(string); /* don't overwrite old string. */ - trim_string(tmp_string); orig_string = tmp_string; --- 297,313 ---- void *string_to_addr_list(const char *string) { + stringbuffer *sb; uint32_t *addr; list_t *addr_list = NULL; ! char *cp, *tmp_string, *orig_string;; ! ! sb = create_stringbuffer(); ! stringbuffer_append(sb, string); ! stringbuffer_trim_newline(sb); ! stringbuffer_trim_whitespace(sb); ! ! tmp_string = xstrdup(stringbuffer_getstring(sb)); ! destroy_stringbuffer(sb); orig_string = tmp_string; Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-files.c 3 Jul 2002 00:51:39 -0000 1.15 --- dhcp-files.c 3 Jul 2002 03:03:26 -0000 1.16 *************** *** 108,112 **** static char *get_pid_file_name(char *name) { ! return (splice_string(name, ".pid")); } --- 108,121 ---- static char *get_pid_file_name(char *name) { ! stringbuffer *sb; ! char *fname; ! ! sb = create_stringbuffer(); ! stringbuffer_append(sb, name); ! stringbuffer_append(sb, ".pid"); ! ! fname = xstrdup(stringbuffer_getstring(sb)); ! destroy_stringbuffer(sb); ! return fname; } Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dhcp-util.c 3 Jul 2002 00:51:39 -0000 1.24 --- dhcp-util.c 3 Jul 2002 03:03:26 -0000 1.25 *************** *** 379,420 **** return new_string; } - - /* trim preprending and trailing space. also get rid of newlines. */ - void trim_string(char *s) - { - char *start, *end, *tmp_string; - int len; - - len = strlen(s); - - if(len == 0) - return; - - tmp_string = xmalloc(len + 1); - strcpy(tmp_string, s); - tmp_string[len] = '\0'; - - start = tmp_string; - - while(isspace(*start)) - start++; - - end = &tmp_string[len - 1]; - - while((end == '\0' || isspace(*end)) && end != start) { - end--; - } - - if(end == start) /* bad. */ - s[0] = '\0'; - - end++; - *end = '\0'; - - strcpy(s, start); - xfree(tmp_string); - - return; - } /* is a valid C string? */ --- 379,382 ---- Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-util.h 3 Jul 2002 00:51:39 -0000 1.10 --- dhcp-util.h 3 Jul 2002 03:03:26 -0000 1.11 *************** *** 61,65 **** extern char *splice_string(const char *s1, const char *s2); extern char *splice_many_strings(int num, char *s, ...); - extern void trim_string(char *s); extern int string_matches(const char *s1, const char *s2); extern int hex_string_to_value(char *string, unsigned char *dst); --- 61,64 ---- |
From: <act...@us...> - 2002-07-03 01:24:22
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv23765 Modified Files: dhcp-client-cache.c dhcp-client-conf.c dhcp-client.c dhcp-convert.c Log Message: fixes to previous update; names were being munged in some places; and conversion was not done right in network addr list Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-client-cache.c 3 Jul 2002 00:51:39 -0000 1.15 --- dhcp-client-cache.c 3 Jul 2002 01:24:20 -0000 1.16 *************** *** 132,136 **** char *fname; stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, ".cache"); fname = xstrdup(stringbuffer_getstring(sb)); --- 132,136 ---- char *fname; stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, "cache"); fname = xstrdup(stringbuffer_getstring(sb)); *************** *** 144,148 **** char *fname; stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, ".cache.tmp"); fname = xstrdup(stringbuffer_getstring(sb)); --- 144,148 ---- char *fname; stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, "cache.tmp"); fname = xstrdup(stringbuffer_getstring(sb)); Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-client-conf.c 3 Jul 2002 00:51:39 -0000 1.14 --- dhcp-client-conf.c 3 Jul 2002 01:24:20 -0000 1.15 *************** *** 69,73 **** char *fname; stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, ".opts"); fname = xstrdup(stringbuffer_getstring(sb)); --- 69,73 ---- char *fname; stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, "opts"); fname = xstrdup(stringbuffer_getstring(sb)); Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** dhcp-client.c 3 Jul 2002 00:51:39 -0000 1.40 --- dhcp-client.c 3 Jul 2002 01:24:20 -0000 1.41 *************** *** 95,99 **** sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s %s", interface, ".conf"); if(init_glob_conf(stringbuffer_getstring(sb))) { --- 95,99 ---- sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", interface, "conf"); if(init_glob_conf(stringbuffer_getstring(sb))) { Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-convert.c 3 Jul 2002 00:51:39 -0000 1.17 --- dhcp-convert.c 3 Jul 2002 01:24:20 -0000 1.18 *************** *** 245,249 **** sb = create_stringbuffer(); ! while(len >= 0) { string = network_addr_to_string(data, len); --- 245,249 ---- sb = create_stringbuffer(); ! while(len > 0) { string = network_addr_to_string(data, len); |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8575 Modified Files: TODO dhcp-cache-entry.c dhcp-client-cache.c dhcp-client-conf.c dhcp-client-control.c dhcp-client.c dhcp-convert.c dhcp-files.c dhcp-files.h dhcp-globconf.c dhcp-globconf.h dhcp-interface.c dhcp-net.c dhcp-sniff.c dhcp-stringbuffer.c dhcp-util.c dhcp-util.h dhcp-varfile.c Log Message: added xstrdup; integrated stringbuffer code into main code instead of string_splice; Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** TODO 2 Jul 2002 18:46:21 -0000 1.33 --- TODO 3 Jul 2002 00:51:39 -0000 1.34 *************** *** 68,79 **** -- other minor optimizations which would be nice are noted in FIXMEs all over the code. - -- be nice to servers. sort the list according to option tag value. - the highest value first seems about right. - -- clean up dhcp-packet-build.c -- the rawnet routines should be a shared library due to too many dependencies. the sniffer for example, only needs the packet parsing routines. - -- dhcpsniff needs as brief mode as well as some fixes to its - current output (timestamps aren't looking too good) -- get stringbuffer used in places where strings are being manipulated heavily. --- 68,74 ---- Index: dhcp-cache-entry.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-cache-entry.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-cache-entry.c 17 Jun 2002 13:23:07 -0000 1.8 --- dhcp-cache-entry.c 3 Jul 2002 00:51:39 -0000 1.9 *************** *** 36,41 **** cache = xmalloc(sizeof(cache_entry_t)); ! cache->name = strdup(name); ! cache->value = strdup(value); return cache; --- 36,41 ---- cache = xmalloc(sizeof(cache_entry_t)); ! cache->name = xstrdup(name); ! cache->value = xstrdup(value); return cache; Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-client-cache.c 30 Jun 2002 08:23:45 -0000 1.14 --- dhcp-client-cache.c 3 Jul 2002 00:51:39 -0000 1.15 *************** *** 130,139 **** static char *get_fname(client_cache_t *cc) { ! return(splice_string(cc->interface, ".cache")); } static char *get_fname_tmp(client_cache_t *cc) { ! return(splice_string(cc->interface, ".cache.tmp")); } --- 130,153 ---- static char *get_fname(client_cache_t *cc) { ! char *fname; ! stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, ".cache"); ! ! fname = xstrdup(stringbuffer_getstring(sb)); ! destroy_stringbuffer(sb); ! ! return fname; } static char *get_fname_tmp(client_cache_t *cc) { ! char *fname; ! stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, ".cache.tmp"); ! ! fname = xstrdup(stringbuffer_getstring(sb)); ! destroy_stringbuffer(sb); ! ! return fname; } Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-client-conf.c 30 Jun 2002 08:23:45 -0000 1.13 --- dhcp-client-conf.c 3 Jul 2002 00:51:39 -0000 1.14 *************** *** 67,71 **** static char *get_conf_options_fname(client_conf_t *cc) { ! return(splice_string(cc->interface, ".opts")); } --- 67,78 ---- static char *get_conf_options_fname(client_conf_t *cc) { ! char *fname; ! stringbuffer *sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s.%s", cc->interface, ".opts"); ! ! fname = xstrdup(stringbuffer_getstring(sb)); ! destroy_stringbuffer(sb); ! ! return fname; } Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dhcp-client-control.c 2 Jul 2002 18:46:21 -0000 1.24 --- dhcp-client-control.c 3 Jul 2002 00:51:39 -0000 1.25 *************** *** 104,108 **** dc = xmalloc(sizeof(dhcp_client_control_t)); memset(dc, 0, sizeof(dhcp_client_control_t)); ! dc->interface = strdup(interface); return dc; --- 104,108 ---- dc = xmalloc(sizeof(dhcp_client_control_t)); memset(dc, 0, sizeof(dhcp_client_control_t)); ! dc->interface = xstrdup(interface); return dc; *************** *** 130,134 **** dc->state = 0; ! dc->interface = strdup(interface); dc->conf = create_client_conf(dc); dc->cache = create_client_cache(dc); --- 130,134 ---- dc->state = 0; ! dc->interface = xstrdup(interface); dc->conf = create_client_conf(dc); dc->cache = create_client_cache(dc); *************** *** 194,198 **** dc->class_id = splice_many_strings(4, utsname.sysname, utsname.nodename, utsname.release, utsname.version, utsname.machine); #else /* HAVE_UNAME */ ! dc->class_id = strdup("Unknown"); #endif /* HAVE_UNAME */ --- 194,198 ---- dc->class_id = splice_many_strings(4, utsname.sysname, utsname.nodename, utsname.release, utsname.version, utsname.machine); #else /* HAVE_UNAME */ ! dc->class_id = xstrdup("Unknown"); #endif /* HAVE_UNAME */ Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** dhcp-client.c 2 Jul 2002 18:41:40 -0000 1.39 --- dhcp-client.c 3 Jul 2002 00:51:39 -0000 1.40 *************** *** 92,106 **** static void read_global_conf(const char *interface) { ! char *filename; ! 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; } --- 92,109 ---- static void read_global_conf(const char *interface) { ! stringbuffer *sb; ! sb = create_stringbuffer(); ! stringbuffer_aprintf(sb, "%s %s", interface, ".conf"); ! ! if(init_glob_conf(stringbuffer_getstring(sb))) { push_exception("main", "read_global_conf", ! "could not read nor create global configuration file: %s", ! stringbuffer_getstring(sb)); exception_errors = unroll_exceptions(); fatal_error_exception(exception_errors); } ! destroy_stringbuffer(sb); return; } *************** *** 195,199 **** return NULL; ! first_interface = strdup(interface_list->data); purge_list(interface_list, NULL); return first_interface; --- 198,202 ---- return NULL; ! first_interface = xstrdup(interface_list->data); purge_list(interface_list, NULL); return first_interface; *************** *** 532,536 **** case 'd': ! work_dir = strdup(optarg); break; --- 535,539 ---- case 'd': ! work_dir = xstrdup(optarg); break; *************** *** 542,550 **** case 'i': ! interface = strdup(optarg); break; case 'm': ! fake_hw_addr = strdup(optarg); break; --- 545,553 ---- case 'i': ! interface = xstrdup(optarg); break; case 'm': ! fake_hw_addr = xstrdup(optarg); break; Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-convert.c 2 Jul 2002 18:35:44 -0000 1.16 --- dhcp-convert.c 3 Jul 2002 00:51:39 -0000 1.17 *************** *** 182,193 **** char *network_byte_to_string_byte(const unsigned char *data, int len) { char *s; if(len < 1) return NULL; ! ! s = xmalloc(BYTE_STRING_SIZE); ! snprintf(s, BYTE_STRING_SIZE, "0x%hhx", *(unsigned char *)data); ! return s; } --- 182,198 ---- char *network_byte_to_string_byte(const unsigned char *data, int len) { + stringbuffer *sb; char *s; if(len < 1) return NULL; ! ! sb = create_stringbuffer(); ! ! stringbuffer_aprintf(sb, "0x%hhx", *(unsigned char *)data); ! ! s = xstrdup(stringbuffer_getstring(sb)); ! destroy_stringbuffer(sb); ! return s; } *************** *** 224,228 **** memcpy(&address.s_addr, data, IP_ADDR_LEN); ! return(strdup(inet_ntoa(address))); } --- 229,233 ---- memcpy(&address.s_addr, data, IP_ADDR_LEN); ! return(xstrdup(inet_ntoa(address))); } *************** *** 230,278 **** char *network_addr_list_to_string(const unsigned char *data, int len) { char *string; - char *tmp, *new_string; ! if(len < IP_ADDR_LEN) ! return NULL; ! ! string = network_addr_to_string(data, len); ! if(string == NULL) return NULL; ! ! tmp = string; ! string = splice_string(string, ";"); ! xfree(tmp); ! ! len -= 4; ! data += 4; ! ! while(len >= 4) { ! ! tmp = string; ! new_string = network_addr_to_string(data, len); ! ! if(new_string == NULL) { ! ! /* truncated address. Just do our best. */ ! ! string = splice_string(string, ";"); ! free(tmp); ! return string; ! } ! string = splice_string(string, new_string); ! xfree(tmp); ! xfree(new_string); ! tmp = string; ! string = splice_string(string, ";"); ! xfree(tmp); ! data += 4; len -= 4; } ! return string; } --- 235,282 ---- char *network_addr_list_to_string(const unsigned char *data, int len) { + stringbuffer *sb; char *string; ! if(len < IP_ADDR_LEN) { ! warn_message("network addr to list: address passed too small."); return NULL; ! } ! sb = create_stringbuffer(); ! while(len >= 0) { ! string = network_addr_to_string(data, len); ! if(string == NULL) { ! warn_message("network addr to list: skipping malformed address"); ! ! } else { ! ! stringbuffer_append(sb, string); ! stringbuffer_append_c(sb, ';'); ! xfree(string); ! ! } ! len -= 4; + data += 4; + } ! ! string = xstrdup(stringbuffer_getstring(sb)); ! ! if(strlen(string) == 0) { ! ! warn_message("network addr to list: no valid addresses passed."); ! destroy_stringbuffer(sb); ! xfree(string); ! return NULL; ! ! } else { ! ! destroy_stringbuffer(sb); return string; + } } *************** *** 297,301 **** char *cp, *tmp_string, *orig_string; ! tmp_string = strdup(string); /* don't overwrite old string. */ trim_string(tmp_string); orig_string = tmp_string; --- 301,305 ---- char *cp, *tmp_string, *orig_string; ! tmp_string = xstrdup(string); /* don't overwrite old string. */ trim_string(tmp_string); orig_string = tmp_string; *************** *** 334,338 **** int count = 0; uint32_t *data, *cp; ! for(ptr = addr_list;ptr;ptr = ptr->next) count++; --- 338,342 ---- int count = 0; uint32_t *data, *cp; ! for(ptr = addr_list;ptr;ptr = ptr->next) count++; *************** *** 394,398 **** /* otherwise strdup a copy. */ ! return strdup(data); } --- 398,402 ---- /* otherwise strdup a copy. */ ! return xstrdup(data); } *************** *** 413,417 **** * into the right places. */ ! return strdup(data); } --- 417,421 ---- * into the right places. */ ! return xstrdup(data); } *************** *** 419,423 **** void *strdup_wrap(const char *s) { ! return(strdup(s)); } --- 423,427 ---- void *strdup_wrap(const char *s) { ! return(xstrdup(s)); } *************** *** 439,442 **** --- 443,447 ---- size_t size, int si) { + stringbuffer *sb; char *string; *************** *** 444,447 **** --- 449,453 ---- return NULL; + sb = create_stringbuffer(); if(si) { /* signed. */ *************** *** 449,459 **** case sizeof(int32_t): ! string = xmalloc(INT32_T_STRING_SIZE); ! snprintf(string, INT32_T_STRING_SIZE, "%"PRIi32"", *(int32_t *)data); break; case sizeof(int16_t): ! string = xmalloc(INT16_T_STRING_SIZE); ! snprintf(string, INT16_T_STRING_SIZE, "%"PRIi16"", *(int16_t *)data); break; --- 455,463 ---- case sizeof(int32_t): ! stringbuffer_aprintf(sb, "%"PRIi32"", *(int32_t *)data); break; case sizeof(int16_t): ! stringbuffer_aprintf(sb, "%"PRIi16"", *(int16_t *)data); break; *************** *** 469,479 **** case sizeof(uint32_t): ! string = xmalloc(UINT32_T_STRING_SIZE); ! snprintf(string, UINT32_T_STRING_SIZE, "%"PRIu32"", *(uint32_t *)data); break; case sizeof(uint16_t): ! string = xmalloc(UINT16_T_STRING_SIZE); ! snprintf(string, UINT16_T_STRING_SIZE, "%"PRIu16"", *(uint16_t *)data); break; --- 473,481 ---- case sizeof(uint32_t): ! stringbuffer_aprintf(sb, "%"PRIu32"", *(uint32_t *)data); break; case sizeof(uint16_t): ! stringbuffer_aprintf(sb, "%"PRIu16"", *(uint16_t *)data); break; *************** *** 484,488 **** } } ! return string; } --- 486,492 ---- } } ! ! string = xstrdup(stringbuffer_getstring(sb)); ! destroy_stringbuffer(sb); return string; } *************** *** 593,599 **** char *network_uint16_list_to_string(const unsigned char *data, int len) { ! char *tmp; ! char *s = NULL; ! char *string = NULL; if(len == 0 || --- 597,603 ---- char *network_uint16_list_to_string(const unsigned char *data, int len) { ! ! stringbuffer *sb; ! char *string; if(len == 0 || *************** *** 601,625 **** return NULL; ! for(;len > 0;len -= sizeof(uint16_t)) { ! ! s = network_uint16_to_string(data, sizeof(uint16_t)); ! if(s == NULL) ! return string; ! tmp = string; ! string = splice_string(s, string); ! ! if(tmp != NULL) ! xfree(tmp); ! xfree(s); ! ! tmp = string; ! string = splice_string(string, ";"); ! free(tmp); ! data += sizeof(uint16_t); } ! ! return string; } --- 605,642 ---- return NULL; ! sb = create_stringbuffer(); ! while(len > 0) { ! string = network_uint16_to_string(data, sizeof(uint16_t)); ! ! if(string == NULL) { ! ! warn_message("network_uint16_list_to_string: malformed data -- skipping"); ! ! } else { ! ! stringbuffer_append(sb, string); ! stringbuffer_append_c(sb, ';'); ! ! xfree(string); ! } ! ! len -= sizeof(uint16_t); ! data += sizeof(uint16_t); } ! ! string = xstrdup(stringbuffer_getstring(sb)); ! ! if(strlen(string) == 0) { ! warn_message("uint16_t list to string: no valid integers passed."); ! xfree(string); ! destroy_stringbuffer(sb); ! return NULL; ! } else { ! destroy_stringbuffer(sb); ! return string; ! } ! } Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-files.c 30 Jun 2002 20:43:10 -0000 1.14 --- dhcp-files.c 3 Jul 2002 00:51:39 -0000 1.15 *************** *** 86,90 **** /* check if a file exists. -- achtung: watch out for race * conditions */ ! int file_exists(char *fname) { FILE *fp; --- 86,90 ---- /* check if a file exists. -- achtung: watch out for race * conditions */ ! int file_exists(const char *fname) { FILE *fp; Index: dhcp-files.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-files.h 30 Jun 2002 08:23:45 -0000 1.5 --- dhcp-files.h 3 Jul 2002 00:51:39 -0000 1.6 *************** *** 30,34 **** extern FILE *file_create_and_truncate_safe(const char *filename, char *mode); ! extern int file_exists(char *fname); extern void move_file(char *fname, char *dest); extern int delete_file(char *fname); --- 30,34 ---- extern FILE *file_create_and_truncate_safe(const char *filename, char *mode); ! extern int file_exists(const char *fname); extern void move_file(char *fname, char *dest); extern int delete_file(char *fname); Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-globconf.c 30 Jun 2002 21:22:15 -0000 1.11 --- dhcp-globconf.c 3 Jul 2002 00:51:39 -0000 1.12 *************** *** 103,107 **** /* read configuration options in and set variables. */ ! int init_glob_conf(unsigned char *filename) { varfile_t *varfile; --- 103,107 ---- /* read configuration options in and set variables. */ ! int init_glob_conf(const char *filename) { varfile_t *varfile; Index: dhcp-globconf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-globconf.h 30 Jun 2002 21:22:15 -0000 1.5 --- dhcp-globconf.h 3 Jul 2002 00:51:39 -0000 1.6 *************** *** 37,41 **** } glob_conf_t; ! extern int init_glob_conf(unsigned char *filename); extern void *glob_conf_get_val(int val_index); extern void glob_conf_set_val(void *val, int option); --- 37,41 ---- } glob_conf_t; ! extern int init_glob_conf(const char *filename); extern void *glob_conf_get_val(int val_index); extern void glob_conf_set_val(void *val, int option); Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-interface.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-interface.c 30 Jun 2002 08:23:45 -0000 1.20 --- dhcp-interface.c 3 Jul 2002 00:51:39 -0000 1.21 *************** *** 217,221 **** if(check(entry)) { ! intf_name = strdup(entry->intf_name); interfaces = add_to_end_of_list(interfaces, intf_name); } --- 217,221 ---- if(check(entry)) { ! intf_name = xstrdup(entry->intf_name); interfaces = add_to_end_of_list(interfaces, intf_name); } Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** dhcp-net.c 30 Jun 2002 20:22:26 -0000 1.31 --- dhcp-net.c 3 Jul 2002 00:51:39 -0000 1.32 *************** *** 202,207 **** net->src_port = dhcp_src_port; net->dst_port = dhcp_dst_port; ! net->device = strdup(device); ! net->pcap_filter = strdup(filter); net->packet_data = xcalloc(DEFAULT_MTU); /* XXX -- fixme make mtu configurable. */ net->promiscuous = promiscuous; --- 202,207 ---- net->src_port = dhcp_src_port; net->dst_port = dhcp_dst_port; ! net->device = xstrdup(device); ! net->pcap_filter = xstrdup(filter); net->packet_data = xcalloc(DEFAULT_MTU); /* XXX -- fixme make mtu configurable. */ net->promiscuous = promiscuous; Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-sniff.c 30 Jun 2002 08:23:45 -0000 1.14 --- dhcp-sniff.c 3 Jul 2002 00:51:39 -0000 1.15 *************** *** 66,70 **** case 'i': ! interface_name = strdup(optarg); break; --- 66,70 ---- case 'i': ! interface_name = xstrdup(optarg); break; *************** *** 90,94 **** if(available_interfaces != NULL) { ! interface_name = strdup(available_interfaces->data); purge_list(available_interfaces, NULL); --- 90,94 ---- if(available_interfaces != NULL) { ! interface_name = xstrdup(available_interfaces->data); purge_list(available_interfaces, NULL); Index: dhcp-stringbuffer.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-stringbuffer.c 30 Jun 2002 08:23:45 -0000 1.7 --- dhcp-stringbuffer.c 3 Jul 2002 00:51:39 -0000 1.8 *************** *** 73,77 **** if(strlen(s) < end) { *len = strlen(s); ! return strdup(s); } --- 73,77 ---- if(strlen(s) < end) { *len = strlen(s); ! return xstrdup(s); } Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** dhcp-util.c 2 Jul 2002 17:09:15 -0000 1.23 --- dhcp-util.c 3 Jul 2002 00:51:39 -0000 1.24 *************** *** 227,231 **** #ifndef HAVE_STRDUP ! char *strdup(char *s) { char *newstring; --- 227,231 ---- #ifndef HAVE_STRDUP ! char *strdup(const char *s) { char *newstring; *************** *** 241,244 **** --- 241,257 ---- #endif + /* strdup wrapper to check if strdup (especially if its the + * system implementation and not ours) returns NULL. Then + * abort. */ + + char *xstrdup(const char *string) + { + char *s = strdup(string); + if(s == NULL) + fatal_error("could not allocate memory! aborting!"); + + return s; + } + /* signal manipulation routines. */ *************** *** 348,352 **** char *new_string; ! new_string = strdup(string); if(num <= 1) --- 361,365 ---- char *new_string; ! new_string = xstrdup(string); if(num <= 1) *************** *** 436,440 **** new_string = splice_string(string, ":"); else ! new_string = strdup(string); if(strlen(new_string) > 18) { --- 449,453 ---- new_string = splice_string(string, ":"); else ! new_string = xstrdup(string); if(strlen(new_string) > 18) { Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-util.h 2 Jul 2002 18:35:44 -0000 1.9 --- dhcp-util.h 3 Jul 2002 00:51:39 -0000 1.10 *************** *** 74,77 **** --- 74,78 ---- extern int port_for_service(const char *serv, const char *proto); extern int is_seven_bit_clean(const char *data, int len); + extern char *xstrdup(const char *string); #endif /* DHCP_UTIL_H */ Index: dhcp-varfile.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-varfile.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-varfile.c 22 Jun 2002 18:11:25 -0000 1.3 --- dhcp-varfile.c 3 Jul 2002 00:51:39 -0000 1.4 *************** *** 50,54 **** varfile = xmalloc(sizeof(varfile_t)); ! varfile->filename = strdup(filename); varfile->var_name = create_stringbuffer(); varfile->var_val = create_stringbuffer(); --- 50,54 ---- varfile = xmalloc(sizeof(varfile_t)); ! varfile->filename = xstrdup(filename); varfile->var_name = create_stringbuffer(); varfile->var_val = create_stringbuffer(); |
From: <act...@us...> - 2002-07-02 18:46:24
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv6074 Modified Files: TODO dhcp-agent.h dhcp-client-control.c dhcp-client-states.c Log Message: client now uses new xid per entry into discover/offer state Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** TODO 2 Jul 2002 18:42:09 -0000 1.32 --- TODO 2 Jul 2002 18:46:21 -0000 1.33 *************** *** 68,73 **** -- other minor optimizations which would be nice are noted in FIXMEs all over the code. - -- make more uses of different xid. currently only one per reboot is - chosen. this is compliant with the rfc, but not really good. -- be nice to servers. sort the list according to option tag value. the highest value first seems about right. --- 68,71 ---- Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** dhcp-agent.h 30 Jun 2002 21:22:15 -0000 1.63 --- dhcp-agent.h 2 Jul 2002 18:46:21 -0000 1.64 *************** *** 730,733 **** --- 730,734 ---- extern dhcp_client_control_t *create_dhcp_client_control_dummy(char *interface); extern void dhcp_client_interface_down(dhcp_client_control_t *dc); + extern void dhcp_client_update_xid(dhcp_client_control_t *dc); /* dhcp client conf */ Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** dhcp-client-control.c 30 Jun 2002 08:23:45 -0000 1.23 --- dhcp-client-control.c 2 Jul 2002 18:46:21 -0000 1.24 *************** *** 109,113 **** } ! static void update_dhcp_xid(dhcp_client_control_t *dc) { dc->xid = dhcp_gen_xid(); --- 109,113 ---- } ! void dhcp_client_update_xid(dhcp_client_control_t *dc) { dc->xid = dhcp_gen_xid(); *************** *** 181,185 **** /* xid setting */ ! update_dhcp_xid(dc); /* secs settings. */ --- 181,185 ---- /* xid setting */ ! dhcp_client_update_xid(dc); /* secs settings. */ Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** dhcp-client-states.c 2 Jul 2002 18:41:40 -0000 1.36 --- dhcp-client-states.c 2 Jul 2002 18:46:21 -0000 1.37 *************** *** 213,216 **** --- 213,219 ---- dhcp_client_update_secs(dc); + /* update new xid per start of discovery .*/ + dhcp_client_update_xid(dc); + /* Our options cleared by build_* since they are passed * down and later purged. */ |
From: <act...@us...> - 2002-07-02 18:42:12
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv4856 Modified Files: TODO Log Message: update to TODO list Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** TODO 24 Jun 2002 14:32:24 -0000 1.31 --- TODO 2 Jul 2002 18:42:09 -0000 1.32 *************** *** 66,71 **** as per RFC2131 - -- add check in validate_to_string for conformity with DHCP RFC on - character set. -- other minor optimizations which would be nice are noted in FIXMEs all over the code. --- 66,69 ---- |
From: <act...@us...> - 2002-07-02 18:41:44
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv4690 Modified Files: dhcp-client-states.c dhcp-client.c dhcp-sysconf.c Log Message: cleanup code re-integrated Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** dhcp-client-states.c 2 Jul 2002 16:46:11 -0000 1.35 --- dhcp-client-states.c 2 Jul 2002 18:41:40 -0000 1.36 *************** *** 324,328 **** { list_t *options; ! options = client_cache_load_option_string_list(dc->cache, 0); if(options == NULL) { --- 324,328 ---- { list_t *options; ! options = client_cache_load_option_string_list(dc->cache, 0); if(options == NULL) { Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** dhcp-client.c 30 Jun 2002 20:43:10 -0000 1.38 --- dhcp-client.c 2 Jul 2002 18:41:40 -0000 1.39 *************** *** 131,138 **** static void do_shutdown(dhcp_client_control_t *dc) { info_message("shutting down."); if(dc) { /* only do clean up if we can. */ ! // do_sysconf_cleanup(dc); client_release(dc); delete_pid_file(dc->interface); --- 131,148 ---- static void do_shutdown(dhcp_client_control_t *dc) { + list_t *cached_options; + info_message("shutting down."); if(dc) { /* only do clean up if we can. */ ! ! /* load what we can from the cache. */ ! ! cached_options = client_cache_load_option_string_list(dc->cache, 0); ! if(cached_options != NULL) ! do_sysconf_cleanup(cached_options, dc); ! ! cache_entry_purge_list(cached_options); ! 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.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** dhcp-sysconf.c 30 Jun 2002 20:43:10 -0000 1.25 --- dhcp-sysconf.c 2 Jul 2002 18:41:40 -0000 1.26 *************** *** 479,481 **** return; } - --- 479,480 ---- |
From: <act...@us...> - 2002-07-02 18:35:48
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv2983 Modified Files: dhcp-convert.c dhcp-convert.h dhcp-util.h Log Message: added network_validate_nvt_string_to_string to conversion routines Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-convert.c 17 Jun 2002 13:23:07 -0000 1.15 --- dhcp-convert.c 2 Jul 2002 18:35:44 -0000 1.16 *************** *** 84,88 **** { network_uint16_to_string, string_to_uint16, string_uint16_to_network, xfree }, /* 13 */ /* boot file size option */ ! { validate_network_string_to_string, strdup_wrap, strdup_wrap_net, xfree }, /* 14 */ /* merit dump file */ { validate_network_string_to_string, strdup_wrap, strdup_wrap_net, --- 84,88 ---- { network_uint16_to_string, string_to_uint16, string_uint16_to_network, xfree }, /* 13 */ /* boot file size option */ ! { validate_network_nvt_string_to_string, strdup_wrap, strdup_wrap_net, xfree }, /* 14 */ /* merit dump file */ { validate_network_string_to_string, strdup_wrap, strdup_wrap_net, *************** *** 90,94 **** { network_addr_to_string, string_to_addr, string_addr_to_network, xfree }, /* 16 */ /* swap server */ ! { validate_network_string_to_string, strdup_wrap, strdup_wrap_net, xfree }, /* 17 */ /* root path */ { validate_network_string_to_string, strdup_wrap, strdup_wrap_net, --- 90,94 ---- { network_addr_to_string, string_to_addr, string_addr_to_network, xfree }, /* 16 */ /* swap server */ ! { validate_network_nvt_string_to_string, strdup_wrap, strdup_wrap_net, xfree }, /* 17 */ /* root path */ { validate_network_string_to_string, strdup_wrap, strdup_wrap_net, *************** *** 136,140 **** { network_byte_to_string_byte, string_byte_to_byte, string_byte_to_network, xfree }, /* 39 */ /* TCP Keepalive Garbage Option. */ ! { validate_network_string_to_string, strdup_wrap, strdup_wrap_net, xfree }, /* 40 */ /* Network Information Service Domain */ { network_addr_list_to_string, string_to_addr_list, --- 136,140 ---- { network_byte_to_string_byte, string_byte_to_byte, string_byte_to_network, xfree }, /* 39 */ /* TCP Keepalive Garbage Option. */ ! { validate_network_nvt_string_to_string, strdup_wrap, strdup_wrap_net, xfree }, /* 40 */ /* Network Information Service Domain */ { network_addr_list_to_string, string_to_addr_list, *************** *** 165,169 **** string_addr_to_network, xfree }, /* 54 */ /* Server Identifier. */ { NULL, NULL, NULL, NULL }, /* 55 */ /* parameter request list. */ ! { NULL, NULL, NULL, NULL }, /* 56 */ /* message. we handle this higher. */ { network_uint16_list_to_string, string_to_uint16_list, string_uint16_list_to_network, purge_list_internal }, /* 57 */ /* Maximum DHCP message size. */ --- 165,170 ---- string_addr_to_network, xfree }, /* 54 */ /* Server Identifier. */ { NULL, NULL, NULL, NULL }, /* 55 */ /* parameter request list. */ ! { validate_network_nvt_string_to_string, strdup_wrap, ! strdup_wrap_net, xfree }, /* 56 */ /* Message */ { network_uint16_list_to_string, string_to_uint16_list, string_uint16_list_to_network, purge_list_internal }, /* 57 */ /* Maximum DHCP message size. */ *************** *** 380,389 **** */ ! /* validate string only: fixme: add rfc character set check. */ char *validate_network_string_to_string(const unsigned char *data, int len) { char *new_string; ! if(!is_string(data, len)) { /* fix if needed. */ new_string = xmalloc(len + 1); memcpy(new_string, data, len); --- 381,390 ---- */ ! /* validate string only */ char *validate_network_string_to_string(const unsigned char *data, int len) { char *new_string; ! if(!is_string(data, len)) { /* add null if needed. */ new_string = xmalloc(len + 1); memcpy(new_string, data, len); *************** *** 394,397 **** --- 395,407 ---- /* otherwise strdup a copy. */ return strdup(data); + } + + /* validate string and make sures it contains nvt ascii characters */ + char *validate_network_nvt_string_to_string(const unsigned char *data, int len) + { + if(is_seven_bit_clean(data, len)) { + return validate_network_string_to_string(data, len); + } else + return NULL; } Index: dhcp-convert.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-convert.h 30 Jun 2002 21:22:15 -0000 1.3 --- dhcp-convert.h 2 Jul 2002 18:35:44 -0000 1.4 *************** *** 88,91 **** --- 88,92 ---- /* network to string */ + extern char *validate_network_nvt_string_to_string(const unsigned char *data, int len); 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); Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-util.h 30 Jun 2002 08:23:45 -0000 1.8 --- dhcp-util.h 2 Jul 2002 18:35:44 -0000 1.9 *************** *** 73,76 **** --- 73,77 ---- extern int resolv(char *address, uint32_t *addr); extern int port_for_service(const char *serv, const char *proto); + extern int is_seven_bit_clean(const char *data, int len); #endif /* DHCP_UTIL_H */ |