Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Sep 2023 15:54:35 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 274028] ng_bridge fails to learn MAC addresses if link is in different VNET
Message-ID:  <bug-274028-227@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 274028
           Summary: ng_bridge fails to learn MAC addresses if link is in
                    different VNET
           Product: Base System
           Version: 13.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: dpslavov@hotmail.com

In data receive method when MAC address save is requested a false assumptio=
n is
made that "curthread" is in same VNET as node, which of course is not always
true. For example eiface is attached to a bridge and moved to different VNE=
T:

kldload ng_ether
ngctl -f - << EOF
mkpeer vtnet0: bridge lower uplink1
name vtnet0:lower switch0
mkpeer switch0: eiface link0 ether
EOF
jail -c path=3D/ vnet=3Dnew vnet.interface=3Dngeth0 persist host.hostname=
=3Dtest
name=3Dtest exec.start=3D"sh -c 'ifconfig ngeth0 inet 192.168.1.123/24; ifc=
onfig
ngeth0 up'"
jexec test ping -c 1 192.168.1.254
ngctl msg switch0: gettable
ngctl msg switch0: getstats 0

In this case failures are recorded as "memoryFailures".

Fix:
--- a/sys/netgraph/ng_bridge.c
+++ b/sys/netgraph/ng_bridge.c
@@ -911,8 +911,10 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
                strncpy(mh->hook, NG_HOOK_NAME(ctx.incoming->hook),
                    sizeof(mh->hook));
                memcpy(mh->addr, eh->ether_shost, sizeof(mh->addr));
+               CURVNET_SET(node->nd_vnet);
                NG_SEND_MSG_ID(error, node, msg, NG_NODE_ID(node),
                    NG_NODE_ID(node));
+               CURVNET_RESTORE();
                if (error)
                        counter_u64_add(ctx.incoming->stats.memoryFailures,=
 1);
        }

--=20
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-274028-227>