summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/wpa/l2_packet.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.sbin/wpa/l2_packet.c b/usr.sbin/wpa/l2_packet.c
index dae3eb7..5304a9d 100644
--- a/usr.sbin/wpa/l2_packet.c
+++ b/usr.sbin/wpa/l2_packet.c
@@ -148,6 +148,16 @@ l2_packet_init_libpcap(struct l2_packet_data *l2, unsigned short protocol)
return 0;
}
+static void
+l2_packet_deinit_libpcap(struct l2_packet_data *l2)
+{
+ if (l2->pcap != NULL) {
+ eloop_unregister_read_sock(pcap_get_selectable_fd(l2->pcap));
+ pcap_close(l2->pcap);
+ l2->pcap = NULL;
+ }
+}
+
static int
eth_get(const char *device, u8 ea[ETH_ALEN])
{
@@ -220,8 +230,7 @@ void
l2_packet_deinit(struct l2_packet_data *l2)
{
if (l2 != NULL) {
- if (l2->pcap)
- pcap_close(l2->pcap);
+ l2_packet_deinit_libpcap(l2);
free(l2);
}
}
OpenPOWER on IntegriCloud