]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Add some bridge port attribute settings
authorAnthony Refuerzo <anthony96922@gmail.com>
Thu, 23 Feb 2023 04:57:23 +0000 (20:57 -0800)
committerJouni Malinen <j@w1.fi>
Wed, 1 Mar 2023 08:50:07 +0000 (10:50 +0200)
"multicast_to_unicast" and "hairpin_mode" are usually set outside of
hostapd. However, DFS channel change events pull the BSS out of the
bridge causing these attributes to be lost. Make these settings tunable
within hostapd so they are retained after the BSS is brought up again.

Signed-off-by: Anthony Refuerzo <anthony96922@gmail.com>
hostapd/config_file.c
src/ap/ap_config.h
src/ap/hostapd.c
src/drivers/driver.h
src/drivers/driver_nl80211.c

index 472a91df2477ea4f255d682b69da24477bbf87dd..2e208d3f677c2de89d732bf4c06b31de301aceca 100644 (file)
@@ -2316,6 +2316,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                           sizeof(conf->bss[0]->iface));
        } else if (os_strcmp(buf, "bridge") == 0) {
                os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
+       } else if (os_strcmp(buf, "bridge_hairpin") == 0) {
+               bss->bridge_hairpin = atoi(pos);
        } else if (os_strcmp(buf, "vlan_bridge") == 0) {
                os_strlcpy(bss->vlan_bridge, pos, sizeof(bss->vlan_bridge));
        } else if (os_strcmp(buf, "wds_bridge") == 0) {
@@ -4467,6 +4469,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 #endif /* CONFIG_FILS */
        } else if (os_strcmp(buf, "multicast_to_unicast") == 0) {
                bss->multicast_to_unicast = atoi(pos);
+       } else if (os_strcmp(buf, "bridge_multicast_to_unicast") == 0) {
+               bss->bridge_multicast_to_unicast = atoi(pos);
        } else if (os_strcmp(buf, "broadcast_deauth") == 0) {
                bss->broadcast_deauth = atoi(pos);
        } else if (os_strcmp(buf, "notify_mgmt_frames") == 0) {
index dfe259c307e7c9809fd4eabb5c5a644ad5d735f8..7036c15d5daf05200c57425e1bda384405e12458 100644 (file)
@@ -284,6 +284,7 @@ struct hostapd_bss_config {
        char bridge[IFNAMSIZ + 1];
        char vlan_bridge[IFNAMSIZ + 1];
        char wds_bridge[IFNAMSIZ + 1];
+       int bridge_hairpin; /* hairpin_mode on bridge members */
 
        enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
 
@@ -748,6 +749,7 @@ struct hostapd_bss_config {
 #endif /* CONFIG_FILS */
 
        int multicast_to_unicast;
+       int bridge_multicast_to_unicast;
 
        int broadcast_deauth;
 
index 58492e51edae51e5398446f2db7575992685f030..c3fd91e434e9d218fa34dd674420eb5cea1801bc 100644 (file)
@@ -1435,6 +1435,22 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
                return -1;
        }
 
+       if (conf->bridge[0]) {
+               /* Set explicitly configured bridge parameters that might have
+                * been lost if the interface has been removed out of the
+                * bridge. */
+
+               /* multicast to unicast on bridge ports */
+               if (conf->bridge_multicast_to_unicast)
+                       hostapd_drv_br_port_set_attr(
+                               hapd, DRV_BR_PORT_ATTR_MCAST2UCAST, 1);
+
+               /* hairpin mode */
+               if (conf->bridge_hairpin)
+                       hostapd_drv_br_port_set_attr(
+                               hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE, 1);
+       }
+
        if (conf->proxy_arp) {
                if (x_snoop_init(hapd)) {
                        wpa_printf(MSG_ERROR,
index 46182552df196a82d914c7f6de3b5a788a4bccb6..b205744d030af5ad97b59fae40795c3a8a66f108 100644 (file)
@@ -2647,6 +2647,7 @@ struct macsec_init_params {
 enum drv_br_port_attr {
        DRV_BR_PORT_ATTR_PROXYARP,
        DRV_BR_PORT_ATTR_HAIRPIN_MODE,
+       DRV_BR_PORT_ATTR_MCAST2UCAST,
 };
 
 enum drv_br_net_param {
index 4db29f1d52df1c8d9c24bbf1b5023a70de3bd064..75825bd94adde3358994ea1270532069c6c8dd9e 100644 (file)
@@ -11615,6 +11615,8 @@ static const char * drv_br_port_attr_str(enum drv_br_port_attr attr)
                return "proxyarp_wifi";
        case DRV_BR_PORT_ATTR_HAIRPIN_MODE:
                return "hairpin_mode";
+       case DRV_BR_PORT_ATTR_MCAST2UCAST:
+               return "multicast_to_unicast";
        }
 
        return NULL;