modernize backfire 10.03 so it can be operational again
[openwrt-10.03/.git] / package / hostapd / patches / 320-nl80211_multicall_fixes.patch
1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -2289,6 +2289,7 @@ static void * wpa_driver_nl80211_init(vo
4         drv->monitor_ifidx = -1;
5         drv->monitor_sock = -1;
6         drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED;
7 +       drv->nlmode = NL80211_IFTYPE_STATION;
8  
9         if (wpa_driver_nl80211_init_nl(drv)) {
10                 os_free(drv);
11 @@ -2446,37 +2447,37 @@ wpa_driver_nl80211_finish_drv_init(struc
12         drv->ifindex = if_nametoindex(bss->ifname);
13         drv->first_bss.ifindex = drv->ifindex;
14  
15 -#ifndef HOSTAPD
16 -       /*
17 -        * Make sure the interface starts up in station mode unless this is a
18 -        * dynamically added interface (e.g., P2P) that was already configured
19 -        * with proper iftype.
20 -        */
21 -       if ((drv->global == NULL ||
22 -            drv->ifindex != drv->global->if_add_ifindex) &&
23 -           wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION) < 0) {
24 -               wpa_printf(MSG_ERROR, "nl80211: Could not configure driver to "
25 -                          "use managed mode");
26 -               return -1;
27 -       }
28 -
29 -       if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) {
30 -               if (rfkill_is_blocked(drv->rfkill)) {
31 -                       wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
32 -                                  "interface '%s' due to rfkill",
33 -                                  bss->ifname);
34 -                       drv->if_disabled = 1;
35 -                       send_rfkill_event = 1;
36 -               } else {
37 -                       wpa_printf(MSG_ERROR, "nl80211: Could not set "
38 -                                  "interface '%s' UP", bss->ifname);
39 +       if (drv->nlmode == NL80211_IFTYPE_STATION) {
40 +               /*
41 +                * Make sure the interface starts up in station mode unless this is a
42 +                * dynamically added interface (e.g., P2P) that was already configured
43 +                * with proper iftype.
44 +                */
45 +               if ((drv->global == NULL ||
46 +                        drv->ifindex != drv->global->if_add_ifindex) &&
47 +                       wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION) < 0) {
48 +                       wpa_printf(MSG_ERROR, "nl80211: Could not configure driver to "
49 +                                  "use managed mode");
50                         return -1;
51                 }
52 -       }
53  
54 -       netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
55 -                              1, IF_OPER_DORMANT);
56 -#endif /* HOSTAPD */
57 +               if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) {
58 +                       if (rfkill_is_blocked(drv->rfkill)) {
59 +                               wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
60 +                                          "interface '%s' due to rfkill",
61 +                                          bss->ifname);
62 +                               drv->if_disabled = 1;
63 +                               send_rfkill_event = 1;
64 +                       } else {
65 +                               wpa_printf(MSG_ERROR, "nl80211: Could not set "
66 +                                          "interface '%s' UP", bss->ifname);
67 +                               return -1;
68 +                       }
69 +               }
70 +
71 +               netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
72 +                                          1, IF_OPER_DORMANT);
73 +       }
74  
75         if (wpa_driver_nl80211_capa(drv))
76                 return -1;