Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Dec 2015 12:09:42 +0000
From:      Steven Hartland <steven@multiplay.co.uk>
To:        Kristof Provost <kp@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r292275 - in head/sys: net netinet netinet6
Message-ID:  <56715486.1000901@freebsd.org>
In-Reply-To: <1016D8B2-F850-44B9-B773-632BD9ABC95D@FreeBSD.org>
References:  <201512151602.tBFG2BTX089543@repo.freebsd.org> <8CEE530E-C08D-4BD1-B908-8EBBCEEAD1CD@FreeBSD.org> <1016D8B2-F850-44B9-B773-632BD9ABC95D@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On 15/12/2015 22:58, Kristof Provost wrote:
>> On 15 Dec 2015, at 23:15, Kristof Provost <kp@FreeBSD.org> wrote:
>> Based on the arp_announce() in the backtrace this commit looks like a possible cause.
> I see this in arp_announce():
> KP: arp_announce() ifp->if_addr = 0
>
> So that explains why we panic in 'lladdr = IF_LLADDR(ifp);’.
>
> I’ve done a very quick hack:
> diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
> index 2214542..9b25356 100644
> --- a/sys/netinet/if_ether.c
> +++ b/sys/netinet/if_ether.c
> @@ -1246,9 +1246,15 @@ arp_announce(struct ifnet *ifp)
>          }
>          IF_ADDR_RUNLOCK(ifp);
>
> -       lladdr = IF_LLADDR(ifp);
> -       for (i = 0; i < cnt; i++) {
> -               arp_announce_addr(ifp, head + i, lladdr);
> +       printf("KP: %s() ifp = %p\n", __FUNCTION__, ifp);
> +       printf("KP: %s() ifp->if_addr = %p\n", __FUNCTION__, ifp->if_addr);
> +
> +       if (ifp->if_addr) {
> +               printf("KP: %s() ifp->if_addr->ifa_addr = %p\n", __FUNCTION__, ifp->if_addr->ifa_addr);
> +               lladdr = IF_LLADDR(ifp);
> +               for (i = 0; i < cnt; i++) {
> +                       arp_announce_addr(ifp, head + i, lladdr);
> +               }
>          }
>          free(head, M_TEMP);
>   }
>
> With this patch the device boots. I haven’t been able to verify if everything works because of a different issue ("Shared object "lib80211.so.1" not found, required by “ifconfig””, no doubt just a small problem with the freebsd-wifi-build scripts).
>
> Regards,
> Kristof
Thanks for all the info Kristof appreciated.

It seems really odd that you're getting a link up event for an interface 
that doesn't have a LLA, so I'm wondering if this is the result of an 
issue elsewhere which this change brings to light, its as though 
if_attach hasn't been called.

Looking at your trace the device seems to be an arswitch. If it never 
allocates a LLA to each port then maybe the more correct fix would be to 
ensure it IFF_NOARP in if_flags?

I've attached a patch which should fix if you could test that would be 
great, but I'd still like to understand if there is something wrong 
elsewhere before I do.

     Regards
     Steve



[-- Attachment #2 --]
Index: sys/netinet/if_ether.c
===================================================================
--- sys/netinet/if_ether.c	(revision 292275)
+++ sys/netinet/if_ether.c	(working copy)
@@ -1209,7 +1209,8 @@ arp_announce(struct ifnet *ifp)
 	struct ifaddr *ifa;
 	struct in_addr *addr, *head;
 
-	if (!(ifp->if_flags & IFF_UP) || (ifp->if_flags & IFF_NOARP))
+	if (!(ifp->if_flags & IFF_UP) || (ifp->if_flags & IFF_NOARP) ||
+	    ifp->if_addr == NULL)
 		return;
 
 	entries = 8;
@@ -1246,9 +1247,11 @@ arp_announce(struct ifnet *ifp)
 	}
 	IF_ADDR_RUNLOCK(ifp);
 
-	lladdr = IF_LLADDR(ifp);
-	for (i = 0; i < cnt; i++) {
-		arp_announce_addr(ifp, head + i, lladdr);
+	if (cnt > 0) {
+		lladdr = IF_LLADDR(ifp);
+		for (i = 0; i < cnt; i++) {
+			arp_announce_addr(ifp, head + i, lladdr);
+		}
 	}
 	free(head, M_TEMP);
 }
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56715486.1000901>