mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 02:17:58 +00:00 
			
		
		
		
	fbwifi: update to the latest HEAD
* sync with the incubator feed Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		| @@ -26,8 +26,6 @@ files/ | ||||
| │   │       └── 50-fbwifi | ||||
| │   ├── init.d | ||||
| │   │   └── fbwifi | ||||
| │   └── uci-defaults | ||||
| │       └── fbwifi | ||||
| ├── usr | ||||
| │   ├── lib | ||||
| │   │   └── lua | ||||
| @@ -38,13 +36,15 @@ files/ | ||||
| │   │           └── view | ||||
| │   │               └── fbwifi.htm | ||||
| │   ├── sbin | ||||
| │   │   ├── fbwifi | ||||
| │   │   ├── fbwifi_debug_dump | ||||
| │   │   ├── fbwifi_gateway_info_update | ||||
| │   │   ├── fbwifi_get_config | ||||
| │   │   └── fbwifi_validate_token_db | ||||
| │   └── share | ||||
| │       └── fbwifi | ||||
| │           ├── firewall.include | ||||
| │       └── uhttpd.include | ||||
| │           └── uhttpd.json | ||||
| └── www | ||||
|     └── cgi-bin | ||||
|         └── fbwifi | ||||
|   | ||||
| @@ -4,20 +4,20 @@ START=90 | ||||
|  | ||||
| USE_PROCD=1 | ||||
|  | ||||
| service_triggers() { | ||||
| 	procd_add_reload_trigger fbwifi | ||||
| } | ||||
|  | ||||
| reload_service() { | ||||
| 	restart | ||||
| } | ||||
|  | ||||
| service_triggers() { | ||||
| 	procd_add_reload_trigger fbwifi | ||||
| } | ||||
|  | ||||
| start_service() { | ||||
|  | ||||
| 	config_load fbwifi | ||||
| 	config_get_bool enabled 'main' 'enabled' '0' | ||||
| 	[ "$enabled" -eq 0 ] && return | ||||
|  | ||||
|  | ||||
| 	config_get http_port main http_port | ||||
| 	[ -z "$http_port" ] && { | ||||
| 		logger -t fbwifi "required option http_port not set" | ||||
| @@ -34,7 +34,7 @@ start_service() { | ||||
|  | ||||
| 	mkdir -p /tmp/fbwifi | ||||
|  | ||||
| 	fbwifi reload | ||||
| 	/usr/sbin/fbwifi reload | ||||
|  | ||||
| 	procd_open_instance | ||||
| 	procd_set_param command /usr/sbin/fbwifi_validate_token_db | ||||
|   | ||||
| @@ -1,14 +1,21 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| case "$1" in | ||||
| disable) | ||||
| 	uci set fbwifi.main.enabled=0 | ||||
|  | ||||
| 	uci delete firewall.fbwifi | ||||
|  | ||||
| 	uci delete uhttpd.fbwifi_redirect | ||||
|  | ||||
| 	uci delete uhttpd.main.json_script | ||||
| 	uci set uhttpd.main.cert='/etc/uhttpd.crt' | ||||
| 	uci set uhttpd.main.key='/etc/uhttpd.key' | ||||
| 	uci set uhttpd.main.rfc1918_filter=1 | ||||
| 	;; | ||||
| enable) | ||||
| 	uci set fbwifi.main.enabled=1 | ||||
|  | ||||
| 	uci set uhttpd.main.cert='/tmp/fbwifi/https_server_cert' | ||||
| 	uci set uhttpd.main.key='/tmp/fbwifi/https_server_key' | ||||
| 	uci set uhttpd.main.json_script='/usr/share/fbwifi/uhttpd.json' | ||||
| 	uci set uhttpd.main.rfc1918_filter=0 | ||||
| 	 | ||||
| 	uci set firewall.fbwifi=include | ||||
| 	uci set firewall.fbwifi.enabled=1 | ||||
| 	uci set firewall.fbwifi.family=ipv4 | ||||
| @@ -18,39 +25,29 @@ enable) | ||||
|  | ||||
| 	uci set uhttpd.fbwifi_redirect=uhttpd | ||||
| 	uci set uhttpd.fbwifi_redirect.enabled=1 | ||||
| 	uci set uhttpd.fbwifi_redirect.cert='/tmp/fbwifi/https_server_cert' | ||||
| 	uci set uhttpd.fbwifi_redirect.json_script='/tmp/fbwifi/uhttpd-redirect.json' | ||||
| 	uci set uhttpd.fbwifi_redirect.key='/tmp/fbwifi/https_server_key' | ||||
| 	uci set uhttpd.fbwifi_redirect.listen_http='0.0.0.0:2060' | ||||
| 	uci set uhttpd.fbwifi_redirect.listen_https='0.0.0.0:2061' | ||||
| 	uci set uhttpd.fbwifi_redirect.cert='/tmp/fbwifi/https_server_cert' | ||||
| 	uci set uhttpd.fbwifi_redirect.key='/tmp/fbwifi/https_server_key' | ||||
| 	uci set uhttpd.fbwifi_redirect.json_script='/tmp/fbwifi/uhttpd-redirect.json' | ||||
|  | ||||
| 	uci add_list dhcp.@dnsmasq[0].rebind_domain=fbwifigateway.net | ||||
| 	uci set uhttpd.main.cert='/tmp/fbwifi/https_server_cert' | ||||
| 	uci set uhttpd.main.json_script='/usr/share/fbwifi/uhttpd.json' | ||||
| 	uci set uhttpd.main.key='/tmp/fbwifi/https_server_key' | ||||
| 	uci set uhttpd.main.rfc1918_filter=0 | ||||
| 	;; | ||||
|  | ||||
| disable) | ||||
| 	uci set fbwifi.main.enabled=0 | ||||
| 	 | ||||
| 	uci delete uhttpd.main.cert | ||||
| 	uci delete uhttpd.main.key | ||||
| 	uci delete uhttpd.main.json_script | ||||
| 	uci delete uhttpd.main.rfc1918_filter | ||||
| 	 | ||||
| 	uci delete firewall.fbwifi | ||||
|  | ||||
| 	uci delete uhttpd.fbwifi_redirect | ||||
|  | ||||
| 	uci delete dhcp.@dnsmasq[0].rebind_domain | ||||
| 	;; | ||||
|  | ||||
| reload) | ||||
| 	/usr/sbin/fbwifi_get_config | ||||
|  | ||||
| 	login_url=$(uci -p /var/state get fbwifi.main.captive_portal_url) | ||||
| 	[ -z "$login_url" ] && { | ||||
| 		logger -t fbwifi "captive_portal_url not available yet" | ||||
| 		exit 1 | ||||
| 	} | ||||
| 	printf '{ "request": [ ["redirect", "%s", 302] ] }' "$login_url" > /tmp/fbwifi/uhttpd-redirect.json | ||||
|  | ||||
| 	/etc/init.d/uhttpd restart | ||||
|  | ||||
| 	exit 0 | ||||
| 	;; | ||||
| esac | ||||
|   | ||||
| @@ -57,9 +57,9 @@ else | ||||
| 	log.syslog(log.LOG_WARNING, "[fbwifi] config is stale, refreshing config") | ||||
|         local result = os.execute("/usr/sbin/fbwifi reload") | ||||
|         if result == 0 then | ||||
|                 log.syslog(log.LOG_INFO, "[fbwifi] init.d fbwifi restarted successfully to fetch and update fresh config ") | ||||
|                 log.syslog(log.LOG_INFO, "[fbwifi] successfully fetched and loaded new config ") | ||||
|         else | ||||
|                 log.syslog(log.LOG_WARNING, "[fbwifi] init.d fbwifi failed to restart. Possible stale config") | ||||
|                 log.syslog(log.LOG_WARNING, "[fbwifi] failed to fetch and load new config, possible stale config") | ||||
|         end | ||||
| end | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin