Patchlevel 27

This commit is contained in:
mellon 1999-04-26 15:43:06 +00:00
parent 5ea46286eb
commit 58d7576468
7 changed files with 97 additions and 50 deletions

View File

@ -82,6 +82,11 @@
* to sleep.
*/
#ifndef lint
static char copyright[] =
"$Id: dlpi.c,v 1.1.1.5 1999/04/26 15:43:06 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
#if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)

View File

@ -40,6 +40,11 @@
* Enterprises, see ``http://www.vix.com''.
*/
#ifndef lint
static char copyright[] =
"$Id: inet.c,v 1.1.1.4 1999/04/26 15:43:07 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
/* Return just the network number of an internet address... */

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: packet.c,v 1.1.1.5 1999/03/26 17:49:22 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: packet.c,v 1.1.1.6 1999/04/26 15:43:07 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -72,6 +72,9 @@ u_int32_t checksum (buf, nbytes, sum)
debug ("sum = %x", sum);
#endif
sum += (u_int16_t) ntohs(*((u_int16_t *)(buf + i)));
/* Add carry. */
if (sum > 0xFFFF)
sum -= 0xFFFF;
}
/* If there's a single byte left over, checksum it, too. Network
@ -81,13 +84,15 @@ u_int32_t checksum (buf, nbytes, sum)
debug ("sum = %x", sum);
#endif
sum += buf [i] << 8;
/* Add carry. */
if (sum > 0xFFFF)
sum -= 0xFFFF;
}
return sum;
}
/* Fold the upper sixteen bits of the checksum down into the lower bits,
complement the sum, and then put it into network byte order. */
/* Finish computing the sum, and then put it into network byte order. */
u_int32_t wrapsum (sum)
u_int32_t sum;
@ -96,17 +101,7 @@ u_int32_t wrapsum (sum)
debug ("wrapsum (%x)", sum);
#endif
while (sum > 0x10000) {
sum = (sum >> 16) + (sum & 0xFFFF);
#ifdef DEBUG_CHECKSUM_VERBOSE
debug ("sum = %x", sum);
#endif
sum += (sum >> 16);
#ifdef DEBUG_CHECKSUM_VERBOSE
debug ("sum = %x", sum);
#endif
}
sum = sum ^ 0xFFFF;
sum = ~sum & 0xFFFF;
#ifdef DEBUG_CHECKSUM_VERBOSE
debug ("sum = %x", sum);
#endif
@ -237,20 +232,25 @@ ssize_t decode_hw_header (interface, buf, bufix, from)
/* UDP header and IP header decoded together for convenience. */
ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
struct interface_info *interface;
unsigned char *buf;
int bufix;
struct sockaddr_in *from;
unsigned char *data;
int len;
int buflen;
{
struct ip *ip;
struct udphdr *udp;
u_int32_t ip_len = (buf [bufix] & 0xf) << 2;
u_int32_t sum, usum;
static int packets_seen;
static int packets_bad_checksum;
static int ip_packets_seen;
static int ip_packets_bad_checksum;
static int udp_packets_seen;
static int udp_packets_bad_checksum;
static int udp_packets_length_checked;
static int udp_packets_length_overflow;
int len;
ip = (struct ip *)(buf + bufix);
udp = (struct udphdr *)(buf + bufix + ip_len);
@ -266,14 +266,23 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
#endif /* USERLAND_FILTER */
/* Check the IP header checksum - it should be zero. */
++ip_packets_seen;
if (wrapsum (checksum (buf + bufix, ip_len, 0))) {
if (packets_seen &&
(++packets_seen / ++packets_bad_checksum) < 2)
note ("Bad IP checksum: %x",
wrapsum (checksum (buf + bufix, sizeof *ip, 0)));
++ip_packets_bad_checksum;
if (ip_packets_seen > 4 &&
(ip_packets_seen / ip_packets_bad_checksum) < 2) {
note ("%d bad IP checksums seen in %d packets",
ip_packets_bad_checksum, ip_packets_seen);
ip_packets_seen = ip_packets_bad_checksum = 0;
}
return -1;
}
/* Check the IP packet length. */
if (ntohs (ip -> ip_len) != buflen)
debug ("ip length %d disagrees with bytes received %d.",
ntohs (ip -> ip_len), buflen);
/* Copy out the IP source address... */
memcpy (&from -> sin_addr, &ip -> ip_src, 4);
@ -283,7 +292,23 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
if (!data) {
data = buf + bufix + ip_len + sizeof *udp;
len -= ip_len + sizeof *udp;
len = ntohs (udp -> uh_ulen) - sizeof *udp;
++udp_packets_length_checked;
if (len + data > buf + bufix + buflen) {
++udp_packets_length_overflow;
if (udp_packets_length_checked > 4 &&
(udp_packets_length_checked /
udp_packets_length_overflow) < 2) {
note ("%d udp packets in %d too long - dropped",
udp_packets_length_overflow,
udp_packets_length_checked);
udp_packets_length_overflow =
udp_packets_length_checked = 0;
}
return -1;
}
if (len + data != buf + bufix + buflen)
debug ("accepting packet with data after udp payload.");
}
usum = udp -> uh_sum;
@ -298,12 +323,15 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
(u_int32_t)
ntohs (udp -> uh_ulen)))));
udp_packets_seen++;
if (usum && usum != sum) {
static int packets_seen;
static int packets_bad_checksum;
if (packets_seen &&
(++packets_seen / ++packets_bad_checksum) < 2)
note ("Bad udp checksum: %x %x", usum, sum);
udp_packets_bad_checksum++;
if (udp_packets_seen > 4 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
note ("%d bad udp checksums in %d packets",
udp_packets_bad_checksum, udp_packets_seen);
udp_packets_seen = udp_packets_bad_checksum = 0;
}
return -1;
}

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: tables.c,v 1.1.1.3 1999/02/18 21:48:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: tables.c,v 1.1.1.4 1999/04/26 15:43:08 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -130,20 +130,20 @@ struct option dhcp_options [256] = {
{ "dhcp-client-identifier", "X", &dhcp_universe, 61 },
{ "option-62", "X", &dhcp_universe, 62 },
{ "option-63", "X", &dhcp_universe, 63 },
{ "option-64", "X", &dhcp_universe, 64 },
{ "option-65", "X", &dhcp_universe, 65 },
{ "option-66", "X", &dhcp_universe, 66 },
{ "option-67", "X", &dhcp_universe, 67 },
{ "option-68", "X", &dhcp_universe, 68 },
{ "option-69", "X", &dhcp_universe, 69 },
{ "option-70", "X", &dhcp_universe, 70 },
{ "option-71", "X", &dhcp_universe, 71 },
{ "option-72", "X", &dhcp_universe, 72 },
{ "option-73", "X", &dhcp_universe, 73 },
{ "option-74", "X", &dhcp_universe, 74 },
{ "option-75", "X", &dhcp_universe, 75 },
{ "option-76", "X", &dhcp_universe, 76 },
{ "dhcp-user-class-identifier", "t", &dhcp_universe, 77 },
{ "nisplus-domain", "t", &dhcp_universe, 64 },
{ "nisplus-servers", "IA", &dhcp_universe, 65 },
{ "tftp-server-name", "t", &dhcp_universe, 66 },
{ "bootfile-name", "t", &dhcp_universe, 67 },
{ "mobile-ip-home-agent", "IA", &dhcp_universe, 68 },
{ "smtp-server", "IA", &dhcp_universe, 69 },
{ "pop-server", "IA", &dhcp_universe, 70 },
{ "nntp-server", "IA", &dhcp_universe, 71 },
{ "www-server", "IA", &dhcp_universe, 72 },
{ "finger-server", "IA", &dhcp_universe, 73 },
{ "irc-server", "IA", &dhcp_universe, 74 },
{ "streettalk-server", "IA", &dhcp_universe, 75 },
{ "streettalk-directory-assistance-server", "IA", &dhcp_universe, 76 },
{ "user-class", "t", &dhcp_universe, 77 },
{ "option-78", "X", &dhcp_universe, 78 },
{ "option-79", "X", &dhcp_universe, 79 },
{ "option-80", "X", &dhcp_universe, 80 },

View File

@ -119,10 +119,10 @@
# include "cf/cygwin32.h"
#endif
#ifdef NeXT
# ifdef __APPLE__
# include "cf/rhapsody.h"
# else
#ifdef __APPLE__
# include "cf/rhapsody.h"
#else
# if defined (NeXT)
# include "cf/nextstep.h"
# endif
#endif

View File

@ -42,7 +42,7 @@
#ifndef lint
static char ocopyright [] =
"$Id: dhcrelay.c,v 1.1.1.13 1999/04/09 17:52:09 mellon Exp $ Copyright (c) 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: dhcrelay.c,v 1.1.1.14 1999/04/26 15:43:10 mellon Exp $ Copyright (c) 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -76,7 +76,7 @@ struct server_list {
static char copyright [] =
"Copyright 1997, 1998, 1999 The Internet Software Consortium.";
static char arr [] = "All rights reserved.";
static char message [] = "Internet Software Consortium DHCP Relay Agent V2.0b1pl25";
static char message [] = "Internet Software Consortium DHCP Relay Agent V2.0b1pl27";
static char contrib [] = "Please contribute if you find this software useful.";
static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html";

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: db.c,v 1.1.1.7 1999/02/18 21:48:54 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: db.c,v 1.1.1.8 1999/04/26 15:43:11 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -231,6 +231,15 @@ void new_lease_file ()
error ("Can't fdopen new lease file!");
}
/* Write an introduction so people don't complain about time
being off. */
fprintf (db_file, "# All times in this file are in UTC (GMT), not %s",
"your local timezone. This is\n");
fprintf (db_file, "# not a bug, so please don't ask about it. %s",
"The format of this file is\n");
fprintf (db_file,
"# documented in the dhcpd.leases(5) manual page.\n\n");
/* Write out all the leases that we know of... */
counting = 0;
write_leases ();