Subject: kern/21902: arplookup() incrementing arpstat.as_allocfail erroneously.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <seanb@qnx.com>
List: netbsd-bugs
Date: 06/16/2003 13:39:28
>Number:         21902
>Category:       kern
>Synopsis:       arplookup() incrementing arpstat.as_allocfail erroneously.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 16 13:40:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Sean Boudreau
>Release:        1-6
>Organization:
QNX
>Environment:
NetBSD  1.6 NetBSD 1.6 (GENERIC) #0: Sun Sep  8 19:43:40 UTC 2002     autobuild@tgm.daemon.org:/autobuild/i386/OBJ/autobuild/src/sys/arch/i386/compile/GENERIC i386
>Description:
Do a 'netstat -sfarp' on a network with a lot
of arp traffic and notice the large count of
'failures to allocate llinfo'.  arplookup()
shouldn't be incrementing arpstat.as_allocfail++
if creation wasn't specified.  Here's a suggested
diff:

-seanb


Index: netinet/if_arp.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/if_arp.c,v
retrieving revision 1.79
diff -c -r1.79 if_arp.c
*** netinet/if_arp.c    2001/11/13 00:32:35     1.79
--- netinet/if_arp.c    2003/06/09 17:10:38
***************
*** 1054,1074 ****
                return (0);
        rt->rt_refcnt--;

!       if (rt->rt_flags & RTF_GATEWAY)
!               why = "host is not on local network";
!       else if ((rt->rt_flags & RTF_LLINFO) == 0) {
!               arpstat.as_allocfail++;
!               why = "could not allocate llinfo";
!       } else if (rt->rt_gateway->sa_family != AF_LINK)
!               why = "gateway route is not ours";
!       else
                return ((struct llinfo_arp *)rt->rt_llinfo);

!       if (create)
                log(LOG_DEBUG, "arplookup: unable to enter address"
                    " for %s@%s on %s (%s)\n",
                    in_fmtaddr(*addr), lla_snprintf(ar_sha(ah), ah->ar_hln),
                    ifp->if_xname, why);
        return (0);
  }

--- 1054,1082 ----
                return (0);
        rt->rt_refcnt--;

!       if ((rt->rt_flags & (RTF_GATEWAY | RTF_LLINFO)) == RTF_LLINFO &&
!           rt->rt_gateway->sa_family == AF_LINK) {
                return ((struct llinfo_arp *)rt->rt_llinfo);
+       }

!       if (create) {
!               if (rt->rt_flags & RTF_GATEWAY) {
!                       why = "host is not on local network";
!               }
!               else if ((rt->rt_flags & RTF_LLINFO) == 0) {
!                       arpstat.as_allocfail++;
!                       why = "could not allocate llinfo";
!               }
!               else {
!                       why = "gateway route is not ours";
!               }
!
                log(LOG_DEBUG, "arplookup: unable to enter address"
                    " for %s@%s on %s (%s)\n",
                    in_fmtaddr(*addr), lla_snprintf(ar_sha(ah), ah->ar_hln),
                    ifp->if_xname, why);
+       }
+
        return (0);
  }

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted: