hostapd: fix wpa_supplicant crash issues in WDS STA mode
[openwrt.git] / package / hostapd / patches / 430-supplicant_bridge_fix.patch
1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -410,6 +410,10 @@ static void wpa_driver_nl80211_event_rtm
4                 return;
5         }
6  
7 +       if (ifi->ifi_family == AF_BRIDGE &&
8 +           drv->nlmode != NL80211_IFTYPE_AP)
9 +               return;
10 +
11         wpa_printf(MSG_DEBUG, "RTM_NEWLINK: operstate=%d ifi_flags=0x%x "
12                    "(%s%s%s%s)",
13                    drv->operstate, ifi->ifi_flags,
14 @@ -481,6 +485,10 @@ static void wpa_driver_nl80211_event_rtm
15         attrlen = len;
16         attr = (struct rtattr *) buf;
17  
18 +       if (ifi->ifi_family == AF_BRIDGE &&
19 +           drv->nlmode != NL80211_IFTYPE_AP)
20 +               return;
21 +
22         rta_len = RTA_ALIGN(sizeof(struct rtattr));
23         while (RTA_OK(attr, attrlen)) {
24                 if (attr->rta_type == IFLA_IFNAME) {
25 @@ -1347,6 +1355,9 @@ static int wpa_driver_nl80211_init_nl(st
26         eloop_register_read_sock(nl_socket_get_fd(drv->nl_handle_event),
27                                  wpa_driver_nl80211_event_receive, drv, ctx);
28  
29 +       drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int);
30 +       drv->if_indices = drv->default_if_indices;
31 +
32         return 0;
33  
34  err4:
35 @@ -4867,8 +4878,6 @@ static void *i802_init(struct hostapd_da
36                 br_ifindex = 0;
37         }
38  
39 -       drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int);
40 -       drv->if_indices = drv->default_if_indices;
41         for (i = 0; i < params->num_bridge; i++) {
42                 if (params->bridge[i]) {
43                         ifindex = if_nametoindex(params->bridge[i]);