Module Name: src Committed By: ozaki-r Date: Mon Sep 9 07:25:32 UTC 2024
Modified Files: src/sys/netinet: if_arp.c Log Message: arp: allow to send packets without an ARP resolution just after receiving an ARP request On receiving an ARP request, the current implemention creates an ARP cache entry but with ND_LLINFO_NOSTATE. Such an entry still needs an ARP resolution to send back a packet to the requester. The original behavior before introducing the common ND framework didn't need the resolution. IPv6 doesn't as well. To restore the original behavior, make a new ARP cache entry with ND_LLINFO_STALE like IPv6 does. To generate a diff of this commit: cvs rdiff -u -r1.314 -r1.315 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.314 src/sys/netinet/if_arp.c:1.315 --- src/sys/netinet/if_arp.c:1.314 Tue Aug 20 08:21:04 2024 +++ src/sys/netinet/if_arp.c Mon Sep 9 07:25:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.314 2024/08/20 08:21:04 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.315 2024/09/09 07:25:32 ozaki-r Exp $ */ /* * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.314 2024/08/20 08:21:04 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.315 2024/09/09 07:25:32 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1034,6 +1034,17 @@ again: /* This was a solicited ARP reply. */ la->ln_byhint = 0; new_state = ND_LLINFO_REACHABLE; + } else if (op == ARPOP_REQUEST && + (la->ln_state == ND_LLINFO_NOSTATE || + la->ln_state == ND_LLINFO_INCOMPLETE)) { + /* + * If an ARP request comes but there is no entry + * and a new one has been created or an entry exists + * but incomplete, make it stale to allow to send + * packets to the requester without an ARP resolution. + */ + la->ln_byhint = 0; + new_state = ND_LLINFO_STALE; } rt_cmd = la->la_flags & LLE_VALID ? 0 : RTM_ADD; }