[Dhcp-agent-commits] CVS: dhcp-agent config.h,NONE,1.1 TODO,1.14,1.15 dhcp-agent.h,1.36,1.37 dhcp-ic
Status: Alpha
Brought to you by:
actmodern
From: Thamer Al-H. <act...@us...> - 2002-05-19 23:03:19
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv18572 Modified Files: TODO dhcp-agent.h dhcp-icmp-discovery.c dhcp-route.c dhcp-sysconf.c Added Files: config.h Log Message: forgot to add the config.h --- NEW FILE: config.h --- /* config.h. Generated automatically by configure. */ /* config.h.in. Generated automatically from configure.in by autoheader. */ /* have sig_atomic_t */ #define HAVE_SIG_ATOMIC_T 1 /* default client work directory */ #define CLIENT_WORK_DIR "/etc/dhcpclient" /* Define if you have the `calloc' function. */ #define HAVE_CALLOC 1 /* Define if you have the `daemon' function. */ #define HAVE_DAEMON 1 /* Define if you have the <getopt.h> header file. */ #define HAVE_GETOPT_H 1 /* Define if you have the `getrusage' function. */ #define HAVE_GETRUSAGE 1 /* Define if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define if you have the `rename' function. */ #define HAVE_RENAME 1 /* Define if you have the <signal.h> header file. */ #define HAVE_SIGNAL_H 1 /* Define if you have the `sprintf' function. */ #define HAVE_SPRINTF 1 /* Define if you have the <stdarg.h> header file. */ #define HAVE_STDARG_H 1 /* Define if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define if you have the `sysconf' function. */ #define HAVE_SYSCONF 1 /* Define if you have the <sys/utsname.h> header file. */ #define HAVE_SYS_UTSNAME_H 1 /* Define if you have the `uname' function. */ #define HAVE_UNAME 1 /* Define if you have the <varargs.h> header file. */ #define HAVE_VARARGS_H 1 /* Define if you have the `vsnprintf' function. */ #define HAVE_VSNPRINTF 1 /* Name of package */ #define PACKAGE "dhcp-agent" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ #define VERSION "0.36" Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TODO 19 May 2002 20:16:55 -0000 1.14 --- TODO 19 May 2002 23:03:15 -0000 1.15 *************** *** 61,63 **** by using devices like /dev/urandom explicitly if available. -- fix overflow issue in dhcp-icmp-discovery (icmp_do_echo) ! --- 61,63 ---- by using devices like /dev/urandom explicitly if available. -- fix overflow issue in dhcp-icmp-discovery (icmp_do_echo) ! -- add global config options which can be gotten anywhere in the code Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** dhcp-agent.h 19 May 2002 20:16:55 -0000 1.36 --- dhcp-agent.h 19 May 2002 23:03:16 -0000 1.37 *************** *** 548,551 **** --- 548,552 ---- /* ICMP discovery routines. */ extern int icmp_subnet_mask_discovery(rawnet_t *net, int retries, uint32_t *subnet_mask); + extern list_t *icmp_rtt_discovery(rawnet_t *net, list_t *addresses); /* ARP discovery routines. */ Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-icmp-discovery.c 19 May 2002 20:16:55 -0000 1.5 --- dhcp-icmp-discovery.c 19 May 2002 23:03:16 -0000 1.6 *************** *** 133,138 **** */ ! /* FIXME: we need to underengineer this code. */ ! list_t *icmp_rtt_discovery(rawnet_t *net, list_t *addresses, int sends) { list_t *rtts = NULL; --- 133,137 ---- */ ! list_t *icmp_rtt_discovery(rawnet_t *net, list_t *addresses) { list_t *rtts = NULL; *************** *** 141,144 **** --- 140,146 ---- ip_addr_t *host_addr; eth_addr_t dest_mac; + + /* FIXME:x get rid of this magic number -- global config options? */ + sends = 3; /* Our algorithm works as such: send out an ICMP echo request Index: dhcp-route.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-route.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-route.c 19 May 2002 18:47:23 -0000 1.1 --- dhcp-route.c 19 May 2002 23:03:16 -0000 1.2 *************** *** 59,61 **** return(arp_discover_hardware_address(net, 3, entry.route_gw.addr_ip, dest_mac)); } - --- 59,60 ---- Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-sysconf.c 18 May 2002 18:10:09 -0000 1.9 --- dhcp-sysconf.c 19 May 2002 23:03:16 -0000 1.10 *************** *** 99,105 **** { struct route_entry r_entry; ! uint32_t *addr_val; route_t *rt; list_t *routers; /* FIXME: insert ICMP ping checks so we can find --- 99,108 ---- { struct route_entry r_entry; ! uint32_t *addr_val = NULL; route_t *rt; list_t *routers; + list_t *average_latencies, *list_ptr; + int lowest_latency = -1; + int *latency; /* FIXME: insert ICMP ping checks so we can find *************** *** 112,116 **** routers = value; ! addr_val = routers->data; r_entry.route_dst.addr_type = ADDR_TYPE_IP; --- 115,138 ---- routers = value; ! average_latencies = icmp_rtt_discovery(dc->rawnet, routers); ! ! /* Now pick best router and use it as default. */ ! for(list_ptr = average_latencies; ! list_ptr != NULL; ! list_ptr = list_ptr->next) { ! ! latency = list_ptr->data; ! if(lowest_latency < latency) { ! lowest_latency = *latency; ! addr_val = list_ptr->data; ! } ! } ! ! purge_list(average_latencies, NULL); ! ! if(addr_val == NULL) { ! error_message("sysconf_routers: could not add router as default route since none are responding!"); ! return -1; ! } r_entry.route_dst.addr_type = ADDR_TYPE_IP; *************** *** 123,129 **** rt = route_open(); ! if(rt == NULL) return -1; ! if(route_add(rt, &r_entry) < 0) { route_close(rt); --- 145,152 ---- rt = route_open(); ! if(rt == NULL) { return -1; ! } ! if(route_add(rt, &r_entry) < 0) { route_close(rt); |