simple-captive-portal: update to 2026.08.06 / use port 80

No issue reported but this is a bit cleaner.

Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
pull/30179/head
Etienne Champetier 2026-08-06 20:49:31 -04:00
parent 23e2f530fe
commit 91a6967643
3 changed files with 7 additions and 8 deletions

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=simple-captive-portal
PKG_VERSION:=2025.06.22
PKG_RELEASE:=2
PKG_VERSION:=2026.08.06
PKG_RELEASE:=1
PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later

View File

@ -4,11 +4,12 @@ USE_PROCD=1
EXTRA_COMMANDS='firewall'
firewall() {
local INTF PORT_REDIRECT TIMEOUT
local INTF PORT_REDIRECT PORT_PORTAL TIMEOUT
config_load "simple-captive-portal"
config_get INTF main interface
[ -z "${INTF}" ] && exit 0
config_get PORT_REDIRECT main port_redirect 8888
config_get PORT_PORTAL main port_portal 8889
config_get TIMEOUT main timeout 86400
/usr/sbin/nft -f- <<EOF
@ -24,6 +25,7 @@ table inet simple-captive-portal {
type nat hook prerouting priority mangle - 5; policy drop;
iif != ${INTF} accept
ether saddr @guest_macs accept
tcp dport 80 fib daddr . iif type local redirect to ${PORT_PORTAL}
tcp dport 80 redirect to ${PORT_REDIRECT}
fib daddr . iif type { local, broadcast, multicast } accept
reject
@ -50,7 +52,6 @@ start_service() {
procd_open_instance redirect
procd_set_param command /usr/sbin/uhttpd -f -c /dev/null -k0 -h /etc/simple-captive-portal/ -l / -L /usr/share/simple-captive-portal/redirect.lua -p "${PORT_REDIRECT}"
procd_set_param env PORT_PORTAL=${PORT_PORTAL}
procd_add_jail simple-captive-portal-redirect log procfs sysfs ronly
procd_add_jail_mount /etc/simple-captive-portal/
procd_add_jail_mount /usr/share/simple-captive-portal/redirect.lua

View File

@ -1,12 +1,10 @@
port_portal = os.getenv("PORT_PORTAL")
function handle_request(env)
uhttpd.send("Status: 302 Found\r\n")
uhttpd.send("Server: simple-captive-portal\r\n")
if string.find(env.SERVER_ADDR, ":") == nil then
uhttpd.send("Location: http://" .. env.SERVER_ADDR .. ":" .. port_portal .. "/\r\n")
uhttpd.send("Location: http://" .. env.SERVER_ADDR .. "/\r\n")
else
uhttpd.send("Location: http://[" .. env.SERVER_ADDR .. "]:" .. port_portal .. "/\r\n")
uhttpd.send("Location: http://[" .. env.SERVER_ADDR .. "]/\r\n")
end
uhttpd.send("Cache-Control: no-cache\r\n")
uhttpd.send("Content-Length: 0\r\n\r\n")