summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>1999-03-26 19:19:46 +0000
committerTed Lemon <source@isc.org>1999-03-26 19:19:46 +0000
commit2d1b06e071253c6850a1d27ca9b7857620ccc5a5 (patch)
treedca2263056763e8bcb12d0687669c8e02bc336e9 /common
parent2540af046cb52279823d956a2f6ff5723d0eeef9 (diff)
downloadisc-dhcp-2d1b06e071253c6850a1d27ca9b7857620ccc5a5.tar.gz
Pull up changes in Patchlevel 19
Diffstat (limited to 'common')
-rw-r--r--common/discover.c31
-rw-r--r--common/lpf.c6
-rw-r--r--common/packet.c20
-rw-r--r--common/upf.c4
4 files changed, 39 insertions, 22 deletions
diff --git a/common/discover.c b/common/discover.c
index 16899386..af3aae3e 100644
--- a/common/discover.c
+++ b/common/discover.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: discover.c,v 1.7 1999/03/25 21:57:30 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: discover.c,v 1.8 1999/03/26 19:19:44 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -121,11 +121,7 @@ void discover_interfaces (state)
/* Skip loopback, point-to-point and down interfaces,
except don't skip down interfaces if we're trying to
get a list of configurable interfaces. */
- if ((((ifr.ifr_flags & IFF_LOOPBACK) ||
-#ifdef HAVE_IFF_POINTOPOINT
- (ifr.ifr_flags & IFF_POINTOPOINT))
- && !tmp) ||
-#endif
+ if ((!(ifr.ifr_flags & IFF_BROADCAST) && !tmp) ||
(!(ifr.ifr_flags & IFF_UP) &&
state != DISCOVER_UNCONFIGURED))
continue;
@@ -342,6 +338,9 @@ void discover_interfaces (state)
case ARPHRD_TUNNEL:
/* ignore tunnel interfaces. */
#endif
+#ifdef HAVE_ARPHRD_ROSE
+ case ARPHRD_ROSE:
+#endif
#ifdef HAVE_ARPHRD_LOOPBACK
case ARPHRD_LOOPBACK:
/* ignore loopback interface */
@@ -354,7 +353,7 @@ void discover_interfaces (state)
memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
break;
-#ifndef ARPHRD_IEEE802
+#ifndef HAVE_ARPHRD_IEEE802
# define ARPHRD_IEEE802 HTYPE_IEEE802
#endif
case ARPHRD_IEEE802:
@@ -363,7 +362,7 @@ void discover_interfaces (state)
memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
break;
-#ifndef ARPHRD_FDDI
+#ifndef HAVE_ARPHRD_FDDI
# define ARPHRD_FDDI HTYPE_FDDI
#endif
case ARPHRD_FDDI:
@@ -380,6 +379,22 @@ void discover_interfaces (state)
break;
#endif
+#ifdef HAVE_ARPHRD_AX25
+ case ARPHRD_AX25:
+ tmp -> hw_address.hlen = 6;
+ tmp -> hw_address.htype = ARPHRD_AX25;
+ memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
+ break;
+#endif
+
+#ifdef HAVE_ARPHRD_NETROM
+ case ARPHRD_NETROM:
+ tmp -> hw_address.hlen = 6;
+ tmp -> hw_address.htype = ARPHRD_NETROM;
+ memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
+ break;
+#endif
+
default:
log_error ("%s: unknown hardware address type %d",
ifr.ifr_name, sa.sa_family);
diff --git a/common/lpf.c b/common/lpf.c
index b43db1b6..76d38560 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -23,7 +23,7 @@
#ifndef lint
static char copyright[] =
-"$Id: lpf.c,v 1.8 1999/03/16 06:37:49 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: lpf.c,v 1.9 1999/03/26 19:19:44 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -72,7 +72,7 @@ int if_register_lpf (info)
if ((sock = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ALL))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
- errno == EAFNOSUPPORT)
+ errno == EAFNOSUPPORT || errno == EINVAL)
log_fatal ("socket: %m - make sure %s %s!",
"CONFIG_PACKET and CONFIG_FILTER are defined",
"in your kernel configuration");
@@ -86,7 +86,7 @@ int if_register_lpf (info)
if (bind (sock, &sa, sizeof sa)) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
- errno == EAFNOSUPPORT)
+ errno == EAFNOSUPPORT || errno = EINVAL)
log_fatal ("socket: %m - make sure %s %s!",
"CONFIG_PACKET and CONFIG_FILTER are defined",
"in your kernel configuration");
diff --git a/common/packet.c b/common/packet.c
index c96b6573..66a13712 100644
--- a/common/packet.c
+++ b/common/packet.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: packet.c,v 1.22 1999/03/25 21:58:13 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: packet.c,v 1.23 1999/03/26 19:19:44 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -174,17 +174,15 @@ void assemble_udp_ip_header (interface, buf, bufix,
/* Compute UDP checksums, including the ``pseudo-header'', the UDP
header and the data. */
-#if 0
udp.uh_sum =
wrapsum (checksum ((unsigned char *)&udp, sizeof udp,
checksum (data, len,
checksum ((unsigned char *)
&ip.ip_src,
- sizeof ip.ip_src,
+ 2 * sizeof ip.ip_src,
IPPROTO_UDP +
(u_int32_t)
ntohs (udp.uh_ulen)))));
-#endif
/* Copy the udp header into the buffer... */
memcpy (&buf [*bufix], &udp, sizeof udp);
@@ -231,7 +229,6 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
struct udphdr *udp;
u_int32_t ip_len = (buf [bufix] & 0xf) << 2;
u_int32_t sum, usum;
- static int packets_seen, packets_bad_checksum;
ip = (struct ip *)(buf + bufix);
udp = (struct udphdr *)(buf + bufix + ip_len);
@@ -248,6 +245,9 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
/* Check the IP header checksum - it should be zero. */
if (wrapsum (checksum (buf + bufix, ip_len, 0))) {
+ static int packets_seen;
+ static int packets_bad_checksum;
+
if (packets_seen &&
(++packets_seen / ++packets_bad_checksum) < 2)
log_info ("Bad IP checksum: %x",
@@ -267,7 +267,6 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
len -= ip_len + sizeof *udp;
}
-#if 0
usum = udp -> uh_sum;
udp -> uh_sum = 0;
@@ -275,16 +274,19 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
checksum (data, len,
checksum ((unsigned char *)
&ip -> ip_src,
- sizeof ip -> ip_src,
+ 2 * sizeof ip -> ip_src,
IPPROTO_UDP +
(u_int32_t)
ntohs (udp -> uh_ulen)))));
if (usum && usum != sum) {
- log_info ("Bad udp checksum: %x %x", usum, sum);
+ static int packets_seen;
+ static int packets_bad_checksum;
+ if (packets_seen &&
+ (++packets_seen / ++packets_bad_checksum) < 2)
+ log_info ("Bad udp checksum: %x %x", usum, sum);
return -1;
}
-#endif
/* Copy out the port... */
memcpy (&from -> sin_port, &udp -> uh_sport, sizeof udp -> uh_sport);
diff --git a/common/upf.c b/common/upf.c
index 65d2d554..a5509911 100644
--- a/common/upf.c
+++ b/common/upf.c
@@ -1,6 +1,6 @@
/* upf.c
- Ultrix PacketFilter interface code.
+ Ultrix PacketFilter interface code. */
/*
* Copyright (c) 1996-1999 Internet Software Consortium.
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: upf.c,v 1.10 1999/03/16 06:37:50 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: upf.c,v 1.11 1999/03/26 19:19:44 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"