mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
Merge pull request #1343 from kernelkit/misc-wifi-fixes
This commit is contained in:
@@ -6,7 +6,7 @@ define BANANAPI_BPI_R3_LINUX_CONFIG_FIXUPS
|
||||
$(call KCONFIG_SET_OPT,CONFIG_I2C_GPIO,y)
|
||||
$(call KCONFIG_SET_OPT,CONFIG_MTK_THERMAL,m)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_MTK_UART)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_MTK_WATCHDOG)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_MEDIATEK_WATCHDOG)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_MEDIATEK_GE_PHY)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_REALTEK_PHY)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_NET_VENDOR_MEDIATEK)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Locally calculated
|
||||
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
|
||||
sha256 57af0fd9eb59bcabc1ced229dab85b69cde36301e4a66f91c127f2aff73ebb07 klish-plugin-sysrepo-a0f348a2716df805c85f3b5403180fcc7c1b9e8d-git4.tar.gz
|
||||
sha256 a852daabf76a7bdd22637af23718a8470b89bc3a0e1c2d0ea10d4b6ba3fc4280 klish-plugin-sysrepo-001a2e49e37ae969fb8f2f9cf63155ae4e172946-git4.tar.gz
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
KLISH_PLUGIN_SYSREPO_VERSION = a0f348a2716df805c85f3b5403180fcc7c1b9e8d
|
||||
KLISH_PLUGIN_SYSREPO_VERSION = 001a2e49e37ae969fb8f2f9cf63155ae4e172946
|
||||
KLISH_PLUGIN_SYSREPO_SITE = https://github.com/kernelkit/klish-plugin-sysrepo.git
|
||||
#KLISH_PLUGIN_SYSREPO_VERSION = cdd3eb51a7f7ee0ed5bd925fa636061d3b1b85fb
|
||||
#KLISH_PLUGIN_SYSREPO_SITE = https://src.libcode.org/pkun/klish-plugin-sysrepo.git
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
|
||||
index 2406658da..23edf0349 100644
|
||||
--- a/src/ap/hostapd.c
|
||||
+++ b/src/ap/hostapd.c
|
||||
@@ -949,18 +949,6 @@ skip_mask_ext:
|
||||
if (!auto_addr)
|
||||
return 0;
|
||||
|
||||
- for (i = 0; i < ETH_ALEN; i++) {
|
||||
- if ((hapd->own_addr[i] & mask[i]) != hapd->own_addr[i]) {
|
||||
- wpa_printf(MSG_ERROR, "Invalid BSSID mask " MACSTR
|
||||
- " for start address " MACSTR ".",
|
||||
- MAC2STR(mask), MAC2STR(hapd->own_addr));
|
||||
- wpa_printf(MSG_ERROR, "Start address must be the "
|
||||
- "first address in the block (i.e., addr "
|
||||
- "AND mask == addr).");
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -314,6 +314,7 @@ static int wifi_gen_bss_section(FILE *hostapd, struct lyd_node *cifs, const char
|
||||
{
|
||||
const char *ssid, *hidden, *security_mode, *secret_name, *secret;
|
||||
struct lyd_node *cif, *wifi, *ap, *security, *secret_node;
|
||||
char bssid[18];
|
||||
|
||||
/* Find the interface node for this BSS */
|
||||
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
|
||||
fprintf(hostapd, "\n# BSS %s\n", ifname);
|
||||
fprintf(hostapd, "bss=%s\n", ifname);
|
||||
|
||||
/* Set BSSID if custom MAC is configured */
|
||||
if (!interface_get_phys_addr(cif, bssid))
|
||||
fprintf(hostapd, "bssid=%s\n", bssid);
|
||||
|
||||
/* SSID configuration */
|
||||
ssid = lydx_get_cattr(ap, "ssid");
|
||||
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,
|
||||
|
||||
fprintf(hostapd, "interface=%s\n", primary_ifname);
|
||||
fprintf(hostapd, "driver=nl80211\n");
|
||||
fprintf(hostapd, "ctrl_interface=/run/hostapd\n\n");
|
||||
fprintf(hostapd, "ctrl_interface=/run/hostapd\n");
|
||||
|
||||
/* Set BSSID if custom MAC is configured */
|
||||
char bssid[18];
|
||||
if (!interface_get_phys_addr(primary_cif, bssid))
|
||||
fprintf(hostapd, "bssid=%s\n", bssid);
|
||||
fprintf(hostapd, "\n");
|
||||
|
||||
fprintf(hostapd, "ssid=%s\n", ssid);
|
||||
if (hidden && !strcmp(hidden, "true"))
|
||||
|
||||
@@ -78,7 +78,7 @@ static int ifchange_cand_infer_type(sr_session_ctx_t *session, const char *path)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!fnmatch("wifi+([0-9])", ifname, FNM_EXTMATCH))
|
||||
if (!fnmatch("wifi+([0-9])*", ifname, FNM_EXTMATCH))
|
||||
inferred.data.string_val = "infix-if-type:wifi";
|
||||
else if (iface_is_phys(ifname))
|
||||
inferred.data.string_val = "infix-if-type:ethernet";
|
||||
@@ -224,7 +224,7 @@ const char *get_chassis_addr(void)
|
||||
return json_string_value(addr);
|
||||
}
|
||||
|
||||
static int get_phys_addr(struct lyd_node *cif, char *mac)
|
||||
int interface_get_phys_addr(struct lyd_node *cif, char *mac)
|
||||
{
|
||||
struct lyd_node *cpa, *chassis;
|
||||
const char *base, *offs;
|
||||
@@ -255,7 +255,7 @@ int link_gen_address(struct lyd_node *cif, FILE *ip)
|
||||
char mac[18];
|
||||
int err;
|
||||
|
||||
err = get_phys_addr(cif, mac);
|
||||
err = interface_get_phys_addr(cif, mac);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -272,7 +272,7 @@ static int netdag_gen_link_addr(FILE *ip, struct lyd_node *cif, struct lyd_node
|
||||
if (!lydx_get_child(dif, "custom-phys-address"))
|
||||
return 0;
|
||||
|
||||
err = get_phys_addr(cif, mac);
|
||||
err = interface_get_phys_addr(cif, mac);
|
||||
if (err)
|
||||
return (err == -ENODATA) ? 0 : err;
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ int netdag_gen_ethtool(struct dagger *net, struct lyd_node *cif, struct lyd_node
|
||||
|
||||
/* interfaces.c */
|
||||
const char *get_chassis_addr(void);
|
||||
int interface_get_phys_addr(struct lyd_node *cif, char *mac);
|
||||
int link_gen_address(struct lyd_node *cif, FILE *ip);
|
||||
int interfaces_get_all_l3(const struct lyd_node *tree, char ***ifaces);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ def detect_wifi_mode(ifname):
|
||||
def find_primary_interface_from_config(ifname):
|
||||
"""Find primary interface by reading hostapd config files"""
|
||||
try:
|
||||
file_list = HOST.run(tuple("ls /etc/hostapd-*.conf".split()), default="")
|
||||
file_list = HOST.run(("sh", "-c", "ls /etc/hostapd-*.conf"), default="")
|
||||
if not file_list:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user