AP: Add some bridge port attribute settings

"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>
This commit is contained in:
Anthony Refuerzo 2023-02-22 20:57:23 -08:00 committed by Jouni Malinen
parent f628e6b30e
commit eb146ee804
5 changed files with 25 additions and 0 deletions

View 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) {

View 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;

View 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,

View 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 {

View 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;