Compare commits

..

37 Commits

Author SHA1 Message Date
Owen Anderson
11ec1256c5 WIFI-2681: Allow re-trying a failed upgrade
Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
2021-06-29 19:16:47 -04:00
ravi vaishnav
dc8b77ce5f Wifi-2690. ipq807x:Enable bridge-mgr to control port mac address learning
Merging from uCentral-trunk.
The switch in the IPQ807x/IPQ60xx devices will automatically learn the mac
addresses behind a port. But it will not unlearn this entry when some mac
switches from the ethernet port to the CPU port. This will for example
happens when a device roams from on AP to another AP. At least when both
are APs are bridging the wifi traffic directly or indirectly (mesh) to the
same ethernet broadcast domain.

As result, the roaming device can no longer receive any ethernet packets
which the AP is expected to receive on the ethernet port. This state will
be kept for a couple of minutes until the entry in the FDB is dropped
automatically. But it is still possible for the wifi device to send data
via the ethernet during this whole time.

One solution is to just disable learning on all ports. The other option
would be to enable the qca bridge-mgr which takes care of gathering the
events from the bridge and forwards it to the qca-ssdk (to manipulate the
state of the switch). The latter option was chosen to follow the approach
which QCA is also using in their QSDK.

Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
2021-06-29 19:16:47 -04:00
Owen Anderson
87ac2d554d WIFI-2825: Supress noisy logs
Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
2021-06-29 19:16:47 -04:00
Chaitanya Godavarthi
b122f99bc1 wifi-2649: Fix SM memory leak
memory leaks while reading apc state/config.
Change read method for apc state/config

Signed-off-by: Chaitanya Godavarthi <chaitanya.kiran@netexperience.com>
2021-06-29 19:16:47 -04:00
Nagendrababu
ef68964976 WIFI-2728-captive-portal-config-parameters-overwriting-issue
This patch will add the conditions to respond captive portal API's to
only valid configuration

Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
2021-06-29 19:16:47 -04:00
Chaitanya Godavarthi
d166cf1e31 wifi-2649 Fix Captive portal vifC vifS mismatch
Mismatch in vifC and vifS for captive portal is
leading to opennds restarts and memory leakage.
Fix by making sure the vifC and vifS are in parity.

uci_blob not being freed, fix by making uci_blob
as global so that it need not be freed and can
be reused instead.

Signed-off-by: Chaitanya Godavarthi <chaitanya.kiran@netexperience.com>

Cleaning up captive portal code to improve stability and reduce memory leaks

Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
2021-06-29 19:16:47 -04:00
Owen Anderson
9a7295d396 WIFI-2685, WIFI-2694: Fixed issues in Luci http portal
Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
2021-06-29 19:16:47 -04:00
Yashvardhan
29768c526d Revert "WIFI-2152: Allow re-trying a failed upgrade"
This reverts commit d6d45ba609.
2021-06-29 19:15:56 -04:00
Owen Anderson
192546ee01 WIFI-2671: Added codes 12 & 13 for rebbot & factory reset upgrade options
Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
2021-06-29 19:15:56 -04:00
Owen Anderson
b78645a965 WIFI2680: Revert inactivefw if sysupgrade fails
Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
2021-06-29 19:15:56 -04:00
Owen Anderson
94fd1a1821 WIFI-2152: Allow re-trying a failed upgrade 2021-06-29 19:15:56 -04:00
John Crispin
c3d02f8719 mac80211/ath11k: backport krak2 mitigation
Signed-off-by: John Crispin <john@phrozen.org>
2021-06-29 19:15:56 -04:00
Arif Alam
cc9936baef WIFI-1899: Fix disable dgaf config
Fix disable dgaf config not getting applied.

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2021-06-29 19:15:56 -04:00
Arif Alam
2e018a628c WIFI-2634: Enable RADIUS accounting multi session id AVP
Turn on PMKSA and Opportunistic Key Caching to get Acct-Multi-Session-Id working.

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2021-06-29 19:15:56 -04:00
Arif Alam
b3b1b1307e WIFI-2087: WPA3-Enterprise 192-Bit support
Configure SUITE-B-192, BIP-GMAC-256 and GCMP-256.

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2021-06-29 19:15:56 -04:00
Yashvardhan
feac133dab wifi-2075- Fix for inconsistency in applying vif configuration
- During the configuration process, AP was triggering network
   and wireless reload multiple times in a very short window
   resulting in a poorly configured hostapd. This patch makes sure
   that network/wireless is reloaded only once after all the configuration
   is committed to UCI files.

Signed-off-by: Yashvardhan <yashvardhan@netexperience.com>
2021-06-29 19:15:56 -04:00
Rick Sommerville
1bc19d3e99 WIFI-2604 wlan-ap-factory-reset.sh calls DigiCert
Signed-off-by: Rick Sommerville <rick.sommerville@netexperience.com>
2021-06-29 19:15:56 -04:00
Chaitanya Godavarthi
bb459312b0 wifi-2512: apc gets stuck in wt mode 1 in 5 reboots
Check if APC conf is disabled and not update the
APC state.

Signed-off-by: Chaitanya Godavarthi <chaitanya.kiran@netexperience.com>
2021-06-29 19:15:56 -04:00
ravi vaishnav
af89773c40 Wifi-2635. Correcting the Model name format
When the manufacturer block does not contain the model info,
it is then extracted from /tmp/sysinfo/board_name, stripped
off the manufacturer name and converted for all upper case string.

Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
2021-06-29 19:15:56 -04:00
Nagendrababu
3a5531b569 WIFI-1934-LED-Turnoff
This Patch will add support to turnoff LEDs of the AP through cloud
command

Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
2021-06-29 19:15:56 -04:00
Arif Alam
1f85d25c83 WIFI-838: Dynamic discovery of HSPs/IDPs
Dynamically discover RADSEC endpoint based on NAPTR DNS records.

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2021-06-29 19:15:56 -04:00
ravi vaishnav
ad9df817de Wifi-2544. Fix for Off-chan dwell time configuration
Applying the user configured dwell time for off-channel scan
requests. This needed driver changes to accommodate the command/event
processing time in the configured scan timeout, otherwise the scan
is aborted resulting in no off-channel survey results.

Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
2021-06-29 19:15:56 -04:00
Owen Anderson
d0387fe60c WIFI-2410: Fixed position of ubus check in hostapd assoc code
Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
2021-06-29 19:15:56 -04:00
Nagendrababu
fc2cba962e WIFI-1907-CPU-Utilization
Made minor changes to improve the accuracy of cpu utilization metric

Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
2021-06-29 19:15:56 -04:00
Owen Anderson
2a202eb697 WIFI-721: Added new var to Radio State that stores max channel power
Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
2021-06-29 19:15:56 -04:00
ravi vaishnav
327c048b30 Wifi-2542. Fix for populating correct ID in AWLAN_Node
This fix applies to EA8300, WF194c and EAP102. For these APs,
the br-wan is mapped to eth1 instead of eth0. Adding fix to
use the mac address from eth1 as ID for these particular APs.

Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
2021-06-29 19:15:56 -04:00
Rick Sommerville
91b2ec5013 WIFI-2502 Fix WM crash due to invalid data
Signed-off-by: Rick Sommerville <rick.sommerville@netexperience.com>
2021-06-29 19:15:56 -04:00
Nagendrababu
ce703e1b2e WIFI-1933-Blink-APs-LED
This patch will change the label names for WiFi6 APs to follow common naming convention

Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
2021-06-29 19:15:56 -04:00
ravi vaishnav
725f213e65 WiFi-1827. Updates for RRM Channel Hop based on Noise Floor threshold
Average Noise Floor is calcluated for the last few samples based on the
configured Noise Floor time. This calculated avg Noise Floor is compared
against the configured Noise Floor threshold to decide if a Channel hop
is required. While calculating the average, each noise sample is first
converted from dBm to milliWatts, an avaerage of the all the noise
samples in milliWatt is calculated, then the average is converted back
to dBm.

Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
2021-06-29 19:15:56 -04:00
Owen Anderson
320896474b WIFI-2148: Added auto value for hw_mode in config
Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
2021-06-29 19:15:56 -04:00
Chaitanya Godavarthi
8b07342d9d wifi-2512 APC state gets stuck in WT mode on bootup
Sometimes the APC_State mode gets stuck in WT mode
on bootup. Sometimes the APC State gets updated at
the same time as disabling the APC (SIGTERM puts it in NC mode)
So it may get updated to WT just after SIGTERM handler
puts it in NC mode.
Fix this by setting APC_State in NC mode again after disabling
the APC from opensync (wm).

Signed-off-by: Chaitanya Godavarthi <chaitanya.kiran@netexperience.com>
2021-06-29 19:15:56 -04:00
Arif Alam
1c5a8940e4 WIFI-2517: auto config radius params when radius proxy is enabled
Auto configure per-ssid radius params to talk to the radius proxy service.

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2021-06-29 19:15:56 -04:00
Nagendrababu
ec8170bb11 WIFI-1864-CPU-Temperature_Update
This patch will add the support to read the cpu temperature of ath11k
chipset boards and update to the UI
Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
2021-06-29 19:15:56 -04:00
ravi vaishnav
804c83e70e Wifi-2529. SM crash when DM tries to re-spawn the SM process.
The earlier changes for detaching the nl sockets for SM activity
also included a small change to relocate the event subscription.
This relocation of code is causing the crash due to possible
NULL pointer dereference.
Reverting the event subscription relocation code to avoid the
continuous SM crash.

Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
2021-06-29 19:15:56 -04:00
ravi vaishnav
e412557080 Wifi-2384. Fix for StatsManager crash
Could not root-cause the issue for SM crash, but there were enough
indications of some kind of memory corruption. Different core captures
show the code crashing at different places. An experiment to unblock
the SM socket on the receive end helped avoid the corruption and
subsequently the crashes.

Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
2021-06-29 19:15:56 -04:00
Owen Anderson
12ed24eaf8 WIFI-1845: Updated rotation conf file with new date format
Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
2021-06-29 18:59:13 -04:00
Rick Sommerville
c3e14356ab opensync: make sure that the intermediate CA bundle is always installed
Signed-off-by: John Crispin <john@phrozen.org>
2021-06-01 17:50:18 -04:00
66 changed files with 337 additions and 10352 deletions

View File

