aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Kurtz <fabian.kurtz@udo.edu>2021-08-18 17:12:48 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2021-08-26 00:03:54 +0000
commitc4055d704360af150d4c9f535aef7a53e99f9d75 (patch)
treee4b312561016474cf17bdba7a8cc6fa539effe5f
parent70eee3be067870f8147afa7695bf2494fd1e3aa4 (diff)
downloadsrc-c4055d704360af150d4c9f535aef7a53e99f9d75.tar.gz
src-c4055d704360af150d4c9f535aef7a53e99f9d75.zip
dhclient: support supersede statement for option 54
PR: 217978 Reported by: Franco Fichtner <franco@opnsense.org> Reviewed by: markj Obtained from: OPNsense MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31503 (cherry picked from commit 0a539a0f005e8acbe4974ede30aa928099c988b9)
-rw-r--r--sbin/dhclient/dhclient.c17
1 files 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;