diff options
author | Steven Barth <steven@midlink.org> | 2008-04-27 16:12:24 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-04-27 16:12:24 +0000 |
commit | bba585f063ccc1e483346c9b5625d4dcf84d6586 (patch) | |
tree | ab369d260f321d1529a15c0a36b60e7e465fe8ae /contrib/package | |
parent | 1b159023db95ec0d429f1fc71536ef96edc37333 (diff) |
* Added initial version of RPC info API
* Fixed client splash
Diffstat (limited to 'contrib/package')
4 files changed, 20 insertions, 8 deletions
diff --git a/contrib/package/ffluci-splash/src/luci-splash.lua b/contrib/package/ffluci-splash/src/luci-splash.lua index 54c32add6..0699d2820 100644 --- a/contrib/package/ffluci-splash/src/luci-splash.lua +++ b/contrib/package/ffluci-splash/src/luci-splash.lua @@ -10,7 +10,6 @@ require("ffluci.model.uci") uci = ffluci.model.uci.Session("/var/state") --- Parse stdin and do something function main(argv) local cmd = argv[1] local arg = argv[2] @@ -156,7 +155,7 @@ function sync() local n = uci:add("luci_splash", "lease") uci:set("luci_splash", n, "mac", v.mac) uci:set("luci_splash", n, "start", v.start) - written[v.mac] = 1 + written[v.mac:lower()] = 1 end end end @@ -164,7 +163,7 @@ function sync() -- Delete rules without state for i, r in ipairs(listrules()) do - if #r > 0 and not written[r] then + if #r > 0 and not written[r:lower()] then remove_rule(r) end end diff --git a/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi b/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi index 4cbddc0c5..91a6b3397 100644 --- a/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi +++ b/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi @@ -7,22 +7,35 @@ require("ffluci.sys") require("ffluci.model.uci") local srv +local net local ip = ffluci.http.remote_addr() for k, v in pairs(ffluci.model.uci.show("network").network) do if v[".type"] == "interface" and v.ipaddr then local p = ffluci.sys.net.mask4prefix(v.netmask) if ffluci.sys.net.belongs(ip, v.ipaddr, p) then + net = k srv = v.ipaddr break end end end +local stat = false +for k, v in pairs(ffluci.model.uci.show("luci_splash").luci_splash) do + if v[".type"] == "iface" and v.network == net then + stat = true + end +end + if not srv then ffluci.http.textheader() return print("Unable to detect network settings!") end +if not stat then + ffluci.http.redirect("http://" .. srv) +end + local action = "splash" local mac = ffluci.sys.net.ip4mac(ip) @@ -30,7 +43,7 @@ if not mac then action = "unknown" end -local status = ffluci.sys.exec("luci-splash status "..mac) +local status = ffluci.sys.execl("luci-splash status "..mac)[1] if status == "whitelisted" or status == "lease" then action = "allowed" diff --git a/contrib/package/ffluci-splash/src/luci_splash.init b/contrib/package/ffluci-splash/src/luci_splash.init index a7bb4abeb..bce432ed3 100644 --- a/contrib/package/ffluci-splash/src/luci_splash.init +++ b/contrib/package/ffluci-splash/src/luci_splash.init @@ -20,7 +20,7 @@ iface_add() { eval "$(ipcalc.sh $ipaddr $netmask)" iptables -t nat -A luci_splash -i "$iface" -s "$IP/$PREFIX" -j luci_splash_portal - iptables -t nat -A luci_splash_portal -i "$iface" -s "$IP/$PREFIX" -d "$ipaddr" -p tcp --dport 80 -j RETURN + iptables -t nat -A luci_splash_portal -i "$iface" -s "$IP/$PREFIX" -d "$ipaddr" -p tcp -m multiport --dports 22,80,443 -j RETURN } blacklist_add() { @@ -64,9 +64,6 @@ start() { ### Start the splash httpd httpd -c /etc/luci_splash_httpd.conf -p 8082 -h /usr/lib/luci-splash/htdocs - ### Sync leases - /usr/lib/luci-splash/sync.lua - ### Hook in the chain iptables -t nat -A prerouting_rule -j luci_splash } diff --git a/contrib/package/ffluci/Makefile b/contrib/package/ffluci/Makefile index 1c45695bb..aba1509e9 100644 --- a/contrib/package/ffluci/Makefile +++ b/contrib/package/ffluci/Makefile @@ -37,6 +37,7 @@ define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR)/core $(MAKE_ACTION) $(MAKE) -C $(PKG_BUILD_DIR)/module/admin-core $(MAKE_ACTION) $(MAKE) -C $(PKG_BUILD_DIR)/module/public-core $(MAKE_ACTION) + $(MAKE) -C $(PKG_BUILD_DIR)/module/rpc-core $(MAKE_ACTION) endef define Package/ffluci/install @@ -66,6 +67,8 @@ define Package/ffluci/install $(CP) $(PKG_BUILD_DIR)/module/public-core/dist/* $(1)/usr/lib/lua/ffluci/ -R $(CP) $(PKG_BUILD_DIR)/module/public-core/contrib/media $(1)/www/ffluci/ -R + $(CP) $(PKG_BUILD_DIR)/module/rpc-core/dist/* $(1)/usr/lib/lua/ffluci/ -R + $(CP) -a ./ipkg/ffluci.postinst $(1)/CONTROL/postinst $(CP) -a ./ipkg/conffiles $(1)/CONTROL/conffiles rm $(DL_DIR)/$(PKG_SOURCE) |