Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/external/bsd/wpa/dist/src/l2_packet Deal with DLT_IEEE...



details:   https://anonhg.NetBSD.org/src-all/rev/ec30c0275725
branches:  trunk
changeset: 988181:ec30c0275725
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Thu Jun 10 20:20:06 2021 +0200

description:
Deal with DLT_IEEE802_11 as alternative to DLT_EN10MB

diffstat:

 external/bsd/wpa/dist/src/l2_packet/l2_packet_freebsd.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 0a0ad93efa71 -r ec30c0275725 external/bsd/wpa/dist/src/l2_packet/l2_packet_freebsd.c
--- a/external/bsd/wpa/dist/src/l2_packet/l2_packet_freebsd.c   Sun Jun 06 14:47:52 2021 +0200
+++ b/external/bsd/wpa/dist/src/l2_packet/l2_packet_freebsd.c   Thu Jun 10 20:20:06 2021 +0200
@@ -105,6 +105,7 @@
        bpf_u_int32 pcap_maskp, pcap_netp;
        char pcap_filter[200], pcap_err[PCAP_ERRBUF_SIZE];
        struct bpf_program pcap_fp;
+       int dlt;
 
        pcap_lookupnet(l2->ifname, &pcap_netp, &pcap_maskp, pcap_err);
        l2->pcap = pcap_open_live(l2->ifname, 2500, 0, 10, pcap_err);
@@ -113,9 +114,12 @@
                fprintf(stderr, "ifname='%s'\n", l2->ifname);
                return -1;
        }
-       if (pcap_datalink(l2->pcap) != DLT_EN10MB &&
-           pcap_set_datalink(l2->pcap, DLT_EN10MB) < 0) {
-               fprintf(stderr, "pcap_set_datalink(DLT_EN10MB): %s\n",
+       dlt = pcap_datalink(l2->pcap);
+       if (dlt != DLT_EN10MB && dlt != DLT_IEEE802_11 &&
+           pcap_set_datalink(l2->pcap, DLT_EN10MB) < 0 &&
+           pcap_set_datalink(l2->pcap, DLT_IEEE802_11) < 0) {
+               fprintf(stderr, "pcap_set_datalink(DLT_EN10MB) "
+                       "[or DLT_IEEE802_11]: %s\n",
                        pcap_geterr(l2->pcap));
                return -1;
        }



Home | Main Index | Thread Index | Old Index