git: 7ba72855939f - main - dhclient: export the Captive Portal URI to the script

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Wed, 07 Oct 2026 14:07:45 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=7ba72855939fc53eb8b6d9def386564579780786

commit 7ba72855939fc53eb8b6d9def386564579780786
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-10-02 19:54:25 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-10-07 14:07:09 +0000

    dhclient: export the Captive Portal URI to the script
    
    Differential Revision=  https://reviews.freebsd.org/D60259
---
 sbin/dhclient/dhclient.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index a9425707577c..bef956645b85 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -2431,10 +2431,21 @@ supersede:
 		if (len) {
 			char name[256];
 
-			if (dhcp_option_ev_name(name, sizeof(name),
+			/*
+			 * The option is named "captive-portal", so the
+			 * generic name derived below would be
+			 * new_captive_portal / old_captive_portal.
+			 * Append "_url" suffix so that the variable name
+			 * says that the value is a URL.
+			 */
+			if (i == DHO_CAPTIVE_PORTAL)
+				strlcpy(name, "captive_portal_url",
+				    sizeof(name));
+			else if (!dhcp_option_ev_name(name, sizeof(name),
 			    &dhcp_options[i]))
-				script_set_env(ip->client, prefix, name,
-				    pretty_print_option(i, dp, len, 0, 0));
+				continue;
+			script_set_env(ip->client, prefix, name,
+			    pretty_print_option(i, dp, len, 0, 0));
 		}
 	}
 	snprintf(tbuf, sizeof(tbuf), "%d", (int)lease->expiry);