From: Roy Marples Date: Tue, 20 Aug 2019 18:08:25 +0000 (+0100) Subject: BPF: Support ARPHRD_NETROM for BOOTP X-Git-Tag: v8.0.3~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=752a7262ee0c712ee8974cd74d6f118d7d7b921c;p=thirdparty%2Fdhcpcd.git BPF: Support ARPHRD_NETROM for BOOTP --- diff --git a/src/bpf.c b/src/bpf.c index c321bb70..d7b6814c 100644 --- a/src/bpf.c +++ b/src/bpf.c @@ -558,6 +558,11 @@ bpf_arp(struct interface *ifp, int fd) #define BPF_M_UDP 3 #define BPF_M_UDPLEN 4 +static const struct bpf_insn bpf_bootp_netrom[] = { + BPF_STMT(BPF_ST, BPF_M_FHLEN), +}; +#define BPF_BOOTP_NETROM_LEN __arraycount(bpf_bootp_netrom) + static const struct bpf_insn bpf_bootp_ether[] = { /* Make sure this is an IP packet. */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, @@ -665,6 +670,12 @@ bpf_bootp(struct interface *ifp, int fd) bp = bpf; /* Check frame header. */ switch(ifp->family) { +#ifdef ARPHRD_NETROM + case ARPHRD_NETROM: + memcpy(bp, bpf_bootp_netrom, sizeof(bpf_bootp_netrom)); + bp += BPF_BOOTP_NETROM_LEN; + break; +#endif case ARPHRD_ETHER: memcpy(bp, bpf_bootp_ether, sizeof(bpf_bootp_ether)); bp += BPF_BOOTP_ETHER_LEN;