applications/luci-splash: Updated to work with new UCI firewall

This commit is contained in:
Steven Barth 2008-08-05 12:58:20 +00:00
parent a0d4bfceb5
commit 2755a46c4d
3 changed files with 16 additions and 31 deletions

View file

@ -11,13 +11,13 @@ s.template = "cbi/tblsection"
s.addremove = true s.addremove = true
s.anonymous = true s.anonymous = true
iface = s:option(ListValue, "network", "Schnittstelle") iface = s:option(ListValue, "zone", "Firewallzone")
luci.model.uci.foreach("network", "interface", luci.model.uci.foreach("firewall", "zone",
function (section) function (section)
if section[".name"] ~= "loopback" then iface:value(section.name)
iface:value(section[".name"])
end
end) end)
gateway = s:option(Value, "gateway", "Gateway")
s = m:section(TypedSection, "whitelist", "Automatische Freigabe") s = m:section(TypedSection, "whitelist", "Automatische Freigabe")
s.template = "cbi/tblsection" s.template = "cbi/tblsection"

View file

@ -4,23 +4,14 @@ START=70
iface_add() { iface_add() {
local cfg="$1" local cfg="$1"
config_get net "$cfg" network config_get zone "$cfg" zone
[ -n "$net" ] || return 0 [ -n "$zone" ] || return 0
config_get iface "$net" ifname config_get gw "$cfg" gateway
[ -n "$iface" ] || return 0 [ -n "$zone" ] || return 0
iface="${iface%%:*}"
config_get ipaddr "$net" ipaddr iptables -t nat -A zone_$zone_prerouting -j luci_splash_portal
[ -n "$ipaddr" ] || return 0 iptables -t nat -A luci_splash_portal -d "$gw" -p tcp -m multiport --dports 22,80,443 -j RETURN
config_get netmask "$net" netmask
[ -n "$netmask" ] || return 0
eval "$(ipcalc.sh $ipaddr $netmask)"
iptables -t nat -A luci_splash -i "$iface" -s "$NETWORK/$PREFIX" -j luci_splash_portal
iptables -t nat -A luci_splash_portal -i "$iface" -s "$NETWORK/$PREFIX" -d "$ipaddr" -p tcp -m multiport --dports 22,80,443 -j RETURN
} }
blacklist_add() { blacklist_add() {
@ -63,15 +54,9 @@ start() {
### Start the splash httpd ### Start the splash httpd
start-stop-daemon -S -b -q -x /usr/bin/luci-splashd start-stop-daemon -S -b -q -x /usr/bin/luci-splashd
### Hook in the chain
iptables -t nat -A prerouting_rule -j luci_splash
} }
stop() { stop() {
### Hook out the chain
iptables -t nat -D prerouting_rule -j luci_splash
### Clear subchains ### Clear subchains
iptables -t nat -F luci_splash_leases iptables -t nat -F luci_splash_leases
iptables -t nat -F luci_splash_portal iptables -t nat -F luci_splash_portal

View file

@ -19,17 +19,17 @@ config extern flash_keep
option firewall "/etc/firewall.user" option firewall "/etc/firewall.user"
config event uci_oncommit config event uci_oncommit
option network "/sbin/luci-reload network firewall dnsmasq" option network "/sbin/luci-reload network firewall dnsmasq luci_splash"
option wireless "/sbin/luci-reload network firewall dnsmasq" option wireless "/sbin/luci-reload network firewall dnsmasq luci_splash"
option olsr "/sbin/luci-reload olsrd" option olsr "/sbin/luci-reload olsrd"
option dhcp "/sbin/luci-reload dnsmasq" option dhcp "/sbin/luci-reload dnsmasq"
option dropbear "/sbin/luci-reload dropbear" option dropbear "/sbin/luci-reload dropbear"
option httpd "/sbin/luci-reload httpd" option httpd "/sbin/luci-reload httpd"
option fstab "/sbin/luci-reload fstab" option fstab "/sbin/luci-reload fstab"
option qos "/sbin/luci-reload qos" option qos "/sbin/luci-reload qos"
option firewall "/sbin/luci-reload firewall" option firewall "/sbin/luci-reload firewall luci_splash"
option luci_ethers "/sbin/luci-reload luci_ethers dnsmasq" option luci_ethers "/sbin/luci-reload luci_ethers dnsmasq"
option luci_splash "/sbin/luci-reload luci_splash" option luci_splash "/sbin/luci-reload firewall luci_splash"
option upnpd "/etc/init.d/miniupnpd enabled && /sbin/luci-reload miniupnpd || /etc/init.d/miniupnpd stop" option upnpd "/etc/init.d/miniupnpd enabled && /sbin/luci-reload miniupnpd || /etc/init.d/miniupnpd stop"
option ntpclient "/sbin/luci-reload ntpclient" option ntpclient "/sbin/luci-reload ntpclient"