Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jul 2015 08:41:21 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 201916] mac address does not update when removing the primary iface from a lagg
Message-ID:  <bug-201916-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201916

            Bug ID: 201916
           Summary: mac address does not update when removing the primary
                    iface from a lagg
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: shahark@mellanox.com

When removing the primary iface froma lagg - the mac should update to the mac
address of the next iface in the lagg list.
Currently it happens but not to the one that is now the new primary.

To reproduce:

# ifconfig lagg0 create laggport ifp0 laggport ifp1
# ifconfig lagg0 -laggport ifp0
and look at the macs before and after


The problem is that the code mark the next ifp as primary(@lagg_port_lladdr)
and then skip updating it because it is primary(@lagg_port_setlladdr).

suggested fix:

diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
index dcd005a..f9e2312 100644
--- a/sys/net/if_lagg.c
+++ b/sys/net/if_lagg.c
@@ -691,22 +691,23 @@ lagg_port_setlladdr(void *arg, int pending)
         * Traverse the queue and set the lladdr on each ifp. It is safe to do
         * unlocked as we have the only reference to it.
         */
+
        for (llq = head; llq != NULL; llq = head) {
                ifp = llq->llq_ifp;
-
                CURVNET_SET(ifp->if_vnet);
-           if (llq->llq_primary == 0) {
-                   /*
-                    * Set the link layer address on the laggport interface.
-                    * if_setlladdr() triggers gratuitous ARPs for INET.
-                    */
-                   error = if_setlladdr(ifp, llq->llq_lladdr,
-                       ETHER_ADDR_LEN);
-                   if (error)
-                           printf("%s: setlladdr failed on %s\n", __func__,
-                               ifp->if_xname);
-           } else
+
+         /*
+          * Set the link layer address on the laggport interface.
+          * if_setlladdr() triggers gratuitous ARPs for INET.
+          */
+         error = if_setlladdr(ifp, llq->llq_lladdr,
+                         ETHER_ADDR_LEN);
+         if (error)
+                 printf("%s: setlladdr failed on %s\n", __func__,
+                                 ifp->if_xname);
+         if (llq->llq_primary) {
                        EVENTHANDLER_INVOKE(iflladdr_event, ifp);
+         }
                CURVNET_RESTORE();
                head = SLIST_NEXT(llq, llq_entries);
                free(llq, M_DEVBUF);

-- 
You are receiving this mail because:
You are the assignee for the bug.



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