So I've found a way to have hotspot detection working with rfc8910.
Here is the behaviour when I connect to a Hotspot Wifi compatible with rfc8910: https://www.youtube.com/shorts/0et6I-lwwwQ
To have it working you need to add to the filesystem the following script:
/etc/NetworkManager/dispatcher.d/99-rfc8910
#!/bin/bash
# NetworkManager dispatcher script for handling DHCP Option 114 (RFC8910)
# Opens the captive portal with URLDispatcher if the network indicates a captive portal
logger "Option 114 init $1 $2"
IFACE="$1"
STATUS="$2"
# Only proceed if the interface is up or dhcp4-change
if [ "$STATUS" != "dhcp4-change" ]; then
exit 0
fi
# --- Retrieve the Option 114 value using dhclient test request ---
dhclient -1 -v -lf /var/lib/NetworkManager/dhclient-rfc8910-wlan0.lease wlan0
LEASE_FILE="/var/lib/NetworkManager/dhclient-rfc8910-wlan0.lease"
CAPTIVE_API=$(grep 'option default-url' "$LEASE_FILE" | tail -n1 | awk -F'"' '{print $2}')
# Remove escaped ampersands (\&) from the URL
CAPTIVE_API=$(echo "$CAPTIVE_API" | sed 's/\\//g')
if [ -z "$CAPTIVE_API" ]; then
logger "No DHCP Option 114 found for interface $IFACE"
exit 0
fi
logger "DHCP Option 114 detected for $IFACE: $CAPTIVE_API"
# --- Query the captive portal API using wget ---
API_RESPONSE=$(wget -qO- "$CAPTIVE_API")
if [ -z "$API_RESPONSE" ]; then
logger "Failed to reach captive portal API: $CAPTIVE_API"
exit 0
fi
# --- Parse JSON for 'captive' and 'user-portal-url' ---
# Extract the 'captive' status (true/false)
CAPTIVE=$(echo "$API_RESPONSE" | grep -oP '"captive"\s*:\s*\K(true|false)')
# Extract the 'user-portal-url' and remove all backslashes
PORTAL_URL=$(echo "$API_RESPONSE" | grep -oP '"user-portal-url"\s*:\s*"\K[^"]+' | sed 's/\\//g')
logger "Captive portal API response: captive=$CAPTIVE, portal_url=$PORTAL_URL"
# --- If the network is captive, open the portal URL via D-Bus ---
if [ "$CAPTIVE" = "true" ] && [ -n "$PORTAL_URL" ]; then
USER_NAME=phablet
sudo -u "$USER_NAME" \
DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/32011/bus" \
gdbus call \
--session \
--dest com.lomiri.URLDispatcher \
--object-path /com/lomiri/URLDispatcher \
--method com.lomiri.URLDispatcher.DispatchURL \
"$PORTAL_URL" ""
logger "Captive portal opened: $PORTAL_URL"
fi
Don't forget to chmod +x /etc/NetworkManager/dispatcher.d/99-rfc8910 and reboot
Tested on 24.04-1.x daily on OnePlus Nord N10
Unfortunatly the script is slightly hacky because it requires to make an external dhclient request. I've not found any other way around as the internal Network Manager dhcp client does not support option 114 in any way. We'll see if it can integrated to the system despite this, and if it can be slightly improved.
On what canal should I discuss with system devs about that?