Date: Mon, 9 Apr 2007 16:31:05 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 117747 for review Message-ID: <200704091631.l39GV5hq099048@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=117747 Change 117747 by sam@sam_ebb on 2007/04/09 16:30:22 change bpf program to filter frames w/ our src address and to accept frames from the multicast address; this enables use of wpa_supplicant on wired networks Submitted by: "Jouke Witteveen" <j.witteveen@gmail.com> Affected files ... .. //depot/projects/wifi/usr.sbin/wpa/l2_packet.c#4 edit Differences ... ==== //depot/projects/wifi/usr.sbin/wpa/l2_packet.c#4 (text+ko) ==== @@ -38,6 +38,9 @@ #include "eloop.h" #include "l2_packet.h" +static const u8 pae_group_addr[ETH_ALEN] = + { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x03 }; + struct l2_packet_data { pcap_t *pcap; char ifname[100]; @@ -149,7 +152,7 @@ l2_packet_init_libpcap(struct l2_packet_data *l2, unsigned short protocol) { bpf_u_int32 pcap_maskp, pcap_netp; - char pcap_filter[100], pcap_err[PCAP_ERRBUF_SIZE]; + char pcap_filter[200], pcap_err[PCAP_ERRBUF_SIZE]; struct bpf_program pcap_fp; pcap_lookupnet(l2->ifname, &pcap_netp, &pcap_maskp, pcap_err); @@ -161,13 +164,17 @@ } if (pcap_datalink(l2->pcap) != DLT_EN10MB && pcap_set_datalink(l2->pcap, DLT_EN10MB) < 0) { - fprintf(stderr, "pcap_set_datalinke(DLT_EN10MB): %s\n", + fprintf(stderr, "pcap_set_datalink(DLT_EN10MB): %s\n", pcap_geterr(l2->pcap)); return -1; } snprintf(pcap_filter, sizeof(pcap_filter), - "ether dst " MACSTR " and ether proto 0x%x", - MAC2STR(l2->own_addr), protocol); + "not ether src " MACSTR " and " + "( ether dst " MACSTR " or ether dst " MACSTR " ) and " + "ether proto 0x%x", + MAC2STR(l2->own_addr), /* do not receive own packets */ + MAC2STR(l2->own_addr), MAC2STR(pae_group_addr), + protocol); if (pcap_compile(l2->pcap, &pcap_fp, pcap_filter, 1, pcap_netp) < 0) { fprintf(stderr, "pcap_compile: %s\n", pcap_geterr(l2->pcap)); return -1;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704091631.l39GV5hq099048>