Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174483192
D60259.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D60259.diff
View Options
diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script
--- a/sbin/dhclient/dhclient-script
+++ b/sbin/dhclient/dhclient-script
@@ -84,6 +84,34 @@
fi
}
+add_captive_portal() {
+ # DHCP option 114 (RFC 8910), with the legacy DHCP option 160
+ # (RFC 7710) as a fallback.
+ captive_portal_url="${new_captive_portal_url:-$new_captive_portal_legacy}"
+
+ if [ -z "$captive_portal_url" ]; then
+ rm -f /var/run/captive-portal.$interface
+ return 0
+ fi
+
+ $LOGGER "New Captive Portal ($interface): $captive_portal_url"
+
+ captive_portal_tmp=/var/run/captive-portal.${interface}.tmp
+ if ! (umask 022; echo "$captive_portal_url" > $captive_portal_tmp); then
+ rm -f $captive_portal_tmp
+ return 1
+ fi
+ if ! mv $captive_portal_tmp /var/run/captive-portal.$interface; then
+ rm -f $captive_portal_tmp
+ return 1
+ fi
+ return 0
+}
+
+delete_captive_portal() {
+ rm -f /var/run/captive-portal.$interface
+}
+
fill_classless_routes() {
set $1
while [ $# -ge 5 ]; do
@@ -349,6 +377,7 @@
if [ "$new_ip_address" != "$alias_ip_address" ]; then
add_new_alias
fi
+ add_captive_portal
if is_default_interface; then
add_new_resolv_conf
fi
@@ -356,6 +385,7 @@
EXPIRE|FAIL)
delete_old_alias
+ delete_captive_portal
if [ -n "$old_ip_address" ]; then
delete_old_address
delete_old_routes
@@ -392,6 +422,7 @@
add_new_alias
fi
add_new_routes
+ add_captive_portal
if ! is_default_interface; then
exit_with_hooks 0
fi
@@ -402,6 +433,7 @@
fi
eval "$IFCONFIG $interface inet -alias $new_ip_address $medium"
delete_old_routes
+ delete_captive_portal
exit_with_hooks 1
;;
esac
diff --git a/sbin/dhclient/dhclient-script.8 b/sbin/dhclient/dhclient-script.8
--- a/sbin/dhclient/dhclient-script.8
+++ b/sbin/dhclient/dhclient-script.8
@@ -36,7 +36,7 @@
.\" see ``http://www.isc.org/isc''. To learn more about Vixie
.\" Enterprises, see ``http://www.vix.com''.
.\"
-.Dd September 6, 2010
+.Dd October 5, 2026
.Dt DHCLIENT-SCRIPT 8
.Os
.Sh NAME
@@ -142,6 +142,15 @@
So for example, the new subnet mask would be passed in
.Va $new_subnet_mask .
.Pp
+As an exception, the captive portal API URI from DHCP option 114
+.Pq see Xr dhcp-options 5
+is passed as
+.Va $new_captive_portal_url .
+When such a URI is received, the script also writes it to
+.Pa /var/run/captive-portal. Ns Va $interface
+so that it can be discovered by other programs.
+The file is removed when the lease expires or is lost.
+.Pp
When a binding has been completed, a lot of network parameters are
likely to need to be set up.
A new
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 4, 2:35 PM (10 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40162933
Default Alt Text
D60259.diff (2 KB)
Attached To
Mode
D60259: dhclient-script: store the Captive Portal URI
Attached
Detach File
Event Timeline
Log In to Comment