mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 18:38:10 +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 | │   │       └── 50-fbwifi | ||||||
| │   ├── init.d | │   ├── init.d | ||||||
| │   │   └── fbwifi | │   │   └── fbwifi | ||||||
| │   └── uci-defaults |  | ||||||
| │       └── fbwifi |  | ||||||
| ├── usr | ├── usr | ||||||
| │   ├── lib | │   ├── lib | ||||||
| │   │   └── lua | │   │   └── lua | ||||||
| @@ -38,13 +36,15 @@ files/ | |||||||
| │   │           └── view | │   │           └── view | ||||||
| │   │               └── fbwifi.htm | │   │               └── fbwifi.htm | ||||||
| │   ├── sbin | │   ├── sbin | ||||||
|  | │   │   ├── fbwifi | ||||||
| │   │   ├── fbwifi_debug_dump | │   │   ├── fbwifi_debug_dump | ||||||
| │   │   ├── fbwifi_gateway_info_update | │   │   ├── fbwifi_gateway_info_update | ||||||
| │   │   ├── fbwifi_get_config | │   │   ├── fbwifi_get_config | ||||||
| │   │   └── fbwifi_validate_token_db | │   │   └── fbwifi_validate_token_db | ||||||
| │   └── share | │   └── share | ||||||
|  | │       └── fbwifi | ||||||
| │           ├── firewall.include | │           ├── firewall.include | ||||||
| │       └── uhttpd.include | │           └── uhttpd.json | ||||||
| └── www | └── www | ||||||
|     └── cgi-bin |     └── cgi-bin | ||||||
|         └── fbwifi |         └── fbwifi | ||||||
|   | |||||||
| @@ -4,20 +4,20 @@ START=90 | |||||||
|  |  | ||||||
| USE_PROCD=1 | USE_PROCD=1 | ||||||
|  |  | ||||||
| service_triggers() { |  | ||||||
| 	procd_add_reload_trigger fbwifi |  | ||||||
| } |  | ||||||
|  |  | ||||||
| reload_service() { | reload_service() { | ||||||
| 	restart | 	restart | ||||||
| } | } | ||||||
|  |  | ||||||
|  | service_triggers() { | ||||||
|  | 	procd_add_reload_trigger fbwifi | ||||||
|  | } | ||||||
|  |  | ||||||
| start_service() { | start_service() { | ||||||
|  |  | ||||||
| 	config_load fbwifi | 	config_load fbwifi | ||||||
| 	config_get_bool enabled 'main' 'enabled' '0' | 	config_get_bool enabled 'main' 'enabled' '0' | ||||||
| 	[ "$enabled" -eq 0 ] && return | 	[ "$enabled" -eq 0 ] && return | ||||||
|  |  | ||||||
|  |  | ||||||
| 	config_get http_port main http_port | 	config_get http_port main http_port | ||||||
| 	[ -z "$http_port" ] && { | 	[ -z "$http_port" ] && { | ||||||
| 		logger -t fbwifi "required option http_port not set" | 		logger -t fbwifi "required option http_port not set" | ||||||
| @@ -34,7 +34,7 @@ start_service() { | |||||||
|  |  | ||||||
| 	mkdir -p /tmp/fbwifi | 	mkdir -p /tmp/fbwifi | ||||||
|  |  | ||||||
| 	fbwifi reload | 	/usr/sbin/fbwifi reload | ||||||
|  |  | ||||||
| 	procd_open_instance | 	procd_open_instance | ||||||
| 	procd_set_param command /usr/sbin/fbwifi_validate_token_db | 	procd_set_param command /usr/sbin/fbwifi_validate_token_db | ||||||
|   | |||||||
| @@ -1,14 +1,21 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
|  |  | ||||||
| case "$1" in | 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) | enable) | ||||||
| 	uci set fbwifi.main.enabled=1 | 	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=include | ||||||
| 	uci set firewall.fbwifi.enabled=1 | 	uci set firewall.fbwifi.enabled=1 | ||||||
| 	uci set firewall.fbwifi.family=ipv4 | 	uci set firewall.fbwifi.family=ipv4 | ||||||
| @@ -18,39 +25,29 @@ enable) | |||||||
|  |  | ||||||
| 	uci set uhttpd.fbwifi_redirect=uhttpd | 	uci set uhttpd.fbwifi_redirect=uhttpd | ||||||
| 	uci set uhttpd.fbwifi_redirect.enabled=1 | 	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_http='0.0.0.0:2060' | ||||||
| 	uci set uhttpd.fbwifi_redirect.listen_https='0.0.0.0:2061' | 	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) | reload) | ||||||
| 	/usr/sbin/fbwifi_get_config | 	/usr/sbin/fbwifi_get_config | ||||||
|  |  | ||||||
| 	login_url=$(uci -p /var/state get fbwifi.main.captive_portal_url) | 	login_url=$(uci -p /var/state get fbwifi.main.captive_portal_url) | ||||||
| 	[ -z "$login_url" ] && { | 	[ -z "$login_url" ] && { | ||||||
| 		logger -t fbwifi "captive_portal_url not available yet" | 		logger -t fbwifi "captive_portal_url not available yet" | ||||||
| 		exit 1 | 		exit 1 | ||||||
| 	} | 	} | ||||||
| 	printf '{ "request": [ ["redirect", "%s", 302] ] }' "$login_url" > /tmp/fbwifi/uhttpd-redirect.json | 	printf '{ "request": [ ["redirect", "%s", 302] ] }' "$login_url" > /tmp/fbwifi/uhttpd-redirect.json | ||||||
|  |  | ||||||
| 	/etc/init.d/uhttpd restart | 	/etc/init.d/uhttpd restart | ||||||
|  |  | ||||||
| 	exit 0 | 	exit 0 | ||||||
| 	;; | 	;; | ||||||
| esac | esac | ||||||
|   | |||||||
| @@ -57,9 +57,9 @@ else | |||||||
| 	log.syslog(log.LOG_WARNING, "[fbwifi] config is stale, refreshing config") | 	log.syslog(log.LOG_WARNING, "[fbwifi] config is stale, refreshing config") | ||||||
|         local result = os.execute("/usr/sbin/fbwifi reload") |         local result = os.execute("/usr/sbin/fbwifi reload") | ||||||
|         if result == 0 then |         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 |         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 | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin