- os.execute("iptables -I luci_splash_counter -m mac --mac-source '"..mac.."' -j RETURN")
- return os.execute("iptables -t nat -I luci_splash_leases -m mac --mac-source '"..mac.."' -j RETURN")
+ local a, b, c, d, e, f = mac:match("(%w+):(%w+):(%w+):(%w+):(%w+):(%w+)")
+ local mac_pre = "%s%s" %{ a, b }
+ local mac_post = "%s%s%s%s" %{ c, d, e, f }
+ local handle = f
+
+ if limit_up > 0 and limit_down > 0 then
+ os.execute("iptables -t mangle -I luci_splash_mark -m mac --mac-source %q -j MARK --set-mark 79" % mac)
+
+ for _, i in ipairs(splash_interfaces) do
+ os.execute("tc filter add dev %q parent 77:0 protocol ip prio 2 " % i ..
+ "handle ::%q u32 " % handle ..
+ "match u16 0x0800 0xFFFF at -2 match u32 0x%q 0xFFFFFFFF at -12 " % mac_post ..
+ "match u16 0x%q 0xFFFF at -14 flowid 77:10" % mac_pre)
+ end
+ end
+
+ os.execute("iptables -t filter -I luci_splash_counter -m mac --mac-source %q -j RETURN" % mac)
+ return os.execute("iptables -t nat -I luci_splash_leases -m mac --mac-source %q -j RETURN" % mac)