+ local handle = mac:match("%w+:%w+:%w+:%w+:%w+:(%w+)")
+
+ local function ipt_delete_foreach(args)
+ for _, r in ipairs(ipt:find(args)) do
+ if r.options and #r.options >= 2 and r.options[1] == "MAC" and
+ r.options[2]:lower() == mac:lower()
+ then
+ os.execute("iptables -t %q -D %q -m mac --mac-source %q %s 2>/dev/null"
+ %{ r.table, r.chain, mac,
+ r.target == "MARK" and "-j MARK --set-mark 79" or
+ r.target and "-j %q" % r.target or "" })
+ end
+ end
+ end
+
+ ipt_delete_foreach({table="filter", chain="luci_splash_counter"})
+ ipt_delete_foreach({table="mangle", chain="luci_splash_mark"})
+ ipt_delete_foreach({table="nat", chain="luci_splash_leases"})
+
+ for _, i in ipairs(splash_interfaces) do
+ os.execute("tc filter del dev %q parent 77:0 protocol ip prio 2 " % i ..
+ "handle 800::%q u32 2>/dev/null" % handle)
+ end
+
+ ipt:resync()