]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ignore ARP Unicast Poll, RFC 1122
authorRoy Marples <roy@marples.name>
Sat, 25 Feb 2017 00:51:55 +0000 (00:51 +0000)
committerRoy Marples <roy@marples.name>
Sat, 25 Feb 2017 00:51:55 +0000 (00:51 +0000)
arp.c

diff --git a/arp.c b/arp.c
index 14364bd1d63837da5385831fcd8efba8fad45277..ccec9db944f77004bf245e38f4b1e58bcf0e31b8 100644 (file)
--- a/arp.c
+++ b/arp.c
@@ -132,7 +132,7 @@ arp_packet(struct interface *ifp, uint8_t *data, size_t len)
        if (ar.ar_pln != sizeof(arm.sip.s_addr))
                return;
 
-       /* Get pointers to the hardware addreses */
+       /* Get pointers to the hardware addresses */
        hw_s = data + sizeof(ar);
        hw_t = hw_s + ar.ar_hln + ar.ar_pln;
        /* Ensure we got all the data */
@@ -157,6 +157,20 @@ arp_packet(struct interface *ifp, uint8_t *data, size_t len)
        memcpy(&arm.tha, hw_t, ar.ar_hln);
        memcpy(&arm.tip.s_addr, hw_t + ar.ar_hln, ar.ar_pln);
 
+       /* Ignore ARP Unicast Poll, RFC 1122 */
+       if (arm.sip.s_addr == INADDR_ANY &&
+           (arm.tha[0] != 0 || memcmp(arm.tha, arm.tha + 1, ar.ar_hln - 1)))
+       {
+#if 0
+               char buf[HWADDR_LEN * 3];
+
+               logger(ifp->ctx, LOG_DEBUG,
+                   "%s: ignoring ARP Unicast Poll from %s", ifp->name,
+                   hwaddr_ntoa(arm.tha, ar.ar_hln, buf, sizeof(buf)));
+#endif
+               return;
+       }
+
        /* Run the conflicts */
        state = ARP_CSTATE(ifp);
        TAILQ_FOREACH_SAFE(astate, &state->arp_states, next, astaten) {