Skip to content

Commit 8468886

Browse files
authored
Merge pull request #1343 from kernelkit/misc-wifi-fixes
2 parents 89c4d21 + f195a0a commit 8468886

File tree

8 files changed

+44
-9
lines changed

8 files changed

+44
-9
lines changed

board/aarch64/bananapi-bpi-r3/bananapi-bpi-r3.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ define BANANAPI_BPI_R3_LINUX_CONFIG_FIXUPS
66
$(call KCONFIG_SET_OPT,CONFIG_I2C_GPIO,y)
77
$(call KCONFIG_SET_OPT,CONFIG_MTK_THERMAL,m)
88
$(call KCONFIG_ENABLE_OPT,CONFIG_MTK_UART)
9-
$(call KCONFIG_ENABLE_OPT,CONFIG_MTK_WATCHDOG)
9+
$(call KCONFIG_ENABLE_OPT,CONFIG_MEDIATEK_WATCHDOG)
1010
$(call KCONFIG_ENABLE_OPT,CONFIG_MEDIATEK_GE_PHY)
1111
$(call KCONFIG_ENABLE_OPT,CONFIG_REALTEK_PHY)
1212
$(call KCONFIG_ENABLE_OPT,CONFIG_NET_VENDOR_MEDIATEK)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Locally calculated
22
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
3-
sha256 57af0fd9eb59bcabc1ced229dab85b69cde36301e4a66f91c127f2aff73ebb07 klish-plugin-sysrepo-a0f348a2716df805c85f3b5403180fcc7c1b9e8d-git4.tar.gz
3+
sha256 a852daabf76a7bdd22637af23718a8470b89bc3a0e1c2d0ea10d4b6ba3fc4280 klish-plugin-sysrepo-001a2e49e37ae969fb8f2f9cf63155ae4e172946-git4.tar.gz

package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
################################################################################
66

7-
KLISH_PLUGIN_SYSREPO_VERSION = a0f348a2716df805c85f3b5403180fcc7c1b9e8d
7+
KLISH_PLUGIN_SYSREPO_VERSION = 001a2e49e37ae969fb8f2f9cf63155ae4e172946
88
KLISH_PLUGIN_SYSREPO_SITE = https://github.com/kernelkit/klish-plugin-sysrepo.git
99
#KLISH_PLUGIN_SYSREPO_VERSION = cdd3eb51a7f7ee0ed5bd925fa636061d3b1b85fb
1010
#KLISH_PLUGIN_SYSREPO_SITE = https://src.libcode.org/pkun/klish-plugin-sysrepo.git
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
2+
index 2406658da..23edf0349 100644
3+
--- a/src/ap/hostapd.c
4+
+++ b/src/ap/hostapd.c
5+
@@ -949,18 +949,6 @@ skip_mask_ext:
6+
if (!auto_addr)
7+
return 0;
8+
9+
- for (i = 0; i < ETH_ALEN; i++) {
10+
- if ((hapd->own_addr[i] & mask[i]) != hapd->own_addr[i]) {
11+
- wpa_printf(MSG_ERROR, "Invalid BSSID mask " MACSTR
12+
- " for start address " MACSTR ".",
13+
- MAC2STR(mask), MAC2STR(hapd->own_addr));
14+
- wpa_printf(MSG_ERROR, "Start address must be the "
15+
- "first address in the block (i.e., addr "
16+
- "AND mask == addr).");
17+
- return -1;
18+
- }
19+
- }
20+
-
21+
return 0;
22+
}
23+

