summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2000-10-26 20:35:33 +0000
committerBob Beck <beck@cvs.openbsd.org>2000-10-26 20:35:33 +0000
commitc8b93224246edba27e693e5e51e5368c654387f1 (patch)
treea53298b5c583d26eceb702d7a620f4e489a8cb61
parent8040ced4c9e0340817c4a116ddfa0a7177f07b82 (diff)
Close pr1295 - Only a DHCPNAK bootreply should have a yiaddr of 0.0.0.0,
this makes sure we ignore bootreplies that aren't NAK's which have a 0 yiaddr.
-rw-r--r--usr.sbin/dhcp/dhclient/dhclient.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/dhcp/dhclient/dhclient.c b/usr.sbin/dhcp/dhclient/dhclient.c
index 2d40a89b208..4bac3573d0b 100644
--- a/usr.sbin/dhcp/dhclient/dhclient.c
+++ b/usr.sbin/dhcp/dhclient/dhclient.c
@@ -56,7 +56,7 @@
#ifndef lint
static char copyright[] =
-"$Id: dhclient.c,v 1.9 2000/07/21 00:33:53 beck Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.10 2000/10/26 20:35:32 beck Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -627,6 +627,24 @@ void dhcp (packet)
return;
}
+ if (packet->packet_type != DHCPNAK) {
+ /* RFC2131 table 3 specifies that only DHCPNAK can
+ * specify yiaddr of 0, Some buggy dhcp servers
+ * can set yiaddr to 0 on non-DHCPNAK packets
+ * we ignore those here.
+ */
+ struct in_addr tmp;
+ memset(&tmp, 0, sizeof(struct in_addr));
+
+ if (memcmp(&tmp, &packet -> raw -> yiaddr, sizeof(tmp)) == 0)
+ {
+ note (
+ "%s from %s rejected due to bogus yiaddr of 0.0.0.0.",
+ type, piaddr (packet->client_addr));
+ return;
+ }
+ }
+
/* If there's a reject list, make sure this packet's sender isn't
on it. */
for (ap = packet -> interface -> client -> config -> reject_list;