]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
arp: clarify that we check ar_hln in the BPF filter
authorRoy Marples <roy@marples.name>
Sun, 6 May 2018 15:26:11 +0000 (16:26 +0100)
committerRoy Marples <roy@marples.name>
Sun, 6 May 2018 15:26:11 +0000 (16:26 +0100)
While here, re-arrange it a little to match the structure.

src/arp.c

index 3949ca4aac54b7d641dd4a603541f51b8f6bec9c..f8bff87a29500c7138ad70ff9f5641064c58d00f 100644 (file)
--- a/src/arp.c
+++ b/src/arp.c
@@ -128,13 +128,16 @@ arp_packet(struct interface *ifp, uint8_t *data, size_t len)
        /* Protocol must be IP. */
        if (ar.ar_pro != htons(ETHERTYPE_IP))
                continue;
-       /* Only these types are recognised */
-       if (ar.ar_op != htons(ARPOP_REPLY) &&
-           ar.ar_op != htons(ARPOP_REQUEST))
+       /* lladdr length matches */
+       if (ar.ar_hln != ifp->hwlen)
                continue;
        /* Protocol length must match in_addr_t */
        if (ar.ar_pln != sizeof(arm.sip.s_addr))
                return;
+       /* Only these types are recognised */
+       if (ar.ar_op != htons(ARPOP_REPLY) &&
+           ar.ar_op != htons(ARPOP_REQUEST))
+               continue;
 #endif
 
        /* Get pointers to the hardware addresses */