summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDavid Hankins <dhankins@isc.org>2006-08-09 14:57:48 +0000
committerDavid Hankins <dhankins@isc.org>2006-08-09 14:57:48 +0000
commit78c553c4a00feae01947eaae167af79460e7c406 (patch)
tree0ec2ad6c34180f9af6d048050b513dd150804699 /common
parent51c4d3f56fcd33f7d4a4e3d5c06bc028cf5846b4 (diff)
downloadisc-dhcp-78c553c4a00feae01947eaae167af79460e7c406.tar.gz
Removing the new I/O changes from HEAD. [ISC-Bugs #16328]
Diffstat (limited to 'common')
-rw-r--r--common/ctrace.c18
-rw-r--r--common/discover.c41
-rw-r--r--common/packet.c36
3 files changed, 10 insertions, 85 deletions
diff --git a/common/ctrace.c b/common/ctrace.c
index 5e8bcc09..8bcb9674 100644
--- a/common/ctrace.c
+++ b/common/ctrace.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
-"$Id: ctrace.c,v 1.5 2006/02/27 23:56:13 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: ctrace.c,v 1.6 2006/08/09 14:57:47 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -46,10 +46,8 @@ void trace_interface_register (trace_type_t *ttype, struct interface_info *ip)
memset (&tipkt, 0, sizeof tipkt);
memcpy (&tipkt.hw_address,
&ip -> hw_address, sizeof ip -> hw_address);
- if (ip -> address_count > 0)
- memcpy (&tipkt.primary_address,
- &ip -> addresses [0],
- sizeof ip -> addresses [0]);
+ memcpy (&tipkt.primary_address,
+ &ip -> primary_address, sizeof ip -> primary_address);
memcpy (tipkt.name, ip -> name, sizeof ip -> name);
tipkt.index = htonl (ip -> index);
@@ -89,12 +87,8 @@ void trace_interface_input (trace_type_t *ttype, unsigned len, char *buf)
memcpy (&ip -> hw_address, &tipkt -> hw_address,
sizeof ip -> hw_address);
- ip -> address_count = ip -> address_max = 1;
- ip -> addresses = dmalloc (sizeof (struct in_addr), MDL);
- if (!ip -> addresses)
- log_fatal ("Can't allocate address buffer for trace interface");
- memcpy (&ip -> addresses [0], &tipkt -> primary_address,
- sizeof ip -> addresses [0]);
+ memcpy (&ip -> primary_address, &tipkt -> primary_address,
+ sizeof ip -> primary_address);
memcpy (ip -> name, tipkt -> name, sizeof ip -> name);
ip -> index = ntohl (tipkt -> index);
@@ -108,7 +102,7 @@ void trace_interface_input (trace_type_t *ttype, unsigned len, char *buf)
ip -> ifp -> ifr_addr.sa_len = sizeof (struct sockaddr_in);
#endif
sin = (struct sockaddr_in *)&ip -> ifp -> ifr_addr;
- sin -> sin_addr = ip -> addresses [0];
+ sin -> sin_addr = ip -> primary_address;
addr.len = 4;
memcpy (addr.iabuf, &sin -> sin_addr.s_addr, addr.len);
diff --git a/common/discover.c b/common/discover.c
index 4d22d149..c22a2a66 100644
--- a/common/discover.c
+++ b/common/discover.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: discover.c,v 1.50 2006/02/27 23:56:13 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n";
+"$Id: discover.c,v 1.51 2006/08/09 14:57:47 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -307,38 +307,8 @@ void discover_interfaces (state)
if (foo.sin_addr.s_addr == htonl (INADDR_LOOPBACK) &&
((tmp -> flags & INTERFACE_AUTOMATIC) &&
state == DISCOVER_SERVER))
- continue;
+ continue;
- /* If the only address we have is 0.0.0.0, we
- shouldn't consider the interface configured. */
- if (foo.sin_addr.s_addr != htonl(INADDR_ANY))
- tmp->configured = 1;
-
- if (!tmp -> addresses) {
- tmp -> addresses =
- dmalloc (10 * sizeof (struct in_addr),
- MDL);
- if (!tmp -> addresses)
- log_fatal ("no memory for ifaddrlist");
- tmp -> address_count = 0;
- tmp -> address_max = 10;
- } else if (tmp -> address_count >= tmp -> address_max) {
- struct in_addr *ta;
- int newmax = tmp -> address_max * 2;
- ta = dmalloc (newmax *
- sizeof (struct in_addr), MDL);
- if (!ta)
- log_fatal ("no memory for new "
- "ifaddrlist");
- memcpy (ta, tmp -> addresses,
- tmp -> address_max *
- sizeof (struct in_addr));
- dfree (tmp -> addresses, MDL);
- tmp -> addresses = ta;
- tmp -> address_max = newmax;
- }
- tmp -> addresses [tmp -> address_count++] =
- foo.sin_addr;
/* If this is the first real IP address we've
found, keep a pointer to ifreq structure in
@@ -355,6 +325,7 @@ void discover_interfaces (state)
log_fatal ("no space for ifp.");
memcpy (tif, ifp, len);
tmp -> ifp = tif;
+ tmp -> primary_address = foo.sin_addr;
}
/* Grab the address... */
@@ -1167,12 +1138,6 @@ void interface_stash (struct interface_info *tptr)
}
interface_vector = vec;
}
- if (interface_vector [tptr -> index]) {
- log_fatal("invalid tracefile - two interfaces with "
- "same index - %s and %s",
- interface_vector [tptr->index] -> name,
- tptr -> name);
- }
interface_reference (&interface_vector [tptr -> index], tptr, MDL);
if (tptr -> index >= interface_count)
interface_count = tptr -> index + 1;
diff --git a/common/packet.c b/common/packet.c
index 7614f576..a6e8e567 100644
--- a/common/packet.c
+++ b/common/packet.c
@@ -33,7 +33,7 @@
#ifndef lint
static char copyright[] =
-"$Id: packet.c,v 1.44 2006/07/19 18:00:36 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: packet.c,v 1.45 2006/08/09 14:57:47 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -231,8 +231,6 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, buflen)
unsigned len;
unsigned ulen;
int ignore = 0;
- struct interface_info *ii;
- int i;
memcpy(&ip, buf + bufix, sizeof (struct ip));
udp = (struct udphdr *)(buf + bufix + ip_len);
@@ -247,38 +245,6 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, buflen)
return -1;
#endif /* USERLAND_FILTER */
- /* Eliminate packets that we might have accidentally intercepted because
- we are doing routing. */
-
- /* The DHCP client may not have an IP address; in that case, if we
- got the packet, we need to look at it. So if address_count is
- zero on the interface on which we received the packet, accept the
- packet. */
- if (!interface -> configured)
- goto good;
-
- /* XXX we should handle subnet broadcast addresses here. */
- /* XXX we should compare against 255.255.255.255, not limited_broadcast,
- XXX because sometimes we tweak limited_broadcast for debugging.
- XXX This is only currently a problem on the server. */
- if (ip.ip_dst.s_addr == limited_broadcast.s_addr)
- goto good;
-
- /* Check IP addresses of _all_ interfaces - it's perfectly okay to send
- a packet to an IP address on one interface that happens to arrive
- through another interface. */
- /* XXX if the user excluded some interfaces, we will not accept packets
- XXX for those interfaces. */
- for (ii = interfaces; ii; ii = ii -> next) {
- for (i = 0; i < ii -> address_count; i++) {
- if (ii -> addresses [i].s_addr == ip.ip_dst.s_addr)
- goto good;
- }
- }
- /* The IP destination address didn't match any of our addresses. */
- return -1;
-
- good:
ulen = ntohs (udp -> uh_ulen);
if (ulen < sizeof *udp ||
((unsigned char *)udp) + ulen > buf + bufix + buflen) {