Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Nov 2019 12:14:55 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r354706 - stable/11/sys/net
Message-ID:  <201911141214.xAECEtqX000156@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Thu Nov 14 12:14:55 2019
New Revision: 354706
URL: https://svnweb.freebsd.org/changeset/base/354706

Log:
  MFC r354443:
    Enqueue lladdr_task to update link level address of vlan, when its parent
    interface has changed.
  
    During vlan reconfiguration without destroying interface, it is possible,
    that parent interface will be changed. This usually means, that link
    layer address of vlan will be different. Therefore we need to update all
    associated with vlan's addresses permanent llentries - NDP for IPv6
    addresses, and ARP for IPv4 addresses. This is done via lladdr_task
    execution. To avoid extra work, before execution do the check, that L2
    address is different.

Modified:
  stable/11/sys/net/if_vlan.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_vlan.c
==============================================================================
--- stable/11/sys/net/if_vlan.c	Thu Nov 14 12:07:49 2019	(r354705)
+++ stable/11/sys/net/if_vlan.c	Thu Nov 14 12:14:55 2019	(r354706)
@@ -1424,17 +1424,25 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1
 	 * Set up our interface address to reflect the underlying
 	 * physical interface's.
 	 */
-	bcopy(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen);
+	TASK_INIT(&ifv->lladdr_task, 0, vlan_lladdr_fn, ifv);
 	((struct sockaddr_dl *)ifp->if_addr->ifa_addr)->sdl_alen =
 	    p->if_addrlen;
 
 	/*
+	 * Do not schedule link address update if it was the same
+	 * as previous parent's. This helps avoid updating for each
+	 * associated llentry.
+	 */
+	if (memcmp(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen) != 0) {
+		bcopy(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen);
+		taskqueue_enqueue(taskqueue_thread, &ifv->lladdr_task);
+	}
+
+	/*
 	 * Configure multicast addresses that may already be
 	 * joined on the vlan device.
 	 */
 	(void)vlan_setmulti(ifp);
-
-	TASK_INIT(&ifv->lladdr_task, 0, vlan_lladdr_fn, ifv);
 
 	/* We are ready for operation now. */
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;



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