[dhcp-agent-commits] dhcp-agent/src dhcp-librawnet.h,1.13,1.14 dhcp-route.c,1.3,1.4 dhcp-arp-discove
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2003-06-08 22:14:19
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv22402/src Modified Files: dhcp-librawnet.h dhcp-route.c dhcp-arp-discovery.c dhcp-icmp-discovery.c Log Message: updated discovery routines to accept fine tuning Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-librawnet.h 25 May 2003 03:37:36 -0000 1.13 --- dhcp-librawnet.h 8 Jun 2003 22:14:15 -0000 1.14 *************** *** 577,588 **** /* 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, int sends); /* ARP discovery routines. */ ! extern int arp_discover_hardware_address(rawnet_t *net, int retries, uint32_t address, eth_addr_t *mac_addr); /* Routing routines. */ ! extern int route_find(rawnet_t *net, ip_addr_t addr, eth_addr_t *dest_mac); /* Misc. */ --- 577,588 ---- /* 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, int timeout, int sends, int arp_retries, int arp_timeout, list_t *addresses); /* ARP discovery routines. */ ! extern int arp_discover_hardware_address(rawnet_t *net, int retries, int timeout, uint32_t address, eth_addr_t *mac_addr); /* Routing routines. */ ! extern int route_find(rawnet_t *net, int sends, int timeout, ip_addr_t addr, eth_addr_t *dest_mac); /* Misc. */ Index: dhcp-route.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-route.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-route.c 16 Nov 2002 00:23:44 -0000 1.3 --- dhcp-route.c 8 Jun 2003 22:14:16 -0000 1.4 *************** *** 35,39 **** #include "dhcp-librawnet.h" ! int route_find(rawnet_t *net, ip_addr_t addr, eth_addr_t *dest_mac) { route_t *rt; --- 35,39 ---- #include "dhcp-librawnet.h" ! int route_find(rawnet_t *net, int retries, int timeout, ip_addr_t addr, eth_addr_t *dest_mac) { route_t *rt; *************** *** 55,59 **** if(route_get(rt, &entry)) { /* not in routing table. do an arp for it then. */ ! return (arp_discover_hardware_address(net, 3, entry.route_dst.addr_ip, dest_mac)); } --- 55,59 ---- if(route_get(rt, &entry)) { /* not in routing table. do an arp for it then. */ ! return (arp_discover_hardware_address(net, retries, timeout, entry.route_dst.addr_ip, dest_mac)); } *************** *** 61,64 **** /* arp for gateway address. */ ! return (arp_discover_hardware_address(net, 3, entry.route_gw.addr_ip, dest_mac)); } --- 61,64 ---- /* arp for gateway address. */ ! return (arp_discover_hardware_address(net, retries, timeout, entry.route_gw.addr_ip, dest_mac)); } Index: dhcp-arp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-arp-discovery.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-arp-discovery.c 2 Jan 2003 04:23:01 -0000 1.4 --- dhcp-arp-discovery.c 8 Jun 2003 22:14:16 -0000 1.5 *************** *** 68,72 **** } ! int arp_discover_hardware_address(rawnet_t *net, int retries, uint32_t address, eth_addr_t *mac_addr) { --- 68,72 ---- } ! int arp_discover_hardware_address(rawnet_t *net, int retries, int timeout, uint32_t address, eth_addr_t *mac_addr) { *************** *** 88,92 **** retval = rawnet_packet_transact(net, arg_list, NULL, check_for_arp_reply, ! RECOMMENDED_MAX_SECS_WAIT); switch (retval) { --- 88,92 ---- retval = rawnet_packet_transact(net, arg_list, NULL, check_for_arp_reply, ! timeout); switch (retval) { *************** *** 112,115 **** --- 112,118 ---- list_destroy(arg_list, NULL); return 1; + + case RAWNET_USER_INTERRUPT: + FATAL_MESSAGE("user interrupt. bailing out!"); default: Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-icmp-discovery.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-icmp-discovery.c 2 Jan 2003 04:23:01 -0000 1.4 --- dhcp-icmp-discovery.c 8 Jun 2003 22:14:16 -0000 1.5 *************** *** 93,96 **** --- 93,99 ---- return 0; + case RAWNET_USER_INTERRUPT: + FATAL_MESSAGE("user interrupt. bailing out!"); + default: FATAL_MESSAGE("invalid return value from raw network handler -- this a bug report it."); *************** *** 141,154 **** /* ! * ICMP Round Trip Time (RTT) Discovery: ! * Here we're interested in how long it takes to ! * get a response from a list of addresses. ! * We return a list of alternating unsigned integers ! * and IP addresses, the uint giving the rtt for the ! * following address. * */ ! list_t *icmp_rtt_discovery(rawnet_t *net, list_t *addresses, int sends) { list_t *rtts; --- 144,155 ---- /* ! * ICMP Round Trip Time (RTT) Discovery: Here we're interested in ! * how long it takes to get a response from a list of addresses. ! * We return a list of unsigned integers representing the latency ! * of each host followed by the address of the host. * */ ! list_t *icmp_rtt_discovery(rawnet_t *net, int sends, int timeout, int arp_retries, int arp_timeout, list_t *addresses) { list_t *rtts; *************** *** 174,178 **** * arp_discover_hardware_address for that. */ ! if(route_find(net, *host_addr, &dest_mac)) { WARN_MESSAGE("could not find route for address for %s -- skipping", rawnet_network_address_to_string_static(*host_addr)); --- 175,179 ---- * arp_discover_hardware_address for that. */ ! if(route_find(net, arp_retries, arp_timeout, *host_addr, &dest_mac)) { WARN_MESSAGE("could not find route for address for %s -- skipping", rawnet_network_address_to_string_static(*host_addr)); *************** *** 241,259 **** xfree(latency); /* free our latency array. */ ! list_add(rtts, average_latency); ! ! /* we need to copy the host address so ! when this list is purged it doesn't affect ! the list we were passed. */ ! host_addr_copy = xmalloc(sizeof(ip_addr_t)); ! memcpy(host_addr_copy, host_addr, sizeof(ip_addr_t)); ! list_add(rtts, host_addr_copy); } ! if(list_get_len(rtts) == 0) { ! list_destroy(rtts, NULL); ! return NULL; ! } else ! return rtts; } --- 242,252 ---- xfree(latency); /* free our latency array. */ ! list_add_to_end(rtts, average_latency); ! host_addr_copy = xmalloc(sizeof(IP_ADDR_LEN)); ! memcpy(host_addr_copy, host_addr, IP_ADDR_LEN); ! list_add_to_end(rtts, host_addr_copy); } ! return rtts; } |