applications/luci-splash: Fix two problems with whitelisting clients

This commit is contained in:
Manuel Munz 2013-10-13 22:40:09 +00:00
parent 2aad24cec1
commit 0c1f8b8aa3
2 changed files with 11 additions and 7 deletions

View file

@ -114,7 +114,7 @@ whitelist_add() {
config_get mac "$1" mac config_get mac "$1" mac
iface=$2 iface=$2
$TC filter add dev "$iface" parent ffff: protocol ip prio 1 u32 match ether src $mac police pass $TC filter add dev "$iface" parent ffff: protocol ip prio 1 u32 match ether src $mac police pass
$TC filter add dev "$iface" parent 1:0 protocol ip prio 1 u32 match ether dst classid 1:1 $TC filter add dev "$iface" parent 1:0 protocol ip prio 1 u32 match ether dst $mac classid 1:1
} }

View file

@ -390,10 +390,12 @@ function remove_whitelist_tc(mac)
end end
uci:foreach("luci_splash", "iface", function(s) uci:foreach("luci_splash", "iface", function(s)
local device = get_physdev(s['.name']) local device = get_physdev(s['.name'])
if device and device ~= "" then
local handle = get_filter_handle('ffff:', 'src', device, mac) local handle = get_filter_handle('ffff:', 'src', device, mac)
exec('tc filter del dev "%s" parent ffff: protocol ip prio 1 handle %s u32' % { device, handle }) exec('tc filter del dev "%s" parent ffff: protocol ip prio 1 handle %s u32' % { device, handle })
local handle = get_filter_handle('1:', 'dest', device, mac) local handle = get_filter_handle('1:', 'dest', device, mac)
exec('tc filter del dev "%s" parent 1:0 protocol ip prio 1 handle %s u32' % { device, handle }) exec('tc filter del dev "%s" parent 1:0 protocol ip prio 1 handle %s u32' % { device, handle })
end
end) end)
end end
@ -486,8 +488,10 @@ function add_whitelist_rule(mac)
end end
uci:foreach("luci_splash", "iface", function(s) uci:foreach("luci_splash", "iface", function(s)
local device = get_physdev(s['.name']) local device = get_physdev(s['.name'])
if device and device ~= "" then
exec('tc filter add dev "%s" parent ffff: protocol ip prio 1 u32 match ether src %s police pass' % { device, mac }) exec('tc filter add dev "%s" parent ffff: protocol ip prio 1 u32 match ether src %s police pass' % { device, mac })
exec('tc filter add dev "%s" parent 1:0 protocol ip prio 1 u32 match ether dst %s classid 1:1' % { device, mac }) exec('tc filter add dev "%s" parent 1:0 protocol ip prio 1 u32 match ether dst %s classid 1:1' % { device, mac })
end
end) end)
end end