https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274028
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: [email protected]
Reporter: [email protected]
In data receive method when MAC address save is requested a false assumption 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 VNET:
kldload ng_ether
ngctl -f - << EOF
mkpeer vtnet0: bridge lower uplink1
name vtnet0:lower switch0
mkpeer switch0: eiface link0 ether
EOF
jail -c path=/ vnet=new vnet.interface=ngeth0 persist host.hostname=test
name=test exec.start="sh -c 'ifconfig ngeth0 inet 192.168.1.123/24; ifconfig
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);
}
--
You are receiving this mail because:
You are the assignee for the bug.