hostapd: add a separate config symbol for 802.11n driver support
[openwrt.git] / package / hostapd / patches / 320-nl80211_multicall_fixes.patch
1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -1468,7 +1468,6 @@ nla_put_failure:
4  }
5  
6  
7 -#ifndef HOSTAPD
8  struct wiphy_info_data {
9         int max_scan_ssids;
10         int ap_supported;
11 @@ -1592,7 +1591,6 @@ static int wpa_driver_nl80211_capa(struc
12  
13         return 0;
14  }
15 -#endif /* HOSTAPD */
16  
17  
18  static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv)
19 @@ -1804,6 +1802,7 @@ static void * wpa_driver_nl80211_init(vo
20         drv->monitor_ifidx = -1;
21         drv->monitor_sock = -1;
22         drv->ioctl_sock = -1;
23 +       drv->nlmode = NL80211_IFTYPE_STATION;
24  
25         if (wpa_driver_nl80211_init_nl(drv)) {
26                 os_free(drv);
27 @@ -1967,32 +1966,32 @@ wpa_driver_nl80211_finish_drv_init(struc
28         drv->ifindex = if_nametoindex(bss->ifname);
29         drv->first_bss.ifindex = drv->ifindex;
30  
31 -#ifndef HOSTAPD
32 -       if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
33 -               wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
34 -                          "use managed mode");
35 -       }
36 -
37 -       if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
38 -               if (rfkill_is_blocked(drv->rfkill)) {
39 -                       wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
40 -                                  "interface '%s' due to rfkill",
41 -                                  bss->ifname);
42 -                       drv->if_disabled = 1;
43 -                       send_rfkill_event = 1;
44 -               } else {
45 -                       wpa_printf(MSG_ERROR, "nl80211: Could not set "
46 -                                  "interface '%s' UP", bss->ifname);
47 -                       return -1;
48 +       if (drv->nlmode == NL80211_IFTYPE_STATION) {
49 +               if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
50 +                       wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
51 +                                  "use managed mode");
52 +               }
53 +
54 +               if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
55 +                       if (rfkill_is_blocked(drv->rfkill)) {
56 +                               wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
57 +                                          "interface '%s' due to rfkill",
58 +                                          bss->ifname);
59 +                               drv->if_disabled = 1;
60 +                               send_rfkill_event = 1;
61 +                       } else {
62 +                               wpa_printf(MSG_ERROR, "nl80211: Could not set "
63 +                                          "interface '%s' UP", bss->ifname);
64 +                               return -1;
65 +                       }
66                 }
67 -       }
68  
69 -       if (wpa_driver_nl80211_capa(drv))
70 -               return -1;
71 +               if (wpa_driver_nl80211_capa(drv))
72 +                       return -1;
73  
74 -       netlink_send_oper_ifla(drv->netlink, drv->ifindex,
75 -                              1, IF_OPER_DORMANT);
76 -#endif /* HOSTAPD */
77 +               netlink_send_oper_ifla(drv->netlink, drv->ifindex,
78 +                                      1, IF_OPER_DORMANT);
79 +       }
80  
81         if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, drv->addr))
82                 return -1;
83 @@ -3719,7 +3718,8 @@ static void nl80211_remove_iface(struct 
84  
85  #ifdef HOSTAPD
86         /* stop listening for EAPOL on this interface */
87 -       del_ifidx(drv, ifidx);
88 +       if (drv->nlmode == NL80211_IFTYPE_AP)
89 +               del_ifidx(drv, ifidx);
90  #endif /* HOSTAPD */
91  
92         msg = nlmsg_alloc();
93 @@ -3792,7 +3792,8 @@ static int nl80211_create_iface_once(str
94  
95  #ifdef HOSTAPD
96         /* start listening for EAPOL on this interface */
97 -       add_ifidx(drv, ifidx);
98 +       if (drv->nlmode == NL80211_IFTYPE_AP)
99 +               add_ifidx(drv, ifidx);
100  #endif /* HOSTAPD */
101  
102         if (addr && iftype != NL80211_IFTYPE_MONITOR &&