mac80211: update to wireless-testing 2014-03-31
[openwrt.git] / package / network / services / hostapd / patches / 400-terminate_on_setup_failure.patch
1 --- a/src/ap/hostapd.c
2 +++ b/src/ap/hostapd.c
3 @@ -1103,13 +1103,8 @@ int hostapd_setup_interface_complete(str
4         size_t j;
5         u8 *prev_addr;
6  
7 -       if (err) {
8 -               wpa_printf(MSG_ERROR, "Interface initialization failed");
9 -               hostapd_set_state(iface, HAPD_IFACE_DISABLED);
10 -               if (iface->interfaces && iface->interfaces->terminate_on_error)
11 -                       eloop_terminate();
12 -               return -1;
13 -       }
14 +       if (err)
15 +               goto error;
16  
17         wpa_printf(MSG_DEBUG, "Completing interface initialization");
18         if (iface->conf->channel) {
19 @@ -1140,7 +1135,7 @@ int hostapd_setup_interface_complete(str
20                                      hapd->iconf->vht_oper_centr_freq_seg1_idx)) {
21                         wpa_printf(MSG_ERROR, "Could not set channel for "
22                                    "kernel driver");
23 -                       return -1;
24 +                       goto error;
25                 }
26         }
27  
28 @@ -1151,7 +1146,7 @@ int hostapd_setup_interface_complete(str
29                         hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
30                                        HOSTAPD_LEVEL_WARNING,
31                                        "Failed to prepare rates table.");
32 -                       return -1;
33 +                       goto error;
34                 }
35         }
36  
37 @@ -1159,14 +1154,14 @@ int hostapd_setup_interface_complete(str
38             hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
39                 wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
40                            "kernel driver");
41 -               return -1;
42 +               goto error;
43         }
44  
45         if (hapd->iconf->fragm_threshold > -1 &&
46             hostapd_set_frag(hapd, hapd->iconf->fragm_threshold)) {
47                 wpa_printf(MSG_ERROR, "Could not set fragmentation threshold "
48                            "for kernel driver");
49 -               return -1;
50 +               goto error;
51         }
52  
53         prev_addr = hapd->own_addr;
54 @@ -1176,7 +1171,7 @@ int hostapd_setup_interface_complete(str
55                 if (j)
56                         os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN);
57                 if (hostapd_setup_bss(hapd, j == 0))
58 -                       return -1;
59 +                       goto error;
60                 if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0)
61                         prev_addr = hapd->own_addr;
62         }
63 @@ -1191,7 +1186,7 @@ int hostapd_setup_interface_complete(str
64         if (hostapd_driver_commit(hapd) < 0) {
65                 wpa_printf(MSG_ERROR, "%s: Failed to commit driver "
66                            "configuration", __func__);
67 -               return -1;
68 +               goto error;
69         }
70  
71         /*
72 @@ -1216,6 +1211,13 @@ int hostapd_setup_interface_complete(str
73                 iface->interfaces->terminate_on_error--;
74  
75         return 0;
76 +
77 +error:
78 +       wpa_printf(MSG_ERROR, "Interface initialization failed");
79 +       hostapd_set_state(iface, HAPD_IFACE_DISABLED);
80 +       if (iface->interfaces && iface->interfaces->terminate_on_error)
81 +               eloop_terminate();
82 +       return -1;
83  }
84  
85