@@ -529,7 +529,7 @@ hostapd_set_bss_options() {
set_default signal_poll_time 5
set_default signal_drop_reason 3
set_default signal_strikes 3
set_default proxy_arp 1
set_default proxy_arp 0
set_default multicast_to_unicast 0
@@ -1000,6 +1000,7 @@ hostapd_set_bss_options() {
json_for_each_item append_venue_url venue_url
json_for_each_item append_nai_realm nai_realm
json_for_each_item append_hs20_conn_capab hs20_conn_capab
json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name
json_for_each_item append_osu_provider osu_provider
json_for_each_item append_operator_icon operator_icon
[ -n "$interworking" ] && append bss_conf "interworking=$interworking" "$N"

View File

@@ -1,68 +0,0 @@
Index: hostapd-2020-07-02-58b384f4/src/ap/ubus.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ubus.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ubus.c
@@ -1483,7 +1483,63 @@ static int hostapd_get_bss_list(struct u
return 0;
}
+enum {
+ MOD_IFACE,
+ MOD_PARAM,
+ MOD_PARAM_VAL,
+ __PARAM_MAX
+};
+
+static const struct blobmsg_policy mod_param_policy[__PARAM_MAX] = {
+ [MOD_IFACE] = { "iface", BLOBMSG_TYPE_STRING },
+ [MOD_PARAM] = { "param", BLOBMSG_TYPE_STRING },
+ [MOD_PARAM_VAL] = { "param_val", BLOBMSG_TYPE_STRING },
+};
+
+
+static int
+hostapd_param_modify(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+ struct blob_attr *tb[__PARAM_MAX];
+ struct hapd_interfaces *interfaces = NULL;
+ struct hostapd_data *hapd_bss = NULL;
+ struct hostapd_config *iconf = NULL;
+ struct hostapd_iface *iface = NULL;
+ size_t i = 0;
+
+ interfaces = get_hapd_interfaces_from_object(obj);
+ blobmsg_parse(mod_param_policy, __PARAM_MAX, tb, blob_data(msg),
+ blob_len(msg));
+
+ if (!tb[MOD_PARAM] || !tb[MOD_IFACE] || !tb[MOD_PARAM_VAL])
+ return UBUS_STATUS_INVALID_ARGUMENT;
+
+ wpa_printf(MSG_DEBUG, "Modifyint %s=%s for %s",
+ blobmsg_get_string(tb[MOD_PARAM]),
+ blobmsg_get_string(tb[MOD_PARAM_VAL]),
+ blobmsg_get_string(tb[MOD_IFACE]));
+
+ hapd_bss = hostapd_get_iface(interfaces,
+ blobmsg_get_string(tb[MOD_IFACE]));
+
+ if (hapd_bss) {
+ iconf = hapd_bss->iconf;
+ if (os_strcmp(blobmsg_get_string(tb[MOD_PARAM]),
+ "rssi_ignore_probe_request") == 0) {
+ iconf->rssi_ignore_probe_request = atoi(blobmsg_get_string(tb[MOD_PARAM_VAL]));
+
+ }
+ }
+
+ return UBUS_STATUS_OK;
+}
+
+
+
static const struct ubus_method daemon_methods[] = {
+ UBUS_METHOD("param_mod", hostapd_param_modify, mod_param_policy),
UBUS_METHOD("config_add", hostapd_config_add, config_add_policy),
UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy),
UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list),

View File

@@ -1,14 +0,0 @@
Index: hostapd-2020-07-02-58b384f4/src/ap/ubus.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ubus.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ubus.c
@@ -1655,7 +1655,8 @@ int hostapd_ubus_handle_rt_event(struct
session_id = sta->cl_session_id;
/* find by session id */
- rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl);
+ if (session_id)
+ rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl);
/* prepare rec if not found */
if (!rec) {

View File

@@ -1,28 +0,0 @@
Index: hostapd-2020-07-02-58b384f4/src/ap/ubus.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ubus.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ubus.c
@@ -528,6 +528,7 @@ enum {
CSA_SEC_CHANNEL_OFFSET,
CSA_HT,
CSA_VHT,
+ CSA_HE,
CSA_BLOCK_TX,
__CSA_MAX
};
@@ -541,6 +542,7 @@ static const struct blobmsg_policy csa_p
[CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 },
[CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL },
[CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL },
+ [CSA_HE] = { "he", BLOBMSG_TYPE_BOOL },
[CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL },
};
@@ -783,6 +785,7 @@ hostapd_switch_chan(struct ubus_context
SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32);
SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool);
SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool);
+ SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool);
SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
for (i = 0; i < hapd->iface->num_bss; i++) {

View File

@@ -1,299 +0,0 @@
Index: hostapd-2020-07-02-58b384f4/src/ap/ubus.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ubus.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ubus.c
@@ -21,6 +21,7 @@
#include "rrm.h"
#include "wnm_ap.h"
#include "taxonomy.h"
+#include "common/hw_features_common.h"
static struct ubus_context *ctx;
static struct blob_buf b;
@@ -754,6 +755,207 @@ static int hostapd_get_chan_switch_event
return 0;
}
+#define HOSTAPD_DFS_CSA_DUR 1
+int csa_ch_id, csa_cf0_id, csa_cf1_id = 0;
+int csa_bw = CHANWIDTH_USE_HT;
+struct csa_settings css;
+
+struct hostapd_channel_data *freq_to_chan(struct hostapd_iface *iface, int freq)
+{
+ struct hostapd_hw_modes *mode;
+ struct hostapd_channel_data *chan;
+ int i;
+
+ mode = iface->current_mode;
+ if (mode == NULL || freq == 0) {
+ wpa_printf(MSG_INFO, "%s: mode is NULL", __func__);
+ return NULL;
+ }
+
+ for (i = 0; i < iface->current_mode->num_channels; i++) {
+ chan = &iface->current_mode->channels[i];
+ if (chan->freq == freq) {
+ return chan; /* Channel found */
+ }
+ }
+ return NULL;
+}
+
+void hostapd_dfs_csa_timeout(void *eloop_data, void *user_data)
+{
+ struct hostapd_data *hapd = eloop_data;
+ struct hostapd_iface *iface = hapd->iface;
+ struct csa_settings *css = user_data;
+ int ret = 0;
+
+ wpa_printf(MSG_DEBUG, "%s Stopping CSA in dfs ", __func__);
+
+ hapd->csa_in_progress = 0;
+
+ hostapd_disable_iface(iface);
+
+ iface->freq = css->freq_params.freq;
+ iface->conf->channel = csa_ch_id;
+ iface->conf->secondary_channel = css->freq_params.sec_channel_offset;
+ hostapd_set_oper_centr_freq_seg0_idx(iface->conf, csa_cf0_id);
+ hostapd_set_oper_centr_freq_seg1_idx(iface->conf, csa_cf1_id);
+ hostapd_set_oper_chwidth(iface->conf, csa_bw);
+ iface->conf->ieee80211n = css->freq_params.ht_enabled;
+ iface->conf->ieee80211ac = css->freq_params.vht_enabled;
+ iface->conf->ieee80211ax = css->freq_params.he_enabled;
+ wpa_printf(MSG_INFO, "%s: freq=%d chan=%d sec_ch=%d cf0=%d cf1=%d bw=%d 11n=%d, ac=%d, ax=%d",
+ __func__, iface->freq, iface->conf->channel,
+ iface->conf->secondary_channel, csa_cf0_id, csa_cf1_id,
+ css->freq_params.bandwidth, iface->conf->ieee80211n,
+ iface->conf->ieee80211ac, iface->conf->ieee80211ax);
+
+ ret = hostapd_enable_iface(iface);
+ if (ret == 0)
+ hostapd_ubus_handle_channel_switch_event(iface,
+ HOSTAPD_UBUS_HIGH_INTERFERENCE,
+ iface->freq);
+}
+
+int hostapd_dfs_set_beacon_csa(struct hostapd_iface *iface, struct csa_settings *css)
+{
+ struct hostapd_data *hapd = iface->bss[0];
+ struct hostapd_data *hapd_bss = NULL;
+ struct csa_settings csa_settings;
+ int secondary_channel = 0;
+ u8 vht_oper_centr_freq_seg0_idx;
+ u8 vht_oper_centr_freq_seg1_idx;
+ int err = 0, i = 0;
+
+ if (hapd->csa_in_progress == 1) {
+ wpa_printf(MSG_ERROR, "CSA in progress, cannot switch channel");
+ return -1;
+ }
+
+ eloop_cancel_timeout(hostapd_dfs_csa_timeout, hapd, NULL);
+
+ /* Setup Beacon CSA request */
+ secondary_channel = iface->conf->secondary_channel;
+ vht_oper_centr_freq_seg0_idx =
+ iface->conf->vht_oper_centr_freq_seg0_idx;
+ vht_oper_centr_freq_seg1_idx =
+ iface->conf->vht_oper_centr_freq_seg1_idx;
+
+ os_memset(&csa_settings, 0, sizeof(csa_settings));
+ err = hostapd_set_freq_params(&csa_settings.freq_params,
+ iface->conf->hw_mode,
+ iface->freq,
+ iface->conf->channel,
+ iface->conf->enable_edmg,
+ iface->conf->edmg_channel,
+ iface->conf->ieee80211n,
+ iface->conf->ieee80211ac,
+ iface->conf->ieee80211ax,
+ secondary_channel,
+ hostapd_get_oper_chwidth(iface->conf),
+ vht_oper_centr_freq_seg0_idx,
+ vht_oper_centr_freq_seg1_idx,
+ iface->current_mode->vht_capab,
+ &iface->current_mode->he_capab[IEEE80211_MODE_AP]);
+ if (err) {
+ wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
+ return -1;
+ }
+
+ if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) {
+ wpa_printf(MSG_ERROR, "CSA is not supported");
+ return -1;
+ }
+
+ /* Set Beacon */
+ for (i = 0; i < hapd->iface->num_bss; i++) {
+ hapd_bss = iface->bss[i];
+ hapd_bss->cs_freq_params = csa_settings.freq_params;
+ hapd_bss->cs_count = css->cs_count;
+ hapd_bss->cs_block_tx = css->block_tx;
+ err = ieee802_11_set_beacon(hapd_bss);
+ if (err)
+ wpa_printf(MSG_ERROR, "CSA beacon set failed, changing channel without an Announcement");
+ }
+
+ hapd->csa_in_progress = 1;
+
+ /* Switch Channel after a timeout */
+ eloop_register_timeout(HOSTAPD_DFS_CSA_DUR, 0,
+ hostapd_dfs_csa_timeout, hapd, css);
+
+ return 0;
+}
+
+int hostapd_switch_chan_dfs(struct hostapd_iface *iface,
+ struct csa_settings *css)
+{
+ struct hostapd_channel_data *ch, *cf1, *cf2 = NULL;
+ int res = 0;
+
+ if (iface == NULL)
+ return -1;
+
+ /* Set channel id and center frequecies id */
+ if (css->freq_params.freq > 0) {
+ ch = freq_to_chan(iface, css->freq_params.freq);
+ csa_ch_id = ch->chan;
+ }
+
+ if (css->freq_params.center_freq1 > 0) {
+ csa_cf0_id = 36 + (css->freq_params.center_freq1 - 5180) / 5;
+ }
+
+ if (css->freq_params.center_freq2 > 0) {
+ csa_cf1_id = 36 + (css->freq_params.center_freq2 - 5180) / 5;
+ }
+
+ wpa_printf(MSG_DEBUG, "%s freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds, ieee80211n=%d, ieee80211ac=%d, ieee80211ax=%d ", __func__,
+ css->freq_params.freq,
+ csa_ch_id, css->freq_params.sec_channel_offset,
+ css->freq_params.bandwidth, csa_cf0_id, csa_cf1_id,
+ iface->dfs_cac_ms / 1000, iface->conf->ieee80211n,
+ iface->conf->ieee80211ac, iface->conf->ieee80211ax);
+
+ /* Set bandwidth */
+ switch (css->freq_params.bandwidth) {
+ case 0:
+ case 20:
+ case 40:
+ csa_bw = CHANWIDTH_USE_HT;
+ break;
+ case 80:
+ if (css->freq_params.center_freq2)
+ csa_bw = CHANWIDTH_80P80MHZ;
+ else
+ csa_bw = CHANWIDTH_80MHZ;
+ break;
+ case 160:
+ csa_bw = CHANWIDTH_160MHZ;
+ break;
+ default:
+ wpa_printf(MSG_WARNING, "Unknown CSA bandwidth: %d",
+ css->freq_params.bandwidth);
+ break;
+ }
+
+ /* Set new frequency info */
+ iface->freq = css->freq_params.freq;
+ iface->conf->channel = csa_ch_id;
+ iface->conf->secondary_channel = css->freq_params.sec_channel_offset;
+ hostapd_set_oper_centr_freq_seg0_idx(iface->conf, csa_cf0_id);
+ hostapd_set_oper_centr_freq_seg1_idx(iface->conf, csa_cf1_id);
+ hostapd_set_oper_chwidth(iface->conf, csa_bw);
+ iface->conf->ieee80211n = css->freq_params.ht_enabled;
+ iface->conf->ieee80211ac = css->freq_params.vht_enabled;
+ iface->conf->ieee80211ax = css->freq_params.he_enabled;
+
+ /*Set beacon for CSA*/
+ hostapd_dfs_set_beacon_csa(iface, css);
+
+ return 0;
+
+}
+
static int
hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -761,14 +963,19 @@ hostapd_switch_chan(struct ubus_context
{
struct blob_attr *tb[__CSA_MAX];
struct hostapd_data *hapd = get_hapd_from_object(obj);
- struct csa_settings css;
+ struct hostapd_iface *iface = hapd->iface;
+ struct hostapd_channel_data *chan =NULL;
int i;
+ int freq = 0;
blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[CSA_FREQ])
return UBUS_STATUS_INVALID_ARGUMENT;
+ freq = blobmsg_get_u32(tb[CSA_FREQ]);
+ chan = freq_to_chan(iface, freq);
+
memset(&css, 0, sizeof(css));
css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]);
@@ -788,6 +995,21 @@ hostapd_switch_chan(struct ubus_context
SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool);
SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
+ wpa_printf(MSG_INFO, "%s: CSS freq=%d chan=%d sec_chan_off=%d, width=%d, seg0=%d, seg1=%d", __func__,
+ css.freq_params.freq,
+ chan->chan, css.freq_params.sec_channel_offset,
+ css.freq_params.bandwidth,
+ css.freq_params.center_freq1,
+ css.freq_params.center_freq2);
+
+ if ((chan->flag & HOSTAPD_CHAN_RADAR) &&
+ ((chan->flag & HOSTAPD_CHAN_DFS_MASK)
+ != HOSTAPD_CHAN_DFS_AVAILABLE)) {
+ wpa_printf(MSG_INFO, "%s: DFS chan need CAC", __func__);
+ hostapd_switch_chan_dfs(iface, &css);
+ return UBUS_STATUS_OK;
+ }
+
for (i = 0; i < hapd->iface->num_bss; i++) {
if (hostapd_switch_channel(hapd->iface->bss[i], &css) != 0)
return UBUS_STATUS_NOT_SUPPORTED;
@@ -1454,10 +1676,16 @@ void hostapd_ubus_free_bss(struct hostap
}
free(name);
- for (size_t i = 0; i < bss_nr; i++)
- os_free(bss_lst[i]);
- free(bss_lst);
- bss_lst = NULL;
+
+ if (bss_lst != NULL) {
+ for (size_t i = 0; i < bss_nr; i++) {
+ os_free(bss_lst[i]);
+ bss_lst[i] = NULL;
+ }
+ free(bss_lst);
+ bss_lst = NULL;
+ bss_nr = 0;
+ }
}
static int hostapd_get_bss_list(struct ubus_context *ctx,
@@ -1477,9 +1705,11 @@ static int hostapd_get_bss_list(struct u
a = blobmsg_open_array(&b_ev, "bss_list");
/* check bss list from hapd */
for (size_t i = 0; i < bss_nr; i++) {
- b = blobmsg_open_table(&b_ev, NULL);
- blobmsg_add_string(&b_ev, "name", bss_lst[i]);
- blobmsg_close_table(&b_ev, b);
+ if (bss_lst[i] != NULL) {
+ b = blobmsg_open_table(&b_ev, NULL);
+ blobmsg_add_string(&b_ev, "name", bss_lst[i]);
+ blobmsg_close_table(&b_ev, b);
+ }
}
blobmsg_close_array(&b_ev, a);
ubus_send_reply(ctx, req, b_ev.head);

View File

@@ -1,64 +0,0 @@
--- a/src/ap/ubus.c
+++ b/src/ap/ubus.c
@@ -531,6 +531,7 @@ enum {
CSA_VHT,
CSA_HE,
CSA_BLOCK_TX,
+ CSA_REASON,
__CSA_MAX
};
@@ -545,6 +546,7 @@ static const struct blobmsg_policy csa_p
[CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL },
[CSA_HE] = { "he", BLOBMSG_TYPE_BOOL },
[CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL },
+ [CSA_REASON] = { "reason", BLOBMSG_TYPE_INT32 },
};
#ifdef NEED_AP_MLME
@@ -810,7 +812,7 @@ void hostapd_dfs_csa_timeout(void *eloop
iface->conf->ieee80211ac, iface->conf->ieee80211ax);
ret = hostapd_enable_iface(iface);
- if (ret == 0)
+ if (ret == 0 && css->reason == 0)
hostapd_ubus_handle_channel_switch_event(iface,
HOSTAPD_UBUS_HIGH_INTERFERENCE,
iface->freq);
@@ -994,6 +996,7 @@ hostapd_switch_chan(struct ubus_context
SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool);
SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool);
SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
+ SET_CSA_SETTING(CSA_REASON, reason, u32);
wpa_printf(MSG_INFO, "%s: CSS freq=%d chan=%d sec_chan_off=%d, width=%d, seg0=%d, seg1=%d", __func__,
css.freq_params.freq,
@@ -1015,7 +1018,9 @@ hostapd_switch_chan(struct ubus_context
return UBUS_STATUS_NOT_SUPPORTED;
}
- hostapd_ubus_handle_channel_switch_event(hapd->iface, HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq);
+ if (css.reason == 0) {
+ hostapd_ubus_handle_channel_switch_event(hapd->iface, HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq);
+ }
return UBUS_STATUS_OK;
#undef SET_CSA_SETTING
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2404,6 +2404,7 @@ struct beacon_data {
* @freq_params: Next channel frequency parameter
* @beacon_csa: Beacon/probe resp/asooc resp info for CSA period
* @beacon_after: Next beacon/probe resp/asooc resp info
+ * @reason: The reason why we are switching the channel
* @counter_offset_beacon: Offset to the count field in beacon's tail
* @counter_offset_presp: Offset to the count field in probe resp.
*/
@@ -2414,6 +2415,7 @@ struct csa_settings {
struct hostapd_freq_params freq_params;
struct beacon_data beacon_csa;
struct beacon_data beacon_after;
+ u32 reason;
u16 counter_offset_beacon[2];
u16 counter_offset_presp[2];

View File

@@ -1,112 +0,0 @@
--- a/src/ap/ubus.c
+++ b/src/ap/ubus.c
@@ -580,6 +580,7 @@ static int hostapd_clear_session(struct
{
if (session_id == rec->session_id) {
/* dec counter and delete */
+ wpa_printf(MSG_INFO, "%s Deleting client session with session id %llu", __func__, session_id);
cached_events_nr -= rec->rec_nr;
avl_delete(&hapd->ubus.rt_events, &rec->avl);
os_free(rec->records);
@@ -633,6 +634,11 @@ static int hostapd_sessions(struct ubus_
/* messages for current session */
for (size_t i = 0; i < rec->rec_nr; i++) {
c_rec = &rec->records[i];
+ if (c_rec->processed) {
+ /* Record is already reported, continue */
+ continue;
+ }
+
/* check message type */
switch (c_rec->type) {
/* ClientAuthEvent */
@@ -646,6 +652,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_u32(&b_ev, "auth_status", p->auth_status);
blobmsg_add_string(&b_ev, "ssid", p->ssid);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -665,6 +672,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_u8(&b_ev, "using11v", p->using11v);
blobmsg_add_string(&b_ev, "ssid", p->ssid);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -680,6 +688,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_u32(&b_ev, "internal_rc", p->internal_rc);
blobmsg_add_string(&b_ev, "ssid", p->ssid);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -693,6 +702,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_u64(&b_ev, "fdata_tx_up_ts_in_us", p->tx_ts.tv_sec * (uint64_t)1000000);
blobmsg_add_u64(&b_ev, "fdata_rx_up_ts_in_us", p->rx_ts.tv_sec * (uint64_t)1000000);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -705,6 +715,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac);
blobmsg_add_string(&b_ev, "ip_address", p->ip_addr);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -1912,6 +1923,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_AUTH;
rp->u.auth.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
@@ -1942,6 +1954,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_ASSOC;
rp->u.assoc.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
/* frequency */
@@ -1986,6 +1999,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_DISASSOC;
rp->u.disassoc.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
/* frequency */
@@ -2017,6 +2031,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_FDATA;
rp->u.fdata.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
/* STA MAC */
@@ -2045,6 +2060,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_IP;
rp->u.ip.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
/* STA MAC */
--- a/src/ap/ubus.h
+++ b/src/ap/ubus.h
@@ -110,6 +110,7 @@ struct client_ip_event {
};
struct client_session_record {
+ bool processed;
int type;
uint64_t timestamp;
union {

View File

@@ -1,31 +0,0 @@
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -7339,16 +7339,18 @@
survey = &ar->survey[idx];
- survey->noise = bss_ch_info_ev.noise_floor;
- survey->time = div_u64(total, cc_freq_hz);
- survey->time_busy = div_u64(busy, cc_freq_hz);
- survey->time_rx = div_u64(rx_bss, cc_freq_hz);
- survey->time_tx = div_u64(tx, cc_freq_hz);
- survey->filled |= (SURVEY_INFO_NOISE_DBM |
- SURVEY_INFO_TIME |
- SURVEY_INFO_TIME_BUSY |
- SURVEY_INFO_TIME_RX |
- SURVEY_INFO_TIME_TX);
+ survey->noise = bss_ch_info_ev.noise_floor;
+ survey->time = div_u64(total, cc_freq_hz);
+ survey->time_busy = div_u64(busy, cc_freq_hz);
+ survey->time_rx = div_u64(rx, cc_freq_hz);
+ survey->time_bss_rx = div_u64(rx_bss, cc_freq_hz);
+ survey->time_tx = div_u64(tx, cc_freq_hz);
+ survey->filled |= (SURVEY_INFO_NOISE_DBM |
+ SURVEY_INFO_TIME |
+ SURVEY_INFO_TIME_BUSY |
+ SURVEY_INFO_TIME_RX |
+ SURVEY_INFO_TIME_TX |
+ SURVEY_INFO_TIME_BSS_RX);
exit:
spin_unlock_bh(&ar->data_lock);
complete(&ar->bss_survey_done);

View File

@@ -1,392 +0,0 @@
Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/debug.c
===================================================================
--- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/debug.c
+++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/debug.c
@@ -1838,6 +1838,230 @@ static const struct file_operations fops
.open = simple_open
};
+static ssize_t ath11k_read_set_rates(struct file *file,
+ char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ const char buf[] =
+ "This is to set fixed bcast, mcast, and beacon rates. Normal rate-ctrl\n"
+ "is handled through normal API using 'iw', etc.\n"
+ "To set a value, you specify the dev-name, type, band and rate-code:\n"
+ "types: bcast, mcast, beacon, mgmt\n"
+ "bands: 2, 5\n"
+ "rate-codes: 1M (0x10000103), 2M (0x10000102), 5.5M (0x10000101),\n 11M (0x10000100), 6M (0x10000003),9M (0x10000007),\n 12M (0x10000002), 18M (0x10000006),\n 24M (0x10000001), 36M (0x10000005), 48M (0x10000000),\n 54M (0x10000004) , 0xFF default\n"
+ "Example, set beacon to 18Mbps on wlan0(2.4G):\n echo \"wlan0 beacon 2 0x10000006\" > /sys/kernel/debug/ieee80211/phy0/ath11k/set_rates\n";
+
+ return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
+}
+
+bool check_band_rate_compat(struct ath11k *ar, long rc, int band)
+{
+ struct ieee80211_supported_band *sband = NULL;
+ int br, i = 0;
+ long rcode = 0;
+
+ sband = ar->hw->wiphy->bands[band];
+ if (sband == NULL) {
+ ath11k_err(ar->ab, "band not valid\n");
+ return false;
+ }
+
+ for (i = 0; i < sband->n_bitrates; i++) {
+ br = sband->bitrates[i].bitrate;
+ rcode = ath11k_mac_get_rate_hw_value(sband->bitrates[i].bitrate);
+ if (rcode == rc){
+ return true;
+ }
+ }
+ ath11k_err(ar->ab, "rate-code not found rc=%ld(0x%lx)", rc, rc);
+ return false;
+}
+
+/* Set the rates for specific types of traffic. */
+static ssize_t ath11k_write_set_rates(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath11k *ar = file->private_data;
+ char buf[80];
+ int ret;
+ struct ath11k_vif *arvif;
+ struct ieee80211_vif *vif;
+ unsigned int vdev_id = 0xFFFF;
+ char* bufptr = buf;
+ long rc;
+ int cfg_band;
+ struct cfg80211_chan_def def;
+ char dev_name_match[IFNAMSIZ + 2];
+ struct wireless_dev *wdev;
+ int set_rate_type;
+
+ memset(buf, 0, sizeof(buf));
+
+ simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
+
+ /* make sure that buf is null terminated */
+ buf[sizeof(buf) - 1] = 0;
+
+ /* drop the possible '\n' from the end */
+ if (buf[count - 1] == '\n')
+ buf[count - 1] = 0;
+
+ mutex_lock(&ar->conf_mutex);
+
+ /* Ignore empty lines, 'echo' appends them sometimes at least. */
+ if (buf[0] == 0) {
+ ret = count;
+ goto exit;
+ }
+
+ /* String starts with vdev name, ie 'wlan0' Find the proper vif that
+ * matches the name.
+ */
+ list_for_each_entry(arvif, &ar->arvifs, list) {
+ vif = arvif->vif;
+ wdev = ieee80211_vif_to_wdev(vif);
+
+ if (!wdev)
+ continue;
+ snprintf(dev_name_match, sizeof(dev_name_match) - 1, "%s ",
+ wdev->netdev->name);
+ if (strncmp(dev_name_match, buf, strlen(dev_name_match)) == 0) {
+ vdev_id = arvif->vdev_id;
+ bufptr = buf + strlen(dev_name_match);
+ break;
+ }
+ }
+
+ if (vdev_id == 0xFFFF) {
+ ath11k_warn(ar->ab, "set-rate, unknown netdev name: %s\n", buf);
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ /* Now, check the type. */
+ if (strncmp(bufptr, "beacon ", strlen("beacon ")) == 0) {
+ set_rate_type = WMI_VDEV_PARAM_BEACON_RATE;
+ bufptr += strlen("beacon ");
+ }
+ else if (strncmp(bufptr, "mgmt ", strlen("mgmt ")) == 0) {
+ set_rate_type = WMI_VDEV_PARAM_MGMT_RATE;
+ bufptr += strlen("mgmt ");
+ }
+ else if (strncmp(bufptr, "bcast ", strlen("bcast ")) == 0) {
+ set_rate_type = WMI_VDEV_PARAM_BCAST_DATA_RATE;
+ bufptr += strlen("bcast ");
+ }
+ else if (strncmp(bufptr, "mcast ", strlen("mcast ")) == 0) {
+ set_rate_type = WMI_VDEV_PARAM_MCAST_DATA_RATE;
+ bufptr += strlen("mcast ");
+ }
+ else {
+ ath11k_warn(ar->ab, "set-rate, invalid rate type: %s\n",
+ bufptr);
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ /* And the band */
+ if (strncmp(bufptr, "2 ", 2) == 0) {
+ cfg_band = NL80211_BAND_2GHZ;
+ bufptr += 2;
+ }
+ else if (strncmp(bufptr, "5 ", 2) == 0) {
+ cfg_band = NL80211_BAND_5GHZ;
+ bufptr += 2;
+ }
+ else if (strncmp(bufptr, "60 ", 3) == 0) {
+ cfg_band = NL80211_BAND_60GHZ;
+ bufptr += 3;
+ }
+ else {
+ ath11k_warn(ar->ab, "set-rate, invalid band: %s\n",
+ bufptr);
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ /* Parse the rate-code. */
+ ret = kstrtol(bufptr, 0, &rc);
+ if (ret != 0) {
+ ath11k_warn(ar->ab, "set-rate, invalid rate-code: %s\n",
+ bufptr);
+ goto exit;
+ }
+
+ /* Store the value so we can re-apply it if firmware is restarted. */
+ if (set_rate_type == WMI_VDEV_PARAM_MGMT_RATE) {
+ arvif->mgt_rate[cfg_band] = rc;
+ arvif->mgt_rate_set[cfg_band] = true;
+ }
+ else if (set_rate_type == WMI_VDEV_PARAM_BCAST_DATA_RATE) {
+ arvif->bcast_rate[cfg_band] = rc;
+ arvif->bcast_rate_set[cfg_band] = true;
+ }
+ else if (set_rate_type == WMI_VDEV_PARAM_MCAST_DATA_RATE) {
+ arvif->mcast_rate[cfg_band] = rc;
+ arvif->mcast_rate_set[cfg_band] = true;
+ }
+ else if (set_rate_type == WMI_VDEV_PARAM_BEACON_RATE) {
+ arvif->bcn_rate[cfg_band] = rc;
+ arvif->bcn_rate_set[cfg_band] = true;
+ }
+
+ if (ar->state != ATH11K_STATE_ON &&
+ ar->state != ATH11K_STATE_RESTARTED) {
+ /* OK, we will set it when vdev comes up */
+ ath11k_warn(ar->ab, "set-rates, deferred-state is down, vdev %i type: 0x%x rc: 0x%lx band: %d\n",
+ arvif->vdev_id, set_rate_type, rc, cfg_band);
+ goto exit;
+ }
+
+ if (ath11k_mac_vif_chan(vif, &def) == 0) {
+ if (def.chan->band != cfg_band) {
+ /* We stored value, will apply it later if we move to
+ * the different band.
+ */
+ ath11k_warn(ar->ab, "set-rates, deferred-other-band, vdev %i type: 0x%x rc: 0x%lx band: %d\n",
+ arvif->vdev_id, set_rate_type,
+ rc, cfg_band);
+ goto exit;
+ }
+
+ if (check_band_rate_compat(ar, rc, def.chan->band) == false) {
+ ath11k_warn(ar->ab, "set-rate, wrong rate code\n");
+ ret = -EINVAL;
+ goto exit;
+ }
+ }
+
+ /* finally, send results to the firmware */
+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
+ set_rate_type, rc);
+ if (ret) {
+ ath11k_warn(ar->ab, "set-rates: vdev %i failed to set fixed rate, param 0x%x rate-code 0x%02lx\n",
+ arvif->vdev_id, set_rate_type, rc);
+ goto exit;
+ }
+
+ ath11k_warn(ar->ab, "set-rates, vdev %i type: 0x%x rc: 0x%lx band: %d\n",
+ arvif->vdev_id, set_rate_type, rc, cfg_band);
+
+ ret = count;
+
+exit:
+ mutex_unlock(&ar->conf_mutex);
+ return ret;
+}
+
+static const struct file_operations fops_set_rates = {
+ .read = ath11k_read_set_rates,
+ .write = ath11k_write_set_rates,
+ .open = simple_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
static ssize_t ath11k_write_enable_m3_dump(struct file *file,
const char __user *ubuf,
size_t count, loff_t *ppos)
@@ -2532,6 +2756,9 @@ int ath11k_debug_register(struct ath11k
&fops__btcoex_duty_cycle);
debugfs_create_file("dump_mgmt_stats", 0644, ar->debug.debugfs_pdev,
ar, &fops_dump_mgmt_stats);
+ debugfs_create_file("set_rates", 0600, ar->debug.debugfs_pdev,
+ ar, &fops_set_rates);
+
if (ar->hw->wiphy->bands[NL80211_BAND_5GHZ]) {
debugfs_create_file("dfs_simulate_radar", 0200,
Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/mac.c
===================================================================
--- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/mac.c
+++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/mac.c
@@ -414,8 +414,8 @@ static u8 ath11k_parse_mpdudensity(u8 mp
}
}
-static int ath11k_mac_vif_chan(struct ieee80211_vif *vif,
- struct cfg80211_chan_def *def)
+int ath11k_mac_vif_chan(struct ieee80211_vif *vif,
+ struct cfg80211_chan_def *def)
{
struct ieee80211_chanctx_conf *conf;
@@ -2633,7 +2633,7 @@ static void ath11k_bss_disassoc(struct i
/* TODO: cancel connection_loss_work */
}
-static u32 ath11k_mac_get_rate_hw_value(int bitrate)
+u32 ath11k_mac_get_rate_hw_value(int bitrate)
{
u32 preamble;
u16 hw_value;
@@ -2672,6 +2672,11 @@ static void ath11k_recalculate_mgmt_rate
lockdep_assert_held(&ar->conf_mutex);
+ /* If user has over-ridden the mgt rate, don't muck with it here. */
+ if (arvif->mgt_rate_set[def->chan->band] ||
+ arvif->bcn_rate_set[def->chan->band])
+ return;
+
sband = ar->hw->wiphy->bands[def->chan->band];
basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1;
bitrate = sband->bitrates[basic_rate_idx].bitrate;
@@ -2682,12 +2687,14 @@ static void ath11k_recalculate_mgmt_rate
return;
}
+ arvif->mgt_rate[def->chan->band] = hw_rate_code;
vdev_param = WMI_VDEV_PARAM_MGMT_RATE;
ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param,
hw_rate_code);
if (ret)
ath11k_warn(ar->ab, "failed to set mgmt tx rate %d\n", ret);
+ arvif->bcn_rate[def->chan->band] = hw_rate_code;
vdev_param = WMI_VDEV_PARAM_BEACON_RATE;
ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param,
hw_rate_code);
@@ -3116,17 +3123,23 @@ static void ath11k_mac_op_bss_info_chang
rate = ATH11K_HW_RATE_CODE(hw_value, 0, preamble);
ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
- "mac vdev %d mcast_rate %x\n",
- arvif->vdev_id, rate);
-
- vdev_param = WMI_VDEV_PARAM_MCAST_DATA_RATE;
- ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
- vdev_param, rate);
- if (ret)
- ath11k_warn(ar->ab,
- "failed to set mcast rate on vdev %i: %d\n",
- arvif->vdev_id, ret);
+ "mac vdev %d mcast_rate %x override-set-mcast: %d override-set-bcast: %d\n",
+ arvif->vdev_id, rate, arvif->mcast_rate_set[band],
+ arvif->bcast_rate_set[band]);
+
+ if (!arvif->mcast_rate_set[band]) {
+ arvif->mcast_rate[band] = rate;
+ vdev_param = WMI_VDEV_PARAM_MCAST_DATA_RATE;
+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
+ vdev_param, rate);
+ if (ret)
+ ath11k_warn(ar->ab,
+ "failed to set mcast rate on vdev %i: %d\n",
+ arvif->vdev_id, ret);
+ }
+ if (!arvif->bcast_rate_set[band]) {
+ arvif->bcast_rate[band] = rate;
vdev_param = WMI_VDEV_PARAM_BCAST_DATA_RATE;
ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
vdev_param, rate);
@@ -3134,6 +3147,7 @@ static void ath11k_mac_op_bss_info_chang
ath11k_warn(ar->ab,
"failed to set bcast rate on vdev %i: %d\n",
arvif->vdev_id, ret);
+ }
}
if (changed & BSS_CHANGED_BASIC_RATES &&
@@ -5832,6 +5846,12 @@ static int ath11k_mac_op_add_interface(s
memset(arvif, 0, sizeof(*arvif));
+ memset(&arvif->bcast_rate, WMI_FIXED_RATE_NONE,
+ sizeof(arvif->bcast_rate));
+ memset(&arvif->mcast_rate, WMI_FIXED_RATE_NONE,
+ sizeof(arvif->mcast_rate));
+ memset(&arvif->mgt_rate, WMI_FIXED_RATE_NONE, sizeof(arvif->mgt_rate));
+
arvif->ar = ar;
arvif->vif = vif;
Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/mac.h
===================================================================
--- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/mac.h
+++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/mac.h
@@ -164,4 +164,8 @@ u8 ath11k_mac_bw_to_mac80211_bw(u8 bw);
enum ath11k_supported_bw ath11k_mac_mac80211_bw_to_ath11k_bw(enum rate_info_bw bw);
enum hal_encrypt_type ath11k_dp_tx_get_encrypt_type(u32 cipher);
void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif);
+int ath11k_mac_vif_chan(struct ieee80211_vif *vif,
+ struct cfg80211_chan_def *def);
+
+u32 ath11k_mac_get_rate_hw_value(int bitrate);
#endif
Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/core.h
===================================================================
--- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/core.h
+++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/core.h
@@ -265,6 +265,23 @@ struct ath11k_vif {
#ifdef CPTCFG_ATH11K_NSS_SUPPORT
struct arvif_nss nss;
#endif
+ /* Firmware allows configuring rate of each of these traffic types.
+ * 0xFF will mean value has not been set by user, and in that case,
+ * we will auto-adjust the rates based on the legacy rate mask.
+ **/
+ /* TODO-BEN: This may conflict with upstream code? */
+ u8 mcast_rate[NUM_NL80211_BANDS];
+ u8 bcast_rate[NUM_NL80211_BANDS];
+ u8 mgt_rate[NUM_NL80211_BANDS];
+ u8 bcn_rate[NUM_NL80211_BANDS];
+
+ /* Flag if these rates are set through debugfs, in that case, ignore
+ * setting from farther up the stack.
+ */
+ bool mcast_rate_set[NUM_NL80211_BANDS];
+ bool bcast_rate_set[NUM_NL80211_BANDS];
+ bool mgt_rate_set[NUM_NL80211_BANDS];
+ bool bcn_rate_set[NUM_NL80211_BANDS];
};
struct ath11k_vif_iter {

View File

@@ -1,11 +0,0 @@
--- a/ath10k-5.7/mac.c 2021-07-06 11:12:56.022146449 -0700
+++ b/ath10k-5.7/mac.c 2021-07-06 19:37:52.352753693 -0700
@@ -8286,7 +8286,7 @@
struct ieee80211_channel *channel)
{
int ret;
- enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR;
+ enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ;
lockdep_assert_held(&ar->conf_mutex);

View File

@@ -1,31 +0,0 @@
--- a/ath10k-5.7/wmi.c
+++ b/ath10k-5.7/wmi.c
@@ -6347,16 +6347,18 @@
survey = &ar->survey[idx];
- survey->noise = noise_floor;
- survey->time = div_u64(total, cc_freq_hz);
- survey->time_busy = div_u64(busy, cc_freq_hz);
- survey->time_rx = div_u64(rx_bss, cc_freq_hz);
- survey->time_tx = div_u64(tx, cc_freq_hz);
- survey->filled |= (SURVEY_INFO_NOISE_DBM |
- SURVEY_INFO_TIME |
- SURVEY_INFO_TIME_BUSY |
- SURVEY_INFO_TIME_RX |
- SURVEY_INFO_TIME_TX);
+ survey->noise = noise_floor;
+ survey->time = div_u64(total, cc_freq_hz);
+ survey->time_busy = div_u64(busy, cc_freq_hz);
+ survey->time_rx = div_u64(rx, cc_freq_hz);
+ survey->time_bss_rx = div_u64(rx_bss, cc_freq_hz);
+ survey->time_tx = div_u64(tx, cc_freq_hz);
+ survey->filled |= (SURVEY_INFO_NOISE_DBM |
+ SURVEY_INFO_TIME |
+ SURVEY_INFO_TIME_BUSY |
+ SURVEY_INFO_TIME_RX |
+ SURVEY_INFO_TIME_TX |
+ SURVEY_INFO_TIME_BSS_RX);
exit:
spin_unlock_bh(&ar->data_lock);
complete(&ar->bss_survey_done);

View File

@@ -918,6 +918,7 @@ hostapd_set_bss_options() {
json_for_each_item append_venue_url venue_url
json_for_each_item append_nai_realm nai_realm
json_for_each_item append_hs20_conn_capab hs20_conn_capab
json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name
json_for_each_item append_osu_provider osu_provider
json_for_each_item append_operator_icon operator_icon
[ -n "$interworking" ] && append bss_conf "interworking=$interworking" "$N"

View File

@@ -1,65 +0,0 @@
Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ubus.c
+++ hostapd-2020-06-08-5a8b3662/src/ap/ubus.c
@@ -1486,7 +1486,60 @@ static int hostapd_get_bss_list(struct u
return 0;
}
+enum {
+ MOD_IFACE,
+ MOD_PARAM,
+ MOD_PARAM_VAL,
+ __PARAM_MAX
+};
+
+static const struct blobmsg_policy mod_param_policy[__PARAM_MAX] = {
+ [MOD_IFACE] = { "iface", BLOBMSG_TYPE_STRING },
+ [MOD_PARAM] = { "param", BLOBMSG_TYPE_STRING },
+ [MOD_PARAM_VAL] = { "param_val", BLOBMSG_TYPE_STRING },
+};
+
+static int
+hostapd_param_modify(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+ struct blob_attr *tb[__PARAM_MAX];
+ struct hapd_interfaces *interfaces = NULL;
+ struct hostapd_data *hapd_bss = NULL;
+ struct hostapd_config *iconf = NULL;
+ struct hostapd_iface *iface = NULL;
+ size_t i = 0;
+
+ interfaces = get_hapd_interfaces_from_object(obj);
+ blobmsg_parse(mod_param_policy, __PARAM_MAX, tb, blob_data(msg),
+ blob_len(msg));
+ if (!tb[MOD_PARAM] || !tb[MOD_IFACE] || !tb[MOD_PARAM_VAL])
+ return UBUS_STATUS_INVALID_ARGUMENT;
+
+ wpa_printf(MSG_DEBUG, "Modifyint %s=%s for %s",
+ blobmsg_get_string(tb[MOD_PARAM]),
+ blobmsg_get_string(tb[MOD_PARAM_VAL]),
+ blobmsg_get_string(tb[MOD_IFACE]));
+
+ hapd_bss = hostapd_get_iface(interfaces,
+ blobmsg_get_string(tb[MOD_IFACE]));
+
+ if (hapd_bss) {
+ iconf = hapd_bss->iconf;
+ if (os_strcmp(blobmsg_get_string(tb[MOD_PARAM]),
+ "rssi_ignore_probe_request") == 0) {
+ iconf->rssi_ignore_probe_request = atoi(blobmsg_get_string(tb[MOD_PARAM_VAL]));
+
+ }
+ }
+
+ return UBUS_STATUS_OK;
+}
+
+
static const struct ubus_method daemon_methods[] = {
+ UBUS_METHOD("param_mod", hostapd_param_modify, mod_param_policy),
UBUS_METHOD("config_add", hostapd_config_add, config_add_policy),
UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy),
UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list),

View File

@@ -1,14 +0,0 @@
Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ubus.c
+++ hostapd-2020-06-08-5a8b3662/src/ap/ubus.c
@@ -1657,7 +1657,8 @@ int hostapd_ubus_handle_rt_event(struct
session_id = sta->cl_session_id;
/* find by session id */
- rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl);
+ if (session_id)
+ rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl);
/* prepare rec if not found */
if (!rec) {

View File

@@ -1,299 +0,0 @@
Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ubus.c
+++ hostapd-2020-06-08-5a8b3662/src/ap/ubus.c
@@ -21,6 +21,7 @@
#include "rrm.h"
#include "wnm_ap.h"
#include "taxonomy.h"
+#include "common/hw_features_common.h"
static struct ubus_context *ctx;
static struct blob_buf b;
@@ -754,6 +755,208 @@ static int hostapd_get_chan_switch_event
return 0;
}
+#define HOSTAPD_DFS_CSA_DUR 1
+int csa_ch_id, csa_cf0_id, csa_cf1_id = 0;
+int csa_bw = CHANWIDTH_USE_HT;
+struct csa_settings css;
+
+struct hostapd_channel_data *freq_to_chan(struct hostapd_iface *iface, int freq)
+{
+ struct hostapd_hw_modes *mode;
+ struct hostapd_channel_data *chan;
+ int i;
+
+ mode = iface->current_mode;
+ if (mode == NULL || freq == 0) {
+ wpa_printf(MSG_INFO, "%s: mode is NULL", __func__);
+ return NULL;
+ }
+
+ for (i = 0; i < iface->current_mode->num_channels; i++) {
+ chan = &iface->current_mode->channels[i];
+ if (chan->freq == freq) {
+ return chan; /* Channel found */
+ }
+ }
+ return NULL;
+}
+
+void hostapd_dfs_csa_timeout(void *eloop_data, void *user_data)
+{
+ struct hostapd_data *hapd = eloop_data;
+ struct hostapd_iface *iface = hapd->iface;
+ struct csa_settings *css = user_data;
+ int ret = 0;
+
+ wpa_printf(MSG_DEBUG, "%s Stopping CSA in dfs ", __func__);
+
+ hapd->csa_in_progress = 0;
+
+ hostapd_disable_iface(iface);
+
+ iface->freq = css->freq_params.freq;
+ iface->conf->channel = csa_ch_id;
+ iface->conf->secondary_channel = css->freq_params.sec_channel_offset;
+ hostapd_set_oper_centr_freq_seg0_idx(iface->conf, csa_cf0_id);
+ hostapd_set_oper_centr_freq_seg1_idx(iface->conf, csa_cf1_id);
+ hostapd_set_oper_chwidth(iface->conf, csa_bw);
+ iface->conf->ieee80211n = css->freq_params.ht_enabled;
+ iface->conf->ieee80211ac = css->freq_params.vht_enabled;
+ iface->conf->ieee80211ax = css->freq_params.he_enabled;
+ wpa_printf(MSG_INFO, "%s: freq=%d chan=%d sec_ch=%d cf0=%d cf1=%d bw=%d 11n=%d, ac=%d, ax=%d",
+ __func__, iface->freq, iface->conf->channel,
+ iface->conf->secondary_channel, csa_cf0_id, csa_cf1_id,
+ css->freq_params.bandwidth, iface->conf->ieee80211n,
+ iface->conf->ieee80211ac, iface->conf->ieee80211ax);
+
+ ret = hostapd_enable_iface(iface);
+ if (ret == 0)
+ hostapd_ubus_handle_channel_switch_event(iface,
+ HOSTAPD_UBUS_HIGH_INTERFERENCE,
+ iface->freq);
+
+}
+
+int hostapd_dfs_set_beacon_csa(struct hostapd_iface *iface, struct csa_settings *css)
+{
+ struct hostapd_data *hapd = iface->bss[0];
+ struct hostapd_data *hapd_bss = NULL;
+ struct csa_settings csa_settings;
+ int secondary_channel = 0;
+ u8 vht_oper_centr_freq_seg0_idx;
+ u8 vht_oper_centr_freq_seg1_idx;
+ int err = 0, i = 0;
+
+ if (hapd->csa_in_progress == 1) {
+ wpa_printf(MSG_ERROR, "CSA in progress, cannot switch channel");
+ return -1;
+ }
+
+ eloop_cancel_timeout(hostapd_dfs_csa_timeout, hapd, NULL);
+
+ /* Setup Beacon CSA request */
+ secondary_channel = iface->conf->secondary_channel;
+ vht_oper_centr_freq_seg0_idx =
+ iface->conf->vht_oper_centr_freq_seg0_idx;
+ vht_oper_centr_freq_seg1_idx =
+ iface->conf->vht_oper_centr_freq_seg1_idx;
+
+ os_memset(&csa_settings, 0, sizeof(csa_settings));
+ err = hostapd_set_freq_params(&csa_settings.freq_params,
+ iface->conf->hw_mode,
+ iface->freq,
+ iface->conf->channel,
+ iface->conf->enable_edmg,
+ iface->conf->edmg_channel,
+ iface->conf->ieee80211n,
+ iface->conf->ieee80211ac,
+ iface->conf->ieee80211ax,
+ secondary_channel,
+ hostapd_get_oper_chwidth(iface->conf),
+ vht_oper_centr_freq_seg0_idx,
+ vht_oper_centr_freq_seg1_idx,
+ iface->current_mode->vht_capab,
+ &iface->current_mode->he_capab[IEEE80211_MODE_AP]);
+ if (err) {
+ wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
+ return -1;
+ }
+
+
+ if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) {
+ wpa_printf(MSG_ERROR, "CSA is not supported");
+ return -1;
+ }
+
+ /* Set Beacon */
+ for (i = 0; i < hapd->iface->num_bss; i++) {
+ hapd_bss = iface->bss[i];
+ hapd_bss->cs_freq_params = csa_settings.freq_params;
+ hapd_bss->cs_count = css->cs_count;
+ hapd_bss->cs_block_tx = css->block_tx;
+ err = ieee802_11_set_beacon(hapd_bss);
+ if (err)
+ wpa_printf(MSG_ERROR, "CSA beacon set failed, changing channel without an Announcement");
+ }
+
+ hapd->csa_in_progress = 1;
+
+ /* Switch Channel after a timeout */
+ eloop_register_timeout(HOSTAPD_DFS_CSA_DUR, 0,
+ hostapd_dfs_csa_timeout, hapd, css);
+
+ return 0;
+}
+
+int hostapd_switch_chan_dfs(struct hostapd_iface *iface,
+ struct csa_settings *css)
+{
+ struct hostapd_channel_data *ch, *cf1, *cf2 = NULL;
+ int res = 0;
+
+ if (iface == NULL)
+ return -1;
+
+ /* Set channel id and center frequecies id */
+ if (css->freq_params.freq > 0) {
+ ch = freq_to_chan(iface, css->freq_params.freq);
+ csa_ch_id = ch->chan;
+ }
+
+ if (css->freq_params.center_freq1 > 0) {
+ csa_cf0_id = 36 + (css->freq_params.center_freq1 - 5180) / 5;
+ }
+
+ if (css->freq_params.center_freq2 > 0) {
+ csa_cf1_id = 36 + (css->freq_params.center_freq2 - 5180) / 5;
+ }
+
+ wpa_printf(MSG_DEBUG, "%s freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds, ieee80211n=%d, ieee80211ac=%d, ieee80211ax=%d ", __func__,
+ css->freq_params.freq,
+ csa_ch_id, css->freq_params.sec_channel_offset,
+ css->freq_params.bandwidth, csa_cf0_id, csa_cf1_id,
+ iface->dfs_cac_ms / 1000, iface->conf->ieee80211n,
+ iface->conf->ieee80211ac, iface->conf->ieee80211ax);
+
+ /* Set bandwidth */
+ switch (css->freq_params.bandwidth) {
+ case 0:
+ case 20:
+ case 40:
+ csa_bw = CHANWIDTH_USE_HT;
+ break;
+ case 80:
+ if (css->freq_params.center_freq2)
+ csa_bw = CHANWIDTH_80P80MHZ;
+ else
+ csa_bw = CHANWIDTH_80MHZ;
+ break;
+ case 160:
+ csa_bw = CHANWIDTH_160MHZ;
+ break;
+ default:
+ wpa_printf(MSG_WARNING, "Unknown CSA bandwidth: %d",
+ css->freq_params.bandwidth);
+ break;
+ }
+
+ /* Set new frequency info */
+ iface->freq = css->freq_params.freq;
+ iface->conf->channel = csa_ch_id;
+ iface->conf->secondary_channel = css->freq_params.sec_channel_offset;
+ hostapd_set_oper_centr_freq_seg0_idx(iface->conf, csa_cf0_id);
+ hostapd_set_oper_centr_freq_seg1_idx(iface->conf, csa_cf1_id);
+ hostapd_set_oper_chwidth(iface->conf, csa_bw);
+ iface->conf->ieee80211n = css->freq_params.ht_enabled;
+ iface->conf->ieee80211ac = css->freq_params.vht_enabled;
+ iface->conf->ieee80211ax = css->freq_params.he_enabled;
+
+ /*Set beacon for CSA*/
+ hostapd_dfs_set_beacon_csa(iface, css);
+
+ return 0;
+}
+
static int
hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -761,14 +964,19 @@ hostapd_switch_chan(struct ubus_context
{
struct blob_attr *tb[__CSA_MAX];
struct hostapd_data *hapd = get_hapd_from_object(obj);
- struct csa_settings css;
+ struct hostapd_iface *iface = hapd->iface;
+ struct hostapd_channel_data *chan =NULL;
int i;
+ int freq = 0;
blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[CSA_FREQ])
return UBUS_STATUS_INVALID_ARGUMENT;
+ freq = blobmsg_get_u32(tb[CSA_FREQ]);
+ chan = freq_to_chan(iface, freq);
+
memset(&css, 0, sizeof(css));
css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]);
@@ -787,6 +995,20 @@ hostapd_switch_chan(struct ubus_context
SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool);
SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
+ wpa_printf(MSG_INFO, "%s: CSS freq=%d chan=%d sec_chan_off=%d, width=%d, seg0=%d, seg1=%d", __func__,
+ css.freq_params.freq,
+ chan->chan, css.freq_params.sec_channel_offset,
+ css.freq_params.bandwidth,
+ css.freq_params.center_freq1,
+ css.freq_params.center_freq2);
+
+ if ((chan->flag & HOSTAPD_CHAN_RADAR) &&
+ ((chan->flag & HOSTAPD_CHAN_DFS_MASK)
+ != HOSTAPD_CHAN_DFS_AVAILABLE)) {
+ wpa_printf(MSG_INFO, "%s: DFS chan need CAC", __func__);
+ hostapd_switch_chan_dfs(iface, &css);
+ return UBUS_STATUS_OK;
+ }
for (i = 0; i < hapd->iface->num_bss; i++) {
if (hostapd_switch_channel(hapd->iface->bss[i], &css) != 0)
@@ -1454,10 +1676,16 @@ void hostapd_ubus_free_bss(struct hostap
}
free(name);
- for (size_t i = 0; i < bss_nr; i++)
- os_free(bss_lst[i]);
- free(bss_lst);
- bss_lst = NULL;
+
+ if (bss_lst != NULL) {
+ for (size_t i = 0; i < bss_nr; i++) {
+ os_free(bss_lst[i]);
+ bss_lst[i] = NULL;
+ }
+ free(bss_lst);
+ bss_lst = NULL;
+ bss_nr = 0;
+ }
}
static int hostapd_get_bss_list(struct ubus_context *ctx,
@@ -1477,9 +1705,11 @@ static int hostapd_get_bss_list(struct u
a = blobmsg_open_array(&b_ev, "bss_list");
/* check bss list from hapd */
for (size_t i = 0; i < bss_nr; i++) {
- b = blobmsg_open_table(&b_ev, NULL);
- blobmsg_add_string(&b_ev, "name", bss_lst[i]);
- blobmsg_close_table(&b_ev, b);
+ if (bss_lst[i] != NULL) {
+ b = blobmsg_open_table(&b_ev, NULL);
+ blobmsg_add_string(&b_ev, "name", bss_lst[i]);
+ blobmsg_close_table(&b_ev, b);
+ }
}
blobmsg_close_array(&b_ev, a);
ubus_send_reply(ctx, req, b_ev.head);

View File

@@ -1,64 +0,0 @@
--- a/src/ap/ubus.c
+++ b/src/ap/ubus.c
@@ -530,6 +530,7 @@ enum {
CSA_HT,
CSA_VHT,
CSA_BLOCK_TX,
+ CSA_REASON,
__CSA_MAX
};
@@ -543,6 +544,7 @@ static const struct blobmsg_policy csa_p
[CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL },
[CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL },
[CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL },
+ [CSA_REASON] = { "reason", BLOBMSG_TYPE_INT32 },
};
#ifdef NEED_AP_MLME
@@ -810,7 +812,7 @@ void hostapd_dfs_csa_timeout(void *eloop
iface->conf->ieee80211ac, iface->conf->ieee80211ax);
ret = hostapd_enable_iface(iface);
- if (ret == 0)
+ if (ret == 0 && css->reason == 0)
hostapd_ubus_handle_channel_switch_event(iface,
HOSTAPD_UBUS_HIGH_INTERFERENCE,
iface->freq);
@@ -994,6 +996,7 @@ hostapd_switch_chan(struct ubus_context
SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool);
SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool);
SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
+ SET_CSA_SETTING(CSA_REASON, reason, u32);
wpa_printf(MSG_INFO, "%s: CSS freq=%d chan=%d sec_chan_off=%d, width=%d, seg0=%d, seg1=%d", __func__,
css.freq_params.freq,
@@ -1015,7 +1018,9 @@ hostapd_switch_chan(struct ubus_context
return UBUS_STATUS_NOT_SUPPORTED;
}
- hostapd_ubus_handle_channel_switch_event(hapd->iface,HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq);
+ if (css.reason == 0) {
+ hostapd_ubus_handle_channel_switch_event(hapd->iface, HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq);
+ }
return UBUS_STATUS_OK;
#undef SET_CSA_SETTING
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2291,6 +2291,7 @@ struct beacon_data {
* @freq_params: Next channel frequency parameter
* @beacon_csa: Beacon/probe resp/asooc resp info for CSA period
* @beacon_after: Next beacon/probe resp/asooc resp info
+ * @reason: The reason why we are switching the channel
* @counter_offset_beacon: Offset to the count field in beacon's tail
* @counter_offset_presp: Offset to the count field in probe resp.
*/
@@ -2301,6 +2302,7 @@ struct csa_settings {
struct hostapd_freq_params freq_params;
struct beacon_data beacon_csa;
struct beacon_data beacon_after;
+ u32 reason;
u16 counter_offset_beacon[2];
u16 counter_offset_presp[2];

View File

@@ -1,111 +0,0 @@
--- a/src/ap/ubus.c
+++ b/src/ap/ubus.c
@@ -578,6 +578,7 @@ static int hostapd_clear_session(struct
{
if (session_id == rec->session_id) {
/* dec counter and delete */
+ wpa_printf(MSG_INFO, "%s Deleting client session with session id %llu", __func__, session_id);
cached_events_nr -= rec->rec_nr;
avl_delete(&hapd->ubus.rt_events, &rec->avl);
os_free(rec->records);
@@ -631,6 +632,10 @@ static int hostapd_sessions(struct ubus_
/* messages for current session */
for (size_t i = 0; i < rec->rec_nr; i++) {
c_rec = &rec->records[i];
+ if (c_rec->processed) {
+ /* Record is already reported, continue */
+ continue;
+ }
/* check message type */
switch (c_rec->type) {
/* ClientAuthEvent */
@@ -644,6 +649,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_u32(&b_ev, "auth_status", p->auth_status);
blobmsg_add_string(&b_ev, "ssid", p->ssid);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -663,6 +669,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_u8(&b_ev, "using11v", p->using11v);
blobmsg_add_string(&b_ev, "ssid", p->ssid);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -678,6 +685,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_u32(&b_ev, "internal_rc", p->internal_rc);
blobmsg_add_string(&b_ev, "ssid", p->ssid);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -691,6 +699,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_u64(&b_ev, "fdata_tx_up_ts_in_us", p->tx_ts.tv_sec * (uint64_t)1000000);
blobmsg_add_u64(&b_ev, "fdata_rx_up_ts_in_us", p->rx_ts.tv_sec * (uint64_t)1000000);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -703,6 +712,7 @@ static int hostapd_sessions(struct ubus_
blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac);
blobmsg_add_string(&b_ev, "ip_address", p->ip_addr);
blobmsg_close_table(&b_ev, t_msg);
+ c_rec->processed = true;
break;
}
@@ -1911,6 +1921,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_AUTH;
rp->u.auth.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
@@ -1941,6 +1952,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_ASSOC;
rp->u.assoc.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
/* frequency */
@@ -1985,6 +1997,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_DISASSOC;
rp->u.disassoc.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
/* frequency */
@@ -2016,6 +2029,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_FDATA;
rp->u.fdata.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
/* STA MAC */
@@ -2044,6 +2058,7 @@ int hostapd_ubus_handle_rt_event(struct
struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
rp->type = CST_IP;
rp->u.ip.session_id = rec->session_id;
+ rp->processed = false;
/* timestamp */
rp->timestamp = timestamp;
/* STA MAC */
--- a/src/ap/ubus.h
+++ b/src/ap/ubus.h
@@ -110,6 +110,7 @@ struct client_ip_event {
};
struct client_session_record {
+ bool processed;
int type;
uint64_t timestamp;
union {

View File

@@ -1,15 +0,0 @@
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
exit 1
fi
action=$1
[ "$action" = "enable" ] && [ ! -f /etc/ssh-flag ] && uci set firewall.lan_ssh_rule.target='REJECT'
[ "$action" = "disable" ] && uci set firewall.lan_ssh_rule.target='ACCEPT'
uci commit firewall
/etc/init.d/firewall restart
exit 0

View File

@@ -3,3 +3,5 @@
#Blink AP's LED
/usr/opensync/tools/ovsh insert Node_Config module:="led" key:="led_blink" value:="on"
#Turnoff AP's LED
/usr/opensync/tools/ovsh insert Node_Config module:="led" key:="led_off" value:="off"

View File

@@ -1,5 +0,0 @@
#!/bin/sh
#Turnoff blinking of AP's LED
/usr/opensync/tools/ovsh insert Node_Config module:="led" key:="led_off" value:="off"

View File

@@ -40,9 +40,6 @@ else
redirector_addr=$1
fi
# Enable lan ssh accsess
lan-ssh-firewall disable
echo "${redirector_addr}" > /usr/opensync/certs/redirector.txt
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start

View File

@@ -13,21 +13,8 @@ hwmode=$(uci get wireless.${radio}.hwmode)
bcn_rate=$(($(uci get wireless.${DEVICENAME}.bcn_rate)/10))
mcast_rate=$(uci get wireless.${DEVICENAME}.mcast_rate)
ATH10K_FILE="/sys/kernel/debug/ieee80211/${phy}/ath10k/set_rates"
if [ -f "$ATH10K_FILE" ]; then
# ath10k rate-codes: 0x43 1M, 0x42 2M, 0x41 5.5M, 0x40 11M, 0x3 6M, 0x7 9M, 0x2 12M, 0x6 18M, 0x1 24M, 0x5 36M, 0x0 48M, 0x4 54M, 0xFF default
rate_codes="1:0x43 2:0x42 5:0x41 11:0x40 6:0x3 9:0x7 12:0x2 18:0x6 24:0x1 36:0x5 48:0x0 54:0x4"
SET_RATES_PATH=${ATH10K_FILE}
fi
ATH11K_FILE="/sys/kernel/debug/ieee80211/${phy}/ath11k/set_rates"
if [ -f "$ATH11K_FILE" ]; then
# ath11k rate-codes: 0x10000103 1M, 0x10000102 2M, 0x10000101 5.5M, 0x10000100 11M, 0x10000003 6M, 0x10000007 9M, 0x10000002 12M, 0x10000006 18M, 0x10000001 24M, 0x10000005 36M, 0x10000000 48M, 0x10000004 54M
rate_codes="1:0x10000103 2:0x10000102 5:0x10000101 11:0x10000100 6:0x10000003 9:0x10000007 12:0x10000002 18:0x10000006 24:0x10000001 36:0x10000005 48:0x10000000 54:0x10000004"
SET_RATES_PATH=${ATH11K_FILE}
fi
rate_codes="1:0x43 2:0x42 5:0x41 11:0x40 6:0x3 9:0x7 12:0x2 18:0x6 24:0x1 36:0x5 48:0x0 54:0x4"
# Default codes
beacon_code=0xFF
@@ -47,15 +34,5 @@ done
# set rates
logger -t hotplug "Set Tx rates for device ${DEVICENAME}"
sleep 20
[ "${beacon_code}" = "0xFF" ] || {
echo "${DEVICENAME} beacon ${band} ${beacon_code}" > ${SET_RATES_PATH}
if [ -f "$ATH11K_FILE" ]; then
echo "${DEVICENAME} mgmt ${band} ${beacon_code}" > ${SET_RATES_PATH}
fi
}
[ "${mcast_code}" = "0xFF" ] || {
echo "${DEVICENAME} mcast ${band} ${mcast_code}" > ${SET_RATES_PATH}
}
echo "${DEVICENAME} beacon ${band} ${beacon_code}" > /sys/kernel/debug/ieee80211/${phy}/ath10k/set_rates
echo "${DEVICENAME} mcast ${band} ${mcast_code}" > /sys/kernel/debug/ieee80211/${phy}/ath10k/set_rates

View File

@@ -72,6 +72,63 @@ Index: opensync-2.0.5.0/interfaces/opensync.ovsschema
}
}
}
Index: opensync-2.0.5.0/platform/openwrt/src/lib/target/src/radio_ubus.c
===================================================================
--- opensync-2.0.5.0.orig/platform/openwrt/src/lib/target/src/radio_ubus.c
+++ opensync-2.0.5.0/platform/openwrt/src/lib/target/src/radio_ubus.c
@@ -10,6 +10,7 @@
extern struct ev_loop *wifihal_evloop;
static struct ubus_context *ubus;
extern struct ev_loop *wifihal_evloop;
+extern void apc_state_set(struct blob_attr *msg);
int hapd_rrm_enable(char *name, int neighbor, int beacon)
{
@@ -179,6 +180,7 @@ radio_ubus_add_vif_cb(struct ubus_contex
return UBUS_STATUS_OK;
}
+
static const struct ubus_method radio_ubus_methods[] = {
UBUS_METHOD("dbg_add_vif", radio_ubus_add_vif_cb, add_vif_policy),
UBUS_METHOD("dummy", radio_ubus_dummy_cb, dummy_policy),
@@ -201,8 +203,36 @@ static void radio_ubus_connect(struct ub
ubus_add_object(ubus, &radio_ubus_object);
}
+static int radio_ubus_notify(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+ char *str;
+
+ str = blobmsg_format_json(msg, true);
+ LOGD("ubus: Received ubus notify '%s': %s\n", method, str);
+ free(str);
+
+ if (!strncmp(method, "apc", 3)) {
+ LOGD("APC notification Received");
+ apc_state_set(msg);
+ }
+
+ return 0;
+}
+
+
+
static struct ubus_instance ubus_instance = {
.connect = radio_ubus_connect,
+ .notify = radio_ubus_notify,
+ .list = {
+ {
+ .path = "apc",
+ },
+ },
+ .len = 1,
+
};
int radio_ubus_init(void)
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

View File

@@ -1,44 +0,0 @@
Index: opensync-2.0.5.0/src/sm/src/sm_scan_schedule.c
===================================================================
--- opensync-2.0.5.0.orig/src/sm/src/sm_scan_schedule.c
+++ opensync-2.0.5.0/src/sm/src/sm_scan_schedule.c
@@ -155,6 +155,12 @@ clean:
/* Remove processed context */
ds_dlist_remove_head(&g_scan_ctx_list);
+ LOG(DEBUG, "sm_scan_schedule_cb. Scan done. Deleting scan_ctx. %p. %s %s %d\n",
+ scan_ctx,
+ radio_get_name_from_type(scan_ctx->scan_request.radio_cfg->type),
+ radio_get_scan_name_from_type(scan_ctx->scan_request.scan_type),
+ scan_ctx->scan_request.chan_list[0]);
+
sm_scan_ctx_free(scan_ctx);
scan_ctx = NULL;
@@ -163,6 +169,13 @@ clean:
if (scan_ctx)
{
scan_status = true;
+
+ LOG(DEBUG, "sm_scan_schedule_cb. Schedule next scan request. %p. %s %s %d\n",
+ scan_ctx,
+ radio_get_name_from_type(scan_ctx->scan_request.radio_cfg->type),
+ radio_get_scan_name_from_type(scan_ctx->scan_request.scan_type),
+ scan_ctx->scan_request.chan_list[0]);
+
rc =
sm_scan_schedule_process (
scan_ctx);
@@ -303,6 +316,12 @@ bool sm_scan_schedule(
if (NULL == scan_in_progress) {
/* Trigger the scan and wait for results */
+ LOG(DEBUG, "sm_scan_schedule. Schedule scan request. %p. %s %s %d\n",
+ scan_ctx,
+ radio_get_name_from_type(scan_ctx->scan_request.radio_cfg->type),
+ radio_get_scan_name_from_type(scan_ctx->scan_request.scan_type),
+ scan_ctx->scan_request.chan_list[0]);
+
rc =
sm_scan_schedule_process(
scan_ctx);

View File

@@ -1,10 +1,9 @@
/* SPDX-License-Identifier: BSD-3-Clause */
#include <string.h>
#include <glob.h>
#include <linux/limits.h>
#include <libgen.h>
#include <stdio.h>
#include <libubox/blobmsg_json.h>
#include "uci.h"
#include "command.h"
@@ -282,10 +281,6 @@ static const struct uci_blob_param_list led_param = {
static char led[][8]={"lan", "wan", "eth", "wifi2", "wifi5", "wlan2g", "wlan5g", "power","eth0",
"status", "eth1", "wifi2g", "eth2", "wifi5g", "plug", "world", "usb", "linksys", "wps", "bt"};
static struct blob_buf b;
#define DEFAULT_BOARD_JSON "/etc/board.json"
static struct blob_attr *board_info;
static void led_state(int config)
{
struct blob_attr *tb[__LED_ATTR_MAX] = { };
@@ -340,57 +335,14 @@ static void set_led_config(char *trigger_name, char *key, char* value, char* led
return;
}
static struct blob_attr* config_find_blobmsg_attr(struct blob_attr *attr, const char *name, int type)
{
struct blobmsg_policy policy = { .name = name, .type = type };
struct blob_attr *cur;
blobmsg_parse(&policy, 1, &cur, blobmsg_data(attr), blobmsg_len(attr));
return cur;
}
static char* get_phy_map_led_info(char* wifi)
{
struct blob_attr *cur;
blob_buf_init(&b, 0);
if (!blobmsg_add_json_from_file(&b, DEFAULT_BOARD_JSON)) {
return NULL;
}
if (board_info != NULL) {
free(board_info);
board_info = NULL;
}
cur = config_find_blobmsg_attr(b.head, "led", BLOBMSG_TYPE_TABLE);
if (!cur) {
LOGD("Failed to find led objet in board.json file");
return NULL;
}
board_info = blob_memdup(cur);
if (!board_info)
return NULL;
cur = config_find_blobmsg_attr(board_info, wifi, BLOBMSG_TYPE_TABLE);
if (!cur) {
LOGD("Failed to find %s objet in board.json file", wifi);
return NULL;
}
cur = config_find_blobmsg_attr(cur, "trigger", BLOBMSG_TYPE_STRING);
if (!cur) {
LOGD("Failed to find trigger in board.json file");
return NULL;
}
return blobmsg_get_string(cur);
}
static void get_led_info_from_sys_config(char* key, char* value)
static void led_handler(int type,
struct schema_Node_Config *old,
struct schema_Node_Config *conf)
{
char led_string[32];
char ap_name[16];
char color[16];
char led_section[16];
char led_name_final[24];
char sys[8];
char class[8];
char leds[8];
@@ -398,57 +350,31 @@ static void get_led_info_from_sys_config(char* key, char* value)
glob_t gl;
unsigned int i;
if (glob("/sys/class/leds/*", GLOB_NOSORT, NULL, &gl))
return;
for (i = 0; i < gl.gl_pathc; i++) {
strncpy(sysled, gl.gl_pathv[i], sizeof(sysled));
sscanf(sysled,"/%[^/]/%[^/]/%[^/]/%s", sys, class, leds, led_string);
sscanf(led_string,"%[^:]:%[^:]:%s",ap_name, color, led_section);
if(available_led_check(led_section)) {
snprintf(led_name_final, sizeof(led_name_final), "%s%s","led_",led_section);
if(!strcmp(key, "led_blink")) {
set_led_config("heartbeat", key, value, led_string, led_name_final);
}
else if(!strcmp(key, "led_off")) {
set_led_config("none", key, value, led_string, led_name_final);
}
else {
if(!strcmp(led_section, "wifi2g") || !strcmp(led_section, "wifi5g")) {
set_led_config(get_phy_map_led_info(led_section), key, value, led_string, led_name_final);
}
else
set_led_config("none", key, value, led_string, led_name_final);
}
}
}
globfree(&gl);
return;
}
static void led_handler(int type,
struct schema_Node_Config *old,
struct schema_Node_Config *conf)
{
int del=1;
switch (type) {
case OVSDB_UPDATE_NEW:
case OVSDB_UPDATE_MODIFY:
if (!strcmp(conf->key, "led_blink") || !strcmp(conf->key, "led_off")) {
get_led_info_from_sys_config(conf->key, conf->value);
del=0;
if (!strcmp(conf->key, "led_blink") || !strcmp(conf->key, "led_off"))
{
if (glob("/sys/class/leds/*", GLOB_NOSORT, NULL, &gl))
return;
for (i = 0; i < gl.gl_pathc; i++) {
strncpy(sysled, gl.gl_pathv[i], sizeof(sysled));
sscanf(sysled,"/%[^/]/%[^/]/%[^/]/%s", sys, class, leds, led_string);
sscanf(led_string,"%[^:]:%[^:]:%s",ap_name, color, led_section);
if(available_led_check(led_section)) {
if(!strcmp(conf->key, "led_blink")) {
set_led_config("heartbeat", conf->key, conf->value, led_string, led_section);
}
else if(!strcmp(conf->key, "led_off")) {
set_led_config("none", conf->key, conf->value, led_string, led_section);
}
}
}
}
break;
case OVSDB_UPDATE_DEL:
get_led_info_from_sys_config("led_state", "default");
break;
default:
LOGD("Invalid Command");
globfree(&gl);
}
uci_commit_all(uci);
if(del)
node_state_del("led");
else
led_state(0);
led_state(0);
}
static struct node_handler {

View File

@@ -10,13 +10,6 @@
static ovsdb_table_t table_Manager;
static int done;
static void disable_ssh()
{
LOGN("Disabling LAN ssh access");
system("lan-ssh-firewall enable");
}
static void stop_http(void *arg)
{
LOGN("Stopping webserver");
@@ -24,8 +17,6 @@ static void stop_http(void *arg)
system("uci commit system");
system("/etc/init.d/uhttpd stop");
system("/etc/init.d/uhttpd disable");
disable_ssh();
}
static void callback_Manager(ovsdb_update_monitor_t *mon,

View File

@@ -54,7 +54,7 @@ UNIT_CFLAGS := -I$(UNIT_PATH)/inc
UNIT_CFLAGS += -Isrc/lib/common/inc/
UNIT_CFLAGS += -Isrc/lib/version/inc/
UNIT_LDFLAGS += -lev -lubox -luci -lubus -lwebsocket -lblobmsg_json
UNIT_LDFLAGS += -lev -lubox -luci -lubus -lwebsocket
UNIT_LDFLAGS += -lrt
UNIT_EXPORT_CFLAGS := $(UNIT_CFLAGS)

View File

@@ -16,15 +16,4 @@ void vif_fixup_del(char *ifname);
bool vif_fixup_captive_enabled(void);
bool vif_fixup_iface_captive_enabled(const char *ifname);
void vif_fixup_set_iface_captive(const char *ifname, bool en);
struct radio_fixup {
struct avl_node avl;
char rname[IF_NAMESIZE];
char hw_mode[8];
};
struct radio_fixup * radio_fixup_find(const char *name);
void radio_fixup_del(char *ifname);
void radio_fixup_set_hw_mode(const char *ifname, char *hw_mode);
char *radio_fixup_get_hw_mode(const char *ifname);
#endif

View File

@@ -19,8 +19,6 @@ extern struct uci_context *uci;
extern int radio_ubus_init(void);
int ubus_set_hapd_param(const char *if_name, const char *param, const char *pval);
int ubus_set_signal_thresholds(const char *if_name, int connect, int stay);
extern int hapd_rrm_enable(char *name, int neighbor, int beacon);
extern int hapd_rrm_set_neighbors(char *name, struct rrm_neighbor *neigh, int count);
@@ -30,8 +28,5 @@ int nl80211_channel_get(char *name, unsigned int *chan);
void set_config_apply_timeout(ovsdb_update_monitor_t *mon);
bool apc_read_conf(struct schema_APC_Config *apcconf);
bool apc_read_state(struct schema_APC_State *apcst);
int ubus_set_channel_switch(const char *if_name, uint32_t frequency,
const char *hw_mode, int channel_bandwidth,
int sec_chan_offset, int reason);
#endif

View File

@@ -33,7 +33,6 @@ extern ovsdb_table_t table_Radius_Proxy_Config;
void callback_Radius_Proxy_Config(ovsdb_update_monitor_t *mon,
struct schema_Radius_Proxy_Config *old, struct schema_Radius_Proxy_Config *conf);
void radius_proxy_fixup(void);
#endif /* RADIUS_PROXY_H_INCLUDED */

View File

@@ -34,12 +34,8 @@ extern ovsdb_table_t table_Wifi_RRM_Config;
void rrm_config_vif(struct blob_buf *b, struct blob_buf *del,
const char * freq_band, const char * if_name);
int rrm_get_backup_channel(const char * freq_band);
bool rrm_config_txpower(const char *rname, unsigned int txpower);
void callback_Wifi_RRM_Config(ovsdb_update_monitor_t *mon,
struct schema_Wifi_RRM_Config *old, struct schema_Wifi_RRM_Config *conf);
void rrm_radio_rebalance_channel(const struct schema_Wifi_Radio_Config *rconf);
#endif /* RRM_CONFIG_H_INCLUDED */

View File

@@ -45,14 +45,14 @@ typedef struct
typedef struct
{
DPP_TARGET_SURVEY_RECORD_COMMON_STRUCT;
uint64_t chan_active;
uint64_t chan_busy;
uint64_t chan_busy_ext;
uint64_t chan_self;
uint64_t chan_rx;
uint64_t chan_tx;
uint32_t chan_active;
uint32_t chan_busy;
uint32_t chan_busy_ext;
uint32_t chan_self;
uint32_t chan_rx;
uint32_t chan_tx;
uint32_t chan_noise;
uint64_t duration_ms;
uint32_t duration_ms;
} target_survey_record_t;
typedef void target_capacity_data_t;

View File

@@ -6,7 +6,6 @@
#include <libubox/blobmsg.h>
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define ATH_DRIVER_NAME_LEN 16
struct mode_map {
int fiveg;
@@ -45,5 +44,4 @@ extern char* get_max_channel_bw_channel(int channel_freq, const char* htmode);
int phy_find_hwmon_helper(char *dir, char *file, char *hwmon);
extern double dBm_to_mwatts(double dBm);
extern double mWatts_to_dBm(double mW);
extern int phy_get_ath_driver_name(char *phy, char *ath_driver);
#endif

View File

@@ -17,7 +17,6 @@
#include <sys/ioctl.h>
#include "target.h"
#include "dhcp_opt.h"
#include "log.h"
#include "dhcpdiscovery.h"
//#include "wc-dhcpdiscoveryDebug.h"
@@ -56,15 +55,14 @@ struct Answer_t
/**
* Use to setup the DHCP client
*/
bool dhcp_setup(const char * serveripaddress, const char * device, int *fd)
int dhcp_setup(const char * serveripaddress, const char * device)
{
struct hostent *hostent;
const int flag = 1;
struct sockaddr_in name;
struct ifreq ifr;
int dhcp_socket = -1;
int dhcp_socket;
*fd = -1;
/* We populate the interface info */
memset(&ifr, 0, sizeof(ifr));
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s\n", device);
@@ -73,7 +71,7 @@ bool dhcp_setup(const char * serveripaddress, const char * device, int *fd)
* setup sending socket
*/
if ((hostent=gethostbyname(serveripaddress))==NULL) {
goto err;
return 0;
}
dhcp_to.sin_family=AF_INET;
@@ -83,16 +81,17 @@ bool dhcp_setup(const char * serveripaddress, const char * device, int *fd)
dhcp_to.sin_port=htons(67);
if ((dhcp_socket=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP))==-1) {
goto err;
if ((dhcp_socket=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP))==-1)
{
return 0;
}
if (setsockopt (dhcp_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof flag) < 0) {
goto err;
return 0;
}
if (setsockopt(dhcp_socket,SOL_SOCKET,SO_BROADCAST,(char *)&flag, sizeof flag) < 0) {
goto err;
return 0;
}
name.sin_family = AF_INET;
@@ -102,16 +101,10 @@ bool dhcp_setup(const char * serveripaddress, const char * device, int *fd)
memset (name.sin_zero, 0, sizeof (name.sin_zero));
if (bind (dhcp_socket, (struct sockaddr *)&name, sizeof name) < 0) {
goto err;
return 0;
}
*fd = dhcp_socket;
return true;
err:
if (dhcp_socket >= 0)
close(dhcp_socket);
return false;
return dhcp_socket;
}
void parseDhcpMessage(unsigned char *buffer,int size, struct Answer_t * response)
@@ -447,39 +440,41 @@ bool generateQuery(const char *ifname)
const char * serverIP = "255.255.255.255";
const char * mac_address = getMACAddress(device);
struct Answer_t response;
int dhcp_socket = -1;
if (!dhcp_setup(serverIP, device, &dhcp_socket)) {
LOGE("%s dhcp client setup failed at line %d", __func__, __LINE__);
goto clean;
}
int dhcp_socket = dhcp_setup(serverIP, device);
// We sent a DISCOVER
send_dhcp_packet(dhcp_socket, DISCOVER,"0.0.0.0",NULL,"0.0.0.0",mac_address);
if( dhcp_socket != 0)
{
// We sent a DISCOVER
send_dhcp_packet(dhcp_socket, DISCOVER,"0.0.0.0",NULL,"0.0.0.0",mac_address);
if (waitForResponse(dhcp_socket, _serveripaddress, WAIT_TIMEOUT_SECONDS, OFFER, &response) == OFFER /* DHCP TYPE: Offer */) {
/* We close our initial socket (which is configured for broadcasting) */
if (dhcp_socket >= 0)
if(waitForResponse(dhcp_socket, _serveripaddress, WAIT_TIMEOUT_SECONDS, OFFER, &response) == OFFER /* DHCP TYPE: Offer */)
{
/* We close our initial socket (which is configured for broadcasting) */
close(dhcp_socket);
/* We open a direct connection (as opposed to broadcasted one) */
dhcp_socket = -1;
if (!dhcp_setup(response.serverIP, device, &dhcp_socket)) {
LOGE("%s dhcp client setup failed at line %d", __func__, __LINE__);
goto clean;
/* We open a direct connection (as opposed to broadcasted one) */
dhcp_socket = dhcp_setup(response.serverIP, device);
/* We send a request */
send_dhcp_packet(dhcp_socket, REQUEST /* Request */, response.serverIP, response.offeredIP, "0.0.0.0", mac_address);
if(waitForResponse(dhcp_socket, _serveripaddress, WAIT_TIMEOUT_SECONDS, ACK_REQUEST, &response) == ACK_REQUEST /* DHCP TYPE: ACK */)
{
rc = true;
}
}
else
{
close(dhcp_socket);
rc = false;
}
/* We send a request */
send_dhcp_packet(dhcp_socket, REQUEST /* Request */, response.serverIP, response.offeredIP, "0.0.0.0", mac_address);
if (waitForResponse(dhcp_socket, _serveripaddress, WAIT_TIMEOUT_SECONDS, ACK_REQUEST, &response) == ACK_REQUEST /* DHCP TYPE: ACK */)
rc = true;
}
clean:
if (mac_address)
if(mac_address)
{
free( (void*) mac_address);
if (dhcp_socket >= 0)
close(dhcp_socket);
}
return rc;
}

View File

@@ -25,7 +25,6 @@
*/
static struct avl_tree vif_fixup_tree = AVL_TREE_INIT(vif_fixup_tree, avl_strcmp, false, NULL);
static struct avl_tree radio_fixup_tree = AVL_TREE_INIT(radio_fixup_tree, avl_strcmp, false, NULL);
struct vif_fixup * vif_fixup_find(const char *ifname)
{
@@ -88,53 +87,3 @@ void vif_fixup_set_iface_captive(const char *ifname, bool en)
if (vif)
vif->has_captive = en;
}
struct radio_fixup * radio_fixup_find(const char *ifname)
{
struct radio_fixup *radio = avl_find_element(&radio_fixup_tree, ifname, radio, avl);
if (radio)
return radio;
/* Not found, add */
radio = malloc(sizeof(*radio));
if (!radio)
return NULL;
memset(radio, 0, sizeof(*radio));
strncpy(radio->rname, ifname, IF_NAMESIZE);
radio->avl.key = radio->rname;
avl_insert(&radio_fixup_tree, &radio->avl);
return radio;
}
void radio_fixup_del(char *ifname)
{
struct radio_fixup *radio = NULL;
radio = avl_find_element(&radio_fixup_tree, ifname, radio, avl);
if (radio) {
avl_delete(&radio_fixup_tree, &radio->avl);
free(radio);
}
}
void radio_fixup_set_hw_mode(const char *ifname, char *hw_mode)
{
struct radio_fixup * radio = NULL;
radio = radio_fixup_find(ifname);
if (radio)
strncpy(radio->hw_mode, hw_mode, strlen(hw_mode));
}
char * radio_fixup_get_hw_mode(const char *ifname)
{
struct radio_fixup * radio = NULL;
radio = radio_fixup_find(ifname);
if (radio)
return radio->hw_mode;
else
return NULL;
}

View File

@@ -28,7 +28,6 @@
#include "vlan.h"
#include "radius_proxy.h"
#include "timer.h"
#include "fixup.h"
ovsdb_table_t table_Hotspot20_Config;
ovsdb_table_t table_Hotspot20_OSU_Providers;
@@ -62,7 +61,7 @@ enum {
WDEV_ATTR_TX_ANTENNA,
WDEV_ATTR_RX_ANTENNA,
WDEV_ATTR_FREQ_BAND,
WDEV_ATTR_CHANNELS,
WDEV_AATR_CHANNELS,
WDEV_ATTR_DISABLE_B_RATES,
WDEV_ATTR_MAXASSOC_CLIENTS,
WDEV_ATTR_LOCAL_PWR_CONSTRAINT,
@@ -82,7 +81,7 @@ static const struct blobmsg_policy wifi_device_policy[__WDEV_ATTR_MAX] = {
[WDEV_ATTR_TX_ANTENNA] = { .name = "txantenna", .type = BLOBMSG_TYPE_INT32 },
[WDEV_ATTR_RX_ANTENNA] = { .name = "rxantenna", .type = BLOBMSG_TYPE_INT32 },
[WDEV_ATTR_FREQ_BAND] = { .name = "freq_band", .type = BLOBMSG_TYPE_STRING },
[WDEV_ATTR_CHANNELS] = {.name = "channels", .type = BLOBMSG_TYPE_ARRAY},
[WDEV_AATR_CHANNELS] = {.name = "channels", .type = BLOBMSG_TYPE_ARRAY},
[WDEV_ATTR_DISABLE_B_RATES] = { .name = "legacy_rates", .type = BLOBMSG_TYPE_BOOL },
[WDEV_ATTR_MAXASSOC_CLIENTS] = { .name = "maxassoc", .type = BLOBMSG_TYPE_INT32 },
[WDEV_ATTR_LOCAL_PWR_CONSTRAINT] = { .name = "local_pwr_constraint", .type = BLOBMSG_TYPE_INT32 },
@@ -216,76 +215,6 @@ static void update_channel_max_power(char* phy, struct schema_Wifi_Radio_State *
}
}
static int get_channel_tx_power_debugfs(char *stats_path, int *tx_power)
{
bool found = false;
char str[512];
FILE * fp = NULL;
int txpower = -1;
int ret = -1;
fp = fopen(stats_path, "r");
if (!fp) {
LOGE("%s: Failed to get tx power, stats file does not exist", __func__);
return -1;
}
const char *substr = "Channel TX power";
while(fgets(str, 512, fp)) {
if((strstr(str, substr)) != NULL) {
char * plast = NULL, * pcur = str;
while ((pcur = strtok( pcur, " "))) {
plast = pcur;
pcur = NULL;
}
txpower = atoi(plast);
found = true;
break;
}
}
if (!found) {
LOGE("%s: Unable to find Tx Power in stats", __func__);
} else {
/* txpower is set as 2 units per dBm in FW */
*tx_power = txpower/2;
ret = 0;
}
if (fp)
fclose(fp);
return ret;
}
static int get_channel_tx_power(char* phy, int *tx_power)
{
char ath_driver[ATH_DRIVER_NAME_LEN] = {'\0'};
char stats_path[128];
if (phy_get_ath_driver_name(phy, ath_driver)) {
LOGE("%s: Failed to get ATH driver name", __func__);
return -1;
}
if (!strncmp(ath_driver, "ath10k", ATH_DRIVER_NAME_LEN)) {
snprintf(stats_path, sizeof(stats_path),
"/sys/kernel/debug/ieee80211/%s/%s/fw_stats", phy,
ath_driver);
} else if (!strncmp(ath_driver, "ath11k", ATH_DRIVER_NAME_LEN)) {
snprintf(stats_path, sizeof(stats_path),
"/sys/kernel/debug/ieee80211/%s/%s/fw_stats/pdev_stats", phy,
ath_driver);
} else {
LOGE("%s: Unknown ATH driver", __func__);
return -1;
}
if (get_channel_tx_power_debugfs(stats_path, tx_power)) {
LOGE("%s: Failed to get Channel Tx Power", __func__);
return -1;
}
return 0;
}
const struct uci_blob_param_list wifi_device_param = {
.n_params = __WDEV_ATTR_MAX,
.params = wifi_device_policy,
@@ -297,7 +226,6 @@ static bool radio_state_update(struct uci_section *s, struct schema_Wifi_Radio_C
struct schema_Wifi_Radio_State rstate;
char phy[6];
int antenna;
int tx_power = -1;
uint32_t chan = 0;
LOGT("%s: get state", s->e.name);
@@ -338,14 +266,13 @@ static bool radio_state_update(struct uci_section *s, struct schema_Wifi_Radio_C
else
SCHEMA_SET_INT(rstate.enabled, 1);
if (!get_channel_tx_power(phy, &tx_power)) {
SCHEMA_SET_INT(rstate.tx_power, tx_power);
} else {
LOGE("%s: Failed to update Channel Tx Power", __func__);
/* Set Tx Power to max OVSDB value */
if (tb[WDEV_ATTR_TXPOWER]) {
SCHEMA_SET_INT(rstate.tx_power, blobmsg_get_u32(tb[WDEV_ATTR_TXPOWER]));
/* 0 means max in UCI, 32 is max in OVSDB */
if (rstate.tx_power == 0)
rstate.tx_power = 32;
} else
SCHEMA_SET_INT(rstate.tx_power, 32);
}
if (tb[WDEV_ATTR_BEACON_INT])
SCHEMA_SET_INT(rstate.bcn_int, blobmsg_get_u32(tb[WDEV_ATTR_BEACON_INT]));
@@ -386,8 +313,6 @@ static bool radio_state_update(struct uci_section *s, struct schema_Wifi_Radio_C
if (m) {
SCHEMA_SET_STR(rstate.hw_mode, m->hwmode);
radio_fixup_set_hw_mode(rstate.if_name, m->hwmode);
if (m->htmode)
SCHEMA_SET_STR(rstate.ht_mode, m->htmode);
else
@@ -401,6 +326,8 @@ static bool radio_state_update(struct uci_section *s, struct schema_Wifi_Radio_C
if (tb[WDEV_ATTR_COUNTRY])
SCHEMA_SET_STR(rstate.country, blobmsg_get_string(tb[WDEV_ATTR_COUNTRY]));
else
SCHEMA_SET_STR(rstate.country, "CA");
rstate.allowed_channels_len = phy_get_channels(phy, rstate.allowed_channels);
rstate.allowed_channels_present = true;
@@ -451,10 +378,8 @@ bool target_radio_config_set2(const struct schema_Wifi_Radio_Config *rconf,
strncpy(ifname, rconf->if_name, sizeof(ifname));
strncpy(phy, target_map_ifname(ifname), sizeof(phy));
if (changed->channel && rconf->channel) {
if (changed->channel && rconf->channel)
blobmsg_add_u32(&b, "channel", rconf->channel);
rrm_radio_rebalance_channel(rconf);
}
if (changed->enabled)
blobmsg_add_u8(&b, "disabled", rconf->enabled ? 0 : 1);
@@ -463,12 +388,9 @@ bool target_radio_config_set2(const struct schema_Wifi_Radio_Config *rconf,
int max_tx_power;
max_tx_power=phy_get_max_tx_power(phy,rconf->channel);
if (rconf->tx_power<=max_tx_power) {
rrm_config_txpower(rconf->if_name, rconf->tx_power);
blobmsg_add_u32(&b, "txpower", rconf->tx_power);
}
else {
rrm_config_txpower(rconf->if_name, max_tx_power);
blobmsg_add_u32(&b, "txpower", max_tx_power);
}
}
@@ -546,7 +468,6 @@ bool target_radio_config_set2(const struct schema_Wifi_Radio_Config *rconf,
blobmsg_add_string(&b, "htmode", m->ucihtmode);
blobmsg_add_string(&b, "hwmode", m->ucihwmode);
blobmsg_add_u32(&b, "chanbw", 20);
radio_fixup_set_hw_mode(rconf->if_name, m->hwmode);
} else
LOGE("%s: failed to set ht/hwmode", rconf->if_name);
}
@@ -1168,7 +1089,6 @@ void apc_init()
static void apply_config_handler(struct timeout *timeout)
{
radius_proxy_fixup();
uci_commit_all(uci);
sync();
LOGI("====Calling reload_config====");

View File

@@ -14,6 +14,7 @@
#include <sys/types.h>
#include <linux/sockios.h>
#include <linux/nl80211.h>
#include <netlink/msg.h>
#include <netlink/attr.h>
@@ -32,7 +33,6 @@
#include <sys/time.h>
#include "nl80211_cpy.h"
#include "target.h"
#include "nl80211.h"
#include "phy.h"
@@ -149,31 +149,13 @@ static void nl80211_add_station(struct nlattr **tb, char *ifname)
addr = nla_data(tb[NL80211_ATTR_MAC]);
vif_add_sta_rate_rule(addr, ifname);
sta = avl_find_element(&sta_tree, addr, sta, avl);
if (sta)
return;
wif = avl_find_element(&wif_tree, ifname, wif, avl);
if (!wif)
return;
sta = avl_find_element(&sta_tree, addr, sta, avl);
/* In case of roaming between interfaces (wif) the sta would
* already be in the sta_tree, but however it should be inserted
* again with new parent wif. Also, sta should be detached from
* old wif and attached to new wif.
* When the client roams between wifs, the sta assocs
* first to new wif(NEW_STATION nlevent) and then the hostapd
* deletes (DEL_STATION nlevent) the stale client from old wif.
*/
if (sta) {
if (!strcasecmp(wif->name, sta->parent->name)) {
return;
}
else {
list_del(&sta->iface);
sta->parent = wif;
list_add(&sta->iface, &wif->stas);
}
}
sta = malloc(sizeof(*sta));
if (!sta)
return;
@@ -192,11 +174,6 @@ static void _nl80211_del_station(char *ifname, struct wifi_station *sta)
{
vif_del_sta_rate_rule(sta->addr, ifname);
vif_add_station(sta, ifname, 0);
/* Dont delete sta if it has roamed to a new interface */
if (strcasecmp(ifname, sta->parent->name))
return;
list_del(&sta->iface);
avl_delete(&sta_tree, &sta->avl);
free(sta);
@@ -601,18 +578,6 @@ static void vif_poll_stations(void *arg)
evsched_task_reschedule_ms(EVSCHED_SEC(STA_POLL_INTERVAL));
}
void vif_get_assoc_stations(void)
{
struct wifi_iface *wif = NULL;
avl_for_each_element(&wif_tree, wif, avl) {
struct nl_msg *msg;
msg = unl_genl_msg(&unl_req, NL80211_CMD_GET_STATION, true);
nla_put_u32(msg, NL80211_ATTR_IFINDEX, wif->ifidx);
unl_genl_request(&unl_req, msg, nl80211_recv, NULL);
}
}
int radio_nl80211_init(void)
{
struct nl_msg *msg;
@@ -642,8 +607,6 @@ int radio_nl80211_init(void)
if (nl_socket_set_nonblocking(unl_notify.sock))
LOGE("radio_nl80211: Failed to set socket in the non blocking mode");
/* Get already associated stations if any */
vif_get_assoc_stations();
ev_io_init(&unl_io, nl80211_ev, unl_notify.sock->s_fd, EV_READ);
ev_io_start(wifihal_evloop, &unl_io);

View File

@@ -10,47 +10,6 @@
extern struct ev_loop *wifihal_evloop;
static struct ubus_context *ubus;
extern struct ev_loop *wifihal_evloop;
extern void apc_state_set(struct blob_attr *msg);
struct blob_buf ub = { };
int ubus_set_signal_thresholds(const char *if_name, int connect, int stay)
{
uint32_t id;
char path[64];
if (connect > 0 && stay > 0)
return -1;
snprintf(path, sizeof(path), "hostapd.%s", if_name);
if (ubus_lookup_id(ubus, path, &id))
return -1;
blob_buf_init(&b, 0);
blobmsg_add_u32(&b, "connect", connect);
blobmsg_add_u32(&b, "stay", stay);
return ubus_invoke(ubus, id, "set_required_signal", b.head, NULL, NULL, 1000);
}
int ubus_set_hapd_param(const char *if_name, const char *param, const char *pval)
{
uint32_t id;
char path[64];
snprintf(path, sizeof(path), "hostapd");
if (ubus_lookup_id(ubus, path, &id))
return -1;
blob_buf_init(&b, 0);
blobmsg_add_string(&b, "iface", if_name);
blobmsg_add_string(&b, "param", param);
blobmsg_add_string(&b, "param_val", pval);
return ubus_invoke(ubus, id, "param_mod", b.head, NULL, NULL, 1000);
}
int hapd_rrm_enable(char *name, int neighbor, int beacon)
{
@@ -91,48 +50,6 @@ int hapd_rrm_set_neighbors(char *name, struct rrm_neighbor *neigh, int count)
return ubus_invoke(ubus, id, "rrm_nr_set", b.head, NULL, NULL, 1000);
}
int ubus_set_channel_switch(const char *if_name, uint32_t frequency,
const char *hw_mode, int channel_bandwidth,
int sec_chan_offset, int reason)
{
uint32_t id;
char path[64];
snprintf(path, sizeof(path), "hostapd.%s", if_name);
if (ubus_lookup_id(ubus, path, &id))
return -1;
blob_buf_init(&ub, 0);
if (!strncmp(hw_mode, "11n", strlen("11n"))) {
blobmsg_add_u8(&ub, "ht", 1);
} else if (!strncmp(hw_mode, "11ac", strlen("11ac"))) {
blobmsg_add_u8(&ub, "ht", 1);
blobmsg_add_u8(&ub, "vht", 1);
} else if (!strncmp(hw_mode, "11ax", strlen("11ax"))) {
blobmsg_add_u8(&ub, "ht", 1);
blobmsg_add_u8(&ub, "vht", 1);
blobmsg_add_u8(&ub, "he", 1);
}
if (channel_bandwidth == 40)
blobmsg_add_u32(&ub, "center_freq1", frequency+10);
else if (channel_bandwidth == 80)
blobmsg_add_u32(&ub, "center_freq1", frequency+30);
else if (channel_bandwidth == 20)
blobmsg_add_u32(&ub, "center_freq1", frequency);
else if (channel_bandwidth == 160)
blobmsg_add_u32(&ub, "center_freq1", frequency+70);
blobmsg_add_u32(&ub, "freq", frequency);
blobmsg_add_u32(&ub, "bcn_count", 5);
blobmsg_add_u32(&ub, "bandwidth", channel_bandwidth);
blobmsg_add_u32(&ub, "sec_channel_offset", sec_chan_offset);
blobmsg_add_u32(&ub, "reason", reason);
return ubus_invoke(ubus, id, "switch_chan", ub.head, NULL, NULL, 1000);
}
enum {
DUMMY_PARAMETER,
__DUMMY_MAX,
@@ -284,33 +201,8 @@ static void radio_ubus_connect(struct ubus_context *ctx)
ubus_add_object(ubus, &radio_ubus_object);
}
static int radio_ubus_notify(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
char *str;
str = blobmsg_format_json(msg, true);
LOGD("ubus: Received ubus notify '%s': %s\n", method, str);
free(str);
if (!strncmp(method, "apc", 3)) {
LOGD("APC notification Received");
apc_state_set(msg);
}
return 0;
}
static struct ubus_instance ubus_instance = {
.connect = radio_ubus_connect,
.notify = radio_ubus_notify,
.list = {
{
.path = "apc",
},
},
.len = 1,
};
int radio_ubus_init(void)

View File

@@ -361,95 +361,6 @@ static bool radius_proxy_config_set(struct schema_Radius_Proxy_Config *conf)
return true;
}
void radius_proxy_fixup()
{
struct uci_package *radsecproxy;
struct uci_context *proxy_ctx;
struct uci_element *e = NULL, *tmp = NULL;
int ret=0, wildcard_count=0, j=0, section_count=0;
char *acct_server = NULL, *auth_server = NULL;
struct uci_section *wildcard_section = NULL;
struct blob_attr *tb[__RADIUS_PROXY_REALM_MAX] = {};
struct blob_attr *n;
char section_name[128] = {};
if (!ovsdb_table_select_where(&table_Radius_Proxy_Config, NULL, &j))
return;
proxy_ctx = uci_alloc_context();
ret = uci_load(proxy_ctx, "radsecproxy", &radsecproxy);
if (ret) {
LOGE("%s: uci_load() failed with rc %d", __func__, ret);
if (proxy_ctx)
uci_free_context(proxy_ctx);
return;
}
uci_foreach_element_safe(&radsecproxy->sections, tmp, e) {
struct uci_section *s = uci_to_section(e);
if ((s == NULL) || (s->type == NULL)) continue;
if (!strcmp(s->type, "realm")) {
const char *realm_name;
section_count++;
realm_name = uci_lookup_option_string(proxy_ctx, s, "name");
if (wildcard_count == 0 && (!strcmp((char *)realm_name, "*"))) {
wildcard_section = s;
wildcard_count = section_count;
}
}
else {
continue;
}
}
TRACEF("wildcard_count: %d section_count: %d", wildcard_count, section_count);
if ((wildcard_count != section_count) && (wildcard_section != NULL)) {
blob_buf_init(&b, 0);
uci_to_blob(&b, wildcard_section, &radius_proxy_realm_param);
blobmsg_parse(radius_proxy_realm_policy, __RADIUS_PROXY_REALM_MAX, tb,
blob_data(b.head), blob_len(b.head));
/* Delete and re-add the wildcard section */
struct blob_attr *ttb[1];
blobmsg_parse_array(radius_proxy_realm_policy, ARRAY_SIZE(ttb), ttb,
blobmsg_data(tb[RADIUS_PROXY_REALM_AUTH_SERVER]),
blobmsg_data_len(tb[RADIUS_PROXY_REALM_AUTH_SERVER]));
if (ttb[0]) {
auth_server = blobmsg_get_string(ttb[0]);
}
blobmsg_parse_array(radius_proxy_realm_policy, ARRAY_SIZE(ttb), ttb,
blobmsg_data(tb[RADIUS_PROXY_REALM_ACCT_SERVER]),
blobmsg_data_len(tb[RADIUS_PROXY_REALM_ACCT_SERVER]));
if (ttb[0]) {
acct_server = blobmsg_get_string(ttb[0]);
}
strcpy(section_name, (char *)wildcard_section->e.name);
TRACEF("Delete section: %s", section_name);
uci_section_del(proxy_ctx, "radsecproxy", "radsecproxy",
(char *)wildcard_section->e.name, "realm");
blob_buf_init(&uci_buf, 0);
blobmsg_add_string(&uci_buf, "name", "*");
n = blobmsg_open_array(&uci_buf, "server");
blobmsg_add_string(&uci_buf, NULL, auth_server);
blobmsg_close_array(&uci_buf, n);
n = blobmsg_open_array(&uci_buf, "accountingServer");
blobmsg_add_string(&uci_buf, NULL, acct_server);
blobmsg_close_array(&uci_buf, n);
blob_to_uci_section(proxy_ctx, "radsecproxy", section_name, "realm",
uci_buf.head, &radius_proxy_realm_param, NULL);
TRACEF("Add section: %s %s %s", section_name, auth_server, acct_server);
uci_commit_all(proxy_ctx);
}
uci_free_context(proxy_ctx);
}
static bool radius_proxy_config_delete()
{
struct uci_package *radsecproxy;

View File

@@ -24,190 +24,10 @@
#include "uci.h"
#include "utils.h"
#include "captive.h"
#include <fcntl.h>
#include "fixup.h"
ovsdb_table_t table_Wifi_RRM_Config;
extern ovsdb_table_t table_Wifi_Radio_Config;
extern ovsdb_table_t table_Wifi_VIF_Config;
#define PHY_NAME_LEN 32
bool rrm_config_txpower(const char *rname, unsigned int txpower)
{
char cmd[126] = {0};
int rid = 0;
txpower = txpower * 100;
sscanf(rname, "radio%d", &rid);
memset(cmd, 0, sizeof(cmd));
/* iw dev <devname> set txpower <auto|fixed|limit> [<tx power in mBm>]*/
snprintf(cmd, sizeof(cmd),
"iw phy phy%d set txpower fixed %d", rid, txpower);
system(cmd);
return true;
}
/* Mcast & Beacon rate set */
#define NUM_OF_RATES 12
enum {
ATH10K_DRIVER,
ATH11K_DRIVER,
ATH_DRIVER_MAX
};
typedef struct ath_rate_codes {
unsigned int rate;
unsigned long code[ATH_DRIVER_MAX];
} ath_rc;
char ath_driver_name[ATH_DRIVER_MAX][16] = {"ath10k", "ath11k"};
ath_rc ath_rcodes[NUM_OF_RATES] = {{1, {0x43, 0x10000103}},
{2, {0x42, 0x10000102}},
{5, {0x41, 0x10000101}},
{11, {0x40, 0x10000100}},
{6, {0x3, 0x10000003}},
{9, {0x7, 0x10000007}},
{12, {0x2, 0x10000002}},
{18, {0x6, 0x10000006}},
{24, {0x1, 0x10000001}},
{36, {0x5, 0x10000005}},
{48, {0x0, 0x10000000}},
{54, {0x4, 0x10000004}}};
/* get phy name */
bool get_80211phy(const char *ifname, char *phy)
{
char path[126] = {0};
int fd, l = 0;
snprintf(path, sizeof(path), "/sys/class/net/%s/phy80211/name", ifname);
fd = open(path, O_RDONLY);
if (fd < 0) {
LOGE("%s: Unable to read sysfs phy name", __func__);
close(fd);
return false;
}
read(fd, phy, PHY_NAME_LEN);
close(fd);
l = strlen(phy);
phy[l-1] = '\0';
return true;
}
bool set_rates_sysfs(const char *type, int rate_code, const char *ifname,
char *band, int dn)
{
int fd = 0;
char path[126] = {0};
char value[126] = {0};
char phy[PHY_NAME_LEN] = {0};
unsigned int band_id = 0;
/* get phy name */
if (!get_80211phy(ifname, phy))
return false;
if (!strcmp(band, "2.4G"))
band_id = 2;
else
band_id = 5;
snprintf(path, sizeof(path),
"/sys/kernel/debug/ieee80211/%s/%s/set_rates", phy,
ath_driver_name[dn]);
snprintf(value, sizeof(value), "%s %s %d 0x%x",
ifname, type, band_id, rate_code);
fd = open(path, O_WRONLY);
if (fd < 0) {
LOGE("%s: Unable to read sysfs set_rates", __func__);
close(fd);
return false;
}
write(fd, value, sizeof(value));
close(fd);
return true;
}
int find_ath_driver_name(const char *ifname)
{
int dn = -1;
char path[126] = {0};
char phy[PHY_NAME_LEN] = {0};
/* get phy name */
if (!get_80211phy(ifname, phy))
return -1;
for (dn = 0; dn < ATH_DRIVER_MAX; dn++) {
snprintf(path, sizeof(path),
"/sys/kernel/debug/ieee80211/%s/%s/set_rates", phy,
ath_driver_name[dn]);
if (access(path, F_OK) == 0) {
return dn;
}
}
return -1;
}
int rrm_config_mcast_bcast_rate(const char *ifname, char *band,
unsigned int bcn_rate, unsigned int mcast_rate)
{
int i = 0;
bool rc = 0;
unsigned int bcn_code = 0xFF;
unsigned int mcast_code = 0xFF;
int dn = 0;
/*Find ath driver version ath10/11k*/
dn = find_ath_driver_name(ifname);
if (dn < -1) {
LOG(ERR, "%s: No set_rate path exists", __func__);
return -1;
}
/* beacon rate given by cloud in multiples of 10 */
if (bcn_rate > 0)
bcn_rate = bcn_rate/10;
/* Get rate code of given rate */
for (i = 0; i < NUM_OF_RATES; i++)
{
if (ath_rcodes[i].rate == bcn_rate)
bcn_code = ath_rcodes[i].code[dn];
if (ath_rcodes[i].rate == mcast_rate)
mcast_code = ath_rcodes[i].code[dn];
}
/* Set the rates to sysfs */
if (bcn_code != 0xFF)
{
if (set_rates_sysfs("beacon", bcn_code, ifname, band, dn) == false)
rc = -1;
/*Ath11k sets mgmt and beacon rates separately*/
if (dn == ATH11K_DRIVER)
if (set_rates_sysfs("mgmt", bcn_code, ifname, band, dn) == false)
rc = -1;
}
if (mcast_code != 0xFF)
{
if (set_rates_sysfs("mcast", mcast_code, ifname, band, dn) == false)
rc = -1;
}
return rc;
}
void rrm_config_vif(struct blob_buf *b, struct blob_buf *del, const char * freq_band, const char * if_name)
{
@@ -260,103 +80,6 @@ int rrm_get_backup_channel(const char * freq_band)
}
void rrm_noreload_config(struct schema_Wifi_RRM_Config *conf, const char *wlanif)
{
char pval[16];
int rc = 0;
if (conf->probe_resp_threshold_changed) {
/* rssi_ignore_probe_request and signal_connect should
* both be probe_resp_threshold */
snprintf(pval, sizeof(pval), "%d",
conf->probe_resp_threshold);
rc = ubus_set_hapd_param(wlanif,
"rssi_ignore_probe_request", pval);
if (rc < 0)
LOG(ERR, "RRM: Set rssi_ignore_probe_req failed");
rc = ubus_set_signal_thresholds(wlanif,
conf->probe_resp_threshold,
conf->client_disconnect_threshold);
if (rc < 0)
LOG(ERR, "RRM: Set probe_resp_threshold failed");
}
if (conf->client_disconnect_threshold_changed) {
rc = ubus_set_signal_thresholds(wlanif,
conf->probe_resp_threshold,
conf->client_disconnect_threshold);
if (rc < 0)
LOG(ERR, "RRM: Set client_disconnect_thres failed");
}
if (conf->mcast_rate_changed) {
rc = rrm_config_mcast_bcast_rate(wlanif, conf->freq_band, 0,
conf->mcast_rate);
if (rc < 0)
LOG(ERR, "RRM: Set mcast rate failed");
}
if (conf->beacon_rate_changed) {
rrm_config_mcast_bcast_rate(wlanif, conf->freq_band,
conf->beacon_rate, 0);
if (rc < 0)
LOG(ERR, "RRM: Set beacon rate failed");
}
}
void get_channel_bandwidth(const char* htmode, int *channel_bandwidth)
{
if(!strcmp(htmode, "HT20"))
*channel_bandwidth=20;
else if (!strcmp(htmode, "HT40"))
*channel_bandwidth=40;
else if(!strcmp(htmode, "HT80"))
*channel_bandwidth=80;
}
void rrm_radio_rebalance_channel(const struct schema_Wifi_Radio_Config *rconf)
{
int channel_bandwidth;
int sec_chan_offset=0;
struct mode_map *m = NULL;
int freq = 0;
char *mode = NULL;
int rid = 0;
char wlanif[16] = {0};
char *hw_mode;
sscanf(rconf->if_name, "radio%d", &rid);
snprintf(wlanif, sizeof(wlanif), "wlan%d", rid);
freq = ieee80211_channel_to_frequency(rconf->channel);
mode = get_max_channel_bw_channel(freq, rconf->ht_mode);
hw_mode = radio_fixup_get_hw_mode(rconf->if_name);
if (hw_mode == NULL) {
LOGE("Failed to get hw mode");
return;
}
m = mode_map_get_uci(rconf->freq_band, mode, hw_mode);
if (m)
sec_chan_offset = m->sec_channel_offset;
else
LOGE("failed to get channel offset");
get_channel_bandwidth(mode, &channel_bandwidth);
ubus_set_channel_switch(wlanif, freq, hw_mode,
channel_bandwidth, sec_chan_offset, 1);
}
static bool rrm_config_update( struct schema_Wifi_RRM_Config *conf, bool addNotDelete)
{
struct schema_Wifi_Radio_Config rconf;
@@ -366,40 +89,12 @@ static bool rrm_config_update( struct schema_Wifi_RRM_Config *conf, bool addNotD
int i;
if (false == ovsdb_table_select_one(&table_Wifi_Radio_Config,
SCHEMA_COLUMN(Wifi_Radio_Config, freq_band),
conf->freq_band, &rconf))
SCHEMA_COLUMN(Wifi_Radio_Config, freq_band), conf->freq_band, &rconf))
{
LOG(WARN, "Wifi_RRM_Config: No radio for band %s",
conf->freq_band );
LOG(WARN, "Wifi_RRM_Config: No radio for band %s", conf->freq_band );
return false;
}
/* Set RRM configurations which do not require a wifi vifs reload
* and return */
if (conf->mcast_rate_changed || conf->beacon_rate_changed ||
conf->probe_resp_threshold_changed ||
conf->client_disconnect_threshold_changed) {
LOGI("RRM Config: beacon_rate:%s mcast_rate:%s probe_resp_threshold:%s client_disconnect_threshold_changed:%s",
(conf->beacon_rate_changed)? "changed":"unchanged",
(conf->mcast_rate_changed)? "changed":"unchanged",
(conf->probe_resp_threshold_changed)? "changed":"unchanged",
(conf->client_disconnect_threshold_changed)? "changed":"unchanged");
for (i = 0; i < rconf.vif_configs_len; i++) {
if (!(where = ovsdb_where_uuid("_uuid",
rconf.vif_configs[i].uuid)))
continue;
memset(&vconf, 0, sizeof(vconf));
if (ovsdb_table_select_one_where(&table_Wifi_VIF_Config,
where, &vconf))
{
rrm_noreload_config(conf, vconf.if_name);
}
}
}
/*Reload the vifs to configure the RRM configurations*/
memset(&changed, 0, sizeof(changed));
for (i = 0; i < rconf.vif_configs_len; i++) {
if (!(where = ovsdb_where_uuid("_uuid", rconf.vif_configs[i].uuid)))
@@ -484,6 +179,7 @@ void callback_Wifi_RRM_Config(ovsdb_update_monitor_t *self,
LOG(ERR, "Wifi_RRM_Config: unexpected mon_type %d %s", self->mon_type, self->mon_uuid);
break;
}
set_config_apply_timeout(self);
return;
}

View File

@@ -242,9 +242,9 @@ bool target_stats_survey_get(radio_entry_t *radio_cfg, uint32_t *chan_list,
while (!ds_dlist_is_empty(&raw_survey_list)) {
survey = ds_dlist_head(&raw_survey_list);
ds_dlist_remove(&raw_survey_list, survey);
LOGD("Survey entry dur %llu busy %llu tx %llu rx %llu rx_self %llu chan %d type %d",
LOGD("Survey entry dur %d busy %d tx %d rx %d chan %d active %d type %d",
survey->duration_ms, survey->chan_busy, survey->chan_tx, survey->chan_rx,
survey->chan_self, survey->info.chan, scan_type);
survey->info.chan, survey->chan_active, scan_type );
if ((scan_type == RADIO_SCAN_TYPE_ONCHAN) && (survey->duration_ms != 0)) {
if (survey->info.chan == chan_list[0]) {
ds_dlist_insert_tail(survey_list, survey);
@@ -267,57 +267,25 @@ bool target_stats_survey_get(radio_entry_t *radio_cfg, uint32_t *chan_list,
}
#define PERCENT(v1, v2) (v2 > 0 ? ((v1 > v2) ? 100 : (v1*100/v2)) : 0)
#define DELTA(n, p) ((n) < (p) ? (n) : (n) - (p))
bool target_stats_survey_convert(radio_entry_t *radio_cfg, radio_scan_type_t scan_type,
target_survey_record_t *data_new, target_survey_record_t *data_old,
dpp_survey_record_t *survey_record)
{
target_survey_record_t delta;
if (data_new->info.chan != data_old->info.chan) {
/* Do not consider the old channel's data */
memset(data_old, 0, sizeof(*data_old));
} else if ((data_new->duration_ms <= data_old->duration_ms) &&
(data_new->chan_busy <= data_old->chan_busy)) {
/*
* Take care of survey data from CHAN_INFO events which are Read-On-Clear
* in nature, whereas survey data from BSS_CHAN_INFO events are Read only.
* Chan_info event down in the driver updates only the duration, noise floor
* and the chan_busy data.
*/
data_new->duration_ms += data_old->duration_ms;
data_new->chan_busy += data_old->chan_busy;
}
LOGD("Survey convert scan_type %d chan %d duration_new:%llu duration_old:%llu "
"busy_new %llu busy_old:%llu tx_new %llu tx_old:%llu rx_new %llu rx_old:%llu "
"rx_self_new %llu rx_self_old:%llu",
scan_type, data_new->info.chan, data_new->duration_ms, data_old->duration_ms,
data_new->chan_busy, data_old->chan_busy, data_new->chan_tx, data_old->chan_tx,
data_new->chan_rx, data_old->chan_rx, data_new->chan_self, data_old->chan_self);
memset(&delta, 0, sizeof(delta));
delta.duration_ms = DELTA(data_new->duration_ms, data_old->duration_ms);
delta.chan_busy = DELTA(data_new->chan_busy, data_old->chan_busy);
delta.chan_busy_ext = DELTA(data_new->chan_busy_ext, data_old->chan_busy_ext);
delta.chan_tx = DELTA(data_new->chan_tx, data_old->chan_tx);
delta.chan_rx = DELTA(data_new->chan_rx, data_old->chan_rx);
delta.chan_self = DELTA(data_new->chan_self, data_old->chan_self);
LOGD("Survey convert scan_type %d chan %d", scan_type, data_new->info.chan);
survey_record->info.chan = data_new->info.chan;
survey_record->chan_tx = PERCENT(delta.chan_tx, delta.duration_ms);
survey_record->chan_self = PERCENT(delta.chan_self, delta.duration_ms);
survey_record->chan_rx = PERCENT(delta.chan_rx, delta.duration_ms);
survey_record->chan_busy_ext = PERCENT(delta.chan_busy_ext, delta.duration_ms);
survey_record->chan_busy = PERCENT(delta.chan_busy, delta.duration_ms);
survey_record->chan_tx = PERCENT(data_new->chan_tx, data_new->duration_ms);
survey_record->chan_self = PERCENT(data_new->chan_self, data_new->duration_ms);
survey_record->chan_rx = PERCENT(data_new->chan_rx, data_new->duration_ms);
survey_record->chan_busy_ext = PERCENT(data_new->chan_busy_ext, data_new->duration_ms);
survey_record->chan_busy = PERCENT(data_new->chan_busy, data_new->duration_ms);
survey_record->chan_noise = data_new->chan_noise;
survey_record->duration_ms = delta.duration_ms;
survey_record->duration_ms = data_new->duration_ms;
return true;
}
/******************************************************************************
* NEIGHBORS definitions
*****************************************************************************/

View File

@@ -13,6 +13,7 @@
#include <sys/types.h>
#include <linux/sockios.h>
#include <linux/nl80211.h>
#include <netlink/msg.h>
#include <netlink/attr.h>
@@ -29,7 +30,6 @@
#include <libubox/vlist.h>
#include <unl.h>
#include "nl80211_cpy.h"
#include "target.h"
#include "nl80211.h"
#include "phy.h"
@@ -42,8 +42,6 @@ static struct unl unl_req;
static struct unl unl_notify;
static ev_io unl_io;
#define NF_OFFSET_24G 14
#define NF_OFFSET_5G 10
struct nl80211_scan {
char name[IF_NAMESIZE];
target_scan_cb_t *scan_cb;
@@ -54,8 +52,6 @@ struct nl80211_scan {
static struct avl_tree nl80211_scan_tree = AVL_TREE_INIT(nl80211_scan_tree, avl_strcmp, false, NULL);
static void nl80211_scan_del(struct nl80211_scan *nl80211_scan);
static int nl80211_chainmask_recv(struct nl_msg *msg, void *arg)
{
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
@@ -196,19 +192,6 @@ static int nl80211_assoclist_recv(struct nl_msg *msg, void *arg)
return NL_OK;
}
static int add_chan_noise_offset(unsigned int chan, int chan_noise)
{
int adjusted_chan_noise = 0;
if (chan > 13) {
adjusted_chan_noise = chan_noise + NF_OFFSET_5G;
} else {
adjusted_chan_noise = chan_noise + NF_OFFSET_24G;
}
return adjusted_chan_noise;
}
static int nl80211_survey_recv(struct nl_msg *msg, void *arg)
{
static struct nla_policy sp[NL80211_SURVEY_INFO_MAX + 1] = {
@@ -220,7 +203,6 @@ static int nl80211_survey_recv(struct nl_msg *msg, void *arg)
[NL80211_SURVEY_INFO_TIME_EXT_BUSY] = { .type = NLA_U64 },
[NL80211_SURVEY_INFO_TIME_SCAN] = { .type = NLA_U64 },
[NL80211_SURVEY_INFO_NOISE] = { .type = NLA_U8 },
[NL80211_SURVEY_INFO_TIME_BSS_RX] = { .type = NLA_U64 },
};
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
@@ -249,7 +231,7 @@ static int nl80211_survey_recv(struct nl_msg *msg, void *arg)
nla_get_u32(si[NL80211_SURVEY_INFO_FREQUENCY]));
if (si[NL80211_SURVEY_INFO_TIME_RX])
survey_record->chan_self = nla_get_u64(si[NL80211_SURVEY_INFO_TIME_BSS_RX]);
survey_record->chan_self = nla_get_u64(si[NL80211_SURVEY_INFO_TIME_RX]);
if (si[NL80211_SURVEY_INFO_TIME_TX])
survey_record->chan_tx = nla_get_u64(si[NL80211_SURVEY_INFO_TIME_TX]);
@@ -267,8 +249,7 @@ static int nl80211_survey_recv(struct nl_msg *msg, void *arg)
survey_record->duration_ms = nla_get_u64(si[NL80211_SURVEY_INFO_TIME]);
if (si[NL80211_SURVEY_INFO_NOISE])
survey_record->chan_noise = add_chan_noise_offset(survey_record->info.chan,
nla_get_u8(si[NL80211_SURVEY_INFO_NOISE]));
survey_record->chan_noise = nla_get_u8(si[NL80211_SURVEY_INFO_NOISE]);
survey_record->chan_in_use=si[NL80211_SURVEY_INFO_IN_USE] ? 1:0;
@@ -385,17 +366,16 @@ static int nl80211_scan_add(char *name, target_scan_cb_t *scan_cb, void *scan_ct
{
struct nl80211_scan *nl80211_scan = avl_find_element(&nl80211_scan_tree, name, nl80211_scan, avl);
if (nl80211_scan)
nl80211_scan_del(nl80211_scan);
nl80211_scan = malloc(sizeof(*nl80211_scan));
if (!nl80211_scan)
return -1;
memset(nl80211_scan, 0, sizeof(*nl80211_scan));
strncpy(nl80211_scan->name, name, IF_NAMESIZE);
nl80211_scan->avl.key = nl80211_scan->name;
avl_insert(&nl80211_scan_tree, &nl80211_scan->avl);
LOGD("%s: added scan context", name);
if (!nl80211_scan) {
nl80211_scan = malloc(sizeof(*nl80211_scan));
if (!nl80211_scan)
return -1;
memset(nl80211_scan, 0, sizeof(*nl80211_scan));
strncpy(nl80211_scan->name, name, IF_NAMESIZE);
nl80211_scan->avl.key = nl80211_scan->name;
avl_insert(&nl80211_scan_tree, &nl80211_scan->avl);
LOGD("%s: added scan context", name);
}
nl80211_scan->scan_cb = scan_cb;
nl80211_scan->scan_ctx = scan_ctx;
@@ -417,6 +397,7 @@ static void nl80211_scan_finish(char *name, bool state)
if (nl80211_scan) {
LOGD("%s: calling context cb", nl80211_scan->name);
(*nl80211_scan->scan_cb)(nl80211_scan->scan_ctx, state);
nl80211_scan_del(nl80211_scan);
}
}

View File

@@ -418,22 +418,6 @@ int phy_lookup(char *name)
return atoi(buf);
}
int phy_get_ath_driver_name(char *phy, char *ath_driver)
{
glob_t gl;
char path[128];
snprintf(path, sizeof(path),
"/sys/kernel/debug/ieee80211/%s/[ath]*", phy);
if (glob(path, GLOB_NOSORT | GLOB_MARK, NULL, &gl))
return -1;
if (gl.gl_pathc) {
memset(ath_driver, '\0', ATH_DRIVER_NAME_LEN);
strncpy(ath_driver, basename(gl.gl_pathv[0]), ATH_DRIVER_NAME_LEN - 1);
}
globfree(&gl);
return 0;
}
int vif_get_mac(char *vap, char *mac)
{
int sz = ETH_ALEN * 3;

View File

@@ -367,24 +367,10 @@ static void callback_Wifi_Inet_Config(ovsdb_update_monitor_t *mon,
{
switch (mon->mon_type) {
case OVSDB_UPDATE_NEW:
if (iconf->parent_ifname_exists && iconf->vlan_id > 2) {
if(!strncmp(iconf->parent_ifname, "lan", strlen("lan"))) {
/* Skip adding VLAN interface for lan */
return;
}
}
wifi_inet_conf_add(iconf);
netifd_add_inet_conf(iconf);
break;
case OVSDB_UPDATE_MODIFY:
if (iconf->parent_ifname_exists && iconf->vlan_id > 2) {
if(!strncmp(iconf->parent_ifname, "lan", strlen("lan"))) {
/* Skip adding VLAN interface for lan */
return;
}
}
wifi_inet_conf_add(iconf);
netifd_modify_inet_conf(iconf);
break;

View File

@@ -89,12 +89,11 @@ int rrm_setup_monitor(void);
void rrm_channel_init(void);
int rrm_ubus_init(struct ev_loop *loop);
int ubus_get_noise(const char *if_name, uint32_t *noise);
int ubus_set_channel_switch(const char *if_name, uint32_t frequency, const char *hw_mode, int channel_bandwidth, int sec_chan_offset, int reason);
int ubus_set_channel_switch(const char *if_name, uint32_t frequency, int channel_bandwidth, int sec_chan_offset);
void set_rrm_parameters(rrm_entry_t *rrm_data);
ds_tree_t* rrm_get_rrm_config_list(void);
ds_tree_t* rrm_get_radio_list(void);
ds_tree_t* rrm_get_vif_list(void);
void rrm_reset_noise_floor_samples(rrm_entry_t *rrm_data);
void rrm_radio_rebalance_channel(const struct schema_Wifi_Radio_Config *rconf);
#endif /* RRM_H_INCLUDED */

View File

@@ -225,7 +225,7 @@ void rrm_nf_timer_handler(struct ev_loop *loop, ev_timer *timer, int revents)
get_channel_bandwidth(get_max_channel_bw_channel(ieee80211_channel_to_frequency(rrm_config->rrm_data.backup_channel),
radio->schema.ht_mode), &channel_bandwidth);
ubus_set_channel_switch(radio->config.if_name,
ieee80211_channel_to_frequency(rrm_config->rrm_data.backup_channel), radio->schema.hw_mode, channel_bandwidth, sec_chan_offset, 0);
ieee80211_channel_to_frequency(rrm_config->rrm_data.backup_channel), channel_bandwidth, sec_chan_offset);
rrm_reset_noise_floor_samples(&(rrm_config->rrm_data));
}

View File

@@ -51,9 +51,7 @@ int ubus_get_noise(const char *if_name, uint32_t *noise)
}
int ubus_set_channel_switch(const char *if_name, uint32_t frequency,
const char *hw_mode, int channel_bandwidth,
int sec_chan_offset, int reason)
int ubus_set_channel_switch(const char *if_name, uint32_t frequency, int channel_bandwidth, int sec_chan_offset)
{
uint32_t id;
static struct blob_buf b;
@@ -65,32 +63,19 @@ int ubus_set_channel_switch(const char *if_name, uint32_t frequency,
return -1;
blob_buf_init(&b, 0);
if (!strncmp(hw_mode, "11n", strlen("11n"))) {
blobmsg_add_u8(&b, "ht", 1);
} else if (!strncmp(hw_mode, "11ac", strlen("11ac"))) {
blobmsg_add_u8(&b, "ht", 1);
blobmsg_add_u8(&b, "vht", 1);
} else if (!strncmp(hw_mode, "11ax", strlen("11ax"))) {
blobmsg_add_u8(&b, "ht", 1);
blobmsg_add_u8(&b, "vht", 1);
blobmsg_add_u8(&b, "he", 1);
if (channel_bandwidth == 20 || channel_bandwidth == 40) {
blobmsg_add_bool(&b, "ht", 1);
} else if (channel_bandwidth == 80) {
blobmsg_add_bool(&b, "vht", 1);
}
if (channel_bandwidth == 40)
blobmsg_add_u32(&b, "center_freq1", frequency+10);
else if (channel_bandwidth == 80)
if (channel_bandwidth == 40 || channel_bandwidth == 80) {
blobmsg_add_u32(&b, "center_freq1", frequency+30);
else if (channel_bandwidth == 20)
blobmsg_add_u32(&b, "center_freq1", frequency);
else if (channel_bandwidth == 160)
blobmsg_add_u32(&b, "center_freq1", frequency+70);
}
blobmsg_add_u32(&b, "freq", frequency);
blobmsg_add_u32(&b, "bcn_count", 5);
blobmsg_add_u32(&b, "bandwidth", channel_bandwidth);
blobmsg_add_u32(&b, "sec_channel_offset", sec_chan_offset);
blobmsg_add_u32(&b, "reason", reason);
return ubus_invoke(ubus, id, "switch_chan", b.head, NULL, NULL, 1000);
}

View File

@@ -6,15 +6,17 @@
/* Global list of events received from hostapd */
dpp_event_report_data_t g_event_report;
/* Internal list of processed events ready to be deleted from hostapd */
static ds_dlist_t deletion_pending_list;
static ds_dlist_t bss_list;
static struct ubus_context *ubus = NULL;
typedef struct {
uint64_t session_id;
char bss[UBUS_OBJ_LEN];
} delete_entry_t;
static void ubus_garbage_collector(void *arg);
ds_dlist_node_t node;
} delete_entry_t;
static const struct blobmsg_policy ubus_collector_chan_switch_event_policy[__CHANNEL_SWITCH_EVENT_MAX] = {
[CHAN_SWITCH_EVENT] = {.name = "chan_switch_event", .type = BLOBMSG_TYPE_TABLE},
@@ -164,7 +166,6 @@ static int client_first_data_event_cb(struct blob_attr *msg,
if (tb_client_first_data_event[CLIENT_FIRST_DATA_STA_MAC]) {
mac_address = blobmsg_get_string(tb_client_first_data_event[CLIENT_FIRST_DATA_STA_MAC]);
memcpy(dpp_session->first_data_event->sta_mac, mac_address, MAC_ADDRESS_STRING_LEN);
LOG(DEBUG, "ubus: Received FDATA event session_id:%llu client mac:%s", event_session_id, mac_address);
}
if (tb_client_first_data_event[CLIENT_FIRST_DATA_TIMESTAMP])
@@ -208,7 +209,6 @@ static int client_disconnect_event_cb(struct blob_attr *msg,
if (tb_client_disconnect_event[CLIENT_DISCONNECT_STA_MAC]) {
mac_address = blobmsg_get_string(tb_client_disconnect_event[CLIENT_DISCONNECT_STA_MAC]);
memcpy(dpp_session->disconnect_event->sta_mac, mac_address, MAC_ADDRESS_STRING_LEN);
LOG(DEBUG, "ubus: Received DISCONNECT event with session_id:%llu client mac:%s", event_session_id, mac_address);
}
if (tb_client_disconnect_event[CLIENT_DISCONNECT_BAND])
@@ -258,7 +258,6 @@ static int client_auth_event_cb(struct blob_attr *msg,
if (tb_client_auth_event[CLIENT_AUTH_STA_MAC]) {
mac_address = blobmsg_get_string(tb_client_auth_event[CLIENT_AUTH_STA_MAC]);
memcpy(dpp_session->auth_event->sta_mac, mac_address, MAC_ADDRESS_STRING_LEN);
LOG(DEBUG, "ubus: Received AUTH event with session_id:%llu client mac:%s", event_session_id, mac_address);
}
if (tb_client_auth_event[CLIENT_AUTH_BAND])
@@ -305,7 +304,6 @@ static int client_assoc_event_cb(struct blob_attr *msg,
if (tb_client_assoc_event[CLIENT_ASSOC_STA_MAC]) {
mac_address = blobmsg_get_string(tb_client_assoc_event[CLIENT_ASSOC_STA_MAC]);
memcpy(dpp_session->assoc_event->sta_mac, mac_address, MAC_ADDRESS_STRING_LEN);
LOG(DEBUG, "ubus: Received ASSOC event with session_id:%llu client mac:%s", event_session_id, mac_address);
}
if (tb_client_assoc_event[CLIENT_ASSOC_SSID]) {
@@ -367,7 +365,6 @@ static int client_ip_event_cb(struct blob_attr *msg,
if (tb_client_ip_event[CLIENT_IP_STA_MAC]) {
mac_address = blobmsg_get_string(tb_client_ip_event[CLIENT_IP_STA_MAC]);
memcpy(dpp_session->ip_event->sta_mac, mac_address, MAC_ADDRESS_STRING_LEN);
LOG(DEBUG, "ubus: Received IP event with session_id:%llu client mac:%s", event_session_id, mac_address);
}
if (tb_client_ip_event[CLIENT_IP_IP_ADDRESS]) {
@@ -393,23 +390,11 @@ static int (*client_event_handler_list[__CLIENT_EVENTS_MAX - 1])(
static void ubus_collector_complete_session_cb(struct ubus_request *req, int ret)
{
LOG(DEBUG, "ubus_collector_complete_session_cb");
if (req)
free(req);
}
static void session_delete(uint64_t session_id, char *ifname)
{
delete_entry_t *delete_entry = NULL;
delete_entry = calloc(1, sizeof(delete_entry_t));
if (delete_entry) {
memset(delete_entry, 0, sizeof(delete_entry_t));
delete_entry->session_id = session_id;
strncpy(delete_entry->bss, ifname, UBUS_OBJ_LEN);
evsched_task(&ubus_garbage_collector, delete_entry,
EVSCHED_SEC(SESSION_DELETE_TIMEOUT));
}
}
static void ubus_collector_session_cb(struct ubus_request *req, int type,
struct blob_attr *msg)
{
@@ -420,9 +405,9 @@ static void ubus_collector_session_cb(struct ubus_request *req, int type,
struct blob_attr *tb_client_events[__CLIENT_EVENTS_MAX] = {};
dpp_event_record_t *event_record = NULL;
uint64_t session_id = 0;
delete_entry_t *delete_entry = NULL;
int i = 0;
(void)type;
bool is_session_empty = true;
char *ifname = (char *)req->priv;
@@ -462,18 +447,13 @@ static void ubus_collector_session_cb(struct ubus_request *req, int type,
continue;
}
session_id = blobmsg_get_u64(tb_client_events[CLIENT_SESSION_ID]);
if (!session_id) {
LOG(DEBUG, "ubus_collector: Invalid sessionId");
continue;
}
event_record = dpp_event_record_alloc();
if (!event_record) {
LOG(ERR, "ubus_collector: not enough memory for event_record");
continue;
}
session_id = blobmsg_get_u64(tb_client_events[CLIENT_SESSION_ID]);
event_record->client_session.session_id = session_id;
for (i = 0; i < __CLIENT_EVENTS_MAX - 1; i++) {
@@ -485,19 +465,21 @@ static void ubus_collector_session_cb(struct ubus_request *req, int type,
client_event_handler_list[i](
tb_client_events[i], &event_record->client_session,
session_id);
is_session_empty = false;
}
}
}
if (is_session_empty) {
dpp_event_record_free(event_record);
} else {
event_record->hasSMProcessed = false;
ds_dlist_insert_tail(&g_event_report.client_event_list, event_record);
event_record = NULL;
}
event_record->hasSMProcessed = false;
ds_dlist_insert_tail(&g_event_report.client_event_list, event_record);
event_record = NULL;
/* Schedule session for deletion */
session_delete(session_id, ifname);
delete_entry = calloc(1, sizeof(delete_entry_t));
if (delete_entry) {
memset(delete_entry, 0, sizeof(delete_entry_t));
delete_entry->session_id = session_id;
strncpy(delete_entry->bss, ifname, UBUS_OBJ_LEN);
ds_dlist_insert_tail(&deletion_pending_list, delete_entry);
delete_entry = NULL;
}
}
}
@@ -537,6 +519,7 @@ static void ubus_collector_hostapd_invoke(void *object_path)
static void ubus_collector_complete_bss_cb(struct ubus_request *req, int ret)
{
LOG(DEBUG, "ubus_collector_complete_bss_cb");
if (req)
free(req);
}
@@ -632,6 +615,8 @@ static void ubus_collector_chan_switch_events_cb(struct ubus_request *req, int t
if (!msg)
return;
LOG(DEBUG, "ubus_collector: received ubus collector chan event message");
error = blobmsg_parse(ubus_collector_chan_switch_event_policy,
__CHANNEL_SWITCH_EVENT_MAX, tb_chan_event_lst,
blobmsg_data(msg), blobmsg_data_len(msg));
@@ -673,6 +658,7 @@ static void ubus_collector_chan_switch_events_cb(struct ubus_request *req, int t
static void ubus_collector_complete_channel_switch_cb(struct ubus_request *req, int ret)
{
LOG(DEBUG, "ubus_collector_complete_channel_switch_cb");
if (req)
free(req);
}
@@ -692,6 +678,8 @@ static void ubus_collector_hostapd_channel_switch_invoke(void *arg)
return;
}
LOG(DEBUG, "ubus_collector: requesting hostapd channel switch data");
ubus_invoke_async(ubus, ubus_object_id, hostapd_method, NULL, req);
req->data_cb = (ubus_data_handler_t)ubus_collector_chan_switch_events_cb;
@@ -758,12 +746,27 @@ static void ubus_collector_hostapd_clear(uint64_t session_id, char *object_path)
static void ubus_garbage_collector(void *arg)
{
delete_entry_t *delete_session = (delete_entry_t *)arg;
delete_entry_t *delete_entry = NULL;
if (delete_session) {
ubus_collector_hostapd_clear(delete_session->session_id, delete_session->bss);
free(delete_session);
if (ds_dlist_is_empty(&deletion_pending_list)) {
evsched_task_reschedule();
return;
}
/* Remove a single session from the deletion list */
delete_entry = ds_dlist_head(&deletion_pending_list);
if (delete_entry) {
if (delete_entry->session_id) {
ubus_collector_hostapd_clear(delete_entry->session_id,
delete_entry->bss);
}
ds_dlist_remove_head(&deletion_pending_list);
free(delete_entry);
delete_entry = NULL;
}
evsched_task_reschedule();
}
int ubus_collector_init(void)
@@ -779,6 +782,7 @@ int ubus_collector_init(void)
/* Initialize the global events, session deletion and bss object lists */
ds_dlist_init(&g_event_report.client_event_list, dpp_event_record_t, node);
ds_dlist_init(&g_event_report.channel_switch_list, dpp_event_channel_switch_t, node);
ds_dlist_init(&deletion_pending_list, delete_entry_t, node);
ds_dlist_init(&bss_list, bss_obj_t, node);
/* Schedule an event: invoke hostapd ubus get bss list method */
@@ -799,6 +803,15 @@ int ubus_collector_init(void)
return -1;
}
/* Schedule an event: clear the hostapd sessions from opensync */
sched_status = evsched_task(&ubus_garbage_collector, NULL,
EVSCHED_SEC(UBUS_GARBAGE_COLLECTION_DELAY));
if (sched_status < 1) {
LOG(ERR, "ubus_collector: failed at task creation, status %d",
sched_status);
return -1;
}
/* Schedule an event: invoke hostapd ubus channel switch method */
sched_status = evsched_task(&ubus_collector_hostapd_channel_switch_invoke, NULL,
EVSCHED_SEC(UBUS_CHANNEL_SWITCH_POLLING_DELAY));

View File

@@ -31,8 +31,8 @@ void ubus_collector_cleanup(void);
/* Poll sessions after this many seconds */
#define UBUS_SESSIONS_POLLING_DELAY 9
/* Delete session after this many seconds of receiving any first event of the session */
#define SESSION_DELETE_TIMEOUT 30
/* Poll the session clearing 'garbage collector' after this many seconds */
#define UBUS_GARBAGE_COLLECTION_DELAY 1
#define UBUS_OBJ_LEN 64

View File

@@ -44,14 +44,14 @@ typedef struct
typedef struct
{
DPP_TARGET_SURVEY_RECORD_COMMON_STRUCT;
uint64_t chan_active;
uint64_t chan_busy;
uint64_t chan_busy_ext;
uint64_t chan_self;
uint64_t chan_rx;
uint64_t chan_tx;
uint32_t chan_active;
uint32_t chan_busy;
uint32_t chan_busy_ext;
uint32_t chan_self;
uint32_t chan_rx;
uint32_t chan_tx;
uint32_t chan_noise;
uint64_t duration_ms;
uint32_t duration_ms;
uint32_t chan_in_use;
} target_survey_record_t;

View File

@@ -72,9 +72,7 @@ static bool update_version_matrix(struct schema_AWLAN_Node *awlan)
{
FILE *fp = NULL;
char *line = NULL;
char *sep = NULL;
char key[128] = {'\0'};
char val[128] = {'\0'};
char *key, *val, *str = NULL;
size_t len;
int rd = 0;
char inactive_fw[128] = "";
@@ -89,15 +87,15 @@ static bool update_version_matrix(struct schema_AWLAN_Node *awlan)
line[rd - 1] = '\0';
else continue;
/* Separate Key and Val */
sep = strchr(line, ':');
if (!sep)
continue;
*sep = '\0';
strncpy(key, line, sizeof(key) - 1);
strncpy(val, sep + 1, sizeof(key) - 1);
str = strdup(line);
key = strtok(str, ":");
val = strtok(NULL, ":");
SCHEMA_KEY_VAL_SET(awlan->version_matrix, key, val);
if (val == NULL) {
SCHEMA_KEY_VAL_SET(awlan->version_matrix, key, "");
} else {
SCHEMA_KEY_VAL_SET(awlan->version_matrix, key, val);
}
}
/* Update the inactive firmware version */
@@ -106,6 +104,8 @@ static bool update_version_matrix(struct schema_AWLAN_Node *awlan)
if (line != NULL)
free(line);
if (str != NULL)
free(str);
fclose(fp);
return true;
}

View File

@@ -1,7 +1,7 @@
#!/bin/sh
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
[ "$INTERFACE" = wan ] || [ "$INTERFACE" = lan ] || 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}')"

View File

@@ -101,56 +101,23 @@ linksys,ea8300)
DAY=$(echo "$MANUF_DATE" | cut -d "/" -f3)
MANUF_DATE="$DAY-$MONTH-$YEAR"
;;
tp-link,ec420-g1|\
tplink,ex227|\
tplink,ex447)
tp-link,ec420-g1)
PLATFORM=$(cat /tmp/sysinfo/model)
MANUF_ABBR="PW"
# tp-link device manufacturing data and certs are stored in product_info partition
tip_part=$(find_mtd_part "product_info" 2> /dev/null)
mkdir -p /tmp/.tip
if mount -t squashfs $tip_part /tmp/.tip &> /dev/null; then
SERIAL=$(cat /tmp/.tip/serial_number)
MODEL=$(cat /tmp/.tip/model)
SKU=$(cat /tmp/.tip/sku)
CERT_REGION=$(cat /tmp/.tip/certification_region)
ID=$(cat /tmp/.tip/mac_address)
MANUF_DATE=$(cat /tmp/.tip/manufacturer_date)
MANUF_NAME=$(cat /tmp/.tip/manufacturer_name)
MANUF_URL=$(cat /tmp/.tip/manufacturer_url)
MODEL_DESCR=$(cat /tmp/.tip/model_description)
MODEL_REV=$(cat /tmp/.tip/model_revision)
REF_DESIGN=$(cat /tmp/.tip/reference_design)
if [ -f /tmp/.tip/certs/ca.pem ] && [ -f /tmp/.tip/certs/client.pem ] && [ -f /tmp/.tip/certs/client_dec.key ]; then
# If certs are default certs, and they will be replaced by manufacturing certs.
if cmp /usr/opensync/certs/ca.pem /rom/usr/opensync/certs/ca.pem &> /dev/null || \
cmp /usr/opensync/certs/client.pem /rom/usr/opensync/certs/client.pem &> /dev/null || \
cmp /usr/opensync/certs/client_dec.key /rom/usr/opensync/certs/client_dec.key &> /dev/null; then
cp /tmp/.tip/certs/* /usr/opensync/certs/
fi
fi
umount -l /tmp/.tip &> /dev/null
# for EC420-G1 DVT sample
elif [ $(board_name) = "tp-link,ec420-g1" ]; then
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)
CERT_REGION=$(cat /dev/mtd9 | grep certification_region | cut -d "=" -f2)
ID=$(cat /dev/mtd9 | grep mac_address | cut -d "=" -f2)
MANUF_DATE=$(cat /dev/mtd9 | grep manufacturer_date | cut -d "=" -f2)
MANUF_NAME=$(cat /dev/mtd9 | grep manufacturer_name | cut -d "=" -f2)
if [ ! $MANUF_NAME ]; then
MANUF_NAME="Proware (TP-Link)"
fi
MANUF_URL=$(cat /dev/mtd9 | grep manufacturer_url | cut -d "=" -f2)
MODEL_DESCR=$(cat /dev/mtd9 | grep model_description | cut -d "=" -f2)
MODEL_REV=$(cat /dev/mtd9 | grep model_revision | cut -d "=" -f2)
REF_DESIGN=$(cat /dev/mtd9 | grep reference_design | cut -d "=" -f2)
else
MODEL=$(cat /tmp/sysinfo/board_name)
SERIAL=$(cat /sys/class/net/eth0/address | tr -d :)
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)
CERT_REGION=$(cat /dev/mtd9 | grep certification_region | cut -d "=" -f2)
ID=$(cat /dev/mtd9 | grep mac_address | cut -d "=" -f2)
MANUF_DATE=$(cat /dev/mtd9 | grep manufacturer_date | cut -d "=" -f2)
MANUF_NAME=$(cat /dev/mtd9 | grep manufacturer_name | cut -d "=" -f2)
if [ ! $MANUF_NAME ]; then
MANUF_NAME="Proware (TP-Link)"
fi
MANUF_ABBR="PW"
MANUF_URL=$(cat /dev/mtd9 | grep manufacturer_url | cut -d "=" -f2)
MODEL_DESCR=$(cat /dev/mtd9 | grep model_description | cut -d "=" -f2)
MODEL_REV=$(cat /dev/mtd9 | grep model_revision | cut -d "=" -f2)
REF_DESIGN=$(cat /dev/mtd9 | grep reference_design | cut -d "=" -f2)
;;
*)
MODEL=$(cat /tmp/sysinfo/board_name)

View File

@@ -6,15 +6,4 @@ uci set network.wan.metric=1
uci set network.lan.metric=10
uci set network.wan.vlan_filtering=1
uci set network.lan.vlan_filtering=1
# Add LAN ssh rule
uci set firewall.lan_ssh_rule=rule
uci set firewall.lan_ssh_rule.src='lan'
uci set firewall.lan_ssh_rule.target='ACCEPT'
uci set firewall.lan_ssh_rule.proto='tcp'
uci set firewall.lan_ssh_rule.dest_port='22'
uci set firewall.lan_ssh_rule.name="Lan SSH Rule"
uci commit firewall
/etc/init.d/firewall restart
exit 0

View File

@@ -1,7 +1,7 @@
From e4903ad3c873fef824f44fa7fb3696e03a778c3f Mon Sep 17 00:00:00 2001
From f2dd3e3677ed1fed6ce328ce4976609b049bb64b Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sat, 18 Jul 2020 08:53:44 +0200
Subject: [PATCH 01/33] ipq807x: add the Qualcomm AX target support
Subject: [PATCH 01/15] ipq807x: add the Qualcomm AX target support
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -152,7 +152,7 @@ index 0000000000..6c429f1852
+exit 0
diff --git a/target/linux/ipq807x/Makefile b/target/linux/ipq807x/Makefile
new file mode 100644
index 0000000000..66031ace35
index 0000000000..90df1f8a9a
--- /dev/null
+++ b/target/linux/ipq807x/Makefile
@@ -0,0 +1,22 @@
@@ -4903,7 +4903,7 @@ index 0000000000..9a5538aee3
+}
diff --git a/target/linux/ipq807x/config-4.4 b/target/linux/ipq807x/config-4.4
new file mode 100644
index 0000000000..b187a643c1
index 0000000000..858d7e1aee
--- /dev/null
+++ b/target/linux/ipq807x/config-4.4
@@ -0,0 +1,821 @@
@@ -8850,7 +8850,7 @@ index 0000000000..5744a2a5bf
+ struct comp_opts {
diff --git a/target/linux/ipq807x/patches/102-cig-wf188.patch b/target/linux/ipq807x/patches/102-cig-wf188.patch
new file mode 100644
index 0000000000..1ca355389d
index 0000000000..225ea45d08
--- /dev/null
+++ b/target/linux/ipq807x/patches/102-cig-wf188.patch
@@ -0,0 +1,869 @@
@@ -9169,8 +9169,8 @@ index 0000000000..1ca355389d
++ pinctrl-names = "default";
++
++ wps {
++ label = "reset";
++ linux,code = <KEY_RESTART>;
++ label = "wps";
++ linux,code = <KEY_WPS_BUTTON>;
++ gpios = <&tlmm 22 GPIO_ACTIVE_LOW>;
++ linux,input-type = <1>;
++ debounce-interval = <60>;
@@ -9597,8 +9597,8 @@ index 0000000000..1ca355389d
++ pinctrl-names = "default";
++
++ wps {
++ label = "reset";
++ linux,code = <KEY_RESTART>;
++ label = "wps";
++ linux,code = <KEY_WPS_BUTTON>;
++ gpios = <&tlmm 22 GPIO_ACTIVE_LOW>;
++ linux,input-type = <1>;
++ debounce-interval = <60>;
@@ -10547,7 +10547,7 @@ index 0000000000..c6d12fe963
++
diff --git a/target/linux/ipq807x/patches/104-wf194c.patch b/target/linux/ipq807x/patches/104-wf194c.patch
new file mode 100644
index 0000000000..05b1b18b6c
index 0000000000..7e7f172688
--- /dev/null
+++ b/target/linux/ipq807x/patches/104-wf194c.patch
@@ -0,0 +1,816 @@
@@ -10841,8 +10841,8 @@ index 0000000000..05b1b18b6c
++ pinctrl-names = "default";
++
++ button@1 {
++ label = "reset";
++ linux,code = <KEY_RESTART>;
++ label = "wps";
++ linux,code = <KEY_WPS_BUTTON>;
++ gpios = <&tlmm 67 GPIO_ACTIVE_LOW>;
++ linux,input-type = <1>;
++ debounce-interval = <60>;
@@ -11386,7 +11386,7 @@ index 0000000000..f91601ec59
+ /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
diff --git a/target/linux/ipq807x/patches/106-eap101.patch b/target/linux/ipq807x/patches/106-eap101.patch
new file mode 100644
index 0000000000..784fc5371e
index 0000000000..6b0eb2f831
--- /dev/null
+++ b/target/linux/ipq807x/patches/106-eap101.patch
@@ -0,0 +1,975 @@

View File

@@ -1,131 +1,101 @@
From 49bf9d17f0b3f7ebb4f9f562f10853e3fd067b7a Mon Sep 17 00:00:00 2001
From 82c689a779db76c74893be4d6249b663d70d80d8 Mon Sep 17 00:00:00 2001
From: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
Date: Wed, 30 Jun 2021 12:46:26 -0400
Subject: [PATCH] WiFi6 Aps LEDs Label name change
Date: Fri, 21 May 2021 16:38:07 -0400
Subject: [PATCH] WiFi6-APs-Label-Name-Change
This patch fixes leds incorrect state issue and also chanage the label
names of leds
Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
---
.../ipq807x/base-files/etc/board.d/01_leds | 13 +-
.../111-WiFi6-Aps-LEDs-Label-Change.patch | 183 ++++++++++++++++++
2 files changed, 193 insertions(+), 3 deletions(-)
create mode 100644 target/linux/ipq807x/patches/111-WiFi6-Aps-LEDs-Label-Change.patch
.../111-WiFi6-APs-LED-Label-Name-Change.patch | 182 ++++++++++++++++++
1 file changed, 182 insertions(+)
create mode 100644 target/linux/ipq807x/patches/111-WiFi6-APs-LED-Label-Name-Change.patch
diff --git a/target/linux/ipq807x/base-files/etc/board.d/01_leds b/target/linux/ipq807x/base-files/etc/board.d/01_leds
index 1402a74f3e..bca3ae8daa 100755
--- a/target/linux/ipq807x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq807x/base-files/etc/board.d/01_leds
@@ -15,10 +15,17 @@ cig,wf194c)
ucidef_set_led_netdev "wan" "WAN" "wf194c:green:wan" "br-wan" "tx rx link"
ucidef_set_led_netdev "lan" "LAN" "wf194c:green:lan" "br-lan" "tx rx link"
;;
-edgecore,eap101 |\
+edgecore,eap101)
+ ucidef_set_led_wlan "wifi5g" "WIFI5G" "eap101:green:wifi5g" "phy0tx"
+ ucidef_set_led_wlan "wifi2g" "WIFI2G" "eap101:green:wifi2g" "phy1tx"
+ ;;
edgecore,eap102)
- ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tx"
- ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tx"
+ ucidef_set_led_wlan "wifi5g" "WIFI5G" "eap102:green:wifi5g" "phy0tx"
+ ucidef_set_led_wlan "wifi2g" "WIFI2G" "eap102:green:wifi2g" "phy1tx"
+ ;;
+cig,wf188n)
+ ucidef_set_led_wlan "wifi5g" "WIFI5G" "wf188:green:wifi5g" "phy0tx"
+ ucidef_set_led_wlan "wifi2g" "WIFI2G" "wf188:green:wifi2g" "phy1tx"
;;
esac
diff --git a/target/linux/ipq807x/patches/111-WiFi6-Aps-LEDs-Label-Change.patch b/target/linux/ipq807x/patches/111-WiFi6-Aps-LEDs-Label-Change.patch
diff --git a/target/linux/ipq807x/patches/111-WiFi6-APs-LED-Label-Name-Change.patch b/target/linux/ipq807x/patches/111-WiFi6-APs-LED-Label-Name-Change.patch
new file mode 100644
index 0000000000..06533425a9
index 0000000000..2396067aac
--- /dev/null
+++ b/target/linux/ipq807x/patches/111-WiFi6-Aps-LEDs-Label-Change.patch
@@ -0,0 +1,183 @@
+++ b/target/linux/ipq807x/patches/111-WiFi6-APs-LED-Label-Name-Change.patch
@@ -0,0 +1,182 @@
+Index: linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce/arch/arm64/boot/dts/qcom/qcom-ipq6018-cig-wf188.dts
+===================================================================
+--- linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce.orig/arch/arm64/boot/dts/qcom/qcom-ipq6018-cig-wf188.dts
++++ linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce/arch/arm64/boot/dts/qcom/qcom-ipq6018-cig-wf188.dts
+@@ -309,28 +309,28 @@
+@@ -309,26 +309,26 @@
+ pinctrl-names = "default";
+
+ led@25 {
+- label = "led_5g";
++ label = "wf188:green:wifi5g";
+ gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
+- gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
+- linux,default-trigger = "wf188:green:5g";
++ label = "wf188:green:wifi5g";
++ gpios = <&tlmm 25 GPIO_ACTIVE_LOW>;
++ linux,default-trigger = "wf188:green:wifi5g";
+ default-state = "off";
+ };
+ led@24 {
+- label = "led_2g";
++ label = "wf188:green:wifi2g";
+ gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>;
+- gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>;
+- linux,default-trigger = "wf188:green:2g";
++ label = "wf188:green:wifi2g";
++ gpios = <&tlmm 24 GPIO_ACTIVE_LOW>;
++ linux,default-trigger = "wf188:green:wifi2g";
+ default-state = "off";
+ };
+ led@18 {
+- label = "led_eth";
+- gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>;
++ label = "wf188:green:eth";
+ gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>;
++ gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "wf188:green:eth";
+- default-state = "off";
++ default-state = "on";
+ default-state = "off";
+ };
+ led_power: led@16 {
+- label = "led_pwr";
+- gpios = <&tlmm 16 GPIO_ACTIVE_HIGH>;
++ label = "wf188:green:power";
+ gpios = <&tlmm 16 GPIO_ACTIVE_HIGH>;
++ gpios = <&tlmm 16 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "wf188:green:power";
+- default-state = "off";
++ default-state = "on";
+ default-state = "off";
+ };
+ };
+
+Index: linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce/arch/arm64/boot/dts/qcom/qcom-ipq6018-cig-wf188n.dts
+===================================================================
+--- linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce.orig/arch/arm64/boot/dts/qcom/qcom-ipq6018-cig-wf188n.dts
++++ linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce/arch/arm64/boot/dts/qcom/qcom-ipq6018-cig-wf188n.dts
+@@ -309,28 +309,28 @@
+@@ -309,26 +309,26 @@
+ pinctrl-names = "default";
+
+ led@25 {
+- label = "led_5g";
++ label = "wf188:green:wifi5g";
+ gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
+- gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
+- linux,default-trigger = "wf188:green:5g";
++ label = "wf188:green:wifi5g";
++ gpios = <&tlmm 25 GPIO_ACTIVE_LOW>;
++ linux,default-trigger = "wf188:green:wifi5g";
+ default-state = "off";
+ };
+ led@24 {
+- label = "led_2g";
++ label = "wf188:green:wifi2g";
+ gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>;
+- gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>;
+- linux,default-trigger = "wf188:green:2g";
++ label = "wf188:green:wifi2g";
++ gpios = <&tlmm 24 GPIO_ACTIVE_LOW>;
++ linux,default-trigger = "wf188:green:wifi2g";
+ default-state = "off";
+ };
+ led@18 {
+- label = "led_eth";
+- gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>;
++ label = "wf188:green:eth";
+ gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>;
++ gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "wf188:green:eth";
+- default-state = "off";
++ default-state = "on";
+ default-state = "off";
+ };
+ led_power: led@16 {
+- label = "led_pwr";
+- gpios = <&tlmm 16 GPIO_ACTIVE_HIGH>;
++ label = "wf188:green:power";
+ gpios = <&tlmm 16 GPIO_ACTIVE_HIGH>;
++ gpios = <&tlmm 16 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "wf188:green:power";
+- default-state = "off";
++ default-state = "on";
+ default-state = "off";
+ };
+ };
+
+Index: linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce/arch/arm64/boot/dts/qcom/qcom-ipq6018-edgecore-eap101.dts
+===================================================================
+--- linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce.orig/arch/arm64/boot/dts/qcom/qcom-ipq6018-edgecore-eap101.dts
@@ -135,27 +105,26 @@ index 0000000000..06533425a9
+
+ led@25 {
+- label = "green:wifi5";
+- gpios = <&tlmm 35 GPIO_ACTIVE_LOW>;
+- linux,default-trigger = "wf188:green:5g";
++ label = "eap101:green:wifi5g";
++ gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>;
+ gpios = <&tlmm 35 GPIO_ACTIVE_LOW>;
+- linux,default-trigger = "wf188:green:5g";
++ linux,default-trigger = "eap101:green:wifi5g";
+ default-state = "off";
+ };
+ led@24 {
+- label = "green:wifi2";
+- gpios = <&tlmm 37 GPIO_ACTIVE_LOW>;
+- linux,default-trigger = "wf188:green:2g";
++ label = "eap101:green:wifi2g";
++ gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
+ gpios = <&tlmm 37 GPIO_ACTIVE_LOW>;
+- linux,default-trigger = "wf188:green:2g";
++ linux,default-trigger = "eap101:green:wifi2g";
+ default-state = "off";
+ };
+ led_power: led@16 {
+- label = "led_pwr";
++ label = "eap101:green:power";
+ gpios = <&tlmm 74 GPIO_ACTIVE_HIGH>;
+- gpios = <&tlmm 74 GPIO_ACTIVE_HIGH>;
+- linux,default-trigger = "green:power";
++ label = "eap101:green:power";
++ gpios = <&tlmm 74 GPIO_ACTIVE_LOW>;
++ linux,default-trigger = "eap101:green:power";
+ default-state = "off";
+ };
@@ -164,7 +133,7 @@ index 0000000000..06533425a9
+===================================================================
+--- linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce.orig/arch/arm64/boot/dts/qcom/qcom-ipq807x-eap102.dts
++++ linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce/arch/arm64/boot/dts/qcom/qcom-ipq807x-eap102.dts
+@@ -671,29 +671,29 @@
+@@ -671,29 +671,27 @@
+ pinctrl-names = "default";
+
+ led_power: led_pwr {
@@ -173,31 +142,31 @@ index 0000000000..06533425a9
+ gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+- linux,default-trigger = "led_pwr";
++ linux,default-trigger = "eap102:green:power";
+ };
+
+ led_2g {
+- label = "green:wifi2";
++ label = "eap102:green:wifi2g";
+ gpio = <&tlmm 47 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+- default-state = "off";
++ default-state = "on";
+ };
+
+ led_5g {
+- label = "green:wifi5";
++ label = "eap102:green:wifi5g";
+ gpio = <&tlmm 48 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+- default-state = "off";
++ default-state = "on";
+ };
+
+ led_bt {
++ label = "eap102:green:bt";
+ gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>;
+- label = "green:bt";
+- default-state = "off";
+- linux,default-trigger = "led_bt";
++ label = "eap102:green:bt";
++ default-state = "on";
++ linux,default-trigger = "eap102:green:bt";
+ };
+ };
+ nss-macsec0 {

View File

@@ -1,26 +0,0 @@
From 97ba6e4ba01fc7c57f769ac6d5c0e5fdf8ef0f62 Mon Sep 17 00:00:00 2001
From: Arthur Su <arthur.su@tp-link.com>
Date: Mon, 12 Jul 2021 02:31:13 +0000
Subject: [PATCH] ipq40xx: fix EC420-G1 reset button
Signed-off-by: Arthur Su <arthur.su@tp-link.com>
---
.../arch/arm/boot/dts/qcom-ipq4019-tp-link-ec420-g1.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-tp-link-ec420-g1.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-tp-link-ec420-g1.dts
index e2062e7cd0..fc48e605d5 100755
--- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-tp-link-ec420-g1.dts
+++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-tp-link-ec420-g1.dts
@@ -69,7 +69,7 @@
button@1 {
label = "reset";
linux,code = <KEY_RESTART>;
- gpios = <&tlmm 10 GPIO_ACTIVE_LOW>;
+ gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
};
};
--
2.20.1

View File

@@ -1,115 +0,0 @@
From 8091bc6a4e9167fe4dc9abea4433b4852a8a4020 Mon Sep 17 00:00:00 2001
From: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
Date: Mon, 12 Jul 2021 14:42:44 -0400
Subject: [PATCH] WiFI5 APs LED label change
This patch will change the label names of ecw5410, ecw5211, and wf610D
APs to follow common naming conventions
Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
---
.../ipq40xx/base-files/etc/board.d/01_leds | 8 ++++----
...000-ecw5211-AP-LED-label-name-change.patch | 19 +++++++++++++++++++
.../ipq806x/base-files/etc/board.d/01_leds | 4 ++--
.../arm/boot/dts/qcom-ipq8068-ecw5410.dts | 8 ++++----
4 files changed, 29 insertions(+), 10 deletions(-)
create mode 100644 target/linux/ipq40xx/patches-4.14/1000-ecw5211-AP-LED-label-name-change.patch
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
index e1833ffcee..033661752c 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
@@ -61,12 +61,12 @@ zyxel,nbg6617)
;;
edgecore,ecw5211 |\
zyxel,wre6606)
- ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" "phy0tpt"
- ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" "phy1tpt"
+ ucidef_set_led_wlan "wifi2g" "WIFI2G" "${boardname}:green:wifi2g" "phy0tpt"
+ ucidef_set_led_wlan "wifi5g" "WIFI5G" "${boardname}:green:wifi5g" "phy1tpt"
;;
cig,wf610d)
- ucidef_set_led_wlan "wlan2g" "WLAN2G" "wf6203:green:wifi2g" "phy0tpt"
- ucidef_set_led_wlan "wlan5g" "WLAN5G" "wf6203:green:wifi5g" "phy1tpt"
+ ucidef_set_led_wlan "wifi2g" "WIFI2G" "wf6203:green:wifi2g" "phy0tpt"
+ ucidef_set_led_wlan "wifi5g" "WIFI5G" "wf6203:green:wifi5g" "phy1tpt"
;;
*)
diff --git a/target/linux/ipq40xx/patches-4.14/1000-ecw5211-AP-LED-label-name-change.patch b/target/linux/ipq40xx/patches-4.14/1000-ecw5211-AP-LED-label-name-change.patch
new file mode 100644
index 0000000000..67664fb0fa
--- /dev/null
+++ b/target/linux/ipq40xx/patches-4.14/1000-ecw5211-AP-LED-label-name-change.patch
@@ -0,0 +1,19 @@
+Index: linux-4.14.187/arch/arm/boot/dts/qcom-ipq4018-ecw5211.dts
+===================================================================
+--- linux-4.14.187.orig/arch/arm/boot/dts/qcom-ipq4018-ecw5211.dts
++++ linux-4.14.187/arch/arm/boot/dts/qcom-ipq4018-ecw5211.dts
+@@ -37,12 +37,12 @@
+ };
+
+ wlan2g {
+- label = "ecw5211:green:wlan2g";
++ label = "ecw5211:green:wifi2g";
+ gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
+ };
+
+ wlan5g {
+- label = "ecw5211:green:wlan5g";
++ label = "ecw5211:green:wifi5g";
+ gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>;
+ };
+ };
diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index ffefb9e01c..809eef820a 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -20,8 +20,8 @@ compex,wpq864)
ucidef_set_led_usbport "pcie-usb" "PCIe USB" "wpq864:green:usb-pcie" "usb3-port1"
;;
edgecore,ecw5410)
- ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" "phy1tpt"
- ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" "phy0tpt"
+ ucidef_set_led_wlan "wifi2g" "WIFI2G" "${boardname}:green:wifi2g" "phy1tpt"
+ ucidef_set_led_wlan "wifi5g" "WIFI5G" "${boardname}:green:wifi5g" "phy0tpt"
;;
nec,wg2600hp)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" "phy1tpt"
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8068-ecw5410.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8068-ecw5410.dts
index 6bddc5e288..7caa1d7e0e 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8068-ecw5410.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8068-ecw5410.dts
@@ -82,17 +82,17 @@
};
wlan2g_green {
- label = "ecw5410:green:wlan2g";
+ label = "ecw5410:green:wifi2g";
gpios = <&qcom_pinmux 23 GPIO_ACTIVE_LOW>;
};
wlan2g_yellow {
- label = "ecw5410:yellow:wlan2g";
+ label = "ecw5410:yellow:wifi2g";
gpios = <&qcom_pinmux 24 GPIO_ACTIVE_LOW>;
};
wlan5g_green {
- label = "ecw5410:green:wlan5g";
+ label = "ecw5410:green:wifi5g";
gpios = <&qcom_pinmux 26 GPIO_ACTIVE_LOW>;
};
@@ -102,7 +102,7 @@
};
wlan5g_yellow {
- label = "ecw5410:yellow:wlan5g";
+ label = "ecw5410:yellow:wifi5g";
gpios = <&qcom_pinmux 59 GPIO_ACTIVE_LOW>;
};
};
--
2.25.1

View File

@@ -1,38 +0,0 @@
From 73bb7009f980da3e898b590be06328703235c8ee Mon Sep 17 00:00:00 2001
From: Arthur Su <arthur.su@tp-link.com>
Date: Fri, 16 Jul 2021 09:43:25 +0000
Subject: [PATCH] ipq40xx: change EC420-G1 patch_mac method
deprecate get_tip command, because manufacturing data aren't binrary
raw.
Signed-off-by: Arthur Su <arthur.su@tp-link.com>
---
.../base-files/etc/hotplug.d/firmware/11-ath10k-caldata | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 428002acf3..38f248fb6e 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -129,7 +129,7 @@ case "$FIRMWARE" in
tp-link,ap2220 |\
tp-link,ec420-g1)
ath10kcal_extract "0:ART" 36864 12064
- ath10kcal_patch_mac_crc $(macaddr_add "$(get_tip mac_address)" 1) # 5G, wlan0
+ ath10kcal_patch_mac_crc $(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) # 5G, wlan0
;;
esac
;;
@@ -200,7 +200,7 @@ case "$FIRMWARE" in
tp-link,ap2220 |\
tp-link,ec420-g1)
ath10kcal_extract "0:ART" 4096 12064
- ath10kcal_patch_mac_crc $(macaddr_add "$(get_tip mac_address)" 9) #2.4G, wlan1
+ ath10kcal_patch_mac_crc $(macaddr_add "$(cat /sys/class/net/eth0/address)" 9) #2.4G, wlan1
;;
esac
;;
--
2.20.1

View File

@@ -1,52 +0,0 @@
From efe92c7fc395794cbfc12d195dddb660be5e4f2c Mon Sep 17 00:00:00 2001
From: Arthur Su <arthur.su@tp-link.com>
Date: Mon, 19 Jul 2021 08:45:27 +0000
Subject: [PATCH] ipq807x: add ath11k_generate_macs method for EX227 and EX447
The ex227 and ex447 have 17 MACs,the base mac is reserved for WAN, and
other 16 MACs are reserved for WLAN0/WALN1.
Signed-off-by: Arthur Su <arthur.su@tp-link.com>
---
.../etc/hotplug.d/firmware/10-ath11k-caldata | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
index 25b22887fe..e6eb7e2dfd 100755
--- a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
+++ b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
@@ -24,6 +24,20 @@ ath11k_generate_macs() {
done
}
+# The tplink device has 17 MAC addresses. The base MAC address is reserved for eth0(WAN),
+# 8 MACs are reserved for 5G wireless(WLAN0), and the other 8 MACs are reserved for 2.4G wireless(WLAN1).
+# eth0: base_mac
+# wlan0: base_mac+1 ~ base_mac+8
+# wlan1: base_mac+9 ~ base_mac+16
+ath11k_generate_macs_for_tplink() {
+ touch /lib/firmware/ath11k-macs
+ eth=$(cat /sys/class/net/eth0/address)
+ wlan0=$(macaddr_add ${eth} 1) # 5G, wlan0
+ echo -ne \\x${wlan0//:/\\x} >> /lib/firmware/ath11k-macs
+ wlan1=$(macaddr_add ${eth} 9) # 2.4G, wlan1
+ echo -ne \\x${wlan1//:/\\x} >> /lib/firmware/ath11k-macs
+}
+
caldata_die() {
echo "caldata: " "$*"
exit 1
@@ -88,6 +102,10 @@ ath11k-macs)
cig,wf188n)
ath11k_generate_macs
;;
+ tplink,ex227|\
+ tplink,ex447)
+ ath11k_generate_macs_for_tplink
+ ;;
esac
;;
*)
--
2.20.1

View File

@@ -1,25 +0,0 @@
From c095555876344c46ac2653e97f4848f7fedd781b Mon Sep 17 00:00:00 2001
From: Owen Anderson <owenthomasanderson@gmail.com>
Date: Fri, 16 Jul 2021 12:53:17 -0400
Subject: [PATCH] Changed the method we use to get the interface name for lldp
---
package/network/services/lldpd/files/lldpd.init | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init
index bc429de484..64dfccfebe 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -37,7 +37,7 @@ write_lldpd_conf()
local iface ifnames=""
for iface in $ifaces; do
local ifname=""
- if network_get_device ifname "$iface" || [ -e "/sys/class/net/$iface" ]; then
+ if network_get_physdev ifname "$iface" || [ -e "/sys/class/net/$iface" ]; then
append ifnames "${ifname:-$iface}" ","
fi
done
--
2.25.1

View File

@@ -1,114 +0,0 @@
From c685d1eb284547aaefb6d7ccb03677905d652b17 Mon Sep 17 00:00:00 2001
From: Arif Alam <arif.alam@netexperience.com>
Date: Thu, 29 Jul 2021 15:25:57 -0400
Subject: [PATCH] Fix mac assign on ath11k
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Arif Alam <arif.alam@netexperience.com>
---
.../files/lib/netifd/wireless/mac80211.sh | 13 +++++++++---
.../mac80211/files/lib/wifi/mac80211.sh | 1 +
.../etc/hotplug.d/firmware/10-ath11k-caldata | 20 ++++++-------------
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 36aebbb2cc..cf3e7ffbb8 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -26,6 +26,7 @@ drv_mac80211_init_device_config() {
config_add_string tx_burst
config_add_int beacon_int chanbw frag rts
config_add_int rxantenna txantenna antenna_gain txpower distance
+ config_add_int num_global_macaddr
config_add_boolean noscan ht_coex
config_add_array ht_capab
config_add_array channels
@@ -382,7 +383,11 @@ mac80211_generate_mac() {
local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS"
macidx=$(($id + 1))
- [ "$((0x$mask1))" -gt 0 ] && {
+
+ local use_global=0
+ [ "$id" -gt 0 -a "$macidx" -le "$num_global_macaddr" ] && use_global=1
+
+ [ "$((0x$mask1))" -gt 0 -a "$use_global" -lt 1 ] && {
b1="0x$1"
[ "$id" -gt 0 ] && \
b1=$(($b1 ^ ((($id - 1) << 2) | 0x2)))
@@ -390,7 +395,7 @@ mac80211_generate_mac() {
return
}
- [ "$((0x$mask6))" -lt 255 ] && {
+ [ "$((0x$mask6))" -lt 255 -a "$use_global" -gt 0 ] && {
printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $(( 0x$6 ^ $id ))
return
}
@@ -724,7 +729,8 @@ drv_mac80211_setup() {
country chanbw distance \
txpower antenna_gain \
rxantenna txantenna \
- frag rts beacon_int:100 htmode
+ frag rts beacon_int:100 htmode \
+ num_global_macaddr
json_get_values basic_rate_list basic_rate
json_select ..
@@ -763,6 +769,7 @@ drv_mac80211_setup() {
set_default txantenna 0xffffffff
set_default distance 0
set_default antenna_gain 0
+ set_default num_global_macaddr 1
[ "$txantenna" = "all" ] && txantenna=0xffffffff
[ "$rxantenna" = "all" ] && rxantenna=0xffffffff
diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
index 511a9188db..09452ab365 100644
--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
@@ -113,6 +113,7 @@ detect_mac80211() {
set wireless.radio${devidx}.hwmode=11${mode_band}
${dev_id}
${ht_capab}
+ set wireless.radio${devidx}.num_global_macaddr=8
set wireless.radio${devidx}.disabled=1
set wireless.default_radio${devidx}=wifi-iface
diff --git a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
index e6eb7e2dfd..02ea5056f4 100755
--- a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
+++ b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
@@ -5,23 +5,15 @@
. /lib/functions.sh
. /lib/functions/system.sh
-macaddr_setup() {
- local mac=$1
- local val=$2
- local oui=${mac%:*:*}
- local nic=$(echo $mac | cut -d: -f 5)
-
- nic=$(printf "%02x" $((0x${nic//:/} + $val & 0xff)) | sed 's/^\(.\{2\}\)\(.\{2\}\)\(.\{2\}\)/\1:\2:\3/')
- echo $oui:$nic:01
-}
-
ath11k_generate_macs() {
touch /lib/firmware/ath11k-macs
eth=$(cat /sys/class/net/eth0/address)
- for a in `seq 1 3`; do
- m=$(macaddr_setup ${eth} $a)
- echo -ne \\x${m//:/\\x} >> /lib/firmware/ath11k-macs
- done
+ mac1=$(macaddr_add $eth 2)
+ mac2=$(macaddr_add $eth 10)
+ mac3=$(macaddr_add $eth 18)
+ echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
+ echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
+ echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
}
# The tplink device has 17 MAC addresses. The base MAC address is reserved for eth0(WAN),
--
2.25.1

View File

@@ -1,68 +0,0 @@
From 5e5917308f769f1228c572e4aed4f8f7f6434a14 Mon Sep 17 00:00:00 2001
From: Owen Anderson <owenthomasanderson@gmail.com>
Date: Wed, 4 Aug 2021 13:38:16 -0400
Subject: [PATCH] Updated LLDPD version to 1.0.5 and updated config information
---
package/network/services/lldpd/Makefile | 4 ++--
package/network/services/lldpd/files/lldpd.init | 11 ++++++-----
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile
index 5b36155b71..48a3993492 100644
--- a/package/network/services/lldpd/Makefile
+++ b/package/network/services/lldpd/Makefile
@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=lldpd
-PKG_VERSION:=1.0.3
+PKG_VERSION:=1.0.5
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd
-PKG_HASH:=39fced395168015416bfe78b95414facf066f841f349024433aa20ab54e4c360
+PKG_HASH:=2dd3b212f4dbabfcbb2794c0010b245f9f8e74b387984e757be6243a74c6cb99
PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
PKG_LICENSE:=ISC
diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init
index 64dfccfebe..66b5a74c18 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -12,11 +12,8 @@ LLDPD_CONFS_DIR=/tmp/lldpd.d
find_release_info()
{
- [ -s /etc/os-release ] && . /etc/os-release
- [ -z "$PRETTY_NAME" ] && [ -s /etc/openwrt_version ] && \
- PRETTY_NAME="$(cat /etc/openwrt_version)"
-
- echo "${PRETTY_NAME:-Unknown OpenWrt release} @ $(cat /proc/sys/kernel/hostname)"
+ FW_VERSION=`sed -n 's/FW_IMAGE_ACTIVE:\(.*\)/\1/p' < /usr/opensync/.versions`
+ echo "${FW_VERSION:-Unknown TIP OpenAp release} @ $(cat /proc/sys/kernel/hostname)"
}
write_lldpd_conf()
@@ -48,6 +45,8 @@ write_lldpd_conf()
[ -n "$lldp_description" ] && echo "configure system description" "\"$lldp_description\"" >> "$LLDPD_CONF"
[ -n "$lldp_hostname" ] && echo "configure system hostname" "\"$lldp_hostname\"" >> "$LLDPD_CONF"
+ echo "configure system ip management pattern br-wan" >> "$LLDPD_CONF"
+
# Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to /tmp/$LLDPD_CONFS_DIR
[ -e $LLDPD_CONFS_DIR ] || ln -s /etc/lldpd.d $LLDPD_CONFS_DIR
}
@@ -107,6 +106,8 @@ reload_service() {
unconfigure lldp custom-tlv
unconfigure system interface pattern
unconfigure system description
+ unconfigure system hostname
+ unconfigure system ip management pattern
EOF
# Rewrite lldpd.conf
# If something changed it should be included by the lldpcli call
--
2.25.1

View File

@@ -1,39 +0,0 @@
From e0c226e8f5cfa6ec3537823685a803b970297005 Mon Sep 17 00:00:00 2001
From: Chaitanya Godavarthi <chaitanya.kiran@netexperience.com>
Date: Sun, 8 Aug 2021 21:38:12 -0400
Subject: [PATCH] wifi-3258: Fix bridge client traffic on same wifi interface
Allow bridging broadcast and multicast traffic within same
bridge port if hairpinmode is enabled for that port.
This fixes the ARP packet between clients on same wifi interface
being dropped.
Signed-off-by: Chaitanya Godavarthi <chaitanya.kiran@netexperience.com>
---
...e-allow-bcast-mcast-same-port-hairpinmode.patch | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 target/linux/ipq807x/patches/112-bridge-allow-bcast-mcast-same-port-hairpinmode.patch
diff --git a/target/linux/ipq807x/patches/112-bridge-allow-bcast-mcast-same-port-hairpinmode.patch b/target/linux/ipq807x/patches/112-bridge-allow-bcast-mcast-same-port-hairpinmode.patch
new file mode 100644
index 0000000000..99989b3067
--- /dev/null
+++ b/target/linux/ipq807x/patches/112-bridge-allow-bcast-mcast-same-port-hairpinmode.patch
@@ -0,0 +1,14 @@
+Index: linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce/net/bridge/br_forward.c
+===================================================================
+--- linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce.orig/net/bridge/br_forward.c
++++ linux-4.4.60-qsdk-10fd7d14853b7020b804acae690c8acec5d954ce/net/bridge/br_forward.c
+@@ -33,8 +33,7 @@ static inline int should_deliver(const s
+ struct net_bridge_vlan_group *vg;
+
+ vg = nbp_vlan_group_rcu(p);
+- return ((skb->dev != p->dev) || ((p->flags & BR_HAIRPIN_MODE) &&
+- (!is_multicast_ether_addr(eth_hdr(skb)->h_dest)))) &&
++ return ((skb->dev != p->dev) || (p->flags & BR_HAIRPIN_MODE)) &&
+ br_allowed_egress(vg, skb) && p->state == BR_STATE_FORWARDING;
+ }
+
--
2.25.1

View File

@@ -1,37 +0,0 @@
From 87af8ae014551b73a51c30a0c30da2a2c666e548 Mon Sep 17 00:00:00 2001
From: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
Date: Fri, 13 Aug 2021 11:41:25 -0400
Subject: [PATCH] WIFI-3244-config-reset-over-sysupgrade
This patch will fix configuration restore problem over sysupgrade
on WF610D
Even though there is a configuration data in the /dev/mtdblock12, it is getting erased while reading it beacuse of JFFS2 empty bitmask code. So I added a condition to check whether the datatype available is JFFS2 or not, and making sure it is not empty before returning the JFFS2 flag to restore the configuration.
Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
---
.../system/fstools/patches/002-wf610d-config-reset | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 package/system/fstools/patches/002-wf610d-config-reset
diff --git a/package/system/fstools/patches/002-wf610d-config-reset b/package/system/fstools/patches/002-wf610d-config-reset
new file mode 100644
index 0000000000..6e18f8669c
--- /dev/null
+++ b/package/system/fstools/patches/002-wf610d-config-reset
@@ -0,0 +1,13 @@
+Index: fstools-2020-05-12-84269037/libfstools/mtd.c
+===================================================================
+--- fstools-2020-05-12-84269037.orig/libfstools/mtd.c
++++ fstools-2020-05-12-84269037/libfstools/mtd.c
+@@ -226,6 +226,8 @@ static int mtd_volume_identify(struct vo
+ if (v->type == UBIVOLUME && deadc0de == 0xffffffff) {
+ return FS_JFFS2;
+ }
++ if (v->type == FS_JFFS2 && v->size && deadc0de == 0xffffffff)
++ return FS_JFFS2;
+
+ return FS_NONE;
+ }
--
2.25.1