Diff below split the lookup inserting a new ARP entry in the routing
table.  This has been initially written to be able to defer the
insertion to a task.  It now seems that we won't need such deferral
mechanism but in case somebody still see a value in it...

diff --git sys/netinet/if_ether.c sys/netinet/if_ether.c
index f7f4182..3cade1b 100644
--- sys/netinet/if_ether.c
+++ sys/netinet/if_ether.c
@@ -478,8 +478,8 @@ in_arpinput(struct ifnet *ifp, struct mbuf *m)
                goto out;
 #endif
 
-       /* Do we have an ARP cache for the sender? Create if we are target. */
-       rt = arplookup(&isaddr, target, 0, rdomain);
+       /* Do we have an ARP cache for the sender? */
+       rt = arplookup(&isaddr, 0, 0, rdomain);
 
        /* Check sender against our interface addresses. */
        if (rtisvalid(rt) && ISSET(rt->rt_flags, RTF_LOCAL) &&
@@ -491,6 +491,13 @@ in_arpinput(struct ifnet *ifp, struct mbuf *m)
        } else if (rt != NULL) {
                if (arpcache(ifp, ea, rt))
                        goto out;
+       } else if (target) {
+               /* Create an ARP cache if we are target. */
+               rt = arplookup(&isaddr, 1, 0, rdomain);
+               if (rt != NULL) {
+                       if (arpcache(ifp, ea, rt))
+                               goto out;
+               }
        }
 
        if (op != ARPOP_REQUEST)

Reply via email to