2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 06:15:55 +00:00

Merge changes between 3.0rc7 and 3.0rc8pl2.

This commit is contained in:
Ted Lemon
2001-06-27 00:31:20 +00:00
parent 07b958004f
commit d758ad8cac
99 changed files with 5909 additions and 2698 deletions

View File

@@ -3,7 +3,7 @@
Packet assembly code, originally contributed by Archie Cobbs. */
/*
* Copyright (c) 1996-1999 Internet Software Consortium.
* Copyright (c) 1996-2001 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: packet.c,v 1.40 2001/02/26 22:21:10 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: packet.c,v 1.41 2001/06/27 00:29:55 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -239,6 +239,7 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
static int udp_packets_length_overflow;
unsigned len;
unsigned ulen;
int ignore = 0;
ip = (struct ip *)(buf + bufix);
udp = (struct udphdr *)(buf + bufix + ip_len);
@@ -274,9 +275,13 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
}
/* Check the IP packet length. */
if (ntohs (ip -> ip_len) != buflen)
log_debug ("ip length %d disagrees with bytes received %d.",
ntohs (ip -> ip_len), buflen);
if (ntohs (ip -> ip_len) != buflen) {
if ((ntohs (ip -> ip_len + 2) & ~1) == buflen)
ignore = 1;
else
log_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);
@@ -302,7 +307,8 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
}
return -1;
}
if (len + data < buf + bufix + buflen)
if (len + data < buf + bufix + buflen &&
len + data != buf + bufix + buflen && !ignore)
log_debug ("accepting packet with data after udp payload.");
if (len + data > buf + bufix + buflen) {
log_debug ("dropping packet with bogus uh_ulen %ld",