summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-07-29 05:48:00 +0000
committersam <sam@FreeBSD.org>2005-07-29 05:48:00 +0000
commit5bf3752adf87424ac27a778614dfb6ffc269a7ca (patch)
tree53efa42b89c4a5cc6aea4c9252a5723cb6b3abe1
parent507be1e3f4854f7dd928fe27d0bcfc12226f92d8 (diff)
downloadFreeBSD-src-5bf3752adf87424ac27a778614dfb6ffc269a7ca.zip
FreeBSD-src-5bf3752adf87424ac27a778614dfb6ffc269a7ca.tar.gz
clear eloop registration when deinit'd the l2 packet support
MFC after: 3 days
-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