summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcpd/dhcp.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2010-03-29 22:09:26 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2010-03-29 22:09:26 +0000
commitb2063d3a4b462cde741b53cdc37df09ecb4b6d63 (patch)
tree0839f21e3031c9805c94f0dbd84ecc7c5ad3f59b /usr.sbin/dhcpd/dhcp.c
parenta12c9c3255460f1fdd60260d3158d236732f1072 (diff)
Always put server id in NAK's to requests. Some router/switches
need this, as reported in PR#6339. Fix tested by submitter, Marcel Widget, who also supplied the diff that I tweaked. ok beck@
Diffstat (limited to 'usr.sbin/dhcpd/dhcp.c')
-rw-r--r--usr.sbin/dhcpd/dhcp.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/dhcpd/dhcp.c b/usr.sbin/dhcpd/dhcp.c
index 720e8494362..511166fc1ac 100644
--- a/usr.sbin/dhcpd/dhcp.c
+++ b/usr.sbin/dhcpd/dhcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcp.c,v 1.30 2010/01/02 04:21:16 krw Exp $ */
+/* $OpenBSD: dhcp.c,v 1.31 2010/03/29 22:09:25 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -552,7 +552,7 @@ nak_lease(struct packet *packet, struct iaddr *cip)
struct dhcp_packet raw;
unsigned char nak = DHCPNAK;
struct packet outgoing;
- struct tree_cache *options[256], dhcpnak_tree, dhcpmsg_tree;
+ struct tree_cache *options[256], dhcpnak_tree, dhcpmsg_tree, server_tree;
memset(options, 0, sizeof options);
memset(&outgoing, 0, sizeof outgoing);
@@ -575,6 +575,21 @@ nak_lease(struct packet *packet, struct iaddr *cip)
options[DHO_DHCP_MESSAGE]->timeout = -1;
options[DHO_DHCP_MESSAGE]->tree = NULL;
+ /* Include server identifier in the NAK. At least one
+ * router vendor depends on it when using dhcp relay proxy mode.
+ */
+ if (packet->options[DHO_DHCP_SERVER_IDENTIFIER].len) {
+ options[DHO_DHCP_SERVER_IDENTIFIER] = &server_tree;
+ options[DHO_DHCP_SERVER_IDENTIFIER]->value =
+ packet->options[DHO_DHCP_SERVER_IDENTIFIER].data,
+ options[DHO_DHCP_SERVER_IDENTIFIER]->len =
+ packet->options[DHO_DHCP_SERVER_IDENTIFIER].len;
+ options[DHO_DHCP_SERVER_IDENTIFIER]->buf_size =
+ packet->options[DHO_DHCP_SERVER_IDENTIFIER].len;
+ options[DHO_DHCP_SERVER_IDENTIFIER]->timeout = -1;
+ options[DHO_DHCP_SERVER_IDENTIFIER]->tree = NULL;
+ }
+
/* Do not use the client's requested parameter list. */
i = DHO_DHCP_PARAMETER_REQUEST_LIST;
if (packet->options[i].data) {