]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
BPF: Support ARPHRD_NETROM for BOOTP
authorRoy Marples <roy@marples.name>
Tue, 20 Aug 2019 18:08:25 +0000 (19:08 +0100)
committerRoy Marples <roy@marples.name>
Tue, 20 Aug 2019 18:08:25 +0000 (19:08 +0100)
src/bpf.c

index c321bb70af4e1f6744c176bda0e59b83819023aa..d7b6814ca1f3e741f8f4717ec240129233cde069 100644 (file)
--- 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;