fix(interceptor): Fix WPAD DHCP option detection

- Check dhcp_option before dhcp_option_force
- Fix PAC URL extraction using grep -oE

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-02-11 12:12:34 +01:00
parent edca533f07
commit e6e9867592

View File

@ -20,11 +20,12 @@ get_wpad_status() {
# Check PAC file
[ -f /www/wpad.dat ] && enabled=1
# Check DHCP option 252
local dhcp_opt=$(uci -q get dhcp.lan.dhcp_option_force)
# Check DHCP option 252 (check both dhcp_option and dhcp_option_force)
local dhcp_opt=$(uci -q get dhcp.lan.dhcp_option)
[ -z "$dhcp_opt" ] && dhcp_opt=$(uci -q get dhcp.lan.dhcp_option_force)
if echo "$dhcp_opt" | grep -q "252"; then
dhcp_configured=1
pac_url=$(echo "$dhcp_opt" | sed 's/252,//')
pac_url=$(echo "$dhcp_opt" | grep -oE 'http://[^ ]+wpad[^ ]*' | head -1)
fi
# Check WPAD enforcement