src/confd/src/hardware.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ static int wifi_gen_bss_section(FILE *hostapd, struct lyd_node *cifs, const char
314314
{
315315
const char *ssid, *hidden, *security_mode, *secret_name, *secret;
316316
struct lyd_node *cif, *wifi, *ap, *security, *secret_node;
317+
char bssid[18];
317318

318319
/* Find the interface node for this BSS */
319320
LYX_LIST_FOR_EACH(cifs, cif, "interface") {
@@ -333,6 +334,10 @@ static int wifi_gen_bss_section(FILE *hostapd, struct lyd_node *cifs, const char
333334
fprintf(hostapd, "\n# BSS %s\n", ifname);
334335
fprintf(hostapd, "bss=%s\n", ifname);
335336

337+
/* Set BSSID if custom MAC is configured */
338+
if (!interface_get_phys_addr(cif, bssid))
339+
fprintf(hostapd, "bssid=%s\n", bssid);
340+
336341
/* SSID configuration */
337342
ssid = lydx_get_cattr(ap, "ssid");
338343
hidden = lydx_get_cattr(ap, "hidden");
@@ -484,7 +489,13 @@ static int wifi_gen_aps_on_radio(const char *radio_name, struct lyd_node *cifs,
484489

485490
fprintf(hostapd, "interface=%s\n", primary_ifname);
486491
fprintf(hostapd, "driver=nl80211\n");
487-
fprintf(hostapd, "ctrl_interface=/run/hostapd\n\n");
492+
fprintf(hostapd, "ctrl_interface=/run/hostapd\n");
493+
494+
/* Set BSSID if custom MAC is configured */
495+
char bssid[18];
496+
if (!interface_get_phys_addr(primary_cif, bssid))
497+
fprintf(hostapd, "bssid=%s\n", bssid);
498+
fprintf(hostapd, "\n");
488499

489500
fprintf(hostapd, "ssid=%s\n", ssid);
490501
if (hidden && !strcmp(hidden, "true"))

src/confd/src/interfaces.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static int ifchange_cand_infer_type(sr_session_ctx_t *session, const char *path)
7878
goto out;
7979
}
8080

81-
if (!fnmatch("wifi+([0-9])", ifname, FNM_EXTMATCH))
81+
if (!fnmatch("wifi+([0-9])*", ifname, FNM_EXTMATCH))
8282
inferred.data.string_val = "infix-if-type:wifi";
8383
else if (iface_is_phys(ifname))
8484
inferred.data.string_val = "infix-if-type:ethernet";
@@ -224,7 +224,7 @@ const char *get_chassis_addr(void)
224224
return json_string_value(addr);
225225
}
226226

227-
static int get_phys_addr(struct lyd_node *cif, char *mac)
227+
int interface_get_phys_addr(struct lyd_node *cif, char *mac)
228228
{
229229
struct lyd_node *cpa, *chassis;
230230
const char *base, *offs;
@@ -255,7 +255,7 @@ int link_gen_address(struct lyd_node *cif, FILE *ip)
255255
char mac[18];
256256
int err;
257257

258-
err = get_phys_addr(cif, mac);
258+
err = interface_get_phys_addr(cif, mac);
259259
if (err)
260260
return err;
261261

@@ -272,7 +272,7 @@ static int netdag_gen_link_addr(FILE *ip, struct lyd_node *cif, struct lyd_node
272272
if (!lydx_get_child(dif, "custom-phys-address"))
273273
return 0;
274274

275-
err = get_phys_addr(cif, mac);
275+
err = interface_get_phys_addr(cif, mac);
276276
if (err)
277277
return (err == -ENODATA) ? 0 : err;
278278

src/confd/src/interfaces.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ int netdag_gen_ethtool(struct dagger *net, struct lyd_node *cif, struct lyd_node
101101

102102
/* interfaces.c */
103103
const char *get_chassis_addr(void);
104+
int interface_get_phys_addr(struct lyd_node *cif, char *mac);
104105
int link_gen_address(struct lyd_node *cif, FILE *ip);
105106
int interfaces_get_all_l3(const struct lyd_node *tree, char ***ifaces);
106107

src/statd/python/yanger/ietf_interfaces/wifi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def detect_wifi_mode(ifname):
2323
def find_primary_interface_from_config(ifname):
2424
"""Find primary interface by reading hostapd config files"""
2525
try:
26-
file_list = HOST.run(tuple("ls /etc/hostapd-*.conf".split()), default="")
26+
file_list = HOST.run(("sh", "-c", "ls /etc/hostapd-*.conf"), default="")
2727
if not file_list:
2828
return None
2929

0 commit comments

Comments
 (0)