From owner-dev-commits-src-branches@freebsd.org Thu Aug 26 00:04:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4285A65DFEB; Thu, 26 Aug 2021 00:04:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gw3441FL7z4Tlm; Thu, 26 Aug 2021 00:04:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 139B525B70; Thu, 26 Aug 2021 00:04:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17Q04J7G004373; Thu, 26 Aug 2021 00:04:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17Q04JhZ004372; Thu, 26 Aug 2021 00:04:19 GMT (envelope-from git) Date: Thu, 26 Aug 2021 00:04:19 GMT Message-Id: <202108260004.17Q04JhZ004372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: c4055d704360 - stable/11 - dhclient: support supersede statement for option 54 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: c4055d704360af150d4c9f535aef7a53e99f9d75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Aug 2021 00:04:20 -0000 The branch stable/11 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c4055d704360af150d4c9f535aef7a53e99f9d75 commit c4055d704360af150d4c9f535aef7a53e99f9d75 Author: Fabian Kurtz AuthorDate: 2021-08-18 17:12:48 +0000 Commit: Kevin Bowling CommitDate: 2021-08-26 00:03:54 +0000 dhclient: support supersede statement for option 54 PR: 217978 Reported by: Franco Fichtner 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 ec4ad127a4a7..7ca9cfe8ab42 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -889,6 +889,8 @@ void state_bound(void *ipp) { struct interface_info *ip = ipp; + u_int8_t *dp = NULL; + int len; ASSERT_STATE(state, S_BOUND); @@ -896,10 +898,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;