hostapd: update to 2010-11-11
[openwrt/svn-archive/archive.git] / package / hostapd / patches / 320-nl80211_multicall_fixes.patch
1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -1380,7 +1380,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 @@ -1493,7 +1492,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 @@ -1667,6 +1665,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 @@ -1823,32 +1822,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 + if (drv->nlmode == NL80211_IFTYPE_STATION) {
37 + if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
38 + wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
39 + "use managed mode");
40 + }
41
42 - if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
43 - if (rfkill_is_blocked(drv->rfkill)) {
44 - wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
45 - "interface '%s' due to rfkill",
46 - bss->ifname);
47 - drv->if_disabled = 1;
48 - send_rfkill_event = 1;
49 - } else {
50 - wpa_printf(MSG_ERROR, "nl80211: Could not set "
51 - "interface '%s' UP", bss->ifname);
52 - return -1;
53 + if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
54 + if (rfkill_is_blocked(drv->rfkill)) {
55 + wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
56 + "interface '%s' due to rfkill",
57 + bss->ifname);
58 + drv->if_disabled = 1;
59 + send_rfkill_event = 1;
60 + } else {
61 + wpa_printf(MSG_ERROR, "nl80211: Could not set "
62 + "interface '%s' UP", bss->ifname);
63 + return -1;
64 + }
65 }
66 - }
67
68 - if (wpa_driver_nl80211_capa(drv))
69 - return -1;
70 + if (wpa_driver_nl80211_capa(drv))
71 + return -1;
72
73 - netlink_send_oper_ifla(drv->netlink, drv->ifindex,
74 - 1, IF_OPER_DORMANT);
75 -#endif /* HOSTAPD */
76 + netlink_send_oper_ifla(drv->netlink, drv->ifindex,
77 + 1, IF_OPER_DORMANT);
78 + }
79
80 if (nl80211_register_action_frames(drv) < 0) {
81 wpa_printf(MSG_DEBUG, "nl80211: Failed to register Action "
82 @@ -2511,13 +2510,9 @@ static int wpa_driver_nl80211_set_key(co
83 */
84 if (ret || !set_tx || alg == WPA_ALG_NONE)
85 return ret;
86 -#ifdef HOSTAPD
87 - if (addr)
88 - return ret;
89 -#else /* HOSTAPD */
90 +
91 if (drv->nlmode == NL80211_IFTYPE_AP && addr)
92 return ret;
93 -#endif /* HOSTAPD */
94
95 msg = nlmsg_alloc();
96 if (!msg)
97 @@ -3368,7 +3363,8 @@ static void nl80211_remove_iface(struct
98
99 #ifdef HOSTAPD
100 /* stop listening for EAPOL on this interface */
101 - del_ifidx(drv, ifidx);
102 + if (drv->nlmode == NL80211_IFTYPE_AP)
103 + del_ifidx(drv, ifidx);
104 #endif /* HOSTAPD */
105
106 msg = nlmsg_alloc();
107 @@ -3441,7 +3437,8 @@ static int nl80211_create_iface_once(str
108
109 #ifdef HOSTAPD
110 /* start listening for EAPOL on this interface */
111 - add_ifidx(drv, ifidx);
112 + if (drv->nlmode == NL80211_IFTYPE_AP)
113 + add_ifidx(drv, ifidx);
114 #endif /* HOSTAPD */
115
116 if (addr && iftype != NL80211_IFTYPE_MONITOR &&
117 @@ -5155,6 +5152,7 @@ static void *i802_init(struct hostapd_da
118 return NULL;
119
120 drv = bss->drv;
121 + drv->nlmode = NL80211_IFTYPE_AP;
122 if (linux_br_get(brname, params->ifname) == 0) {
123 wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s",
124 params->ifname, brname);