[Dhcp-agent-commits] dhcp-agent dhcp-sysconf.c,1.17,1.18 dhcp-icmp-discovery.c,1.13,1.14
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2002-06-17 02:23:58
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv3898 Modified Files: dhcp-sysconf.c dhcp-icmp-discovery.c Log Message: fixed changes to dhcp-sysconf/dhcp-icmp-discovery; host addresses were being freed() twice because one copy was used; order in which address were gotten was wrong; bunch of other small things Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-sysconf.c 16 Jun 2002 00:57:32 -0000 1.17 --- dhcp-sysconf.c 17 Jun 2002 02:23:55 -0000 1.18 *************** *** 119,132 **** * we still want to use one of them. * (See RFC 1812, section 4.3.3.6.) */ ! addr_val = average_latencies->next->data; ! latency = list_ptr->data; ! lowest_latency = *latency; /* 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(*latency != -1 && *latency < lowest_latency) { lowest_latency = *latency; --- 119,131 ---- * we still want to use one of them. * (See RFC 1812, section 4.3.3.6.) */ ! addr_val = average_latencies->data; ! lowest_latency = *(int *)average_latencies->next->data; /* Now pick best router and use it as default. */ for(list_ptr = average_latencies; list_ptr != NULL; ! list_ptr = list_ptr->next->next) { ! latency = list_ptr->next->data; if(*latency != -1 && *latency < lowest_latency) { lowest_latency = *latency; *************** *** 135,140 **** } - purge_list(average_latencies, NULL); - r_entry.route_dst.addr_type = ADDR_TYPE_IP; r_entry.route_dst.addr_bits = 0; --- 134,137 ---- *************** *** 144,147 **** --- 141,146 ---- r_entry.route_gw.addr_bits = 0; memcpy(&r_entry.route_gw.addr_ip, addr_val, IP_ADDR_LEN); + + purge_list(average_latencies, NULL); rt = route_open(); Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-icmp-discovery.c 16 Jun 2002 00:57:32 -0000 1.13 --- dhcp-icmp-discovery.c 17 Jun 2002 02:23:55 -0000 1.14 *************** *** 137,141 **** int *latency, *average_latency; int send_count, unreachable_count, highest_latency; ! ip_addr_t *host_addr; eth_addr_t dest_mac; --- 137,141 ---- int *latency, *average_latency; int send_count, unreachable_count, highest_latency; ! ip_addr_t *host_addr, *host_addr_copy; eth_addr_t dest_mac; *************** *** 225,229 **** xfree(latency); /* free our latency array. */ rtts = add_to_list(rtts, average_latency); ! rtts = add_to_list(rtts, host_addr); } --- 225,236 ---- xfree(latency); /* free our latency array. */ rtts = add_to_list(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)); ! ! rtts = add_to_list(rtts, host_addr_copy); } |