diff mbox series

[1/3] Close l2_packet socket after getting own MAC address

Message ID 20200106152107.124745-2-markus.theil@tu-ilmenau.de
State Changes Requested
Headers show
Series [1/3] Close l2_packet socket after getting own MAC address | expand

Commit Message

Markus Theil Jan. 6, 2020, 3:21 p.m. UTC
wpa_supplicant now uses the l2_packet socket only to obtain the local
device MAC address. Future patches may split this out.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
 wpa_supplicant/wpa_supplicant.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jouni Malinen Jan. 6, 2020, 8:36 p.m. UTC | #1
On Mon, Jan 06, 2020 at 04:21:05PM +0100, Markus Theil wrote:
> wpa_supplicant now uses the l2_packet socket only to obtain the local
> device MAC address. Future patches may split this out.

This cannot be done before patch 2/3 and based on the test failure I
noticed with wpas_ctrl_ipaddr, it looks like this change cannot really
be done even with patch 2/3. It looks like it is safe to leave the
l2_packet socket open even if EAPOL RX happens through driver_nl80211,
but I guess it would save some resources if this would not be needed.
Anyway, the more critical issue is in getting patch 2/3 into a state
where it does not break any of the test cases.
Markus Theil Jan. 6, 2020, 10:26 p.m. UTC | #2
On 1/6/20 9:36 PM, Jouni Malinen wrote:
> On Mon, Jan 06, 2020 at 04:21:05PM +0100, Markus Theil wrote:
>> wpa_supplicant now uses the l2_packet socket only to obtain the local
>> device MAC address. Future patches may split this out.
> This cannot be done before patch 2/3 and based on the test failure I
> noticed with wpas_ctrl_ipaddr, it looks like this change cannot really
> be done even with patch 2/3. It looks like it is safe to leave the
> l2_packet socket open even if EAPOL RX happens through driver_nl80211,
> but I guess it would save some resources if this would not be needed.
> Anyway, the more critical issue is in getting patch 2/3 into a state
> where it does not break any of the test cases.
Ok, then I drop this patch for now and try to get 2/3 to work in all 
test cases. Leaving the l2 socket open should do no harm in my opinion. 
After 2/3 works, I may add some helper functions for getting IP 
addresses and MAC addresses without leaving the socket permanently open, 
but getting patch 2 in a working state has of course higher priority.

Markus
diff mbox series

Patch

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 0a9e37c3b..18e5dadcc 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -4685,6 +4685,12 @@  int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s)
 	wpa_sm_set_own_addr(wpa_s->wpa, wpa_s->own_addr);
 	wpas_wps_update_mac_addr(wpa_s);
 
+	/* use l2 socket only to get local MAC address */
+	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_CONTROL_PORT) {
+		l2_packet_deinit(wpa_s->l2);
+		wpa_s->l2 = NULL;
+	}
+
 #ifdef CONFIG_FST
 	if (wpa_s->fst)
 		fst_update_mac_addr(wpa_s->fst, wpa_s->own_addr);