git: 663441de575d - stable/12 - dhclient: support supersede statement for option 54

Kevin Bowling kbowling at FreeBSD.org
Thu Aug 26 00:03:19 UTC 2021


The branch stable/12 has been updated by kbowling (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=663441de575dbdd38275d298ba220a4dc871f14b

commit 663441de575dbdd38275d298ba220a4dc871f14b
Author:     Fabian Kurtz <fabian.kurtz at udo.edu>
AuthorDate: 2021-08-18 17:12:48 +0000
Commit:     Kevin Bowling <kbowling at FreeBSD.org>
CommitDate: 2021-08-26 00:02:21 +0000

    dhclient: support supersede statement for option 54
    
    PR:             217978
    Reported by:    Franco Fichtner <franco at opnsense.org>
    Reviewed by:    markj
    Obtained from:  OPNsense
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D31503
    
    (cherry picked from commit 0a539a0f005e8acbe4974ede30aa928099c988b9)
---
 sbin/dhclient/dhclient.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 4108405d99b0..628490874e69 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -923,6 +923,8 @@ void
 state_bound(void *ipp)
 {
 	struct interface_info *ip = ipp;
+	u_int8_t *dp = NULL;
+	int len;
 
 	ASSERT_STATE(state, S_BOUND);
 
@@ -930,10 +932,17 @@ state_bound(void *ipp)
 	make_request(ip, ip->client->active);
 	ip->client->xid = ip->client->packet.xid;
 
-	if (ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len == 4) {
-		memcpy(ip->client->destination.iabuf, ip->client->active->
-		    options[DHO_DHCP_SERVER_IDENTIFIER].data, 4);
-		ip->client->destination.len = 4;
+	if (ip->client->config->default_actions[DHO_DHCP_SERVER_IDENTIFIER] ==
+	    ACTION_SUPERSEDE) {
+		dp = ip->client->config->defaults[DHO_DHCP_SERVER_IDENTIFIER].data;
+		len = ip->client->config->defaults[DHO_DHCP_SERVER_IDENTIFIER].len;
+	} else {
+		dp = ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].data;
+		len = ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len;
+	}
+	if (len == 4) {
+		memcpy(ip->client->destination.iabuf, dp, len);
+		ip->client->destination.len = len;
 	} else
 		ip->client->destination = iaddr_broadcast;
 


More information about the dev-commits-src-branches mailing list