@@ -2168,7 +2168,7 @@ wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
break;
wpa_s->interface_removed = 0;
wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was added");
- if (wpa_supplicant_driver_init(wpa_s) < 0) {
+ if (wpa_supplicant_driver_init(wpa_s, 1) < 0) {
wpa_msg(wpa_s, MSG_INFO, "Failed to initialize the "
"driver after interface was added");
}
@@ -2909,7 +2909,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
case EVENT_INTERFACE_ENABLED:
wpa_dbg(wpa_s, MSG_DEBUG, "Interface was enabled");
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
- wpa_supplicant_update_mac_addr(wpa_s);
+ wpa_supplicant_update_mac_addr(wpa_s, 1);
#ifdef CONFIG_AP
if (!wpa_s->ap_iface) {
wpa_supplicant_set_state(wpa_s,
@@ -2316,15 +2316,14 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
}
-int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s)
+int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s, int l2_needed)
{
if (wpa_s->driver->send_eapol) {
const u8 *addr = wpa_drv_get_mac_addr(wpa_s);
if (addr)
os_memcpy(wpa_s->own_addr, addr, ETH_ALEN);
- } else if (!(wpa_s->drv_flags &
- (WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE |
- WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE))) {
+ } else if (l2_needed && !(wpa_s->drv_flags &
+ WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE)) {
l2_packet_deinit(wpa_s->l2);
wpa_s->l2 = l2_packet_init(wpa_s->ifname,
wpa_drv_get_mac_addr(wpa_s),
@@ -2343,10 +2342,6 @@ int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s)
return -1;
}
- wpa_dbg(wpa_s, MSG_DEBUG, "Own MAC address: " MACSTR,
- MAC2STR(wpa_s->own_addr));
- wpa_sm_set_own_addr(wpa_s->wpa, wpa_s->own_addr);
-
return 0;
}
@@ -2379,19 +2374,24 @@ static void wpa_supplicant_rx_eapol_bridge(void *ctx, const u8 *src_addr,
/**
* wpa_supplicant_driver_init - Initialize driver interface parameters
* @wpa_s: Pointer to wpa_supplicant data
+ * @l2_needed: need call l2_packet_init() for this interface
* Returns: 0 on success, -1 on failure
*
* This function is called to initialize driver interface parameters.
* wpa_drv_init() must have been called before this function to initialize the
* driver interface.
*/
-int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
+int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s, int l2_needed)
{
static int interface_count = 0;
- if (wpa_supplicant_update_mac_addr(wpa_s) < 0)
+ if (wpa_supplicant_update_mac_addr(wpa_s, l2_needed) < 0)
return -1;
+ wpa_dbg(wpa_s, MSG_DEBUG, "Own MAC address: " MACSTR,
+ MAC2STR(wpa_s->own_addr));
+ wpa_sm_set_own_addr(wpa_s->wpa, wpa_s->own_addr);
+
if (wpa_s->bridge_ifname[0]) {
wpa_dbg(wpa_s, MSG_DEBUG, "Receiving packets from bridge "
"interface '%s'", wpa_s->bridge_ifname);
@@ -2955,7 +2955,7 @@ next_driver:
if (wpa_s->max_remain_on_chan == 0)
wpa_s->max_remain_on_chan = 1000;
- if (wpa_supplicant_driver_init(wpa_s) < 0)
+ if (wpa_supplicant_driver_init(wpa_s, !iface->p2p_mgmt) < 0)
return -1;
#ifdef CONFIG_TDLS
@@ -715,8 +715,8 @@ int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
const char * wpa_supplicant_state_txt(enum wpa_states state);
-int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
-int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
+int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s, int l2_needed);
+int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s, int l2_needed);
int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
struct wpa_bss *bss, struct wpa_ssid *ssid,
u8 *wpa_ie, size_t *wpa_ie_len);