From aefa3a69622c43b0249a8cb511dd8cc2920d0414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 5 Jan 2026 10:14:23 +0100 Subject: [PATCH] confd: wifi: Set bssid if custom-phys-address has been used This since hostapd change MAC address from its insane logic radio + 1, if bssid is not set. --- src/confd/src/hardware.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/confd/src/hardware.c b/src/confd/src/hardware.c index 24de8543..1af1f2e5 100644 --- a/src/confd/src/hardware.c +++ b/src/confd/src/hardware.c @@ -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"))