Skip to content

Commit

Permalink
net/hostapd-devel: Update to the latest GH commit
Browse files Browse the repository at this point in the history
Update to the latest w1.fi commit, proxied through my GH account.
  • Loading branch information
cschuber committed Oct 30, 2023
1 parent fe1ae3d commit 42ad49f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 68 deletions.
5 changes: 2 additions & 3 deletions net/hostapd-devel/Makefile
@@ -1,6 +1,5 @@
PORTNAME= hostapd
PORTVERSION= ${COMMIT_DATE}
PORTREVISION= 3
CATEGORIES= net
PKGNAMESUFFIX= -devel

Expand All @@ -11,8 +10,8 @@ WWW= https://w1.fi/hostapd/
USE_GITHUB= yes
GH_ACCOUNT= cschuber
GH_PROJECT= hostap
GH_TAGNAME= 2d4be0019
COMMIT_DATE= 2023.10.05
GH_TAGNAME= 77785da66
COMMIT_DATE= 2023.10.30

LICENSE= BSD3CLAUSE

Expand Down
6 changes: 3 additions & 3 deletions net/hostapd-devel/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1696992505
SHA256 (cschuber-hostap-2023.10.05-2d4be0019_GH0.tar.gz) = 79621569d1cafe506293ae3a76ee964655f22094f85297eff9d0e73851bbfb52
SIZE (cschuber-hostap-2023.10.05-2d4be0019_GH0.tar.gz) = 5116272
TIMESTAMP = 1698698885
SHA256 (cschuber-hostap-2023.10.30-77785da66_GH0.tar.gz) = a7fd27b661bd3d52cd9a1c846e58ca162d08ba93be24fe5d13750baddade0d7a
SIZE (cschuber-hostap-2023.10.30-77785da66_GH0.tar.gz) = 5125026
64 changes: 2 additions & 62 deletions net/hostapd-devel/files/patch-src_l2__packet_l2__packet__freebsd.c
@@ -1,5 +1,5 @@
--- src/l2_packet/l2_packet_freebsd.c.orig 2023-09-05 10:38:47.000000000 -0700
+++ src/l2_packet/l2_packet_freebsd.c 2023-09-11 22:21:57.799201000 -0700
--- src/l2_packet/l2_packet_freebsd.c.orig 2023-10-30 10:53:18.000000000 -0700
+++ src/l2_packet/l2_packet_freebsd.c 2023-10-30 14:10:36.396969000 -0700
@@ -8,7 +8,10 @@
*/

Expand All @@ -12,63 +12,3 @@
#include <net/bpf.h>
#endif /* __APPLE__ */
#include <pcap.h>
@@ -20,6 +23,7 @@
#include <sys/sysctl.h>
#endif /* __sun__ */

+#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/route.h>
@@ -76,24 +80,33 @@
{
struct l2_packet_data *l2 = eloop_ctx;
pcap_t *pcap = sock_ctx;
- struct pcap_pkthdr hdr;
+ struct pcap_pkthdr *hdr;
const u_char *packet;
struct l2_ethhdr *ethhdr;
unsigned char *buf;
size_t len;

- packet = pcap_next(pcap, &hdr);
+ if (pcap_next_ex(pcap, &hdr, &packet) == -1) {
+ wpa_printf(MSG_ERROR, "Error reading packet, has device disappeared?");
+ packet = NULL;
+ eloop_terminate();
+ }

- if (!l2->rx_callback || !packet || hdr.caplen < sizeof(*ethhdr))
+ if (!l2->rx_callback || !packet || hdr->caplen < sizeof(*ethhdr))
return;

ethhdr = (struct l2_ethhdr *) packet;
if (l2->l2_hdr) {
buf = (unsigned char *) ethhdr;
- len = hdr.caplen;
+ len = hdr->caplen;
} else {
buf = (unsigned char *) (ethhdr + 1);
- len = hdr.caplen - sizeof(*ethhdr);
+ len = hdr->caplen - sizeof(*ethhdr);
+ /* handle 8021Q encapsulated frames */
+ if (ethhdr->h_proto == htons(ETH_P_8021Q)) {
+ buf += ETHER_VLAN_ENCAP_LEN;
+ len -= ETHER_VLAN_ENCAP_LEN;
+ }
}
l2->rx_callback(l2->rx_callback_ctx, ethhdr->h_source, buf, len);
}
@@ -122,10 +135,10 @@
os_snprintf(pcap_filter, sizeof(pcap_filter),
"not ether src " MACSTR " and "
"( ether dst " MACSTR " or ether dst " MACSTR " ) and "
- "ether proto 0x%x",
+ "( ether proto 0x%x or ( vlan 0 and ether proto 0x%x ) )",
MAC2STR(l2->own_addr), /* do not receive own packets */
MAC2STR(l2->own_addr), MAC2STR(pae_group_addr),
- protocol);
+ protocol, 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;

0 comments on commit 42ad49f

Please sign in to comment.