mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-11-04 04:18:07 +00:00 
			
		
		
		
	Compare commits
	
		
			6 Commits
		
	
	
		
			v1.1.0-rc3
			...
			release/v1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					7bcd7093d2 | ||
| 
						 | 
					f273ec572e | ||
| 
						 | 
					5fd49f6b64 | ||
| 
						 | 
					f3fc398eac | ||
| 
						 | 
					7aea689d9a | ||
| 
						 | 
					7a634d80ed | 
@@ -47,15 +47,6 @@ hostapd_append_wpa_key_mgmt() {
 | 
				
			|||||||
			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256"
 | 
								[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256"
 | 
				
			||||||
			[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256"
 | 
								[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256"
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
		eap-only)
 | 
					 | 
				
			||||||
			append wpa_key_mgmt "WPA-EAP-SHA256"
 | 
					 | 
				
			||||||
			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
 | 
					 | 
				
			||||||
		;;
 | 
					 | 
				
			||||||
		eap-transition)
 | 
					 | 
				
			||||||
			append wpa_key_mgmt "WPA-EAP"
 | 
					 | 
				
			||||||
			append wpa_key_mgmt "WPA-EAP-SHA256"
 | 
					 | 
				
			||||||
			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
 | 
					 | 
				
			||||||
		;;
 | 
					 | 
				
			||||||
		eap192)
 | 
							eap192)
 | 
				
			||||||
			append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
 | 
								append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
 | 
				
			||||||
			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
 | 
								[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
 | 
				
			||||||
@@ -321,15 +312,14 @@ hostapd_common_add_bss_config() {
 | 
				
			|||||||
	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
 | 
						config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config_add_boolean interworking internet
 | 
						config_add_boolean interworking internet
 | 
				
			||||||
	config_add_int access_network_type asra esr uesa venue_group venue_type  \
 | 
						config_add_int access_network_type asra esr uesa venue_group venue_type ipaddr_type_availability \
 | 
				
			||||||
		gas_address3
 | 
							gas_address3
 | 
				
			||||||
	config_add_string hessid network_auth_type ipaddr_type_availability \
 | 
						config_add_string hessid network_auth_type \
 | 
				
			||||||
		anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url
 | 
							anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config_add_array airtime_sta_weight
 | 
						config_add_array airtime_sta_weight
 | 
				
			||||||
	config_add_int airtime_bss_weight airtime_bss_limit
 | 
						config_add_int airtime_bss_weight airtime_bss_limit
 | 
				
			||||||
	config_add_int rts_threshold
 | 
						config_add_int rts_threshold
 | 
				
			||||||
	config_add_boolean multicast_to_unicast proxy_arp
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
hostapd_set_vlan_file() {
 | 
					hostapd_set_vlan_file() {
 | 
				
			||||||
@@ -496,8 +486,7 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
		bss_load_update_period chan_util_avg_period sae_require_mfp \
 | 
							bss_load_update_period chan_util_avg_period sae_require_mfp \
 | 
				
			||||||
		multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
 | 
							multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
 | 
				
			||||||
		airtime_bss_weight airtime_bss_limit airtime_sta_weight \
 | 
							airtime_bss_weight airtime_bss_limit airtime_sta_weight \
 | 
				
			||||||
		rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold \
 | 
							rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold 
 | 
				
			||||||
		proxy_arp multicast_to_unicast
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	set_default isolate 0
 | 
						set_default isolate 0
 | 
				
			||||||
	set_default maxassoc 0
 | 
						set_default maxassoc 0
 | 
				
			||||||
@@ -520,8 +509,7 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
	set_default rssi_reject_assoc_rssi 0
 | 
						set_default rssi_reject_assoc_rssi 0
 | 
				
			||||||
	set_default rssi_ignore_probe_request 0
 | 
						set_default rssi_ignore_probe_request 0
 | 
				
			||||||
	set_default rts_threshold -1
 | 
						set_default rts_threshold -1
 | 
				
			||||||
	set_default proxy_arp 0
 | 
					
 | 
				
			||||||
	set_default multicast_to_unicast 0
 | 
					 | 
				
			||||||
	append bss_conf "ctrl_interface=/var/run/hostapd"
 | 
						append bss_conf "ctrl_interface=/var/run/hostapd"
 | 
				
			||||||
	if [ "$isolate" -gt 0 ]; then
 | 
						if [ "$isolate" -gt 0 ]; then
 | 
				
			||||||
		append bss_conf "ap_isolate=$isolate" "$N"
 | 
							append bss_conf "ap_isolate=$isolate" "$N"
 | 
				
			||||||
@@ -550,9 +538,6 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
	append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
 | 
						append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
 | 
				
			||||||
	append bss_conf "rts_threshold=$rts_threshold" "$N"
 | 
						append bss_conf "rts_threshold=$rts_threshold" "$N"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[ -n "$proxy_arp" ] && append bss_conf "proxy_arp=$proxy_arp" "$N"
 | 
					 | 
				
			||||||
	[ -n "$multicast_to_unicast" ] && append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
 | 
						[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[ "$wpa" -gt 0 ] && {
 | 
						[ "$wpa" -gt 0 ] && {
 | 
				
			||||||
@@ -573,11 +558,11 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case "$auth_type" in
 | 
						case "$auth_type" in
 | 
				
			||||||
		sae|owe|eap192|eap-eap192|eap-only)
 | 
							sae|owe|eap192|eap-eap192)
 | 
				
			||||||
			set_default ieee80211w 2
 | 
								set_default ieee80211w 2
 | 
				
			||||||
			set_default sae_require_mfp 1
 | 
								set_default sae_require_mfp 1
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
		psk-sae|eap-transition)
 | 
							psk-sae)
 | 
				
			||||||
			set_default ieee80211w 1
 | 
								set_default ieee80211w 1
 | 
				
			||||||
			set_default sae_require_mfp 1
 | 
								set_default sae_require_mfp 1
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
@@ -619,7 +604,7 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
			vlan_possible=1
 | 
								vlan_possible=1
 | 
				
			||||||
			wps_possible=1
 | 
								wps_possible=1
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
		eap|eap192|eap-eap192|eap-only|eap-transition)
 | 
							eap|eap192|eap-eap192)
 | 
				
			||||||
			json_get_vars \
 | 
								json_get_vars \
 | 
				
			||||||
				auth_server auth_secret auth_port \
 | 
									auth_server auth_secret auth_port \
 | 
				
			||||||
				dae_client dae_secret dae_port \
 | 
									dae_client dae_secret dae_port \
 | 
				
			||||||
@@ -956,6 +941,7 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
	set_default access_network_type 0
 | 
						set_default access_network_type 0
 | 
				
			||||||
	set_default venue_group 0
 | 
						set_default venue_group 0
 | 
				
			||||||
	set_default venue_type 0
 | 
						set_default venue_type 0
 | 
				
			||||||
 | 
						set_default ipaddr_type_availability 0
 | 
				
			||||||
	set_default gas_address3 0
 | 
						set_default gas_address3 0
 | 
				
			||||||
	set_default hs20_deauth_req_timeout 60
 | 
						set_default hs20_deauth_req_timeout 60
 | 
				
			||||||
	if [ "$hs20" = "1" ]; then
 | 
						if [ "$hs20" = "1" ]; then
 | 
				
			||||||
@@ -987,7 +973,7 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
		[ "$uesa" -gt 0 ] && append bss_conf "uesa=$uesa" "$N"
 | 
							[ "$uesa" -gt 0 ] && append bss_conf "uesa=$uesa" "$N"
 | 
				
			||||||
		[ "$venue_group" -gt 0 ] && append bss_conf "venue_group=$venue_group" "$N"
 | 
							[ "$venue_group" -gt 0 ] && append bss_conf "venue_group=$venue_group" "$N"
 | 
				
			||||||
		[ "$venue_type" -gt 0 ] && append bss_conf "venue_type=$venue_type" "$N"
 | 
							[ "$venue_type" -gt 0 ] && append bss_conf "venue_type=$venue_type" "$N"
 | 
				
			||||||
		[ -n "$ipaddr_type_availability" ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N"
 | 
							[ "$ipaddr_type_availability" -gt 0 ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N"
 | 
				
			||||||
		[ "$gas_address3" -gt 0 ] && append bss_conf "gas_address3=$gas_address3" "$N"
 | 
							[ "$gas_address3" -gt 0 ] && append bss_conf "gas_address3=$gas_address3" "$N"
 | 
				
			||||||
		[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N"
 | 
							[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N"
 | 
				
			||||||
		[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N"
 | 
							[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,28 +0,0 @@
 | 
				
			|||||||
Index: hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c
 | 
					 | 
				
			||||||
===================================================================
 | 
					 | 
				
			||||||
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ieee802_11.c
 | 
					 | 
				
			||||||
+++ hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c
 | 
					 | 
				
			||||||
@@ -3675,6 +3675,13 @@ static int add_associated_sta(struct hos
 | 
					 | 
				
			||||||
 	 * drivers to accept the STA parameter configuration. Since this is
 | 
					 | 
				
			||||||
 	 * after a new FT-over-DS exchange, a new TK has been derived, so key
 | 
					 | 
				
			||||||
 	 * reinstallation is not a concern for this case.
 | 
					 | 
				
			||||||
+	 *
 | 
					 | 
				
			||||||
+	 * If the STA was associated and authorized earlier, but came for a new
 | 
					 | 
				
			||||||
+	 * connection (!added_unassoc + !reassoc), remove the existing STA entry
 | 
					 | 
				
			||||||
+	 * so that it can be re-added. This case is rarely seen when the AP could
 | 
					 | 
				
			||||||
+	 * not receive the deauth/disassoc frame from the STA. And the STA comes
 | 
					 | 
				
			||||||
+	 * back with new connection within a short period or before the inactive
 | 
					 | 
				
			||||||
+	 * STA entry is removed from the list.
 | 
					 | 
				
			||||||
 	 */
 | 
					 | 
				
			||||||
 	wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR
 | 
					 | 
				
			||||||
 		   " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)",
 | 
					 | 
				
			||||||
@@ -3688,7 +3695,8 @@ static int add_associated_sta(struct hos
 | 
					 | 
				
			||||||
 	    (!(sta->flags & WLAN_STA_AUTHORIZED) ||
 | 
					 | 
				
			||||||
 	     (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) ||
 | 
					 | 
				
			||||||
 	     (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) &&
 | 
					 | 
				
			||||||
-	      !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)))) {
 | 
					 | 
				
			||||||
+	      !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)) ||
 | 
					 | 
				
			||||||
+	     (!reassoc && (sta->flags & WLAN_STA_AUTHORIZED)))) {
 | 
					 | 
				
			||||||
 		hostapd_drv_sta_remove(hapd, sta->addr);
 | 
					 | 
				
			||||||
 		wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED);
 | 
					 | 
				
			||||||
 		set = 0;
 | 
					 | 
				
			||||||
@@ -47,15 +47,6 @@ hostapd_append_wpa_key_mgmt() {
 | 
				
			|||||||
			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256"
 | 
								[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256"
 | 
				
			||||||
			[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256"
 | 
								[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256"
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
		eap-only)
 | 
					 | 
				
			||||||
			append wpa_key_mgmt "WPA-EAP-SHA256"
 | 
					 | 
				
			||||||
			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
 | 
					 | 
				
			||||||
		;;
 | 
					 | 
				
			||||||
		eap-transition)
 | 
					 | 
				
			||||||
			append wpa_key_mgmt "WPA-EAP"
 | 
					 | 
				
			||||||
			append wpa_key_mgmt "WPA-EAP-SHA256"
 | 
					 | 
				
			||||||
			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
 | 
					 | 
				
			||||||
		;;
 | 
					 | 
				
			||||||
		eap192)
 | 
							eap192)
 | 
				
			||||||
			append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
 | 
								append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
 | 
				
			||||||
			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
 | 
								[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
 | 
				
			||||||
@@ -304,17 +295,15 @@ hostapd_common_add_bss_config() {
 | 
				
			|||||||
	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
 | 
						config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config_add_boolean interworking internet
 | 
						config_add_boolean interworking internet
 | 
				
			||||||
	config_add_int access_network_type asra esr uesa venue_group venue_type \
 | 
						config_add_int access_network_type asra esr uesa venue_group venue_type ipaddr_type_availability \
 | 
				
			||||||
		gas_address3
 | 
							gas_address3
 | 
				
			||||||
	config_add_string hessid network_auth_type ipaddr_type_availability \
 | 
						config_add_string hessid network_auth_type \
 | 
				
			||||||
		anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url
 | 
							anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config_add_int airtime_bss_weight airtime_bss_limit
 | 
						config_add_int airtime_bss_weight airtime_bss_limit
 | 
				
			||||||
	config_add_int rts_threshold
 | 
						config_add_int rts_threshold
 | 
				
			||||||
	config_add_array radius_auth_req_attr
 | 
						config_add_array radius_auth_req_attr
 | 
				
			||||||
	config_add_array radius_acct_req_attr
 | 
						config_add_array radius_acct_req_attr
 | 
				
			||||||
 | 
					 | 
				
			||||||
	config_add_boolean multicast_to_unicast proxy_arp
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
hostapd_set_vlan_file() {
 | 
					hostapd_set_vlan_file() {
 | 
				
			||||||
@@ -458,8 +447,7 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
		bss_load_update_period chan_util_avg_period sae_require_mfp \
 | 
							bss_load_update_period chan_util_avg_period sae_require_mfp \
 | 
				
			||||||
		multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
 | 
							multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
 | 
				
			||||||
		airtime_bss_weight airtime_bss_limit \
 | 
							airtime_bss_weight airtime_bss_limit \
 | 
				
			||||||
		rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold \
 | 
							rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold 
 | 
				
			||||||
		proxy_arp multicast_to_unicast
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	set_default isolate 0
 | 
						set_default isolate 0
 | 
				
			||||||
	set_default maxassoc 0
 | 
						set_default maxassoc 0
 | 
				
			||||||
@@ -487,9 +475,6 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
	set_default signal_poll_time 5
 | 
						set_default signal_poll_time 5
 | 
				
			||||||
	set_default signal_drop_reason 3
 | 
						set_default signal_drop_reason 3
 | 
				
			||||||
	set_default signal_strikes 3
 | 
						set_default signal_strikes 3
 | 
				
			||||||
	set_default proxy_arp 0
 | 
					 | 
				
			||||||
	set_default multicast_to_unicast 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	append bss_conf "ctrl_interface=/var/run/hostapd"
 | 
						append bss_conf "ctrl_interface=/var/run/hostapd"
 | 
				
			||||||
	if [ "$isolate" -gt 0 ]; then
 | 
						if [ "$isolate" -gt 0 ]; then
 | 
				
			||||||
@@ -523,9 +508,6 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
	append bss_conf "signal_strikes=$signal_strikes" "$N"
 | 
						append bss_conf "signal_strikes=$signal_strikes" "$N"
 | 
				
			||||||
	append bss_conf "signal_drop_reason=$signal_drop_reason" "$N"
 | 
						append bss_conf "signal_drop_reason=$signal_drop_reason" "$N"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[ -n "$proxy_arp" ] && append bss_conf "proxy_arp=$proxy_arp" "$N"
 | 
					 | 
				
			||||||
	[ -n "$multicast_to_unicast" ] && append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
 | 
						[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[ "$wpa" -gt 0 ] && {
 | 
						[ "$wpa" -gt 0 ] && {
 | 
				
			||||||
@@ -548,11 +530,11 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case "$auth_type" in
 | 
						case "$auth_type" in
 | 
				
			||||||
		sae|owe|eap192|eap-eap192|eap-only)
 | 
							sae|owe|eap192|eap-eap192)
 | 
				
			||||||
			set_default ieee80211w 2
 | 
								set_default ieee80211w 2
 | 
				
			||||||
			set_default sae_require_mfp 1
 | 
								set_default sae_require_mfp 1
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
		psk-sae|eap-transition)
 | 
							psk-sae)
 | 
				
			||||||
			set_default ieee80211w 1
 | 
								set_default ieee80211w 1
 | 
				
			||||||
			set_default sae_require_mfp 1
 | 
								set_default sae_require_mfp 1
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
@@ -594,7 +576,7 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
			vlan_possible=1
 | 
								vlan_possible=1
 | 
				
			||||||
			wps_possible=1
 | 
								wps_possible=1
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
		eap|eap192|eap-eap192|eap-only|eap-transition)
 | 
							eap|eap192|eap-eap192)
 | 
				
			||||||
			json_get_vars \
 | 
								json_get_vars \
 | 
				
			||||||
				auth_server auth_secret auth_port \
 | 
									auth_server auth_secret auth_port \
 | 
				
			||||||
				dae_client dae_secret dae_port \
 | 
									dae_client dae_secret dae_port \
 | 
				
			||||||
@@ -890,6 +872,7 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
	set_default access_network_type 0
 | 
						set_default access_network_type 0
 | 
				
			||||||
	set_default venue_group 0
 | 
						set_default venue_group 0
 | 
				
			||||||
	set_default venue_type 0
 | 
						set_default venue_type 0
 | 
				
			||||||
 | 
						set_default ipaddr_type_availability 0
 | 
				
			||||||
	set_default gas_address3 0
 | 
						set_default gas_address3 0
 | 
				
			||||||
	set_default hs20_deauth_req_timeout 60
 | 
						set_default hs20_deauth_req_timeout 60
 | 
				
			||||||
	if [ "$hs20" = "1" ]; then
 | 
						if [ "$hs20" = "1" ]; then
 | 
				
			||||||
@@ -921,7 +904,7 @@ hostapd_set_bss_options() {
 | 
				
			|||||||
		[ "$uesa" -gt 0 ] && append bss_conf "uesa=$uesa" "$N"
 | 
							[ "$uesa" -gt 0 ] && append bss_conf "uesa=$uesa" "$N"
 | 
				
			||||||
		[ "$venue_group" -gt 0 ] && append bss_conf "venue_group=$venue_group" "$N"
 | 
							[ "$venue_group" -gt 0 ] && append bss_conf "venue_group=$venue_group" "$N"
 | 
				
			||||||
		[ "$venue_type" -gt 0 ] && append bss_conf "venue_type=$venue_type" "$N"
 | 
							[ "$venue_type" -gt 0 ] && append bss_conf "venue_type=$venue_type" "$N"
 | 
				
			||||||
		[ -n "$ipaddr_type_availability" ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N"
 | 
							[ "$ipaddr_type_availability" -gt 0 ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N"
 | 
				
			||||||
		[ "$gas_address3" -gt 0 ] && append bss_conf "gas_address3=$gas_address3" "$N"
 | 
							[ "$gas_address3" -gt 0 ] && append bss_conf "gas_address3=$gas_address3" "$N"
 | 
				
			||||||
		[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N"
 | 
							[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N"
 | 
				
			||||||
		[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N"
 | 
							[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,28 +0,0 @@
 | 
				
			|||||||
Index: hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c
 | 
					 | 
				
			||||||
===================================================================
 | 
					 | 
				
			||||||
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ieee802_11.c
 | 
					 | 
				
			||||||
+++ hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c
 | 
					 | 
				
			||||||
@@ -3675,6 +3675,13 @@ static int add_associated_sta(struct hos
 | 
					 | 
				
			||||||
 	 * drivers to accept the STA parameter configuration. Since this is
 | 
					 | 
				
			||||||
 	 * after a new FT-over-DS exchange, a new TK has been derived, so key
 | 
					 | 
				
			||||||
 	 * reinstallation is not a concern for this case.
 | 
					 | 
				
			||||||
+	 *
 | 
					 | 
				
			||||||
+	 * If the STA was associated and authorized earlier, but came for a new
 | 
					 | 
				
			||||||
+	 * connection (!added_unassoc + !reassoc), remove the existing STA entry
 | 
					 | 
				
			||||||
+	 * so that it can be re-added. This case is rarely seen when the AP could
 | 
					 | 
				
			||||||
+	 * not receive the deauth/disassoc frame from the STA. And the STA comes
 | 
					 | 
				
			||||||
+	 * back with new connection within a short period or before the inactive
 | 
					 | 
				
			||||||
+	 * STA entry is removed from the list.
 | 
					 | 
				
			||||||
 	 */
 | 
					 | 
				
			||||||
 	wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR
 | 
					 | 
				
			||||||
 		   " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)",
 | 
					 | 
				
			||||||
@@ -3688,7 +3695,8 @@ static int add_associated_sta(struct hos
 | 
					 | 
				
			||||||
 	    (!(sta->flags & WLAN_STA_AUTHORIZED) ||
 | 
					 | 
				
			||||||
 	     (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) ||
 | 
					 | 
				
			||||||
 	     (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) &&
 | 
					 | 
				
			||||||
-	      !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)))) {
 | 
					 | 
				
			||||||
+	      !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)) ||
 | 
					 | 
				
			||||||
+	     (!reassoc && (sta->flags & WLAN_STA_AUTHORIZED)))) {
 | 
					 | 
				
			||||||
 		hostapd_drv_sta_remove(hapd, sta->addr);
 | 
					 | 
				
			||||||
 		wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED);
 | 
					 | 
				
			||||||
 		set = 0;
 | 
					 | 
				
			||||||
@@ -253,10 +253,6 @@ static void check_timer_handler(struct uloop_timeout *timeout)
 | 
				
			|||||||
		if (CheckIp && (MyIpAddr != CheckIp))
 | 
							if (CheckIp && (MyIpAddr != CheckIp))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			printf("IP address changed from %x to %x - restart APC election\n", MyIpAddr, CheckIp);
 | 
								printf("IP address changed from %x to %x - restart APC election\n", MyIpAddr, CheckIp);
 | 
				
			||||||
			system("/usr/opensync/bin/ovsh u APC_State dr_addr:=0.0.0.0 bdr_addr:=0.0.0.0 enabled:=false mode:=NC");
 | 
					 | 
				
			||||||
			uloop_done();
 | 
					 | 
				
			||||||
			ubus_done();
 | 
					 | 
				
			||||||
			interap_rcv_close();
 | 
					 | 
				
			||||||
			exit(0);
 | 
								exit(0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@@ -270,9 +266,6 @@ static void check_timer_handler(struct uloop_timeout *timeout)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static void handle_signal(int signo)
 | 
					static void handle_signal(int signo)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uloop_done();
 | 
					 | 
				
			||||||
	ubus_done();
 | 
					 | 
				
			||||||
	interap_rcv_close();
 | 
					 | 
				
			||||||
	system("/usr/opensync/bin/ovsh u APC_State dr_addr:=0.0.0.0 bdr_addr:=0.0.0.0 enabled:=false mode:=NC");
 | 
						system("/usr/opensync/bin/ovsh u APC_State dr_addr:=0.0.0.0 bdr_addr:=0.0.0.0 enabled:=false mode:=NC");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -334,10 +327,8 @@ int main(int argc, char *const* argv)
 | 
				
			|||||||
	callback cb = receive_from_socket;
 | 
						callback cb = receive_from_socket;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (interap_recv(IAC_APC_ELECTION_PORT, cb, 1000,
 | 
						if (interap_recv(IAC_APC_ELECTION_PORT, cb, 1000,
 | 
				
			||||||
			 NULL, NULL) < 0) {
 | 
								 NULL, NULL) < 0)
 | 
				
			||||||
		printf("Error: Failed InterAP receive");
 | 
							printf("Error: Failed InterAP receive");
 | 
				
			||||||
		return 1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	memset(Timers, 0, sizeof(Timers));
 | 
						memset(Timers, 0, sizeof(Timers));
 | 
				
			||||||
@@ -360,7 +351,6 @@ int main(int argc, char *const* argv)
 | 
				
			|||||||
	uloop_run();
 | 
						uloop_run();
 | 
				
			||||||
	uloop_done();
 | 
						uloop_done();
 | 
				
			||||||
	ubus_done();
 | 
						ubus_done();
 | 
				
			||||||
	interap_rcv_close();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return(1);
 | 
						return(1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -189,11 +189,8 @@ void apc_send_hello(struct apc_iface * ifa, int kind )
 | 
				
			|||||||
			else
 | 
								else
 | 
				
			||||||
				ApcSpec.FloatIp = ApcSpecSaved.FloatIp;
 | 
									ApcSpec.FloatIp = ApcSpecSaved.FloatIp;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (ApcSpec.IsApc == I_AM_BAPC )
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			ifa->priority = 0x12;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else {
 | 
					 | 
				
			||||||
			ifa->priority = 0x11;
 | 
								ifa->priority = 0x11;
 | 
				
			||||||
			if ((ApcSpecSaved.IsApc == I_AM_APC) || BackingUpRadius )
 | 
								if ((ApcSpecSaved.IsApc == I_AM_APC) || BackingUpRadius )
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -168,7 +168,7 @@ void apc_iface_new( void )
 | 
				
			|||||||
	ifa->priority = 0x11;
 | 
						ifa->priority = 0x11;
 | 
				
			||||||
	ifa->drip = MyIpAddr;
 | 
						ifa->drip = MyIpAddr;
 | 
				
			||||||
	ifa->helloint = 4;
 | 
						ifa->helloint = 4;
 | 
				
			||||||
	ifa->deadint = 12;
 | 
						ifa->deadint = 16;
 | 
				
			||||||
	ifa->waitint = 16;
 | 
						ifa->waitint = 16;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	ifa->type = APC_IT_BCAST;
 | 
						ifa->type = APC_IT_BCAST;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -482,17 +482,13 @@ static void inactivity_timer_hook(struct _timer * tmr)
 | 
				
			|||||||
			n_neigh += 1;
 | 
								n_neigh += 1;
 | 
				
			||||||
			//Radius stuff
 | 
								//Radius stuff
 | 
				
			||||||
			BackingUpRadius = 1;
 | 
								BackingUpRadius = 1;
 | 
				
			||||||
			apc_ifa->priority = 0x33;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			apc_ifa->priority = 0x11;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		apc_ifa->drip = MyIpAddr;
 | 
							apc_ifa->drip = MyIpAddr;
 | 
				
			||||||
 | 
							apc_ifa->priority = 0x11;
 | 
				
			||||||
		apc_ifa->bdrip = 0;
 | 
							apc_ifa->bdrip = 0;
 | 
				
			||||||
		memset(&ApcSpec, 0, sizeof(struct apc_spec));
 | 
							memset(&ApcSpec, 0, sizeof(struct apc_spec));
 | 
				
			||||||
		WaitingToReelect = 3;
 | 
							WaitingToReelect = 12;
 | 
				
			||||||
 | 
					 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	printf("Inactivity timer expired for nbr %x on %s", n->rid, 
 | 
						printf("Inactivity timer expired for nbr %x on %s", n->rid, 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,16 +14,10 @@
 | 
				
			|||||||
struct ubus_context *ubus_ctx = NULL;
 | 
					struct ubus_context *ubus_ctx = NULL;
 | 
				
			||||||
static struct blob_buf b;
 | 
					static struct blob_buf b;
 | 
				
			||||||
static struct blob_buf nb;
 | 
					static struct blob_buf nb;
 | 
				
			||||||
 | 
					static const char *ubus_path;
 | 
				
			||||||
timer *notify_timer;
 | 
					timer *notify_timer;
 | 
				
			||||||
extern struct apc_iface * apc_ifa;
 | 
					extern struct apc_iface * apc_ifa;
 | 
				
			||||||
/* Mandatorily Notify APC_State period */
 | 
					#define APC_NOTIFY_INTERVAL 30
 | 
				
			||||||
#define APC_NOTIFY_INTERVAL 10
 | 
					 | 
				
			||||||
/* Check if any change in APC State and notify period */
 | 
					 | 
				
			||||||
#define APC_NOTIFY_CHECK 1
 | 
					 | 
				
			||||||
static ip_addr old_drip;
 | 
					 | 
				
			||||||
static ip_addr old_bdrip;
 | 
					 | 
				
			||||||
static u8 old_state;
 | 
					 | 
				
			||||||
static unsigned int ucount = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct apc_state {
 | 
					struct apc_state {
 | 
				
			||||||
	char mode[4];
 | 
						char mode[4];
 | 
				
			||||||
@@ -100,67 +94,35 @@ apc_info_handle(struct ubus_context *ctx, struct ubus_object *obj,
 | 
				
			|||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static char apc_mode[APC_MAX_MODE][8] = {"DOWN", "LOOP", "WT", "PTP", "OR", "BDR", "DR"};
 | 
					static char apc_mode[APC_MAX_MODE][8] = {"DOWN", "LOOP", "WAITING", "PTP", "OR", "BDR", "DR"};
 | 
				
			||||||
int apc_update_state(void)
 | 
					void apc_update_state()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct in_addr dr_addr;
 | 
						struct in_addr dr_addr;
 | 
				
			||||||
	struct in_addr bdr_addr;
 | 
						struct in_addr bdr_addr;
 | 
				
			||||||
	ip_addr cur_drip;
 | 
						dr_addr.s_addr = htonl(apc_ifa->drip);
 | 
				
			||||||
	ip_addr cur_bdrip;
 | 
						bdr_addr.s_addr = htonl(apc_ifa->bdrip);
 | 
				
			||||||
	u8 cur_state;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	cur_drip = apc_ifa->drip;
 | 
					 | 
				
			||||||
	cur_bdrip = apc_ifa->bdrip;
 | 
					 | 
				
			||||||
	cur_state = apc_ifa->state;
 | 
					 | 
				
			||||||
	ucount++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (cur_drip == old_drip &&
 | 
					 | 
				
			||||||
	    cur_bdrip == old_bdrip &&
 | 
					 | 
				
			||||||
	    cur_state == old_state && ucount < APC_NOTIFY_INTERVAL) {
 | 
					 | 
				
			||||||
		return -1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	printf("APC State update %u", ucount);
 | 
					 | 
				
			||||||
	ucount = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	dr_addr.s_addr = htonl(cur_drip);
 | 
					 | 
				
			||||||
	bdr_addr.s_addr = htonl(cur_bdrip);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	state.enabled = true;
 | 
						state.enabled = true;
 | 
				
			||||||
	if ((cur_state == APC_IS_DR) ||
 | 
						if ((apc_ifa->state == APC_IS_DR) ||
 | 
				
			||||||
	    (cur_state == APC_IS_BACKUP) ||
 | 
						    (apc_ifa->state == APC_IS_BACKUP) ||
 | 
				
			||||||
	    (cur_state == APC_IS_DROTHER)) {
 | 
						    (apc_ifa->state == APC_IS_DROTHER)) {
 | 
				
			||||||
		snprintf(state.mode, sizeof(state.mode), "%s",
 | 
							snprintf(state.mode, sizeof(state.mode), "%s",
 | 
				
			||||||
			 &apc_mode[cur_state][0]);
 | 
								 &apc_mode[apc_ifa->state][0]);
 | 
				
			||||||
		snprintf(state.dr_addr, sizeof(state.dr_addr),
 | 
							snprintf(state.dr_addr, sizeof(state.dr_addr),
 | 
				
			||||||
			 "%s", inet_ntoa(dr_addr));
 | 
								 "%s", inet_ntoa(dr_addr));
 | 
				
			||||||
		snprintf(state.bdr_addr, sizeof(state.bdr_addr),
 | 
							snprintf(state.bdr_addr, sizeof(state.bdr_addr),
 | 
				
			||||||
			 "%s", inet_ntoa(bdr_addr));
 | 
								 "%s", inet_ntoa(bdr_addr));
 | 
				
			||||||
	} else if (apc_ifa->state == APC_IS_WAITING) {
 | 
						}
 | 
				
			||||||
		snprintf(state.mode, sizeof(state.mode), "%s",
 | 
						else {
 | 
				
			||||||
			 &apc_mode[cur_state][0]);
 | 
					 | 
				
			||||||
		snprintf(state.dr_addr, sizeof(state.dr_addr), "0.0.0.0");
 | 
					 | 
				
			||||||
		snprintf(state.bdr_addr, sizeof(state.bdr_addr), "0.0.0.0");
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		snprintf(state.mode, sizeof(state.mode), "NC");
 | 
							snprintf(state.mode, sizeof(state.mode), "NC");
 | 
				
			||||||
		snprintf(state.dr_addr, sizeof(state.dr_addr), "0.0.0.0");
 | 
							snprintf(state.dr_addr, sizeof(state.dr_addr), "0.0.0.0");
 | 
				
			||||||
		snprintf(state.bdr_addr, sizeof(state.bdr_addr), "0.0.0.0");
 | 
							snprintf(state.bdr_addr, sizeof(state.bdr_addr), "0.0.0.0");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	old_drip = cur_drip;
 | 
					 | 
				
			||||||
	old_bdrip = cur_bdrip;
 | 
					 | 
				
			||||||
	old_state = cur_state;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return 0;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void apc_send_notification(struct _timer * tmr)
 | 
					void apc_send_notification(struct _timer * tmr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int ustate = 0;
 | 
						apc_update_state();
 | 
				
			||||||
 | 
					 | 
				
			||||||
	ustate = apc_update_state();
 | 
					 | 
				
			||||||
	if(ustate != 0)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	printf("APC send ubus notification\n");
 | 
						printf("APC send ubus notification\n");
 | 
				
			||||||
	blob_buf_init(&nb, 0);
 | 
						blob_buf_init(&nb, 0);
 | 
				
			||||||
@@ -193,10 +155,10 @@ ubus_init(void) {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
	add_object(&apc_object);
 | 
						add_object(&apc_object);
 | 
				
			||||||
	notify_timer = tm_new_set(apc_send_notification, NULL,
 | 
						notify_timer = tm_new_set(apc_send_notification, NULL,
 | 
				
			||||||
				  0, APC_NOTIFY_CHECK);
 | 
									  0, APC_NOTIFY_INTERVAL);
 | 
				
			||||||
	if (notify_timer) {
 | 
						if (notify_timer) {
 | 
				
			||||||
		printf("APC Start state check and notify timer\n");
 | 
							printf("APC Start notify timer\n");
 | 
				
			||||||
		tm_start(notify_timer, APC_NOTIFY_CHECK);
 | 
							tm_start(notify_timer, APC_NOTIFY_INTERVAL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ubus_ctx->connection_lost = ubus_connection_lost;
 | 
						ubus_ctx->connection_lost = ubus_connection_lost;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,8 +30,5 @@ endef
 | 
				
			|||||||
define Package/libinterapcomm/install
 | 
					define Package/libinterapcomm/install
 | 
				
			||||||
	$(INSTALL_DIR) $(1)/usr/lib
 | 
						$(INSTALL_DIR) $(1)/usr/lib
 | 
				
			||||||
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/libinterapcomm.so $(1)/usr/lib/
 | 
						$(INSTALL_DATA) $(PKG_BUILD_DIR)/libinterapcomm.so $(1)/usr/lib/
 | 
				
			||||||
	$(INSTALL_DIR) $(1)/etc/init.d
 | 
					 | 
				
			||||||
	$(INSTALL_BIN) ./files/interap.init $(1)/etc/init.d/interap
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
$(eval $(call BuildPackage,libinterapcomm))
 | 
					$(eval $(call BuildPackage,libinterapcomm))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,35 +0,0 @@
 | 
				
			|||||||
#!/bin/sh /etc/rc.common
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
START=12
 | 
					 | 
				
			||||||
STOP=12
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
start() {
 | 
					 | 
				
			||||||
	apc=`cat /etc/config/firewall | grep Allow-APC`
 | 
					 | 
				
			||||||
	ucc=`cat /etc/config/firewall | grep Allow-UCC`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if [ -z "$apc" ]; then
 | 
					 | 
				
			||||||
		uci add firewall rule
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].name='Allow-APC'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].src='wan'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].proto='udp'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].dst_port='50010'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].target='ACCEPT'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].family='ipv4'
 | 
					 | 
				
			||||||
		uci commit firewall
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if [ -z "$ucc" ]; then
 | 
					 | 
				
			||||||
		uci add firewall rule
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].name='Allow-UCC'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].src='wan'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].proto='udp'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].dst_port='50000'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].target='ACCEPT'
 | 
					 | 
				
			||||||
		uci set firewall.@rule[-1].family='ipv4'
 | 
					 | 
				
			||||||
		uci commit firewall
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
stop() {
 | 
					 | 
				
			||||||
	echo stop
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -5,7 +5,6 @@ int interap_send(unsigned short port, char *dst_ip,
 | 
				
			|||||||
int interap_recv(unsigned short port, int (*recv_cb)(void *, ssize_t),
 | 
					int interap_recv(unsigned short port, int (*recv_cb)(void *, ssize_t),
 | 
				
			||||||
		 unsigned int len, struct ev_loop *loop,
 | 
							 unsigned int len, struct ev_loop *loop,
 | 
				
			||||||
		 ev_io *io);
 | 
							 ev_io *io);
 | 
				
			||||||
void interap_rcv_close(void);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef int (*callback)(void *, ssize_t);
 | 
					typedef int (*callback)(void *, ssize_t);
 | 
				
			||||||
typedef struct recv_arg {
 | 
					typedef struct recv_arg {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,10 +22,8 @@ static void receive_data_uloop(struct uloop_fd *fd, unsigned int events)
 | 
				
			|||||||
	recv_data = malloc(ra.len);
 | 
						recv_data = malloc(ra.len);
 | 
				
			||||||
	memset(recv_data, 0, ra.len);
 | 
						memset(recv_data, 0, ra.len);
 | 
				
			||||||
	if ((recv_data_len = recvfrom(recv_sock, recv_data, ra.len,
 | 
						if ((recv_data_len = recvfrom(recv_sock, recv_data, ra.len,
 | 
				
			||||||
				      0, NULL, 0)) < 0) {
 | 
									      0, NULL, 0)) < 0)
 | 
				
			||||||
		printf("recvfrom() failed");
 | 
							printf("recvfrom() failed");
 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ra.cb(recv_data, recv_data_len);
 | 
						ra.cb(recv_data, recv_data_len);
 | 
				
			||||||
	free(recv_data);
 | 
						free(recv_data);
 | 
				
			||||||
@@ -101,11 +99,6 @@ int interap_recv(unsigned short port, int (*recv_cb)(void *, ssize_t),
 | 
				
			|||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void interap_rcv_close(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	close(recv_sock);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int interap_send(unsigned short port, char *dst_ip, void *data,
 | 
					int interap_send(unsigned short port, char *dst_ip, void *data,
 | 
				
			||||||
		 unsigned int len)
 | 
							 unsigned int len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if="$(uci get network.wan.ifname)"
 | 
					 | 
				
			||||||
[ "$(cat /sys/class/net/"${if}"/carrier)" = 0 ] && {
 | 
					 | 
				
			||||||
	return 0
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
return 1
 | 
					 | 
				
			||||||
@@ -1,10 +0,0 @@
 | 
				
			|||||||
/tmp/log/openvswitch/* {
 | 
					 | 
				
			||||||
    daily
 | 
					 | 
				
			||||||
    rotate 5
 | 
					 | 
				
			||||||
    size 1M
 | 
					 | 
				
			||||||
    compress
 | 
					 | 
				
			||||||
    delaycompress
 | 
					 | 
				
			||||||
    dateext
 | 
					 | 
				
			||||||
    dateformat -%d%m%Y
 | 
					 | 
				
			||||||
    notifempty
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -2,7 +2,7 @@ Index: opensync-2.0.5.0/interfaces/opensync.ovsschema
 | 
				
			|||||||
===================================================================
 | 
					===================================================================
 | 
				
			||||||
--- opensync-2.0.5.0.orig/interfaces/opensync.ovsschema
 | 
					--- opensync-2.0.5.0.orig/interfaces/opensync.ovsschema
 | 
				
			||||||
+++ opensync-2.0.5.0/interfaces/opensync.ovsschema
 | 
					+++ opensync-2.0.5.0/interfaces/opensync.ovsschema
 | 
				
			||||||
@@ -9368,6 +9368,69 @@
 | 
					@@ -9368,6 +9368,68 @@
 | 
				
			||||||
             }
 | 
					             }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
       "isRoot": true
 | 
					       "isRoot": true
 | 
				
			||||||
@@ -57,7 +57,6 @@ Index: opensync-2.0.5.0/interfaces/opensync.ovsschema
 | 
				
			|||||||
+                  "DR",
 | 
					+                  "DR",
 | 
				
			||||||
+                  "BDR",
 | 
					+                  "BDR",
 | 
				
			||||||
+                  "OR",
 | 
					+                  "OR",
 | 
				
			||||||
+                  "WT",
 | 
					 | 
				
			||||||
+                  "NC"
 | 
					+                  "NC"
 | 
				
			||||||
+                ]
 | 
					+                ]
 | 
				
			||||||
+              ]
 | 
					+              ]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
--- a/interfaces/opensync.ovsschema
 | 
					--- a/interfaces/opensync.ovsschema
 | 
				
			||||||
+++ b/interfaces/opensync.ovsschema
 | 
					+++ b/interfaces/opensync.ovsschema
 | 
				
			||||||
@@ -9492,6 +9492,137 @@
 | 
					@@ -9439,6 +9439,110 @@
 | 
				
			||||||
       },
 | 
					       },
 | 
				
			||||||
       "isRoot": true,
 | 
					       "isRoot": true,
 | 
				
			||||||
       "maxRows": 1
 | 
					       "maxRows": 1
 | 
				
			||||||
@@ -52,33 +52,6 @@
 | 
				
			|||||||
+                "max": 1
 | 
					+                "max": 1
 | 
				
			||||||
+              }
 | 
					+              }
 | 
				
			||||||
+            },
 | 
					+            },
 | 
				
			||||||
+            "acct_server": {
 | 
					 | 
				
			||||||
+                "type": {
 | 
					 | 
				
			||||||
+                "key": {
 | 
					 | 
				
			||||||
+                  "type": "string"
 | 
					 | 
				
			||||||
+                },
 | 
					 | 
				
			||||||
+                "min": 0,
 | 
					 | 
				
			||||||
+                "max": 1
 | 
					 | 
				
			||||||
+              }
 | 
					 | 
				
			||||||
+            },
 | 
					 | 
				
			||||||
+            "acct_port": {
 | 
					 | 
				
			||||||
+              "type": {
 | 
					 | 
				
			||||||
+                "key": {
 | 
					 | 
				
			||||||
+                  "type": "integer"
 | 
					 | 
				
			||||||
+                },
 | 
					 | 
				
			||||||
+                "min": 0,
 | 
					 | 
				
			||||||
+                "max": 1
 | 
					 | 
				
			||||||
+              }
 | 
					 | 
				
			||||||
+            },
 | 
					 | 
				
			||||||
+            "acct_secret": {
 | 
					 | 
				
			||||||
+                "type": {
 | 
					 | 
				
			||||||
+                "key": {
 | 
					 | 
				
			||||||
+                  "type": "string"
 | 
					 | 
				
			||||||
+                },
 | 
					 | 
				
			||||||
+                "min": 0,
 | 
					 | 
				
			||||||
+                "max": 1
 | 
					 | 
				
			||||||
+              }
 | 
					 | 
				
			||||||
+            },
 | 
					 | 
				
			||||||
+            "ca_cert": {
 | 
					+            "ca_cert": {
 | 
				
			||||||
+                "type": {
 | 
					+                "type": {
 | 
				
			||||||
+                    "key": {
 | 
					+                    "key": {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +0,0 @@
 | 
				
			|||||||
Index: opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h
 | 
					 | 
				
			||||||
===================================================================
 | 
					 | 
				
			||||||
--- opensync-2.0.5.0.orig/src/lib/schema/inc/schema_consts.h
 | 
					 | 
				
			||||||
+++ opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h
 | 
					 | 
				
			||||||
@@ -155,6 +155,8 @@ typedef enum {
 | 
					 | 
				
			||||||
 #define SCHEMA_CONSTS_IEEE80211k	"ieee80211k"
 | 
					 | 
				
			||||||
 #define SCHEMA_CONSTS_DYNAMIC_VLAN	"dynamic_vlan"
 | 
					 | 
				
			||||||
 #define SCHEMA_CONSTS_RADPROXY	"radproxy"
 | 
					 | 
				
			||||||
+#define SCHEMA_CONSTS_PROXY_ARP		"proxy_arp"
 | 
					 | 
				
			||||||
+#define SCHEMA_CONSTS_MCAST_TO_UCAST	"mcast_to_ucast"
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* radio Custom options */
 | 
					 | 
				
			||||||
 #define SCHEMA_CONSTS_LOCAL_PWR_CONSTRAINT "local_pwr_constraint"
 | 
					 | 
				
			||||||
@@ -1,66 +0,0 @@
 | 
				
			|||||||
Index: opensync-2.0.5.0/interfaces/opensync.ovsschema
 | 
					 | 
				
			||||||
===================================================================
 | 
					 | 
				
			||||||
--- opensync-2.0.5.0.orig/interfaces/opensync.ovsschema
 | 
					 | 
				
			||||||
+++ opensync-2.0.5.0/interfaces/opensync.ovsschema
 | 
					 | 
				
			||||||
@@ -8982,6 +8982,61 @@
 | 
					 | 
				
			||||||
                     "min": 0,
 | 
					 | 
				
			||||||
                     "max": 1
 | 
					 | 
				
			||||||
                 }
 | 
					 | 
				
			||||||
+            },
 | 
					 | 
				
			||||||
+            "noise_floor_thresh": {
 | 
					 | 
				
			||||||
+                "type": {
 | 
					 | 
				
			||||||
+                    "key": {
 | 
					 | 
				
			||||||
+                        "type": "integer",
 | 
					 | 
				
			||||||
+                        "minInteger": -90,
 | 
					 | 
				
			||||||
+                        "maxInteger": -10
 | 
					 | 
				
			||||||
+                    },
 | 
					 | 
				
			||||||
+                    "min": 0,
 | 
					 | 
				
			||||||
+                    "max": 1
 | 
					 | 
				
			||||||
+                }
 | 
					 | 
				
			||||||
+            },
 | 
					 | 
				
			||||||
+            "noise_floor_time": {
 | 
					 | 
				
			||||||
+                "type": {
 | 
					 | 
				
			||||||
+                    "key": {
 | 
					 | 
				
			||||||
+                        "type": "integer",
 | 
					 | 
				
			||||||
+                        "minInteger": 60,
 | 
					 | 
				
			||||||
+                        "maxInteger": 600
 | 
					 | 
				
			||||||
+                    },
 | 
					 | 
				
			||||||
+                    "min": 0,
 | 
					 | 
				
			||||||
+                    "max": 1
 | 
					 | 
				
			||||||
+                }
 | 
					 | 
				
			||||||
+            },
 | 
					 | 
				
			||||||
+            "non_wifi_thresh": {
 | 
					 | 
				
			||||||
+                "type": {
 | 
					 | 
				
			||||||
+                    "key": {
 | 
					 | 
				
			||||||
+                        "type": "integer",
 | 
					 | 
				
			||||||
+                        "minInteger": 0,
 | 
					 | 
				
			||||||
+                        "maxInteger": 100
 | 
					 | 
				
			||||||
+                    },
 | 
					 | 
				
			||||||
+                    "min": 0,
 | 
					 | 
				
			||||||
+                    "max": 1
 | 
					 | 
				
			||||||
+                }
 | 
					 | 
				
			||||||
+            },
 | 
					 | 
				
			||||||
+            "non_wifi_time": {
 | 
					 | 
				
			||||||
+                "type": {
 | 
					 | 
				
			||||||
+                    "key": {
 | 
					 | 
				
			||||||
+                        "type": "integer",
 | 
					 | 
				
			||||||
+                        "minInteger": 60,
 | 
					 | 
				
			||||||
+                        "maxInteger": 600
 | 
					 | 
				
			||||||
+                    },
 | 
					 | 
				
			||||||
+                    "min": 0,
 | 
					 | 
				
			||||||
+                    "max": 1
 | 
					 | 
				
			||||||
+                }
 | 
					 | 
				
			||||||
+            },
 | 
					 | 
				
			||||||
+            "obss_hop_mode": {
 | 
					 | 
				
			||||||
+                "type": {
 | 
					 | 
				
			||||||
+                    "key": {
 | 
					 | 
				
			||||||
+                        "type": "integer",
 | 
					 | 
				
			||||||
+                        "minInteger": 1,
 | 
					 | 
				
			||||||
+                        "maxInteger": 2
 | 
					 | 
				
			||||||
+                    },
 | 
					 | 
				
			||||||
+                    "min": 0,
 | 
					 | 
				
			||||||
+                    "max": 1
 | 
					 | 
				
			||||||
+                }
 | 
					 | 
				
			||||||
             }
 | 
					 | 
				
			||||||
         },
 | 
					 | 
				
			||||||
         "isRoot": true
 | 
					 | 
				
			||||||
@@ -215,7 +215,6 @@ pid_t cmd_handler_tcpdump_wifi(struct task *task)
 | 
				
			|||||||
	char *argv[] = { "/usr/sbin/tcpdump", "-c", "1000", "-G", duration, "-W", "1", "-w", pcap, "-i", phy, NULL };
 | 
						char *argv[] = { "/usr/sbin/tcpdump", "-c", "1000", "-G", duration, "-W", "1", "-w", pcap, "-i", phy, NULL };
 | 
				
			||||||
	char iw[128];
 | 
						char iw[128];
 | 
				
			||||||
	pid_t pid;
 | 
						pid_t pid;
 | 
				
			||||||
	int ret = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	task->arg = SCHEMA_KEY_VAL(task->conf.payload, "wifi");
 | 
						task->arg = SCHEMA_KEY_VAL(task->conf.payload, "wifi");
 | 
				
			||||||
	if (!task->arg) {
 | 
						if (!task->arg) {
 | 
				
			||||||
@@ -226,23 +225,15 @@ pid_t cmd_handler_tcpdump_wifi(struct task *task)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	blob_buf_init(&b, 0);
 | 
						blob_buf_init(&b, 0);
 | 
				
			||||||
	uci = uci_alloc_context();
 | 
						uci = uci_alloc_context();
 | 
				
			||||||
 | 
						uci_load(uci, "wireless", &p);
 | 
				
			||||||
	ret = uci_load(uci, "wireless", &p);
 | 
					 | 
				
			||||||
	if (ret) {
 | 
					 | 
				
			||||||
		LOGE("%s: uci_load() failed with rc %d", __func__, ret);
 | 
					 | 
				
			||||||
		uci_free_context(uci);
 | 
					 | 
				
			||||||
		return -1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	s = uci_lookup_section(uci, p, task->arg);
 | 
						s = uci_lookup_section(uci, p, task->arg);
 | 
				
			||||||
        if (!s) {
 | 
					        if (!s) {
 | 
				
			||||||
		task_status(task, TASK_FAILED, "unknown wifi");
 | 
							task_status(task, TASK_FAILED, "unknown wifi");
 | 
				
			||||||
		uci_unload(uci, p);
 | 
					 | 
				
			||||||
		uci_free_context(uci);
 | 
							uci_free_context(uci);
 | 
				
			||||||
                return -1;
 | 
					                return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        uci_to_blob(&b, s, &phy_param);
 | 
					        uci_to_blob(&b, s, &phy_param);
 | 
				
			||||||
	uci_unload(uci, p);
 | 
					 | 
				
			||||||
	uci_free_context(uci);
 | 
						uci_free_context(uci);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	blobmsg_parse(phy_policy, __PHY_ATTR_MAX, tb, blob_data(b.head), blob_len(b.head));
 | 
						blobmsg_parse(phy_policy, __PHY_ATTR_MAX, tb, blob_data(b.head), blob_len(b.head));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -88,14 +88,9 @@ static void syslog_state(int config)
 | 
				
			|||||||
	struct uci_element *e = NULL;
 | 
						struct uci_element *e = NULL;
 | 
				
			||||||
	struct uci_section *s = NULL;
 | 
						struct uci_section *s = NULL;
 | 
				
			||||||
	char val[128];
 | 
						char val[128];
 | 
				
			||||||
	int ret = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	blob_buf_init(&b, 0);
 | 
						blob_buf_init(&b, 0);
 | 
				
			||||||
	ret = uci_load(uci, "system", &system);
 | 
						uci_load(uci, "system", &system);
 | 
				
			||||||
	if (ret) {
 | 
					 | 
				
			||||||
		LOGE("%s: uci_load() failed with rc %d", __func__, ret);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	uci_foreach_element(&system->sections, e) {
 | 
						uci_foreach_element(&system->sections, e) {
 | 
				
			||||||
		s = uci_to_section(e);
 | 
							s = uci_to_section(e);
 | 
				
			||||||
		if (!strcmp(s->type, "system"))
 | 
							if (!strcmp(s->type, "system"))
 | 
				
			||||||
@@ -184,20 +179,14 @@ static void ntp_state(int config)
 | 
				
			|||||||
        struct uci_section *s;
 | 
					        struct uci_section *s;
 | 
				
			||||||
	struct blob_attr *cur = NULL;
 | 
						struct blob_attr *cur = NULL;
 | 
				
			||||||
	char val[128] = {};
 | 
						char val[128] = {};
 | 
				
			||||||
	int first = 1, rem = 0, ret = 0;
 | 
						int first = 1, rem = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	blob_buf_init(&b, 0);
 | 
						blob_buf_init(&b, 0);
 | 
				
			||||||
	ret = uci_load(uci, "system", &p);
 | 
						uci_load(uci, "system", &p);
 | 
				
			||||||
	if (ret) {
 | 
					 | 
				
			||||||
		LOGE("%s: uci_load() failed with rc %d", __func__, ret);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	s = uci_lookup_section(uci, p, "ntp");
 | 
						s = uci_lookup_section(uci, p, "ntp");
 | 
				
			||||||
	if (!s) {
 | 
						if (!s)
 | 
				
			||||||
		uci_unload(uci, p);
 | 
					 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uci_to_blob(&b, s, &ntp_param);
 | 
						uci_to_blob(&b, s, &ntp_param);
 | 
				
			||||||
	blobmsg_parse(ntp_policy, __NTP_ATTR_MAX, tb, blob_data(b.head), blob_len(b.head));
 | 
						blobmsg_parse(ntp_policy, __NTP_ATTR_MAX, tb, blob_data(b.head), blob_len(b.head));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,5 @@ void vif_hs20_update(struct schema_Hotspot20_Config *hs2conf);
 | 
				
			|||||||
void vif_hs20_osu_update(struct schema_Hotspot20_OSU_Providers *hs2osuconf);
 | 
					void vif_hs20_osu_update(struct schema_Hotspot20_OSU_Providers *hs2osuconf);
 | 
				
			||||||
void vif_hs20_icon_update(struct schema_Hotspot20_Icon_Config *hs2iconconf);
 | 
					void vif_hs20_icon_update(struct schema_Hotspot20_Icon_Config *hs2iconconf);
 | 
				
			||||||
void vif_section_del(char *section_name);
 | 
					void vif_section_del(char *section_name);
 | 
				
			||||||
void vif_check_radius_proxy(void);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -501,30 +501,26 @@ void opennds_parameters(char *ifname)
 | 
				
			|||||||
void opennds_section_del(char *section_name)
 | 
					void opennds_section_del(char *section_name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct uci_package *opennds;
 | 
						struct uci_package *opennds;
 | 
				
			||||||
	struct uci_context *nds_ctx;
 | 
					 | 
				
			||||||
	struct uci_element *e = NULL, *tmp = NULL;
 | 
						struct uci_element *e = NULL, *tmp = NULL;
 | 
				
			||||||
	int ret=0;
 | 
						int ret=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	nds_ctx = uci_alloc_context();
 | 
						ret= uci_load(uci, "opennds", &opennds);
 | 
				
			||||||
	ret = uci_load(nds_ctx, "opennds", &opennds);
 | 
					 | 
				
			||||||
	if (ret) {
 | 
						if (ret) {
 | 
				
			||||||
		LOGE("%s: %s uci_load() failed with rc %d", section_name, __func__, ret);
 | 
							LOGD("%s: uci_load() failed with rc %d", section_name, ret);
 | 
				
			||||||
		uci_free_context(nds_ctx);
 | 
					 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uci_foreach_element_safe(&opennds->sections, tmp, e) {
 | 
						uci_foreach_element_safe(&opennds->sections, tmp, e) {
 | 
				
			||||||
		struct uci_section *s = uci_to_section(e);
 | 
							struct uci_section *s = uci_to_section(e);
 | 
				
			||||||
		if (!strcmp(s->e.name, section_name)) {
 | 
							if (!strcmp(s->e.name, section_name)) {
 | 
				
			||||||
			uci_section_del(nds_ctx, "vif", "opennds", (char *)s->e.name, section_name);
 | 
								uci_section_del(uci, "vif", "opennds", (char *)s->e.name, section_name);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else {
 | 
							else {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						uci_commit(uci, &opennds, false);
 | 
				
			||||||
	uci_commit(nds_ctx, &opennds, false);
 | 
						uci_unload(uci, opennds);
 | 
				
			||||||
	uci_unload(nds_ctx, opennds);
 | 
						reload_config = 1;
 | 
				
			||||||
	uci_free_context(nds_ctx);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void vif_captive_portal_set(const struct schema_Wifi_VIF_Config *vconf, char *ifname)
 | 
					void vif_captive_portal_set(const struct schema_Wifi_VIF_Config *vconf, char *ifname)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,12 +31,10 @@
 | 
				
			|||||||
ovsdb_table_t table_Hotspot20_Config;
 | 
					ovsdb_table_t table_Hotspot20_Config;
 | 
				
			||||||
ovsdb_table_t table_Hotspot20_OSU_Providers;
 | 
					ovsdb_table_t table_Hotspot20_OSU_Providers;
 | 
				
			||||||
ovsdb_table_t table_Hotspot20_Icon_Config;
 | 
					ovsdb_table_t table_Hotspot20_Icon_Config;
 | 
				
			||||||
ovsdb_table_t table_Radius_Proxy_Config;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
ovsdb_table_t table_APC_Config;
 | 
					ovsdb_table_t table_APC_Config;
 | 
				
			||||||
ovsdb_table_t table_APC_State;
 | 
					ovsdb_table_t table_APC_State;
 | 
				
			||||||
unsigned int radproxy_apc = 0;
 | 
					unsigned int radproxy_apc;
 | 
				
			||||||
extern json_t* ovsdb_table_where(ovsdb_table_t *table, void *record);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct uci_package *wireless;
 | 
					static struct uci_package *wireless;
 | 
				
			||||||
struct uci_context *uci;
 | 
					struct uci_context *uci;
 | 
				
			||||||
@@ -447,7 +445,6 @@ static void periodic_task(void *arg)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	static int counter = 0;
 | 
						static int counter = 0;
 | 
				
			||||||
	struct uci_element *e = NULL, *tmp = NULL;
 | 
						struct uci_element *e = NULL, *tmp = NULL;
 | 
				
			||||||
	int ret = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((counter % 15) && !reload_config)
 | 
						if ((counter % 15) && !reload_config)
 | 
				
			||||||
		goto done;
 | 
							goto done;
 | 
				
			||||||
@@ -464,19 +461,16 @@ static void periodic_task(void *arg)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (reload_config) {
 | 
						if (reload_config) {
 | 
				
			||||||
		LOGD("periodic: reload_config");
 | 
							LOGT("periodic: reload config");
 | 
				
			||||||
		reload_config = 0;
 | 
							reload_config = 0;
 | 
				
			||||||
		uci_commit_all(uci);
 | 
							uci_commit_all(uci);
 | 
				
			||||||
		sync();
 | 
							sync();
 | 
				
			||||||
		system("reload_config");
 | 
							system("reload_config");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	LOGD("periodic: start state update ");
 | 
						LOGT("periodic: start state update ");
 | 
				
			||||||
	ret = uci_load(uci, "wireless", &wireless);
 | 
					
 | 
				
			||||||
	if (ret) {
 | 
						uci_load(uci, "wireless", &wireless);
 | 
				
			||||||
		LOGE("%s: uci_load() failed with rc %d", __func__, ret);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	uci_foreach_element_safe(&wireless->sections, tmp, e) {
 | 
						uci_foreach_element_safe(&wireless->sections, tmp, e) {
 | 
				
			||||||
		struct uci_section *s = uci_to_section(e);
 | 
							struct uci_section *s = uci_to_section(e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -491,7 +485,7 @@ static void periodic_task(void *arg)
 | 
				
			|||||||
			vif_state_update(s, NULL);
 | 
								vif_state_update(s, NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uci_unload(uci, wireless);
 | 
						uci_unload(uci, wireless);
 | 
				
			||||||
	LOGD("periodic: stop state update ");
 | 
						LOGT("periodic: stop state update ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
done:
 | 
					done:
 | 
				
			||||||
	counter++;
 | 
						counter++;
 | 
				
			||||||
@@ -697,34 +691,43 @@ const struct uci_blob_param_list apc_param = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void APC_config_update(struct schema_APC_Config *conf)
 | 
					void APC_config_update(struct schema_APC_Config *conf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct uci_package *apc;
 | 
				
			||||||
	struct blob_buf apcb = { };
 | 
						struct blob_buf apcb = { };
 | 
				
			||||||
	struct uci_context *apc_uci;
 | 
						int rc = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	apc_uci = uci_alloc_context();
 | 
						LOGD("APC: APC_config_update");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rc = uci_load(uci, "apc", &apc);
 | 
				
			||||||
 | 
						if (rc)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LOGD("%s: uci_load failed with rc %d", __func__, rc);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	blob_buf_init(&apcb, 0);
 | 
						blob_buf_init(&apcb, 0);
 | 
				
			||||||
	if (conf && conf->enabled == true) {
 | 
					
 | 
				
			||||||
 | 
					 	if (conf->enabled_changed) {
 | 
				
			||||||
 | 
							if (conf->enabled == true) {
 | 
				
			||||||
			blobmsg_add_bool(&apcb, "enabled", 1);
 | 
								blobmsg_add_bool(&apcb, "enabled", 1);
 | 
				
			||||||
			system("/etc/init.d/apc start");
 | 
								system("/etc/init.d/apc start");
 | 
				
			||||||
	} else {
 | 
							}
 | 
				
			||||||
 | 
							else {
 | 
				
			||||||
			blobmsg_add_bool(&apcb, "enabled", 0);
 | 
								blobmsg_add_bool(&apcb, "enabled", 0);
 | 
				
			||||||
			system("/etc/init.d/apc stop");
 | 
								system("/etc/init.d/apc stop");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	blob_to_uci_section(apc_uci, "apc", "apc", "apc",
 | 
					        blob_to_uci_section(uci, "apc", "apc", "apc",
 | 
				
			||||||
                            apcb.head, &apc_param, NULL);
 | 
					                            apcb.head, &apc_param, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uci_commit_all(apc_uci);
 | 
						uci_commit(uci, &apc, false);
 | 
				
			||||||
	uci_free_context(apc_uci);
 | 
						uci_unload(uci, apc);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void callback_APC_Config(ovsdb_update_monitor_t *mon,
 | 
					static void callback_APC_Config(ovsdb_update_monitor_t *mon,
 | 
				
			||||||
                                struct schema_APC_Config *old,
 | 
					                                struct schema_APC_Config *old,
 | 
				
			||||||
                                struct schema_APC_Config *conf)
 | 
					                                struct schema_APC_Config *conf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (mon->mon_type == OVSDB_UPDATE_DEL)
 | 
						if (mon->mon_type != OVSDB_UPDATE_DEL)
 | 
				
			||||||
		APC_config_update(NULL);
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		APC_config_update(conf);
 | 
							APC_config_update(conf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -744,10 +747,6 @@ static void callback_APC_State(ovsdb_update_monitor_t *mon,
 | 
				
			|||||||
		radproxy_apc = 0;
 | 
							radproxy_apc = 0;
 | 
				
			||||||
		system("ubus call service event '{\"type\": \"config.change\", \"data\": { \"package\": \"wireless\" }}'");
 | 
							system("ubus call service event '{\"type\": \"config.change\", \"data\": { \"package\": \"wireless\" }}'");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* APC changed: start / stop radius proxy service if needed */
 | 
					 | 
				
			||||||
	vif_check_radius_proxy();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct schema_APC_State apc_state;
 | 
					struct schema_APC_State apc_state;
 | 
				
			||||||
@@ -781,12 +780,12 @@ void apc_state_set(struct blob_attr *msg)
 | 
				
			|||||||
			       blobmsg_get_string(tb[APC_ATTR_MODE]));
 | 
								       blobmsg_get_string(tb[APC_ATTR_MODE]));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (tb[APC_ATTR_DR_ADDR]) {
 | 
						if (tb[APC_ATTR_DR_ADDR]) {
 | 
				
			||||||
		LOGD("APC dr-addr: %s", blobmsg_get_string(tb[APC_ATTR_DR_ADDR]));
 | 
							LOGD("APC br-addr: %s", blobmsg_get_string(tb[APC_ATTR_DR_ADDR]));
 | 
				
			||||||
		SCHEMA_SET_STR(apc_state.dr_addr,
 | 
							SCHEMA_SET_STR(apc_state.dr_addr,
 | 
				
			||||||
			       blobmsg_get_string(tb[APC_ATTR_DR_ADDR]));
 | 
								       blobmsg_get_string(tb[APC_ATTR_DR_ADDR]));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (tb[APC_ATTR_BDR_ADDR]) {
 | 
						if (tb[APC_ATTR_BDR_ADDR]) {
 | 
				
			||||||
		LOGD("APC bdr-addr: %s", blobmsg_get_string(tb[APC_ATTR_BDR_ADDR]));
 | 
							LOGD("APC dbr-addr: %s", blobmsg_get_string(tb[APC_ATTR_BDR_ADDR]));
 | 
				
			||||||
		SCHEMA_SET_STR(apc_state.bdr_addr,
 | 
							SCHEMA_SET_STR(apc_state.bdr_addr,
 | 
				
			||||||
			       blobmsg_get_string(tb[APC_ATTR_BDR_ADDR]));
 | 
								       blobmsg_get_string(tb[APC_ATTR_BDR_ADDR]));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -800,120 +799,21 @@ void apc_state_set(struct blob_attr *msg)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	LOGI("APC_state Updating: mode: %s, dr-addr: %s bdr-addr: %s", 
 | 
						LOGD("APC_state Updating");
 | 
				
			||||||
	     apc_state.mode, apc_state.dr_addr, apc_state.bdr_addr);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (!ovsdb_table_update(&table_APC_State, &apc_state))
 | 
						if (!ovsdb_table_update(&table_APC_State, &apc_state))
 | 
				
			||||||
		LOG(ERR, "APC_state: failed to update");
 | 
							LOG(ERR, "APC_state: failed to update");
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ovsdb_table_t table_Manager;
 | 
					 | 
				
			||||||
static int conn_since = 0;
 | 
					 | 
				
			||||||
#define APC_CLOUD_MON_PERIOD 60
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void apc_enable(bool flag) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	SCHEMA_SET_INT(apc_conf.enabled, flag);
 | 
					 | 
				
			||||||
	if (!ovsdb_table_update(&table_APC_Config, &apc_conf)) {
 | 
					 | 
				
			||||||
		LOG(ERR, "%s:APC_Config: failed to update", __func__);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	LOGI("APC %s: %s APC", __func__, flag?"enable":"disable");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
apc_cld_mon_cb(struct schema_Manager *mgr)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int i = 0;
 | 
					 | 
				
			||||||
	conn_since = 0;
 | 
					 | 
				
			||||||
	struct schema_APC_State apc_state;
 | 
					 | 
				
			||||||
	json_t *where;
 | 
					 | 
				
			||||||
	int ret = 0;
 | 
					 | 
				
			||||||
	int link = 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	where = ovsdb_table_where(&table_APC_State, &apc_state);
 | 
					 | 
				
			||||||
	if (false == ovsdb_table_select_one_where(&table_APC_State,
 | 
					 | 
				
			||||||
						  where, &apc_state)) {
 | 
					 | 
				
			||||||
		LOG(ERR, "%s: APC_State read failed", __func__);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*Checks if wan ethernet port is down and disables apc*/
 | 
					 | 
				
			||||||
	ret = system("/bin/check_wan_link.sh");
 | 
					 | 
				
			||||||
	if (WIFEXITED(ret)) {
 | 
					 | 
				
			||||||
		LOGI("The return value: %d\n", WEXITSTATUS(ret));
 | 
					 | 
				
			||||||
		link = WEXITSTATUS(ret);
 | 
					 | 
				
			||||||
		if (link == 0) {
 | 
					 | 
				
			||||||
			apc_enable(false);
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*if cloud conn is false then disable apc*/
 | 
					 | 
				
			||||||
	if (mgr->is_connected == false) {
 | 
					 | 
				
			||||||
			apc_enable(false);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else {
 | 
					 | 
				
			||||||
		for(i=0; i < mgr->status_len; i++) {
 | 
					 | 
				
			||||||
			if(!strncmp(mgr->status_keys[i] , "sec_since_connect",
 | 
					 | 
				
			||||||
					       strlen("sec_since_connect"))) {
 | 
					 | 
				
			||||||
				conn_since = atoi(mgr->status[i]);
 | 
					 | 
				
			||||||
				LOGI("conn_since: %d", conn_since);
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/*if the APC was stopped earlier, start it if connection good
 | 
					 | 
				
			||||||
		 * for atleast 60 secs*/
 | 
					 | 
				
			||||||
		if (!apc_state.enabled && conn_since > APC_CLOUD_MON_PERIOD) {
 | 
					 | 
				
			||||||
			apc_enable(true);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*Monitor the cloud connection*/
 | 
					 | 
				
			||||||
static void callback_Manager(ovsdb_update_monitor_t *mon,
 | 
					 | 
				
			||||||
			     struct schema_Manager *old,
 | 
					 | 
				
			||||||
			     struct schema_Manager *conf)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	switch (mon->mon_type)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	case OVSDB_UPDATE_NEW:
 | 
					 | 
				
			||||||
	case OVSDB_UPDATE_MODIFY:
 | 
					 | 
				
			||||||
		apc_cld_mon_cb(conf);
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	case OVSDB_UPDATE_DEL:
 | 
					 | 
				
			||||||
		apc_enable(false);
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	default:
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void cloud_disconn_mon(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	OVSDB_TABLE_INIT_NO_KEY(Manager);
 | 
					 | 
				
			||||||
	OVSDB_TABLE_MONITOR(Manager, false);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void apc_init()
 | 
					void apc_init()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* APC Config */
 | 
						/* APC Config */
 | 
				
			||||||
	OVSDB_TABLE_INIT_NO_KEY(APC_Config);
 | 
						OVSDB_TABLE_INIT(APC_Config, _uuid);
 | 
				
			||||||
	OVSDB_TABLE_MONITOR(APC_Config, false);
 | 
						OVSDB_TABLE_MONITOR(APC_Config, false);
 | 
				
			||||||
	/* Disable APC by default, enable when cloud connected*/
 | 
						SCHEMA_SET_INT(apc_conf.enabled, true);
 | 
				
			||||||
	SCHEMA_SET_INT(apc_conf.enabled, false);
 | 
					 | 
				
			||||||
	LOGI("APC state/config Initialize");
 | 
						LOGI("APC state/config Initialize");
 | 
				
			||||||
	if (!ovsdb_table_insert(&table_APC_Config, &apc_conf)) {
 | 
						if (!ovsdb_table_insert(&table_APC_Config, &apc_conf))
 | 
				
			||||||
		LOG(ERR, "APC_Config: failed to initialize");
 | 
							LOG(ERR, "APC_Config: failed to initialize");
 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* APC State */
 | 
						/* APC State */
 | 
				
			||||||
	OVSDB_TABLE_INIT_NO_KEY(APC_State);
 | 
						OVSDB_TABLE_INIT_NO_KEY(APC_State);
 | 
				
			||||||
@@ -922,16 +822,8 @@ void apc_init()
 | 
				
			|||||||
	SCHEMA_SET_STR(apc_state.dr_addr, "0.0.0.0");
 | 
						SCHEMA_SET_STR(apc_state.dr_addr, "0.0.0.0");
 | 
				
			||||||
	SCHEMA_SET_STR(apc_state.bdr_addr, "0.0.0.0");
 | 
						SCHEMA_SET_STR(apc_state.bdr_addr, "0.0.0.0");
 | 
				
			||||||
	SCHEMA_SET_INT(apc_state.enabled, false);
 | 
						SCHEMA_SET_INT(apc_state.enabled, false);
 | 
				
			||||||
	if (!ovsdb_table_insert(&table_APC_State, &apc_state)) {
 | 
						if (!ovsdb_table_insert(&table_APC_State, &apc_state))
 | 
				
			||||||
		LOG(ERR, "APC_state: failed to initialize");
 | 
							LOG(ERR, "APC_state: failed to initialize");
 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Cloud connection monitor - if cloud unreachable
 | 
					 | 
				
			||||||
	 * for certain time, disable APC and enable after the
 | 
					 | 
				
			||||||
	 * cloud connection becomes stable. */
 | 
					 | 
				
			||||||
	cloud_disconn_mon();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool target_radio_init(const struct target_radio_ops *ops)
 | 
					bool target_radio_init(const struct target_radio_ops *ops)
 | 
				
			||||||
@@ -962,12 +854,12 @@ bool target_radio_init(const struct target_radio_ops *ops)
 | 
				
			|||||||
	OVSDB_TABLE_INIT(Radius_Proxy_Config, _uuid);
 | 
						OVSDB_TABLE_INIT(Radius_Proxy_Config, _uuid);
 | 
				
			||||||
	OVSDB_TABLE_MONITOR(Radius_Proxy_Config, false);
 | 
						OVSDB_TABLE_MONITOR(Radius_Proxy_Config, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						apc_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	evsched_task(&periodic_task, NULL, EVSCHED_SEC(5));
 | 
						evsched_task(&periodic_task, NULL, EVSCHED_SEC(5));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	radio_nl80211_init();
 | 
						radio_nl80211_init();
 | 
				
			||||||
	radio_ubus_init();
 | 
						radio_ubus_init();
 | 
				
			||||||
	apc_init();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clock_gettime(CLOCK_MONOTONIC, &startup_time);
 | 
						clock_gettime(CLOCK_MONOTONIC, &startup_time);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,8 +50,7 @@
 | 
				
			|||||||
extern struct ev_loop *wifihal_evloop;
 | 
					extern struct ev_loop *wifihal_evloop;
 | 
				
			||||||
extern ovsdb_table_t table_Wifi_VIF_State;
 | 
					extern ovsdb_table_t table_Wifi_VIF_State;
 | 
				
			||||||
extern ovsdb_table_t table_Wifi_Associated_Clients;
 | 
					extern ovsdb_table_t table_Wifi_Associated_Clients;
 | 
				
			||||||
static struct unl unl_req;
 | 
					static struct unl unl;
 | 
				
			||||||
static struct unl unl_notify;
 | 
					 | 
				
			||||||
static ev_io unl_io;
 | 
					static ev_io unl_io;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int avl_addrcmp(const void *k1, const void *k2, void *ptr)
 | 
					static int avl_addrcmp(const void *k1, const void *k2, void *ptr)
 | 
				
			||||||
@@ -472,10 +471,10 @@ int nl80211_channel_get(char *name, unsigned int *chan)
 | 
				
			|||||||
	if (!idx)
 | 
						if (!idx)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	msg = unl_genl_msg(&unl_req, NL80211_CMD_GET_INTERFACE, true);
 | 
						msg = unl_genl_msg(&unl, NL80211_CMD_GET_INTERFACE, true);
 | 
				
			||||||
	nla_put_u32(msg, NL80211_ATTR_IFINDEX, idx);
 | 
						nla_put_u32(msg, NL80211_ATTR_IFINDEX, idx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	unl_genl_request(&unl_req, msg, nl80211_channel_recv, chan);
 | 
						unl_genl_request(&unl, msg, nl80211_channel_recv, chan);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	phy->current_channel = *chan;
 | 
						phy->current_channel = *chan;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -563,7 +562,7 @@ static void nl80211_ev(struct ev_loop *ev, struct ev_io *io, int event)
 | 
				
			|||||||
	nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, NULL);
 | 
						nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, NULL);
 | 
				
			||||||
	nl_cb_set(cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL);
 | 
						nl_cb_set(cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL);
 | 
				
			||||||
	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, nl80211_recv, NULL);
 | 
						nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, nl80211_recv, NULL);
 | 
				
			||||||
	nl_recvmsgs(unl_notify.sock, cb);
 | 
						nl_recvmsgs(unl.sock, cb);
 | 
				
			||||||
	nl_cb_put(cb);
 | 
						nl_cb_put(cb);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -581,33 +580,24 @@ int radio_nl80211_init(void)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	struct nl_msg *msg;
 | 
						struct nl_msg *msg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (unl_genl_init(&unl_req, "nl80211") < 0) {
 | 
						if (unl_genl_init(&unl, "nl80211") < 0) {
 | 
				
			||||||
		syslog(0, "nl80211: failed to connect\n");
 | 
							syslog(0, "nl80211: failed to connect\n");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (unl_genl_init(&unl_notify, "nl80211") < 0) {
 | 
						msg = unl_genl_msg(&unl, NL80211_CMD_GET_WIPHY, true);
 | 
				
			||||||
		syslog(0, "nl80211: failed to connect\n");
 | 
						unl_genl_request(&unl, msg, nl80211_recv, NULL);
 | 
				
			||||||
		return -1;
 | 
						msg = unl_genl_msg(&unl, NL80211_CMD_GET_INTERFACE, true);
 | 
				
			||||||
	}
 | 
						unl_genl_request(&unl, msg, nl80211_recv, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	msg = unl_genl_msg(&unl_req, NL80211_CMD_GET_WIPHY, true);
 | 
						unl_genl_subscribe(&unl, "config");
 | 
				
			||||||
	unl_genl_request(&unl_req, msg, nl80211_recv, NULL);
 | 
						unl_genl_subscribe(&unl, "mlme");
 | 
				
			||||||
	msg = unl_genl_msg(&unl_req, NL80211_CMD_GET_INTERFACE, true);
 | 
						unl_genl_subscribe(&unl, "vendor");
 | 
				
			||||||
	unl_genl_request(&unl_req, msg, nl80211_recv, NULL);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	unl_genl_subscribe(&unl_notify, "config");
 | 
						if (nl_socket_set_buffer_size(unl.sock, 262144, 0) < 0)
 | 
				
			||||||
	unl_genl_subscribe(&unl_notify, "mlme");
 | 
					 | 
				
			||||||
	unl_genl_subscribe(&unl_notify, "vendor");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (nl_socket_set_buffer_size(unl_notify.sock, 262144, 0) < 0)
 | 
					 | 
				
			||||||
		LOGE("radio_nl80211: Failed to set nl socket buffer size");
 | 
							LOGE("radio_nl80211: Failed to set nl socket buffer size");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (nl_socket_set_nonblocking(unl_notify.sock))
 | 
						ev_io_init(&unl_io, nl80211_ev, unl.sock->s_fd, EV_READ);
 | 
				
			||||||
		LOGE("radio_nl80211: Failed to set socket in the non blocking mode");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ev_io_init(&unl_io, nl80211_ev, unl_notify.sock->s_fd, EV_READ);
 | 
					 | 
				
			||||||
        ev_io_start(wifihal_evloop, &unl_io);
 | 
					        ev_io_start(wifihal_evloop, &unl_io);
 | 
				
			||||||
	evsched_task(&vif_poll_stations, NULL, EVSCHED_SEC(5));
 | 
						evsched_task(&vif_poll_stations, NULL, EVSCHED_SEC(5));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,7 @@
 | 
				
			|||||||
#include "utils.h"
 | 
					#include "utils.h"
 | 
				
			||||||
#include "radius_proxy.h"
 | 
					#include "radius_proxy.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ovsdb_table_t table_Radius_Proxy_Config;
 | 
				
			||||||
struct blob_buf uci_buf = {};
 | 
					struct blob_buf uci_buf = {};
 | 
				
			||||||
struct blob_attr *n;
 | 
					struct blob_attr *n;
 | 
				
			||||||
extern ovsdb_table_t table_APC_State;
 | 
					extern ovsdb_table_t table_APC_State;
 | 
				
			||||||
@@ -34,13 +35,11 @@ extern json_t* ovsdb_table_where(ovsdb_table_t *table, void *record);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
	RADIUS_PROXY_OPTIONS_LISTEN_UDP,
 | 
						RADIUS_PROXY_OPTIONS_LISTEN_UDP,
 | 
				
			||||||
	RADIUS_PROXY_OPTIONS_NAME,
 | 
					 | 
				
			||||||
	__RADIUS_PROXY_OPTIONS_MAX
 | 
						__RADIUS_PROXY_OPTIONS_MAX
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
	RADIUS_PROXY_CLIENT_NAME,
 | 
						RADIUS_PROXY_CLIENT_NAME,
 | 
				
			||||||
	RADIUS_PROXY_CLIENT_HOST,
 | 
					 | 
				
			||||||
	RADIUS_PROXY_CLIENT_TYPE,
 | 
						RADIUS_PROXY_CLIENT_TYPE,
 | 
				
			||||||
	RADIUS_PROXY_CLIENT_SECRET,
 | 
						RADIUS_PROXY_CLIENT_SECRET,
 | 
				
			||||||
	__RADIUS_PROXY_CLIENT_MAX
 | 
						__RADIUS_PROXY_CLIENT_MAX
 | 
				
			||||||
@@ -48,10 +47,8 @@ enum {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
	RADIUS_PROXY_SERVER_NAME,
 | 
						RADIUS_PROXY_SERVER_NAME,
 | 
				
			||||||
	RADIUS_PROXY_SERVER_HOST,
 | 
					 | 
				
			||||||
	RADIUS_PROXY_SERVER_TYPE,
 | 
						RADIUS_PROXY_SERVER_TYPE,
 | 
				
			||||||
	RADIUS_PROXY_SERVER_SECRET,
 | 
						RADIUS_PROXY_SERVER_SECRET,
 | 
				
			||||||
	RADIUS_PROXY_SERVER_PORT,
 | 
					 | 
				
			||||||
	RADIUS_PROXY_SERVER_STATUS,
 | 
						RADIUS_PROXY_SERVER_STATUS,
 | 
				
			||||||
	RADIUS_PROXY_SERVER_TLS,
 | 
						RADIUS_PROXY_SERVER_TLS,
 | 
				
			||||||
	RADIUS_PROXY_SERVER_CERT_NAME_CHECK,
 | 
						RADIUS_PROXY_SERVER_CERT_NAME_CHECK,
 | 
				
			||||||
@@ -77,12 +74,10 @@ enum {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static const struct blobmsg_policy radius_proxy_options_policy[__RADIUS_PROXY_OPTIONS_MAX] = {
 | 
					static const struct blobmsg_policy radius_proxy_options_policy[__RADIUS_PROXY_OPTIONS_MAX] = {
 | 
				
			||||||
		[RADIUS_PROXY_OPTIONS_LISTEN_UDP] = { .name = "ListenUDP", BLOBMSG_TYPE_ARRAY },
 | 
							[RADIUS_PROXY_OPTIONS_LISTEN_UDP] = { .name = "ListenUDP", BLOBMSG_TYPE_ARRAY },
 | 
				
			||||||
		[RADIUS_PROXY_OPTIONS_NAME] = { .name = "name", BLOBMSG_TYPE_STRING },
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct blobmsg_policy radius_proxy_client_policy[__RADIUS_PROXY_CLIENT_MAX] = {
 | 
					static const struct blobmsg_policy radius_proxy_client_policy[__RADIUS_PROXY_CLIENT_MAX] = {
 | 
				
			||||||
		[RADIUS_PROXY_CLIENT_NAME] = { .name = "name", BLOBMSG_TYPE_STRING },
 | 
							[RADIUS_PROXY_CLIENT_NAME] = { .name = "name", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
		[RADIUS_PROXY_CLIENT_HOST] = { .name = "host", BLOBMSG_TYPE_STRING },
 | 
					 | 
				
			||||||
		[RADIUS_PROXY_CLIENT_TYPE] = { .name = "type", BLOBMSG_TYPE_STRING },
 | 
							[RADIUS_PROXY_CLIENT_TYPE] = { .name = "type", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
		[RADIUS_PROXY_CLIENT_SECRET] = { .name = "secret", BLOBMSG_TYPE_STRING },
 | 
							[RADIUS_PROXY_CLIENT_SECRET] = { .name = "secret", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -97,10 +92,8 @@ static const struct blobmsg_policy radius_proxy_tls_policy[__RADIUS_PROXY_TLS_MA
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static const struct blobmsg_policy radius_proxy_server_policy[__RADIUS_PROXY_SERVER_MAX] = {
 | 
					static const struct blobmsg_policy radius_proxy_server_policy[__RADIUS_PROXY_SERVER_MAX] = {
 | 
				
			||||||
		[RADIUS_PROXY_SERVER_NAME] = { .name = "name", BLOBMSG_TYPE_STRING },
 | 
							[RADIUS_PROXY_SERVER_NAME] = { .name = "name", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
		[RADIUS_PROXY_SERVER_HOST] = { .name = "host", BLOBMSG_TYPE_STRING },
 | 
					 | 
				
			||||||
		[RADIUS_PROXY_SERVER_TYPE] = { .name = "type", BLOBMSG_TYPE_STRING },
 | 
							[RADIUS_PROXY_SERVER_TYPE] = { .name = "type", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
		[RADIUS_PROXY_SERVER_SECRET] = { .name = "secret", BLOBMSG_TYPE_STRING },
 | 
							[RADIUS_PROXY_SERVER_SECRET] = { .name = "secret", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
		[RADIUS_PROXY_SERVER_PORT] = { .name = "port", BLOBMSG_TYPE_INT32 },
 | 
					 | 
				
			||||||
		[RADIUS_PROXY_SERVER_STATUS] = { .name = "statusServer", BLOBMSG_TYPE_BOOL },
 | 
							[RADIUS_PROXY_SERVER_STATUS] = { .name = "statusServer", BLOBMSG_TYPE_BOOL },
 | 
				
			||||||
		[RADIUS_PROXY_SERVER_TLS] = { .name = "tls", BLOBMSG_TYPE_STRING },
 | 
							[RADIUS_PROXY_SERVER_TLS] = { .name = "tls", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
		[RADIUS_PROXY_SERVER_CERT_NAME_CHECK] = { .name = "certificateNameCheck", BLOBMSG_TYPE_BOOL },
 | 
							[RADIUS_PROXY_SERVER_CERT_NAME_CHECK] = { .name = "certificateNameCheck", BLOBMSG_TYPE_BOOL },
 | 
				
			||||||
@@ -147,27 +140,17 @@ static bool radsec_download_cert(char *cert_name, char *dir_name, char *cert_url
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	CURL *curl;
 | 
						CURL *curl;
 | 
				
			||||||
	FILE *fp;
 | 
						FILE *fp;
 | 
				
			||||||
	CURLcode curl_ret;
 | 
						CURLcode res;
 | 
				
			||||||
	char path[200];
 | 
						char path[200];
 | 
				
			||||||
	char dir_path[200];
 | 
					 | 
				
			||||||
	char name[32];
 | 
						char name[32];
 | 
				
			||||||
	char dir[32];
 | 
						char dir[32];
 | 
				
			||||||
	char *gw_clientcert = "/usr/opensync/certs/client.pem";
 | 
						char *gw_clientcert = "/usr/opensync/certs/client.pem";
 | 
				
			||||||
	char *gw_clientkey = "/usr/opensync/certs/client_dec.key";
 | 
						char *gw_clientkey = "/usr/opensync/certs/client_dec.key";
 | 
				
			||||||
	struct stat stat_buf;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	strcpy(name, cert_name);
 | 
						strcpy(name, cert_name);
 | 
				
			||||||
	strcpy(dir, dir_name);
 | 
						strcpy(dir, dir_name);
 | 
				
			||||||
	sprintf(dir_path, "/tmp/radsec/certs/%s", dir);
 | 
					 | 
				
			||||||
	sprintf(path, "/tmp/radsec/certs/%s/%s", dir, name);
 | 
						sprintf(path, "/tmp/radsec/certs/%s/%s", dir, name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (stat(dir_path, &stat_buf) == -1)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		char cmd[200];
 | 
					 | 
				
			||||||
		sprintf(cmd, "mkdir -p %s", dir_path);
 | 
					 | 
				
			||||||
		system(cmd);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	curl = curl_easy_init();
 | 
						curl = curl_easy_init();
 | 
				
			||||||
	if (curl)
 | 
						if (curl)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -194,19 +177,10 @@ static bool radsec_download_cert(char *cert_name, char *dir_name, char *cert_url
 | 
				
			|||||||
		curl_easy_setopt(curl, CURLOPT_URL, cert_url);
 | 
							curl_easy_setopt(curl, CURLOPT_URL, cert_url);
 | 
				
			||||||
		curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, file_write);
 | 
							curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, file_write);
 | 
				
			||||||
		curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
 | 
							curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
 | 
				
			||||||
		curl_ret = curl_easy_perform(curl);
 | 
							res = curl_easy_perform(curl);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (curl_ret != CURLE_OK)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			LOGE("radsec: certificate download failed %s", curl_easy_strerror(curl_ret));
 | 
					 | 
				
			||||||
			curl_easy_cleanup(curl);
 | 
					 | 
				
			||||||
			fclose(fp);
 | 
					 | 
				
			||||||
			remove(path);
 | 
					 | 
				
			||||||
			return false;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		curl_easy_cleanup(curl);
 | 
							curl_easy_cleanup(curl);
 | 
				
			||||||
		fclose(fp);
 | 
							fclose(fp);
 | 
				
			||||||
 | 
							return res;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
@@ -217,11 +191,9 @@ static bool radius_proxy_config_set(struct schema_Radius_Proxy_Config *conf)
 | 
				
			|||||||
	int i=0;
 | 
						int i=0;
 | 
				
			||||||
	char path[200];
 | 
						char path[200];
 | 
				
			||||||
	char name[256];
 | 
						char name[256];
 | 
				
			||||||
	char server_name[256] = {};
 | 
					 | 
				
			||||||
	char acct_server_name[256] = {};
 | 
					 | 
				
			||||||
	char tls_name[256] = {};
 | 
					 | 
				
			||||||
	struct schema_APC_State apc_conf;
 | 
						struct schema_APC_State apc_conf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Configure only if APC selects this as master AP (DR) */
 | 
				
			||||||
	json_t *where = ovsdb_table_where(&table_APC_State, &apc_conf);
 | 
						json_t *where = ovsdb_table_where(&table_APC_State, &apc_conf);
 | 
				
			||||||
	if (false == ovsdb_table_select_one_where(&table_APC_State,
 | 
						if (false == ovsdb_table_select_one_where(&table_APC_State,
 | 
				
			||||||
			where, &apc_conf)) {
 | 
								where, &apc_conf)) {
 | 
				
			||||||
@@ -229,33 +201,31 @@ static bool radius_proxy_config_set(struct schema_Radius_Proxy_Config *conf)
 | 
				
			|||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!strncmp(apc_conf.mode, "OR", 2) || !strncmp(apc_conf.mode, "BDR", 2))
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Configure options block */
 | 
						/* Configure options block */
 | 
				
			||||||
	blob_buf_init(&uci_buf, 0);
 | 
						blob_buf_init(&uci_buf, 0);
 | 
				
			||||||
	n = blobmsg_open_array(&uci_buf,"ListenUDP");
 | 
						n = blobmsg_open_array(&uci_buf,"ListenUDP");
 | 
				
			||||||
	blobmsg_add_string(&uci_buf, NULL, "*:1812");
 | 
						blobmsg_add_string(&uci_buf, NULL, "127.0.0.1:1812");
 | 
				
			||||||
	blobmsg_add_string(&uci_buf, NULL, "*:1813");
 | 
						blobmsg_add_string(&uci_buf, NULL, "127.0.0.1:1813");
 | 
				
			||||||
	blobmsg_close_array(&uci_buf, n);
 | 
						blobmsg_close_array(&uci_buf, n);
 | 
				
			||||||
	memset(name, '\0', sizeof(name));
 | 
						memset(name, '\0', sizeof(name));
 | 
				
			||||||
	sprintf(name, "%s%s", conf->radius_config_name, "options");
 | 
						sprintf(name, "%s%s", conf->radius_config_name, "options");
 | 
				
			||||||
	blobmsg_add_string(&uci_buf, "name", name);
 | 
					 | 
				
			||||||
	blob_to_uci_section(uci, "radsecproxy", name, "options",
 | 
						blob_to_uci_section(uci, "radsecproxy", name, "options",
 | 
				
			||||||
			uci_buf.head, &radius_proxy_options_param, NULL);
 | 
								uci_buf.head, &radius_proxy_options_param, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Configure client block */
 | 
						/* Configure client block */
 | 
				
			||||||
	blob_buf_init(&uci_buf, 0);
 | 
						blob_buf_init(&uci_buf, 0);
 | 
				
			||||||
	blobmsg_add_string(&uci_buf, "host", "0.0.0.0/0");
 | 
						blobmsg_add_string(&uci_buf, "name", "localhost");
 | 
				
			||||||
	blobmsg_add_string(&uci_buf, "type", "udp");
 | 
						blobmsg_add_string(&uci_buf, "type", "udp");
 | 
				
			||||||
	blobmsg_add_string(&uci_buf, "secret", "secret");
 | 
						blobmsg_add_string(&uci_buf, "secret", "secret");
 | 
				
			||||||
	memset(name, '\0', sizeof(name));
 | 
						memset(name, '\0', sizeof(name));
 | 
				
			||||||
	sprintf(name, "%s%s", conf->radius_config_name, "client");
 | 
						sprintf(name, "%s%s", conf->radius_config_name, "client");
 | 
				
			||||||
	blobmsg_add_string(&uci_buf, "name", name);
 | 
					 | 
				
			||||||
	blob_to_uci_section(uci, "radsecproxy", name, "client",
 | 
						blob_to_uci_section(uci, "radsecproxy", name, "client",
 | 
				
			||||||
			uci_buf.head, &radius_proxy_client_param, NULL);
 | 
								uci_buf.head, &radius_proxy_client_param, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Configure TLS/non-TLS and server blocks */
 | 
						/* Configure TLS/non-TLS and server blocks */
 | 
				
			||||||
	sprintf(server_name, "%s%s", conf->radius_config_name, "server");
 | 
					 | 
				
			||||||
	sprintf(acct_server_name, "%s%s", conf->radius_config_name, "Acctserver");
 | 
					 | 
				
			||||||
	sprintf(tls_name, "%s%s", conf->radius_config_name, "tls");
 | 
					 | 
				
			||||||
	if (conf->radsec)
 | 
						if (conf->radsec)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		blob_buf_init(&uci_buf, 0);
 | 
							blob_buf_init(&uci_buf, 0);
 | 
				
			||||||
@@ -266,7 +236,7 @@ static bool radius_proxy_config_set(struct schema_Radius_Proxy_Config *conf)
 | 
				
			|||||||
		radsec_download_cert("clientdec.key",
 | 
							radsec_download_cert("clientdec.key",
 | 
				
			||||||
				conf->radius_config_name, conf->client_key);
 | 
									conf->radius_config_name, conf->client_key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "name", tls_name);
 | 
							blobmsg_add_string(&uci_buf, "name", conf->server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		memset(path, '\0', sizeof(path));
 | 
							memset(path, '\0', sizeof(path));
 | 
				
			||||||
		sprintf(path, "/tmp/radsec/certs/%s/cacert.pem",
 | 
							sprintf(path, "/tmp/radsec/certs/%s/cacert.pem",
 | 
				
			||||||
@@ -286,49 +256,34 @@ static bool radius_proxy_config_set(struct schema_Radius_Proxy_Config *conf)
 | 
				
			|||||||
		if (strlen(conf->passphrase) > 0)
 | 
							if (strlen(conf->passphrase) > 0)
 | 
				
			||||||
			blobmsg_add_string(&uci_buf, "certificateKeyPassword", conf->passphrase);
 | 
								blobmsg_add_string(&uci_buf, "certificateKeyPassword", conf->passphrase);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		blob_to_uci_section(uci, "radsecproxy", tls_name,
 | 
							memset(name, '\0', sizeof(name));
 | 
				
			||||||
 | 
							sprintf(name, "%s%s", conf->radius_config_name, "tls");
 | 
				
			||||||
 | 
							blob_to_uci_section(uci, "radsecproxy", name,
 | 
				
			||||||
				"tls", uci_buf.head, &radius_proxy_tls_param, NULL);
 | 
									"tls", uci_buf.head, &radius_proxy_tls_param, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		blob_buf_init(&uci_buf, 0);
 | 
							blob_buf_init(&uci_buf, 0);
 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "name", server_name);
 | 
							blobmsg_add_string(&uci_buf, "name", conf->server);
 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "host", conf->server);
 | 
					 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "type", "tls");
 | 
							blobmsg_add_string(&uci_buf, "type", "tls");
 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "tls", tls_name);
 | 
							blobmsg_add_string(&uci_buf, "tls", conf->server);
 | 
				
			||||||
		blobmsg_add_u32(&uci_buf, "port", conf->port);
 | 
					 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "secret", "radsec");
 | 
							blobmsg_add_string(&uci_buf, "secret", "radsec");
 | 
				
			||||||
		blobmsg_add_bool(&uci_buf, "statusServer", 0);
 | 
							blobmsg_add_bool(&uci_buf, "statusServer", 0);
 | 
				
			||||||
		blobmsg_add_bool(&uci_buf, "certificateNameCheck", 0);
 | 
							blobmsg_add_bool(&uci_buf, "certificateNameCheck", 0);
 | 
				
			||||||
		blob_to_uci_section(uci, "radsecproxy", server_name, "server",
 | 
							memset(name, '\0', sizeof(name));
 | 
				
			||||||
 | 
							sprintf(name, "%s%s", conf->radius_config_name, "server");
 | 
				
			||||||
 | 
							blob_to_uci_section(uci, "radsecproxy", name, "server",
 | 
				
			||||||
				uci_buf.head, &radius_proxy_server_param, NULL);
 | 
									uci_buf.head, &radius_proxy_server_param, NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else /* non-TLS block */
 | 
						else /* non-TLS block */
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		/* Authentication server */
 | 
					 | 
				
			||||||
		blob_buf_init(&uci_buf, 0);
 | 
							blob_buf_init(&uci_buf, 0);
 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "name", server_name);
 | 
							blobmsg_add_string(&uci_buf, "name", conf->server);
 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "host", conf->server);
 | 
					 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "type", "udp");
 | 
							blobmsg_add_string(&uci_buf, "type", "udp");
 | 
				
			||||||
		if (strlen(conf->secret) > 0)
 | 
							if (strlen(conf->secret) > 0)
 | 
				
			||||||
			blobmsg_add_string(&uci_buf, "secret", conf->secret);
 | 
								blobmsg_add_string(&uci_buf, "secret", conf->secret);
 | 
				
			||||||
		if (conf->port > 0)
 | 
							memset(name, '\0', sizeof(name));
 | 
				
			||||||
			blobmsg_add_u32(&uci_buf, "port", conf->port);
 | 
							sprintf(name, "%s%s", conf->radius_config_name, "server");
 | 
				
			||||||
		blob_to_uci_section(uci, "radsecproxy", server_name, "server",
 | 
							blob_to_uci_section(uci, "radsecproxy", name, "server",
 | 
				
			||||||
				uci_buf.head, &radius_proxy_server_param, NULL);
 | 
									uci_buf.head, &radius_proxy_server_param, NULL);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* Accounting server */
 | 
					 | 
				
			||||||
		if (strlen(conf->acct_server) > 0)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			blob_buf_init(&uci_buf, 0);
 | 
					 | 
				
			||||||
			blobmsg_add_string(&uci_buf, "name", acct_server_name);
 | 
					 | 
				
			||||||
			blobmsg_add_string(&uci_buf, "host", conf->acct_server);
 | 
					 | 
				
			||||||
			blobmsg_add_string(&uci_buf, "type", "udp");
 | 
					 | 
				
			||||||
			if (strlen(conf->secret) > 0)
 | 
					 | 
				
			||||||
				blobmsg_add_string(&uci_buf, "secret", conf->acct_secret);
 | 
					 | 
				
			||||||
			if (conf->acct_port > 0)
 | 
					 | 
				
			||||||
				blobmsg_add_u32(&uci_buf, "port", conf->acct_port);
 | 
					 | 
				
			||||||
			blob_to_uci_section(uci, "radsecproxy", acct_server_name, "server",
 | 
					 | 
				
			||||||
								uci_buf.head, &radius_proxy_server_param, NULL);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Configure realm block */
 | 
						/* Configure realm block */
 | 
				
			||||||
@@ -337,20 +292,11 @@ static bool radius_proxy_config_set(struct schema_Radius_Proxy_Config *conf)
 | 
				
			|||||||
		blob_buf_init(&uci_buf, 0);
 | 
							blob_buf_init(&uci_buf, 0);
 | 
				
			||||||
		blobmsg_add_string(&uci_buf, "name", conf->realm[i]);
 | 
							blobmsg_add_string(&uci_buf, "name", conf->realm[i]);
 | 
				
			||||||
		n = blobmsg_open_array(&uci_buf,"server");
 | 
							n = blobmsg_open_array(&uci_buf,"server");
 | 
				
			||||||
		blobmsg_add_string(&uci_buf, NULL, server_name);
 | 
							blobmsg_add_string(&uci_buf, NULL, conf->server);
 | 
				
			||||||
		blobmsg_close_array(&uci_buf, n);
 | 
							blobmsg_close_array(&uci_buf, n);
 | 
				
			||||||
		if (conf->radsec)
 | 
					 | 
				
			||||||
		{ /* Accounting server same as auth server */
 | 
					 | 
				
			||||||
		n = blobmsg_open_array(&uci_buf,"accountingServer");
 | 
							n = blobmsg_open_array(&uci_buf,"accountingServer");
 | 
				
			||||||
			blobmsg_add_string(&uci_buf, NULL, server_name);
 | 
							blobmsg_add_string(&uci_buf, NULL, conf->server);
 | 
				
			||||||
		blobmsg_close_array(&uci_buf, n);
 | 
							blobmsg_close_array(&uci_buf, n);
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else if (strlen(conf->acct_server) > 0)
 | 
					 | 
				
			||||||
		{ /* non-TLS case where accounting server is configured */
 | 
					 | 
				
			||||||
			n = blobmsg_open_array(&uci_buf, "accountingServer");
 | 
					 | 
				
			||||||
			blobmsg_add_string(&uci_buf, NULL, acct_server_name);
 | 
					 | 
				
			||||||
			blobmsg_close_array(&uci_buf, n);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		memset(name, '\0', sizeof(name));
 | 
							memset(name, '\0', sizeof(name));
 | 
				
			||||||
		sprintf(name, "%s%s%d", conf->radius_config_name, "realm", i);
 | 
							sprintf(name, "%s%s%d", conf->radius_config_name, "realm", i);
 | 
				
			||||||
		blob_to_uci_section(uci, "radsecproxy", name, "realm",
 | 
							blob_to_uci_section(uci, "radsecproxy", name, "realm",
 | 
				
			||||||
@@ -364,27 +310,22 @@ static bool radius_proxy_config_set(struct schema_Radius_Proxy_Config *conf)
 | 
				
			|||||||
static bool radius_proxy_config_delete()
 | 
					static bool radius_proxy_config_delete()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct uci_package *radsecproxy;
 | 
						struct uci_package *radsecproxy;
 | 
				
			||||||
	struct uci_context *rad_uci;
 | 
					 | 
				
			||||||
	struct uci_element *e = NULL, *tmp = NULL;
 | 
						struct uci_element *e = NULL, *tmp = NULL;
 | 
				
			||||||
	int ret=0;
 | 
						int ret=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rad_uci = uci_alloc_context();
 | 
						ret= uci_load(uci, "radsecproxy", &radsecproxy);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	ret = uci_load(rad_uci, "radsecproxy", &radsecproxy);
 | 
					 | 
				
			||||||
	if (ret) {
 | 
						if (ret) {
 | 
				
			||||||
		LOGE("%s: uci_load() failed with rc %d", __func__, ret);
 | 
							LOGD("%s: uci_load() failed with rc %d", __func__, ret);
 | 
				
			||||||
		uci_free_context(rad_uci);
 | 
					 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uci_foreach_element_safe(&radsecproxy->sections, tmp, e) {
 | 
						uci_foreach_element_safe(&radsecproxy->sections, tmp, e) {
 | 
				
			||||||
		struct uci_section *s = uci_to_section(e);
 | 
							struct uci_section *s = uci_to_section(e);
 | 
				
			||||||
		if ((s == NULL) || (s->type == NULL)) continue;
 | 
							if ((s == NULL) || (s->type == NULL)) continue;
 | 
				
			||||||
		uci_section_del(rad_uci, "radsecproxy", "radsecproxy",
 | 
							uci_section_del(uci, "radsecproxy", "radsecproxy",
 | 
				
			||||||
				(char *)s->e.name, s->type);
 | 
									(char *)s->e.name, s->type);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uci_commit(rad_uci, &radsecproxy, false);
 | 
						uci_commit(uci, &radsecproxy, false);
 | 
				
			||||||
	uci_unload(rad_uci, radsecproxy);
 | 
						uci_unload(uci, radsecproxy);
 | 
				
			||||||
	uci_free_context(rad_uci);
 | 
					 | 
				
			||||||
	reload_config = 1;
 | 
						reload_config = 1;
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -398,12 +339,11 @@ void callback_Radius_Proxy_Config(ovsdb_update_monitor_t *self,
 | 
				
			|||||||
	case OVSDB_UPDATE_NEW:
 | 
						case OVSDB_UPDATE_NEW:
 | 
				
			||||||
	case OVSDB_UPDATE_MODIFY:
 | 
						case OVSDB_UPDATE_MODIFY:
 | 
				
			||||||
		(void) radius_proxy_config_set(conf);
 | 
							(void) radius_proxy_config_set(conf);
 | 
				
			||||||
		vif_check_radius_proxy();
 | 
					 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case OVSDB_UPDATE_DEL:
 | 
						case OVSDB_UPDATE_DEL:
 | 
				
			||||||
		(void) radius_proxy_config_delete();
 | 
							(void) radius_proxy_config_delete();
 | 
				
			||||||
		vif_check_radius_proxy();
 | 
							(void) radius_proxy_config_set(conf);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,19 +47,8 @@ void rrm_config_vif(struct blob_buf *b, struct blob_buf *del, const char * freq_
 | 
				
			|||||||
		blobmsg_add_u32(b, "rssi_ignore_probe_request", conf.probe_resp_threshold);
 | 
							blobmsg_add_u32(b, "rssi_ignore_probe_request", conf.probe_resp_threshold);
 | 
				
			||||||
		blobmsg_add_u32(b, "signal_connect", conf.client_disconnect_threshold);
 | 
							blobmsg_add_u32(b, "signal_connect", conf.client_disconnect_threshold);
 | 
				
			||||||
		blobmsg_add_u32(b, "signal_stay", conf.client_disconnect_threshold);
 | 
							blobmsg_add_u32(b, "signal_stay", conf.client_disconnect_threshold);
 | 
				
			||||||
		blobmsg_add_u32(b, "mcast_rate", conf.mcast_rate);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (conf.beacon_rate == 0) {
 | 
					 | 
				
			||||||
			// Default to the lowest possible bit rate for each frequency band
 | 
					 | 
				
			||||||
			if (!strcmp(freq_band, "2.4G")) {
 | 
					 | 
				
			||||||
				blobmsg_add_u32(b, "bcn_rate", 10);
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				blobmsg_add_u32(b, "bcn_rate", 60);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
		blobmsg_add_u32(b, "bcn_rate", conf.beacon_rate);
 | 
							blobmsg_add_u32(b, "bcn_rate", conf.beacon_rate);
 | 
				
			||||||
		}
 | 
							blobmsg_add_u32(b, "mcast_rate", conf.mcast_rate);
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -210,10 +210,8 @@ int uci_section_to_blob(struct uci_context *uci, char *package, char *section,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (uci_load(uci, package, &p))
 | 
						if (uci_load(uci, package, &p))
 | 
				
			||||||
		p = uci_lookup_package(uci, package);
 | 
							p = uci_lookup_package(uci, package);
 | 
				
			||||||
	if (!p) {
 | 
						if (!p)
 | 
				
			||||||
		uci_unload(uci, p);
 | 
					 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	s = uci_lookup_section(uci, p, section);
 | 
						s = uci_lookup_section(uci, p, section);
 | 
				
			||||||
	if (!s)
 | 
						if (!s)
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
extern ovsdb_table_t table_Wifi_VIF_Config;
 | 
					extern ovsdb_table_t table_Wifi_VIF_Config;
 | 
				
			||||||
extern ovsdb_table_t table_Hotspot20_Icon_Config;
 | 
					extern ovsdb_table_t table_Hotspot20_Icon_Config;
 | 
				
			||||||
extern ovsdb_table_t table_Radius_Proxy_Config;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern struct blob_buf b;
 | 
					extern struct blob_buf b;
 | 
				
			||||||
extern struct blob_buf del;
 | 
					extern struct blob_buf del;
 | 
				
			||||||
@@ -95,7 +94,6 @@ enum {
 | 
				
			|||||||
	WIF_ATTR_VENUE_URL,
 | 
						WIF_ATTR_VENUE_URL,
 | 
				
			||||||
	WIF_ATTR_NETWORK_AUTH_TYPE,
 | 
						WIF_ATTR_NETWORK_AUTH_TYPE,
 | 
				
			||||||
	WIF_ATTR_IPADDR_TYPE_AVAILABILITY,
 | 
						WIF_ATTR_IPADDR_TYPE_AVAILABILITY,
 | 
				
			||||||
	WIF_ATTR_CONNECTION_CAPABILITY,
 | 
					 | 
				
			||||||
	WIF_ATTR_DOMAIN_NAME,
 | 
						WIF_ATTR_DOMAIN_NAME,
 | 
				
			||||||
	WIF_ATTR_MCC_MNC,
 | 
						WIF_ATTR_MCC_MNC,
 | 
				
			||||||
	WIF_ATTR_NAI_REALM,
 | 
						WIF_ATTR_NAI_REALM,
 | 
				
			||||||
@@ -134,8 +132,6 @@ enum {
 | 
				
			|||||||
	WIF_ATTR_11R_R0KH,
 | 
						WIF_ATTR_11R_R0KH,
 | 
				
			||||||
	WIF_ATTR_11R_R1KH,
 | 
						WIF_ATTR_11R_R1KH,
 | 
				
			||||||
	WIF_ATTR_RADPROXY,
 | 
						WIF_ATTR_RADPROXY,
 | 
				
			||||||
	WIF_ATTR_PROXY_ARP,
 | 
					 | 
				
			||||||
	WIF_ATTR_MCAST_TO_UCAST,
 | 
					 | 
				
			||||||
	__WIF_ATTR_MAX,
 | 
						__WIF_ATTR_MAX,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -191,8 +187,7 @@ static const struct blobmsg_policy wifi_iface_policy[__WIF_ATTR_MAX] = {
 | 
				
			|||||||
	[WIF_ATTR_VENUE_TYPE] = { .name = "venue_type", BLOBMSG_TYPE_INT32 },
 | 
						[WIF_ATTR_VENUE_TYPE] = { .name = "venue_type", BLOBMSG_TYPE_INT32 },
 | 
				
			||||||
	[WIF_ATTR_VENUE_URL] = { .name = "venue_url", BLOBMSG_TYPE_ARRAY },
 | 
						[WIF_ATTR_VENUE_URL] = { .name = "venue_url", BLOBMSG_TYPE_ARRAY },
 | 
				
			||||||
	[WIF_ATTR_NETWORK_AUTH_TYPE] = { .name = "network_auth_type", BLOBMSG_TYPE_STRING },
 | 
						[WIF_ATTR_NETWORK_AUTH_TYPE] = { .name = "network_auth_type", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
	[WIF_ATTR_IPADDR_TYPE_AVAILABILITY] = { .name = "ipaddr_type_availability", BLOBMSG_TYPE_STRING },
 | 
						[WIF_ATTR_IPADDR_TYPE_AVAILABILITY] = { .name = "ipaddr_type_availability", BLOBMSG_TYPE_INT32 },
 | 
				
			||||||
	[WIF_ATTR_CONNECTION_CAPABILITY] = { .name = "hs20_conn_capab", BLOBMSG_TYPE_ARRAY },
 | 
					 | 
				
			||||||
	[WIF_ATTR_DOMAIN_NAME] = { .name = "domain_name", BLOBMSG_TYPE_STRING },
 | 
						[WIF_ATTR_DOMAIN_NAME] = { .name = "domain_name", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
	[WIF_ATTR_MCC_MNC] = { .name = "anqp_3gpp_cell_net", BLOBMSG_TYPE_STRING },
 | 
						[WIF_ATTR_MCC_MNC] = { .name = "anqp_3gpp_cell_net", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
	[WIF_ATTR_NAI_REALM] = { .name = "nai_realm", BLOBMSG_TYPE_ARRAY },
 | 
						[WIF_ATTR_NAI_REALM] = { .name = "nai_realm", BLOBMSG_TYPE_ARRAY },
 | 
				
			||||||
@@ -231,8 +226,6 @@ static const struct blobmsg_policy wifi_iface_policy[__WIF_ATTR_MAX] = {
 | 
				
			|||||||
	[WIF_ATTR_11R_R0KH] = { .name = "r0kh", BLOBMSG_TYPE_STRING },
 | 
						[WIF_ATTR_11R_R0KH] = { .name = "r0kh", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
	[WIF_ATTR_11R_R1KH] = { .name = "r1kh", BLOBMSG_TYPE_STRING },
 | 
						[WIF_ATTR_11R_R1KH] = { .name = "r1kh", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
	[WIF_ATTR_RADPROXY] = { .name = "radproxy", BLOBMSG_TYPE_STRING },
 | 
						[WIF_ATTR_RADPROXY] = { .name = "radproxy", BLOBMSG_TYPE_STRING },
 | 
				
			||||||
	[WIF_ATTR_PROXY_ARP] = { .name = "proxy_arp", BLOBMSG_TYPE_BOOL },
 | 
					 | 
				
			||||||
	[WIF_ATTR_MCAST_TO_UCAST] = { .name = "multicast_to_unicast", BLOBMSG_TYPE_BOOL },
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const struct uci_blob_param_list wifi_iface_param = {
 | 
					const struct uci_blob_param_list wifi_iface_param = {
 | 
				
			||||||
@@ -320,7 +313,7 @@ static struct vif_crypto {
 | 
				
			|||||||
	{ "wpa-mixed", OVSDB_SECURITY_ENCRYPTION_WPA_EAP, OVSDB_SECURITY_MODE_MIXED, 1 },
 | 
						{ "wpa-mixed", OVSDB_SECURITY_ENCRYPTION_WPA_EAP, OVSDB_SECURITY_MODE_MIXED, 1 },
 | 
				
			||||||
	{ "sae", OVSDB_SECURITY_ENCRYPTION_WPA_SAE, OVSDB_SECURITY_MODE_WPA3, 0 },
 | 
						{ "sae", OVSDB_SECURITY_ENCRYPTION_WPA_SAE, OVSDB_SECURITY_MODE_WPA3, 0 },
 | 
				
			||||||
	{ "sae-mixed", OVSDB_SECURITY_ENCRYPTION_WPA_SAE, OVSDB_SECURITY_MODE_MIXED, 0 },
 | 
						{ "sae-mixed", OVSDB_SECURITY_ENCRYPTION_WPA_SAE, OVSDB_SECURITY_MODE_MIXED, 0 },
 | 
				
			||||||
	{ "wpa3-only", OVSDB_SECURITY_ENCRYPTION_WPA3_EAP, OVSDB_SECURITY_MODE_WPA3, 1 },
 | 
						{ "wpa3", OVSDB_SECURITY_ENCRYPTION_WPA3_EAP, OVSDB_SECURITY_MODE_WPA3, 1 },
 | 
				
			||||||
	{ "wpa3-mixed", OVSDB_SECURITY_ENCRYPTION_WPA3_EAP, OVSDB_SECURITY_MODE_MIXED, 1 },
 | 
						{ "wpa3-mixed", OVSDB_SECURITY_ENCRYPTION_WPA3_EAP, OVSDB_SECURITY_MODE_MIXED, 1 },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -330,7 +323,7 @@ extern unsigned int radproxy_apc;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* Custom options table */
 | 
					/* Custom options table */
 | 
				
			||||||
#define SCHEMA_CUSTOM_OPT_SZ            20
 | 
					#define SCHEMA_CUSTOM_OPT_SZ            20
 | 
				
			||||||
#define SCHEMA_CUSTOM_OPTS_MAX          15
 | 
					#define SCHEMA_CUSTOM_OPTS_MAX          13
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char custom_options_table[SCHEMA_CUSTOM_OPTS_MAX][SCHEMA_CUSTOM_OPT_SZ] =
 | 
					const char custom_options_table[SCHEMA_CUSTOM_OPTS_MAX][SCHEMA_CUSTOM_OPT_SZ] =
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -347,8 +340,6 @@ const char custom_options_table[SCHEMA_CUSTOM_OPTS_MAX][SCHEMA_CUSTOM_OPT_SZ] =
 | 
				
			|||||||
	SCHEMA_CONSTS_RADIUS_NAS_IP,
 | 
						SCHEMA_CONSTS_RADIUS_NAS_IP,
 | 
				
			||||||
	SCHEMA_CONSTS_DYNAMIC_VLAN,
 | 
						SCHEMA_CONSTS_DYNAMIC_VLAN,
 | 
				
			||||||
	SCHEMA_CONSTS_RADPROXY,
 | 
						SCHEMA_CONSTS_RADPROXY,
 | 
				
			||||||
	SCHEMA_CONSTS_PROXY_ARP,
 | 
					 | 
				
			||||||
	SCHEMA_CONSTS_MCAST_TO_UCAST,
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool vif_config_custom_opt_get_proxy(
 | 
					static bool vif_config_custom_opt_get_proxy(
 | 
				
			||||||
@@ -663,19 +654,8 @@ static void vif_config_custom_opt_set(struct blob_buf *b, struct blob_buf *del,
 | 
				
			|||||||
				strncpy(value, "br-wan.", 20);
 | 
									strncpy(value, "br-wan.", 20);
 | 
				
			||||||
				blobmsg_add_string(del, "vlan_bridge", value);
 | 
									blobmsg_add_string(del, "vlan_bridge", value);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else if (strcmp(opt, "radproxy") == 0) {
 | 
							} else if (strcmp(opt, "radproxy") == 0)
 | 
				
			||||||
			blobmsg_add_string(b, "radproxy", value);
 | 
								blobmsg_add_string(b, "radproxy", value);
 | 
				
			||||||
		} else if (strcmp(opt, "proxy_arp") == 0) {
 | 
					 | 
				
			||||||
			if (strcmp(value, "1") == 0)
 | 
					 | 
				
			||||||
				blobmsg_add_bool(b, "proxy_arp", 1);
 | 
					 | 
				
			||||||
			else if (strcmp(value, "0") == 0)
 | 
					 | 
				
			||||||
				blobmsg_add_bool(del, "proxy_arp", 1);
 | 
					 | 
				
			||||||
		} else if (strcmp(opt, "mcast_to_ucast") == 0) {
 | 
					 | 
				
			||||||
			if (strcmp(value, "1") == 0)
 | 
					 | 
				
			||||||
				blobmsg_add_bool(b, "multicast_to_unicast", 1);
 | 
					 | 
				
			||||||
			else if (strcmp(value, "0") == 0)
 | 
					 | 
				
			||||||
				blobmsg_add_bool(del, "multicast_to_unicast", 1);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* No NASID was found from blob, so use BSSID as NASID */
 | 
						/* No NASID was found from blob, so use BSSID as NASID */
 | 
				
			||||||
@@ -825,33 +805,8 @@ static void vif_state_custom_options_get(struct schema_Wifi_VIF_State *vstate,
 | 
				
			|||||||
							custom_options_table[i],
 | 
												custom_options_table[i],
 | 
				
			||||||
							buf);
 | 
												buf);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
		} else if (strcmp(opt, "proxy_arp") == 0) {
 | 
					 | 
				
			||||||
			if (tb[WIF_ATTR_PROXY_ARP]) {
 | 
					 | 
				
			||||||
				if (blobmsg_get_bool(tb[WIF_ATTR_PROXY_ARP])) {
 | 
					 | 
				
			||||||
					set_custom_option_state(vstate, &index,
 | 
					 | 
				
			||||||
								custom_options_table[i],
 | 
					 | 
				
			||||||
								"1");
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					set_custom_option_state(vstate, &index,
 | 
					 | 
				
			||||||
								custom_options_table[i],
 | 
					 | 
				
			||||||
								"0");
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		} else if (strcmp(opt, "mcast_to_ucast") == 0) {
 | 
					 | 
				
			||||||
			if (tb[WIF_ATTR_MCAST_TO_UCAST]) {
 | 
					 | 
				
			||||||
				if (blobmsg_get_bool(tb[WIF_ATTR_MCAST_TO_UCAST])) {
 | 
					 | 
				
			||||||
					set_custom_option_state(vstate, &index,
 | 
					 | 
				
			||||||
								custom_options_table[i],
 | 
					 | 
				
			||||||
								"1");
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					set_custom_option_state(vstate, &index,
 | 
					 | 
				
			||||||
								custom_options_table[i],
 | 
					 | 
				
			||||||
								"0");
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1021,38 +976,40 @@ size_t write_file(void *ptr, size_t size, size_t nmemb, FILE *stream) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void vif_section_del(char *section_name)
 | 
					void vif_section_del(char *section_name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct uci_package *wireless;
 | 
						struct uci_package *wireless;
 | 
				
			||||||
	struct uci_context *sec_ctx;
 | 
					 | 
				
			||||||
	struct uci_element *e = NULL, *tmp = NULL;
 | 
						struct uci_element *e = NULL, *tmp = NULL;
 | 
				
			||||||
	int ret=0;
 | 
						int ret=0;
 | 
				
			||||||
	sec_ctx = uci_alloc_context();
 | 
					
 | 
				
			||||||
	ret= uci_load(sec_ctx, "wireless", &wireless);
 | 
						ret= uci_load(uci, "wireless", &wireless);
 | 
				
			||||||
	if (ret) {
 | 
						if (ret) {
 | 
				
			||||||
		LOGE("%s: %s uci_load() failed with rc %d", section_name, __func__, ret);
 | 
							LOGD("%s: uci_load() failed with rc %d", section_name, ret);
 | 
				
			||||||
		uci_free_context(sec_ctx);
 | 
					 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uci_foreach_element_safe(&wireless->sections, tmp, e) {
 | 
						uci_foreach_element_safe(&wireless->sections, tmp, e) {
 | 
				
			||||||
		struct uci_section *s = uci_to_section(e);
 | 
							struct uci_section *s = uci_to_section(e);
 | 
				
			||||||
		if ((s == NULL) || (s->type == NULL)) continue;
 | 
							if ((s == NULL) || (s->type == NULL)) continue;
 | 
				
			||||||
		if (!strcmp(s->type, section_name)) {
 | 
							if (!strcmp(s->type, section_name)) {
 | 
				
			||||||
			uci_section_del(sec_ctx, "vif", "wireless", (char *)s->e.name, section_name);
 | 
								uci_section_del(uci, "vif", "wireless", (char *)s->e.name, section_name);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else {
 | 
							else {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uci_commit(sec_ctx, &wireless, false);
 | 
						uci_commit(uci, &wireless, false);
 | 
				
			||||||
	uci_unload(sec_ctx, wireless);
 | 
						uci_unload(uci, wireless);
 | 
				
			||||||
	uci_free_context(sec_ctx);
 | 
					 | 
				
			||||||
	reload_config = 1;
 | 
						reload_config = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void vif_check_radius_proxy()
 | 
					static void vif_check_radius_proxy()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct uci_context *uci_ctx;
 | 
				
			||||||
 | 
						struct uci_package *wireless;
 | 
				
			||||||
	struct schema_APC_State apc_conf;
 | 
						struct schema_APC_State apc_conf;
 | 
				
			||||||
	int n = 0;
 | 
						struct uci_element *e = NULL, *tmp = NULL;
 | 
				
			||||||
	void *buf = NULL;
 | 
						char *buf = NULL;
 | 
				
			||||||
 | 
						int rc = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	json_t *where = ovsdb_table_where(&table_APC_State, &apc_conf);
 | 
						json_t *where = ovsdb_table_where(&table_APC_State, &apc_conf);
 | 
				
			||||||
	if (false == ovsdb_table_select_one_where(&table_APC_State, where, &apc_conf))
 | 
						if (false == ovsdb_table_select_one_where(&table_APC_State, where, &apc_conf))
 | 
				
			||||||
@@ -1061,29 +1018,51 @@ void vif_check_radius_proxy()
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	buf = ovsdb_table_select_where(&table_Radius_Proxy_Config, NULL, &n);
 | 
						uci_ctx = uci_alloc_context();
 | 
				
			||||||
	if (!buf)
 | 
					
 | 
				
			||||||
 | 
						rc = uci_load(uci_ctx, "wireless", &wireless);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (rc)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		LOGI("Radius_Proxy_Config table doesn't exist.  Stop radsecproxy service.");
 | 
							LOGD("%s: uci_load() failed with rc %d", __func__, rc);
 | 
				
			||||||
		system("/etc/init.d/radsecproxy stop");
 | 
							goto free;
 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (!strcmp(apc_conf.mode, "DR"))
 | 
					
 | 
				
			||||||
 | 
						uci_foreach_element_safe(&wireless->sections, tmp, e)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							struct blob_attr *tb[__WIF_ATTR_MAX];
 | 
				
			||||||
 | 
							struct uci_section *s = uci_to_section(e);
 | 
				
			||||||
 | 
							if ((s == NULL) || (s->type == NULL))
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (strcmp(s->type, "wifi-iface"))
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							blob_buf_init(&b, 0);
 | 
				
			||||||
 | 
							uci_to_blob(&b, s, &wifi_iface_param);
 | 
				
			||||||
 | 
							blobmsg_parse(wifi_iface_policy, __WIF_ATTR_MAX, tb, blob_data(b.head), blob_len(b.head));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (tb[WIF_ATTR_RADPROXY])
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								buf = blobmsg_get_string(tb[WIF_ATTR_RADPROXY]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (!strcmp(buf, "1") && !strcmp(apc_conf.mode, "DR"))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if (!system("pidof radsecproxy"))
 | 
									if (!system("pidof radsecproxy"))
 | 
				
			||||||
			goto out;
 | 
										goto free;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		LOGI("Start radsecproxy service.");
 | 
					 | 
				
			||||||
				system("/etc/init.d/radsecproxy start");
 | 
									system("/etc/init.d/radsecproxy start");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									goto free;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		LOGI("Not DR. Stop radsecproxy service.");
 | 
					 | 
				
			||||||
		system("/etc/init.d/radsecproxy stop");
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
out:
 | 
						system("/etc/init.d/radsecproxy stop");
 | 
				
			||||||
	free(buf);
 | 
					
 | 
				
			||||||
 | 
					free:
 | 
				
			||||||
 | 
						uci_unload(uci_ctx, wireless);
 | 
				
			||||||
 | 
						uci_free_context(uci_ctx);
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1141,7 +1120,6 @@ static void hs20_vif_config(struct blob_buf *b,
 | 
				
			|||||||
	int i = 0;
 | 
						int i = 0;
 | 
				
			||||||
	unsigned int len = 0;
 | 
						unsigned int len = 0;
 | 
				
			||||||
	char domain_name[256];
 | 
						char domain_name[256];
 | 
				
			||||||
	char str[3] = {};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (hs2conf->enable) {
 | 
						if (hs2conf->enable) {
 | 
				
			||||||
		blobmsg_add_bool(b, "interworking", 1);
 | 
							blobmsg_add_bool(b, "interworking", 1);
 | 
				
			||||||
@@ -1254,20 +1232,6 @@ static void hs20_vif_config(struct blob_buf *b,
 | 
				
			|||||||
	if (strlen(hs2conf->wan_metrics))
 | 
						if (strlen(hs2conf->wan_metrics))
 | 
				
			||||||
		blobmsg_add_string(b, "hs20_wan_metrics", hs2conf->wan_metrics);
 | 
							blobmsg_add_string(b, "hs20_wan_metrics", hs2conf->wan_metrics);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	len = strlen(hs2conf->ipaddr_type_availability);
 | 
					 | 
				
			||||||
	if (len)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		if (len == 1)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			snprintf(str, sizeof(str), "0%s", hs2conf->ipaddr_type_availability);
 | 
					 | 
				
			||||||
			blobmsg_add_string(b, "ipaddr_type_availability", str);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			blobmsg_add_string(b, "ipaddr_type_availability", hs2conf->ipaddr_type_availability);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	n = blobmsg_open_array(b, "hs20_oper_friendly_name");
 | 
						n = blobmsg_open_array(b, "hs20_oper_friendly_name");
 | 
				
			||||||
	for (i = 0; i < hs2conf->operator_friendly_name_len; i++)
 | 
						for (i = 0; i < hs2conf->operator_friendly_name_len; i++)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -1284,13 +1248,6 @@ static void hs20_vif_config(struct blob_buf *b,
 | 
				
			|||||||
		blobmsg_add_u32(b, "venue_type", venue_type);
 | 
							blobmsg_add_u32(b, "venue_type", venue_type);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	n = blobmsg_open_array(b, "hs20_conn_capab");
 | 
					 | 
				
			||||||
	for (i = 0; i < hs2conf->connection_capability_len; i++)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		blobmsg_add_string(b, NULL, hs2conf->connection_capability[i]);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	blobmsg_close_array(b, n);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (hs2conf->operator_icons_len)
 | 
						if (hs2conf->operator_icons_len)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		n = blobmsg_open_array(b, "operator_icon");
 | 
							n = blobmsg_open_array(b, "operator_icon");
 | 
				
			||||||
@@ -1311,17 +1268,14 @@ static void hs20_vif_config(struct blob_buf *b,
 | 
				
			|||||||
bool target_vif_config_del(const struct schema_Wifi_VIF_Config *vconf)
 | 
					bool target_vif_config_del(const struct schema_Wifi_VIF_Config *vconf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct uci_package *wireless;
 | 
						struct uci_package *wireless;
 | 
				
			||||||
	struct uci_context *vif_ctx;
 | 
					 | 
				
			||||||
	struct uci_element *e = NULL, *tmp = NULL;
 | 
						struct uci_element *e = NULL, *tmp = NULL;
 | 
				
			||||||
	const char *ifname;
 | 
						const char *ifname;
 | 
				
			||||||
	int ret=0;
 | 
						int ret=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vlan_del((char *)vconf->if_name);
 | 
						vlan_del((char *)vconf->if_name);
 | 
				
			||||||
	vif_ctx = uci_alloc_context();
 | 
						ret= uci_load(uci, "wireless", &wireless);
 | 
				
			||||||
	ret= uci_load(vif_ctx, "wireless", &wireless);
 | 
					 | 
				
			||||||
	if (ret) {
 | 
						if (ret) {
 | 
				
			||||||
		LOGE("%s: %s uci_load() failed with rc %d", vconf->if_name, __func__, ret);
 | 
							LOGD("%s: uci_load() failed with rc %d", vconf->if_name, ret);
 | 
				
			||||||
		uci_free_context(vif_ctx);
 | 
					 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uci_foreach_element_safe(&wireless->sections, tmp, e) {
 | 
						uci_foreach_element_safe(&wireless->sections, tmp, e) {
 | 
				
			||||||
@@ -1329,15 +1283,14 @@ bool target_vif_config_del(const struct schema_Wifi_VIF_Config *vconf)
 | 
				
			|||||||
		if ((s == NULL) || (s->type == NULL)) continue; 
 | 
							if ((s == NULL) || (s->type == NULL)) continue; 
 | 
				
			||||||
		if (strcmp(s->type, "wifi-iface")) continue;
 | 
							if (strcmp(s->type, "wifi-iface")) continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ifname = uci_lookup_option_string( vif_ctx, s, "ifname" );
 | 
							ifname = uci_lookup_option_string( uci, s, "ifname" );
 | 
				
			||||||
		if (!strcmp(ifname,vconf->if_name)) {
 | 
							if (!strcmp(ifname,vconf->if_name)) {
 | 
				
			||||||
			uci_section_del(vif_ctx, "vif", "wireless", (char *)s->e.name, "wifi-iface");
 | 
								uci_section_del(uci, "vif", "wireless", (char *)s->e.name, "wifi-iface");
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uci_commit(vif_ctx, &wireless, false);
 | 
						uci_commit(uci, &wireless, false);
 | 
				
			||||||
	uci_unload(vif_ctx, wireless);
 | 
						uci_unload(uci, wireless);
 | 
				
			||||||
	uci_free_context(vif_ctx);
 | 
					 | 
				
			||||||
	reload_config = 1;
 | 
						reload_config = 1;
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1530,6 +1483,7 @@ static int ap_vif_config_set(const struct schema_Wifi_Radio_Config *rconf,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	blob_buf_init(&b, 0);
 | 
						blob_buf_init(&b, 0);
 | 
				
			||||||
	blob_buf_init(&del,0);
 | 
						blob_buf_init(&del,0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	blobmsg_add_string(&b, "ifname", vconf->if_name);
 | 
						blobmsg_add_string(&b, "ifname", vconf->if_name);
 | 
				
			||||||
	blobmsg_add_string(&b, "device", rconf->if_name);
 | 
						blobmsg_add_string(&b, "device", rconf->if_name);
 | 
				
			||||||
	blobmsg_add_string(&b, "mode", "ap");
 | 
						blobmsg_add_string(&b, "mode", "ap");
 | 
				
			||||||
@@ -1638,6 +1592,9 @@ static int ap_vif_config_set(const struct schema_Wifi_Radio_Config *rconf,
 | 
				
			|||||||
		vif_dhcp_opennds_allowlist_set(vconf,(char*)vconf->if_name);
 | 
							vif_dhcp_opennds_allowlist_set(vconf,(char*)vconf->if_name);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (changed->custom_options)
 | 
				
			||||||
 | 
							vif_check_radius_proxy();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	reload_config = 1;
 | 
						reload_config = 1;
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -249,31 +249,48 @@ int main(int argc, char ** argv)
 | 
				
			|||||||
	backtrace_init();
 | 
						backtrace_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	json_memdbg_init(loop);
 | 
						json_memdbg_init(loop);
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
 | 
						if (!dpp_init())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
					        	LOG(ERR,
 | 
				
			||||||
 | 
					            	"Initializing SM "
 | 
				
			||||||
 | 
					            	"(Failed to init DPP library)");
 | 
				
			||||||
 | 
							return -1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!uccm_mqtt_init())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LOG(ERR,
 | 
				
			||||||
 | 
							"Initializing SM "
 | 
				
			||||||
 | 
							"(Failed to start MQTT)");
 | 
				
			||||||
 | 
							return -1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	if (!ovsdb_init_loop(loop, "UCCM")) {
 | 
						if (!ovsdb_init_loop(loop, "UCCM")) {
 | 
				
			||||||
		LOGEM("Initializing UCCM (Failed to initialize OVSDB)");
 | 
							LOGEM("Initializing UCCM (Failed to initialize OVSDB)");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						evsched_init(loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	callback cb = recv_process;
 | 
						callback cb = recv_process;
 | 
				
			||||||
	LOGI("Call interap_recv");
 | 
						LOGI("Call interap_recv");
 | 
				
			||||||
	if( interap_recv(IAC_VOIP_PORT, cb, sizeof(struct voip_session),
 | 
						if( interap_recv(IAC_VOIP_PORT, cb, sizeof(struct voip_session),
 | 
				
			||||||
			 loop, &iac_io) < 0) {
 | 
								 loop, &iac_io) < 0)
 | 
				
			||||||
		interap_rcv_close();
 | 
					 | 
				
			||||||
		LOGI("Error: Failed InterAP receive");
 | 
							LOGI("Error: Failed InterAP receive");
 | 
				
			||||||
		return 1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	evsched_init(loop);
 | 
					//	task_init();
 | 
				
			||||||
	netlink_listen(loop);
 | 
						netlink_listen(loop);
 | 
				
			||||||
 | 
					//	command_ubus_init(loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ev_run(loop, 0);
 | 
						ev_run(loop, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!ovsdb_stop_loop(loop))
 | 
						if (!ovsdb_stop_loop(loop))
 | 
				
			||||||
		LOGE("Stopping UCCM (Failed to stop OVSDB");
 | 
							LOGE("Stopping UCCM (Failed to stop OVSDB");
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
 | 
						uccm_mqtt_stop();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	ev_default_destroy();
 | 
						ev_default_destroy();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	interap_rcv_close();
 | 
					 | 
				
			||||||
	LOGN("Exiting UCCM");
 | 
						LOGN("Exiting UCCM");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,25 +0,0 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
 | 
					 | 
				
			||||||
[ "$INTERFACE" = wan ] || exit 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
conflict=0
 | 
					 | 
				
			||||||
wan_ipaddr="$(ubus call network.interface.wan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
 | 
					 | 
				
			||||||
lan_ipaddr="$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
 | 
					 | 
				
			||||||
logger -t hotplug "$ACTION of $INTERFACE ($DEVICE) $wan_ipaddr"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[ "$wan_ipaddr" = "192.168.1" ] && [ "$lan_ipaddr" = "192.168.1" ] && {
 | 
					 | 
				
			||||||
    conflict=1
 | 
					 | 
				
			||||||
    dest_ip="192.168.0.1"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
[ "$wan_ipaddr" = "192.168.0" ] && [ "$lan_ipaddr" = "192.168.0" ] && {
 | 
					 | 
				
			||||||
    conflict=1
 | 
					 | 
				
			||||||
    dest_ip="192.168.1.1"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
[ $conflict = 1 ] && {
 | 
					 | 
				
			||||||
    logger -t hotplug "IP conflict with br-wan.  Switch br-lan to $dest_ip"
 | 
					 | 
				
			||||||
    uci set network.lan.ipaddr="$dest_ip"
 | 
					 | 
				
			||||||
    uci_commit
 | 
					 | 
				
			||||||
    reload_config
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
exit 0
 | 
					 | 
				
			||||||
@@ -3,9 +3,9 @@
 | 
				
			|||||||
. /lib/functions.sh
 | 
					. /lib/functions.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SKU="unknown"
 | 
					SKU="unknown"
 | 
				
			||||||
MODEL=""
 | 
					MODEL="unknown"
 | 
				
			||||||
PLATFORM="unknown"
 | 
					PLATFORM="unknown"
 | 
				
			||||||
SERIAL=""
 | 
					SERIAL="unknown"
 | 
				
			||||||
MODEL_REV="unknown"
 | 
					MODEL_REV="unknown"
 | 
				
			||||||
MODEL_DESCR="unknown"
 | 
					MODEL_DESCR="unknown"
 | 
				
			||||||
MANUF_NAME="unknown"
 | 
					MANUF_NAME="unknown"
 | 
				
			||||||
@@ -19,12 +19,9 @@ ID=""
 | 
				
			|||||||
case "$(board_name)" in
 | 
					case "$(board_name)" in
 | 
				
			||||||
edgecore,ecw5211|\
 | 
					edgecore,ecw5211|\
 | 
				
			||||||
edgecore,ecw5410)
 | 
					edgecore,ecw5410)
 | 
				
			||||||
 | 
						MODEL=$(cat /tmp/sysinfo/board_name | sed "s/edgecore,//" | tr [a-z] [A-Z])
 | 
				
			||||||
	PLATFORM=$(cat /tmp/sysinfo/model)
 | 
						PLATFORM=$(cat /tmp/sysinfo/model)
 | 
				
			||||||
	SERIAL=$(cat /dev/mtd5 | grep serial_number | cut -d "=" -f2)
 | 
						SERIAL=$(cat /dev/mtd5 | grep serial_number | cut -d "=" -f2)
 | 
				
			||||||
	MODEL=$(cat /dev/mtd5 | grep "model=" | cut -d "=" -f2)
 | 
					 | 
				
			||||||
	if [ ! $MODEL ]; then
 | 
					 | 
				
			||||||
		MODEL=$(cat /tmp/sysinfo/board_name | sed "s/edgecore,//" | tr [a-z] [A-Z])
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	SKU=$(cat /dev/mtd5 | grep sku | cut -d "=" -f2)
 | 
						SKU=$(cat /dev/mtd5 | grep sku | cut -d "=" -f2)
 | 
				
			||||||
	CERT_REGION=$(cat /dev/mtd5 | grep certification_region | cut -d "=" -f2)
 | 
						CERT_REGION=$(cat /dev/mtd5 | grep certification_region | cut -d "=" -f2)
 | 
				
			||||||
	ID=$(cat /dev/mtd5 | grep mac_address | cut -d "=" -f2)
 | 
						ID=$(cat /dev/mtd5 | grep mac_address | cut -d "=" -f2)
 | 
				
			||||||
@@ -40,12 +37,12 @@ edgecore,ecw5410)
 | 
				
			|||||||
	REF_DESIGN=$(cat /dev/mtd5 | grep reference_design | cut -d "=" -f2)
 | 
						REF_DESIGN=$(cat /dev/mtd5 | grep reference_design | cut -d "=" -f2)
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
cig,wf194c)
 | 
					cig,wf194c)
 | 
				
			||||||
 | 
						MODEL=$(cat /tmp/sysinfo/board_name)
 | 
				
			||||||
	PLATFORM=$(cat /tmp/sysinfo/model)
 | 
						PLATFORM=$(cat /tmp/sysinfo/model)
 | 
				
			||||||
	SERIAL=$(cat /dev/mtd14 | grep serial_number | cut -d "=" -f2)
 | 
						SERIAL=$(cat /dev/mtd14 | grep serial_number | cut -d "=" -f2)
 | 
				
			||||||
	if [ ! $SERIAL ]; then
 | 
						if [ ! $SERIAL ]; then
 | 
				
			||||||
		SERIAL=$(cat /dev/mtd14 | grep BaseMacAddress | cut -dx -f2)
 | 
							SERIAL=$(cat /dev/mtd14 | grep BaseMacAddress | cut -dx -f2)
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	MODEL=$(cat /dev/mtd14 | grep "model=" | cut -d "=" -f2)
 | 
					 | 
				
			||||||
	SKU=$(cat /dev/mtd14 | grep sku | cut -d "=" -f2)
 | 
						SKU=$(cat /dev/mtd14 | grep sku | cut -d "=" -f2)
 | 
				
			||||||
	CERT_REGION=$(cat /dev/mtd14 | grep certification_region | cut -d "=" -f2)
 | 
						CERT_REGION=$(cat /dev/mtd14 | grep certification_region | cut -d "=" -f2)
 | 
				
			||||||
	ID=$(cat /dev/mtd14 | grep mac_address | cut -d "=" -f2)
 | 
						ID=$(cat /dev/mtd14 | grep mac_address | cut -d "=" -f2)
 | 
				
			||||||
@@ -61,9 +58,9 @@ cig,wf194c)
 | 
				
			|||||||
	REF_DESIGN=$(cat /dev/mtd14 | grep reference_design | cut -d "=" -f2)
 | 
						REF_DESIGN=$(cat /dev/mtd14 | grep reference_design | cut -d "=" -f2)
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
cig,wf188n)
 | 
					cig,wf188n)
 | 
				
			||||||
 | 
						MODEL=$(cat /tmp/sysinfo/board_name)
 | 
				
			||||||
	PLATFORM=$(cat /tmp/sysinfo/model)
 | 
						PLATFORM=$(cat /tmp/sysinfo/model)
 | 
				
			||||||
	SERIAL=$(cat /dev/mtd12 | grep serial_number | cut -d "=" -f2)
 | 
						SERIAL=$(cat /dev/mtd12 | grep serial_number | cut -d "=" -f2)
 | 
				
			||||||
	MODEL=$(cat /dev/mtd12 | grep "model=" | cut -d "=" -f2)
 | 
					 | 
				
			||||||
	SKU=$(cat /dev/mtd12 | grep sku | cut -d "=" -f2)
 | 
						SKU=$(cat /dev/mtd12 | grep sku | cut -d "=" -f2)
 | 
				
			||||||
	CERT_REGION=$(cat /dev/mtd12 | grep certification_region | cut -d "=" -f2)
 | 
						CERT_REGION=$(cat /dev/mtd12 | grep certification_region | cut -d "=" -f2)
 | 
				
			||||||
	ID=$(cat /dev/mtd12 | grep mac_address | cut -d "=" -f2)
 | 
						ID=$(cat /dev/mtd12 | grep mac_address | cut -d "=" -f2)
 | 
				
			||||||
@@ -100,9 +97,9 @@ linksys,ea8300)
 | 
				
			|||||||
	MANUF_DATE="$DAY-$MONTH-$YEAR"
 | 
						MANUF_DATE="$DAY-$MONTH-$YEAR"
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
tp-link,ec420-g1)
 | 
					tp-link,ec420-g1)
 | 
				
			||||||
 | 
						MODEL=$(cat /tmp/sysinfo/board_name)
 | 
				
			||||||
	PLATFORM=$(cat /tmp/sysinfo/model)
 | 
						PLATFORM=$(cat /tmp/sysinfo/model)
 | 
				
			||||||
	SERIAL=$(cat /dev/mtd9 | grep serial_number | cut -d "=" -f2)
 | 
						SERIAL=$(cat /dev/mtd9 | grep serial_number | cut -d "=" -f2)
 | 
				
			||||||
	MODEL=$(cat /dev/mtd9 | grep "model=" | cut -d "=" -f2)
 | 
					 | 
				
			||||||
	SKU=$(cat /dev/mtd9 | grep sku | cut -d "=" -f2)
 | 
						SKU=$(cat /dev/mtd9 | grep sku | cut -d "=" -f2)
 | 
				
			||||||
	CERT_REGION=$(cat /dev/mtd9 | grep certification_region | cut -d "=" -f2)
 | 
						CERT_REGION=$(cat /dev/mtd9 | grep certification_region | cut -d "=" -f2)
 | 
				
			||||||
	ID=$(cat /dev/mtd9 | grep mac_address | cut -d "=" -f2)
 | 
						ID=$(cat /dev/mtd9 | grep mac_address | cut -d "=" -f2)
 | 
				
			||||||
@@ -136,22 +133,11 @@ if [ ! $ID ]; then
 | 
				
			|||||||
	ID=$(cat /sys/class/net/eth0/address)
 | 
						ID=$(cat /sys/class/net/eth0/address)
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# fallback check to get the model if flash does not contain this info.
 | 
					 | 
				
			||||||
if [ ! $MODEL ]; then
 | 
					 | 
				
			||||||
	MODEL=$(cat /tmp/sysinfo/board_name)
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Read the active firmware version info
 | 
					 | 
				
			||||||
FIRMWARE=$(cat /usr/opensync/.versions | grep FW_IMAGE_ACTIVE | grep -o '[^-]*$')
 | 
					 | 
				
			||||||
if [ ! $FIRMWARE ]; then
 | 
					 | 
				
			||||||
	FIRMWARE=$(cat /usr/opensync/.versions | grep FW_VERSION | cut -d ":" -f2)
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uci set system.tip=tip
 | 
					uci set system.tip=tip
 | 
				
			||||||
uci set system.tip.serial="${SERIAL}"
 | 
					uci set system.tip.serial="${SERIAL}"
 | 
				
			||||||
uci set system.tip.model="${MODEL}"
 | 
					uci set system.tip.model="${MODEL}"
 | 
				
			||||||
uci set system.tip.platform="${PLATFORM}"
 | 
					uci set system.tip.platform="${PLATFORM}"
 | 
				
			||||||
uci set system.tip.firmware="${FIRMWARE}"
 | 
					uci set system.tip.firmware='0.1.0'
 | 
				
			||||||
uci set system.tip.sku_number="${SKU}"
 | 
					uci set system.tip.sku_number="${SKU}"
 | 
				
			||||||
uci set system.tip.revision="${MODEL_REV}"
 | 
					uci set system.tip.revision="${MODEL_REV}"
 | 
				
			||||||
uci set system.tip.model_description="${MODEL_DESCR}"
 | 
					uci set system.tip.model_description="${MODEL_DESCR}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,8 +2,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
uci set network.wan.type=bridge
 | 
					uci set network.wan.type=bridge
 | 
				
			||||||
uci set network.wan6.ifname=@wan
 | 
					uci set network.wan6.ifname=@wan
 | 
				
			||||||
uci set network.wan.metric=1
 | 
					 | 
				
			||||||
uci set network.lan.metric=10
 | 
					 | 
				
			||||||
uci set network.wan.vlan_filtering=1
 | 
					uci set network.wan.vlan_filtering=1
 | 
				
			||||||
uci set network.lan.vlan_filtering=1
 | 
					uci set network.lan.vlan_filtering=1
 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12281,14 +12281,14 @@ index 0000000000..6b0eb2f831
 | 
				
			|||||||
++		pinctrl-names = "default";
 | 
					++		pinctrl-names = "default";
 | 
				
			||||||
++
 | 
					++
 | 
				
			||||||
++		led@25 {
 | 
					++		led@25 {
 | 
				
			||||||
++			label = "green:wifi5";
 | 
					++			label = "wifi5g";
 | 
				
			||||||
++			gpios = <&tlmm 35 GPIO_ACTIVE_LOW>;
 | 
					++			gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>;
 | 
				
			||||||
++			linux,default-trigger = "wf188:green:5g";
 | 
					++			linux,default-trigger = "wf188:green:5g";
 | 
				
			||||||
++			default-state = "off";
 | 
					++			default-state = "off";
 | 
				
			||||||
++		};
 | 
					++		};
 | 
				
			||||||
++		led@24 {
 | 
					++		led@24 {
 | 
				
			||||||
++			label = "green:wifi2";
 | 
					++			label = "wifi2g";
 | 
				
			||||||
++			gpios = <&tlmm 37 GPIO_ACTIVE_LOW>;
 | 
					++			gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
 | 
				
			||||||
++			linux,default-trigger = "wf188:green:2g";
 | 
					++			linux,default-trigger = "wf188:green:2g";
 | 
				
			||||||
++			default-state = "off";
 | 
					++			default-state = "off";
 | 
				
			||||||
++		};
 | 
					++		};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,39 +0,0 @@
 | 
				
			|||||||
From dc2e1e24e5a69face7d154fea6d3ecbee6c90e45 Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: Arif Alam <arif.alam@netexperience.com>
 | 
					 | 
				
			||||||
Date: Wed, 28 Apr 2021 19:29:23 -0400
 | 
					 | 
				
			||||||
Subject: [PATCH] netifd: Add WPA3 Enterprise modes
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Add configuration options for:
 | 
					 | 
				
			||||||
- WPA3 Enterprise Only mode
 | 
					 | 
				
			||||||
- WPA3 Enterprise Transition mode
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Signed-off-by: Arif Alam <arif.alam@netexperience.com>
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 .../patches/0105-add-wpa3-enterprise-modes.patch  | 15 +++++++++++++++
 | 
					 | 
				
			||||||
 1 file changed, 15 insertions(+)
 | 
					 | 
				
			||||||
 create mode 100644 package/network/config/netifd/patches/0105-add-wpa3-enterprise-modes.patch
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/package/network/config/netifd/patches/0105-add-wpa3-enterprise-modes.patch b/package/network/config/netifd/patches/0105-add-wpa3-enterprise-modes.patch
 | 
					 | 
				
			||||||
new file mode 100644
 | 
					 | 
				
			||||||
index 0000000000..9018365807
 | 
					 | 
				
			||||||
--- /dev/null
 | 
					 | 
				
			||||||
+++ b/package/network/config/netifd/patches/0105-add-wpa3-enterprise-modes.patch
 | 
					 | 
				
			||||||
@@ -0,0 +1,15 @@
 | 
					 | 
				
			||||||
+--- a/scripts/netifd-wireless.sh
 | 
					 | 
				
			||||||
++++ b/scripts/netifd-wireless.sh
 | 
					 | 
				
			||||||
+@@ -244,8 +244,11 @@ wireless_vif_parse_encryption() {
 | 
					 | 
				
			||||||
+ 		owe*)
 | 
					 | 
				
			||||||
+ 			auth_type=owe
 | 
					 | 
				
			||||||
+ 		;;
 | 
					 | 
				
			||||||
++		wpa3-only*)
 | 
					 | 
				
			||||||
++			auth_type=eap-only
 | 
					 | 
				
			||||||
++		;;
 | 
					 | 
				
			||||||
+ 		wpa3-mixed*)
 | 
					 | 
				
			||||||
+-			auth_type=eap-eap192
 | 
					 | 
				
			||||||
++			auth_type=eap-transition
 | 
					 | 
				
			||||||
+ 		;;
 | 
					 | 
				
			||||||
+ 		wpa3*)
 | 
					 | 
				
			||||||
+ 			auth_type=eap192
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.25.1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,156 +0,0 @@
 | 
				
			|||||||
From 4a5ac0aa04a5e6cf9316ce7c16843f0f4a4128ce Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: John Crispin <john@phrozen.org>
 | 
					 | 
				
			||||||
Date: Wed, 12 May 2021 07:00:18 +0200
 | 
					 | 
				
			||||||
Subject: [PATCH] ipq807x: fix edgecore eap102
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* import the fixes for the update hardware revision
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Signed-off-by: John Crispin <john@phrozen.org>
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 target/linux/ipq807x/base-files/etc/board.d/02_network    | 5 +----
 | 
					 | 
				
			||||||
 target/linux/ipq807x/base-files/etc/init.d/bootcount      | 3 ++-
 | 
					 | 
				
			||||||
 target/linux/ipq807x/base-files/lib/upgrade/platform.sh   | 4 ++--
 | 
					 | 
				
			||||||
 .../arch/arm64/boot/dts/qcom/qcom-ipq807x-eap102.dts      | 8 ++++----
 | 
					 | 
				
			||||||
 target/linux/ipq807x/image/ipq60xx.mk                     | 6 +++---
 | 
					 | 
				
			||||||
 target/linux/ipq807x/image/ipq807x.mk                     | 2 +-
 | 
					 | 
				
			||||||
 6 files changed, 13 insertions(+), 15 deletions(-)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/target/linux/ipq807x/base-files/etc/board.d/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network
 | 
					 | 
				
			||||||
index f23a9f3eac..e90a73f7bf 100755
 | 
					 | 
				
			||||||
--- a/target/linux/ipq807x/base-files/etc/board.d/02_network
 | 
					 | 
				
			||||||
+++ b/target/linux/ipq807x/base-files/etc/board.d/02_network
 | 
					 | 
				
			||||||
@@ -28,6 +28,7 @@ qcom_setup_interfaces()
 | 
					 | 
				
			||||||
                 ucidef_set_interface_wan "eth0"
 | 
					 | 
				
			||||||
                 ;;
 | 
					 | 
				
			||||||
 	cig,wf194c|\
 | 
					 | 
				
			||||||
+	edgecore,eap102|\
 | 
					 | 
				
			||||||
 	sercomm,wallaby)
 | 
					 | 
				
			||||||
 		ucidef_set_interface_lan "eth0"
 | 
					 | 
				
			||||||
 		ucidef_set_interface_wan "eth1"
 | 
					 | 
				
			||||||
@@ -36,10 +37,6 @@ qcom_setup_interfaces()
 | 
					 | 
				
			||||||
 		ucidef_set_interface_lan "eth1 eth2"
 | 
					 | 
				
			||||||
 		ucidef_set_interface_wan "eth0"
 | 
					 | 
				
			||||||
 		;;
 | 
					 | 
				
			||||||
-	edgecore,eap102)
 | 
					 | 
				
			||||||
-		ucidef_set_interface_lan "eth1"
 | 
					 | 
				
			||||||
-		ucidef_set_interface_wan "eth0"
 | 
					 | 
				
			||||||
-		;;
 | 
					 | 
				
			||||||
 	esac
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
diff --git a/target/linux/ipq807x/base-files/etc/init.d/bootcount b/target/linux/ipq807x/base-files/etc/init.d/bootcount
 | 
					 | 
				
			||||||
index ac345d6d4a..a24f27353e 100755
 | 
					 | 
				
			||||||
--- a/target/linux/ipq807x/base-files/etc/init.d/bootcount
 | 
					 | 
				
			||||||
+++ b/target/linux/ipq807x/base-files/etc/init.d/bootcount
 | 
					 | 
				
			||||||
@@ -4,7 +4,8 @@ START=99
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 boot() {
 | 
					 | 
				
			||||||
 	case "$(board_name)" in
 | 
					 | 
				
			||||||
-	edgecore,eap101)
 | 
					 | 
				
			||||||
+	edgecore,eap101|\
 | 
					 | 
				
			||||||
+	edgecore,eap102)
 | 
					 | 
				
			||||||
 		fw_setenv bootcount 0
 | 
					 | 
				
			||||||
 		;;
 | 
					 | 
				
			||||||
 	esac
 | 
					 | 
				
			||||||
diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
 | 
					 | 
				
			||||||
index 59d1578925..a520df40d7 100755
 | 
					 | 
				
			||||||
--- a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
 | 
					 | 
				
			||||||
+++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
 | 
					 | 
				
			||||||
@@ -48,7 +48,6 @@ platform_do_upgrade() {
 | 
					 | 
				
			||||||
 		;;
 | 
					 | 
				
			||||||
 	cig,wf188n|\
 | 
					 | 
				
			||||||
 	cig,wf194c|\
 | 
					 | 
				
			||||||
-	edgecore,eap102|\
 | 
					 | 
				
			||||||
 	qcom,ipq6018-cp01|\
 | 
					 | 
				
			||||||
 	qcom,ipq807x-hk01|\
 | 
					 | 
				
			||||||
 	sercomm,wallaby|\
 | 
					 | 
				
			||||||
@@ -56,7 +55,8 @@ platform_do_upgrade() {
 | 
					 | 
				
			||||||
 	tplink,ex227)
 | 
					 | 
				
			||||||
 		nand_upgrade_tar "$1"
 | 
					 | 
				
			||||||
 		;;
 | 
					 | 
				
			||||||
-	edgecore,eap101)
 | 
					 | 
				
			||||||
+	edgecore,eap101|\
 | 
					 | 
				
			||||||
+	edgecore,eap102)
 | 
					 | 
				
			||||||
 		CI_UBIPART="rootfs1"
 | 
					 | 
				
			||||||
 		nand_upgrade_tar "$1"
 | 
					 | 
				
			||||||
 		;;
 | 
					 | 
				
			||||||
diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq807x-eap102.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq807x-eap102.dts
 | 
					 | 
				
			||||||
index e8157f5514..cf822c246e 100755
 | 
					 | 
				
			||||||
--- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq807x-eap102.dts
 | 
					 | 
				
			||||||
+++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq807x-eap102.dts
 | 
					 | 
				
			||||||
@@ -32,8 +32,8 @@
 | 
					 | 
				
			||||||
 		 * Aliases as required by u-boot
 | 
					 | 
				
			||||||
 		 * to patch MAC addresses
 | 
					 | 
				
			||||||
 		 */
 | 
					 | 
				
			||||||
-		ethernet0 = "/soc/dp5";
 | 
					 | 
				
			||||||
-		ethernet1 = "/soc/dp6";
 | 
					 | 
				
			||||||
+		ethernet0 = "/soc/dp6";
 | 
					 | 
				
			||||||
+		ethernet1 = "/soc/dp5";
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 		led-boot = &led_power;
 | 
					 | 
				
			||||||
 		led-failsafe = &led_power;
 | 
					 | 
				
			||||||
@@ -593,7 +593,7 @@
 | 
					 | 
				
			||||||
 		};
 | 
					 | 
				
			||||||
 	};
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
-	dp1 {
 | 
					 | 
				
			||||||
+/*	dp1 {
 | 
					 | 
				
			||||||
 		device_type = "network";
 | 
					 | 
				
			||||||
 		compatible = "qcom,nss-dp";
 | 
					 | 
				
			||||||
 		qcom,id = <1>;
 | 
					 | 
				
			||||||
@@ -639,7 +639,7 @@
 | 
					 | 
				
			||||||
 		qcom,link-poll = <1>;
 | 
					 | 
				
			||||||
 		qcom,phy-mdio-addr = <3>;
 | 
					 | 
				
			||||||
 		phy-mode = "sgmii";
 | 
					 | 
				
			||||||
-	};
 | 
					 | 
				
			||||||
+	};*/
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 	dp5 {
 | 
					 | 
				
			||||||
 		device_type = "network";
 | 
					 | 
				
			||||||
diff --git a/target/linux/ipq807x/image/ipq60xx.mk b/target/linux/ipq807x/image/ipq60xx.mk
 | 
					 | 
				
			||||||
index c536a174f8..201885a760 100644
 | 
					 | 
				
			||||||
--- a/target/linux/ipq807x/image/ipq60xx.mk
 | 
					 | 
				
			||||||
+++ b/target/linux/ipq807x/image/ipq60xx.mk
 | 
					 | 
				
			||||||
@@ -7,7 +7,7 @@ define Device/cig_wf188
 | 
					 | 
				
			||||||
   SUPPORTED_DEVICES := cig,wf188
 | 
					 | 
				
			||||||
   IMAGES := sysupgrade.tar
 | 
					 | 
				
			||||||
   IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
 | 
					 | 
				
			||||||
-  DEVICE_PACKAGES := ath11k-wifi-cig-wf188 uboot-env
 | 
					 | 
				
			||||||
+  DEVICE_PACKAGES := ath11k-wifi-cig-wf188 uboot-envtools
 | 
					 | 
				
			||||||
 endef
 | 
					 | 
				
			||||||
 TARGET_DEVICES += cig_wf188
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -16,7 +16,7 @@ define Device/cig_wf188n
 | 
					 | 
				
			||||||
   DEVICE_DTS := qcom-ipq6018-cig-wf188n
 | 
					 | 
				
			||||||
   DEVICE_DTS_CONFIG := config@cp03-c1
 | 
					 | 
				
			||||||
   SUPPORTED_DEVICES := cig,wf188n
 | 
					 | 
				
			||||||
-  DEVICE_PACKAGES := ath11k-wifi-cig-wf188n uboot-env
 | 
					 | 
				
			||||||
+  DEVICE_PACKAGES := ath11k-wifi-cig-wf188n uboot-envtools
 | 
					 | 
				
			||||||
 endef
 | 
					 | 
				
			||||||
 TARGET_DEVICES += cig_wf188n
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -25,7 +25,7 @@ define Device/edgecore_eap101
 | 
					 | 
				
			||||||
   DEVICE_DTS := qcom-ipq6018-edgecore-eap101
 | 
					 | 
				
			||||||
   DEVICE_DTS_CONFIG := config@cp01-c1
 | 
					 | 
				
			||||||
   SUPPORTED_DEVICES := edgecore,eap101
 | 
					 | 
				
			||||||
-  DEVICE_PACKAGES := ath11k-wifi-edgecore-eap101 uboot-env
 | 
					 | 
				
			||||||
+  DEVICE_PACKAGES := ath11k-wifi-edgecore-eap101 uboot-envtools
 | 
					 | 
				
			||||||
 endef
 | 
					 | 
				
			||||||
 TARGET_DEVICES += edgecore_eap101
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
diff --git a/target/linux/ipq807x/image/ipq807x.mk b/target/linux/ipq807x/image/ipq807x.mk
 | 
					 | 
				
			||||||
index 7081769407..000d2793c9 100644
 | 
					 | 
				
			||||||
--- a/target/linux/ipq807x/image/ipq807x.mk
 | 
					 | 
				
			||||||
+++ b/target/linux/ipq807x/image/ipq807x.mk
 | 
					 | 
				
			||||||
@@ -41,7 +41,7 @@ define Device/edgecore_eap102
 | 
					 | 
				
			||||||
   DEVICE_DTS := qcom-ipq807x-eap102
 | 
					 | 
				
			||||||
   DEVICE_DTS_CONFIG=config@ac02
 | 
					 | 
				
			||||||
   SUPPORTED_DEVICES := edgecore,eap102
 | 
					 | 
				
			||||||
-  DEVICE_PACKAGES := ath11k-wifi-edgecore-eap102 kmod-usb3 kmod-usb2
 | 
					 | 
				
			||||||
+  DEVICE_PACKAGES := ath11k-wifi-edgecore-eap102 kmod-usb2 uboot-envtools
 | 
					 | 
				
			||||||
 endef
 | 
					 | 
				
			||||||
 TARGET_DEVICES += edgecore_eap102
 | 
					 | 
				
			||||||
 define Device/tplink_ex227
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.25.1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -60,7 +60,6 @@ packages:
 | 
				
			|||||||
  - kmod-ip6-tunnel
 | 
					  - kmod-ip6-tunnel
 | 
				
			||||||
  - kmod-iptunnel
 | 
					  - kmod-iptunnel
 | 
				
			||||||
  - kmod-iptunnel6
 | 
					  - kmod-iptunnel6
 | 
				
			||||||
  - logrotate
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
diffconfig: |
 | 
					diffconfig: |
 | 
				
			||||||
  CONFIG_OPENSSL_ENGINE=y
 | 
					  CONFIG_OPENSSL_ENGINE=y
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,7 +80,6 @@ packages:
 | 
				
			|||||||
  - eapol-test
 | 
					  - eapol-test
 | 
				
			||||||
  - apc
 | 
					  - apc
 | 
				
			||||||
  - radsecproxy
 | 
					  - radsecproxy
 | 
				
			||||||
  - logrotate
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
diffconfig: |
 | 
					diffconfig: |
 | 
				
			||||||
  CONFIG_OPENSSL_ENGINE=y
 | 
					  CONFIG_OPENSSL_ENGINE=y
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user