developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 1 | --- a/src/ap/ap_config.h |
| 2 | +++ b/src/ap/ap_config.h |
| 3 | @@ -284,6 +284,7 @@ struct hostapd_bss_config { |
| 4 | char iface[IFNAMSIZ + 1]; |
| 5 | char bridge[IFNAMSIZ + 1]; |
| 6 | char ft_iface[IFNAMSIZ + 1]; |
| 7 | + char snoop_iface[IFNAMSIZ + 1]; |
| 8 | char vlan_bridge[IFNAMSIZ + 1]; |
| 9 | char wds_bridge[IFNAMSIZ + 1]; |
developer | 505c943 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 10 | int bridge_hairpin; /* hairpin_mode on bridge members */ |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 11 | --- a/src/ap/x_snoop.c |
| 12 | +++ b/src/ap/x_snoop.c |
developer | 36fe709 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 13 | @@ -33,14 +33,16 @@ int x_snoop_init(struct hostapd_data *ha |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 14 | |
| 15 | hapd->x_snoop_initialized = true; |
| 16 | |
| 17 | - if (hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE, |
| 18 | + if (!conf->snoop_iface[0] && |
| 19 | + hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE, |
| 20 | 1)) { |
| 21 | wpa_printf(MSG_DEBUG, |
| 22 | "x_snoop: Failed to enable hairpin_mode on the bridge port"); |
| 23 | return -1; |
| 24 | } |
| 25 | |
| 26 | - if (hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_PROXYARP, 1)) { |
| 27 | + if (!conf->snoop_iface[0] && |
| 28 | + hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_PROXYARP, 1)) { |
| 29 | wpa_printf(MSG_DEBUG, |
| 30 | "x_snoop: Failed to enable proxyarp on the bridge port"); |
| 31 | return -1; |
developer | 36fe709 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 32 | @@ -54,7 +56,8 @@ int x_snoop_init(struct hostapd_data *ha |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | #ifdef CONFIG_IPV6 |
| 36 | - if (hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, 1)) { |
| 37 | + if (!conf->snoop_iface[0] && |
developer | 36fe709 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 38 | + hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, 1)) { |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 39 | wpa_printf(MSG_DEBUG, |
| 40 | "x_snoop: Failed to enable multicast snooping on the bridge"); |
| 41 | return -1; |
| 42 | @@ -73,8 +76,12 @@ x_snoop_get_l2_packet(struct hostapd_dat |
| 43 | { |
| 44 | struct hostapd_bss_config *conf = hapd->conf; |
| 45 | struct l2_packet_data *l2; |
| 46 | + const char *ifname = conf->bridge; |
developer | 95671ae | 2023-09-25 14:16:05 +0800 | [diff] [blame] | 47 | |
| 48 | - l2 = l2_packet_init(conf->bridge, NULL, ETH_P_ALL, handler, hapd, 1); |
developer | 36fe709 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 49 | + if (conf->snoop_iface[0]) |
| 50 | + ifname = conf->snoop_iface; |
| 51 | + |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 52 | + l2 = l2_packet_init(ifname, NULL, ETH_P_ALL, handler, hapd, 1); |
| 53 | if (l2 == NULL) { |
| 54 | wpa_printf(MSG_DEBUG, |
| 55 | "x_snoop: Failed to initialize L2 packet processing %s", |
| 56 | --- a/hostapd/config_file.c |
| 57 | +++ b/hostapd/config_file.c |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 58 | @@ -2322,6 +2322,8 @@ static int hostapd_config_fill(struct ho |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 59 | os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge)); |
developer | 505c943 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 60 | } else if (os_strcmp(buf, "bridge_hairpin") == 0) { |
| 61 | bss->bridge_hairpin = atoi(pos); |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 62 | + } else if (os_strcmp(buf, "snoop_iface") == 0) { |
| 63 | + os_strlcpy(bss->snoop_iface, pos, sizeof(bss->snoop_iface)); |
| 64 | } else if (os_strcmp(buf, "vlan_bridge") == 0) { |
| 65 | os_strlcpy(bss->vlan_bridge, pos, sizeof(bss->vlan_bridge)); |
| 66 | } else if (os_strcmp(buf, "wds_bridge") == 0) { |