From nobody Sun Nov 15 18:45:08 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jSKg90383z70sfF for ; Sun, 15 Nov 2026 18:45:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jSKg83W7mz4nWv for ; Sun, 15 Nov 2026 18:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794768308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T4ewcGLPxGkbZ6wRR+ns3PzI2xNr8kWrGqpHsTDo7eo=; b=yN0oqW22hX1f0XbJPxesXHt3ALpQ8Y+FBJI7k1ST+UpF+m4+fUtPtZG7tOWDuWvJ5tAW/A S9KJiy5E7tOmjWDs02Cpr8ma/ix1+a0ttbV35wA647cj1bMiTGj+MAy24xnC+U1NqcF861 YsSYkckDxc1wh1kvj8OOG8//K6+fc7YV5XhD8hHjkETq0jisGJrnKCiTM7rRwqGcSGzcIh UwKJRBm+/EYop9wiS/XIyVfXuNvwjHHLtZBUZQXKWym/7xomibhJY6iVy/J+oHJqQSMhIL 8/bWGQcWSHTwdMzOam1uUhNTxwu7kBSzkM9XKcRzuhGoHfayu0SJjCYVlQOJXQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794768308; b=NdLnBAOeIX4I3poGZrLHYs0HAYI7IVtMCA+09tUvi3iBIqZTrh4UVMliBH8ZcXrKqIBGhW 3ECde5BI0mKPXBziC+goqxbxynQhck205iMa216hOGO3mQueW5rx7qIn00Y9ty/uYNjr5J eeRPozKepZD+RLE8PiTI4AalTo4qgL+CJXnnww50LRyhWgvphj3JGnkAVp79uKzcEEgUUC W6IK+VOT5SFDX4iDhgzNEtZWqEjvAcYkLQ2VJ2j3MBfwGPlHOqNmvXYTmavhWrascMC1CZ I2GZW2GYjWmi20CWW4fE4x4jIWC9NiOxJzhD/TZ9kwoFifFt5RsfQo7PKWMRTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794768308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T4ewcGLPxGkbZ6wRR+ns3PzI2xNr8kWrGqpHsTDo7eo=; b=XKQrr3RHUOk2y4hoYTsC7b9Wy455fH1vJkGcjbhRJCavEufw9vdWLKabNBW242AQZTdMr+ TN+1y56LHcqndgfbGDGwUbIOAfyUJnimuT5mLLUtTIDxrBS5zC3pItCX3zp1xsh5YAoz6k xT13pnYYwAfZrQkPgoZxH5dz3erHXidyhh8PM/DEZ53qoAKPpZUvk4CezZIgPblE10voAK eFAwbh8djz5MlbXAqd89b1LxJ0D6ocpMy4VpcXXrDie449DTmJUCNASj4vtxSZmLaYQxTp ytgIiAYycLKze0t2X8VzUx3D8V684ygeTVaSbU+XZh1kPPhBaoWQvU63Qj5WNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jSKg839kczJy3 for ; Sun, 15 Nov 2026 18:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 139a2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 15 Nov 2026 18:45:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: e24434f286fd - main - if_bridge: Use bridge's FIB for incoming unicasts List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e24434f286fdd2d6ba1924ecd7eadea6f563f08a Auto-Submitted: auto-generated Date: Sun, 15 Nov 2026 18:45:08 +0000 Message-Id: <6af9fdb4.139a2.6c411fe9@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=e24434f286fdd2d6ba1924ecd7eadea6f563f08a commit e24434f286fdd2d6ba1924ecd7eadea6f563f08a Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-11-15 18:43:52 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-11-15 18:43:52 +0000 if_bridge: Use bridge's FIB for incoming unicasts A unicast frame for the bridge is handed to the stack with rcvif set to the bridge, but it kept the FIB of the member it arrived on. With the bridge in another FIB, replies were looked up in the wrong routing table and dropped. Set the FIB of the bridge on such frames. If member_ifaddrs is enabled and the bridge inherited its MAC address from a member, keep the old behaviour, since the frame may be for an address configured on that member. Reviewed by: zlei Differential Revision: https://reviews.freebsd.org/D61517 --- sys/net/if_bridge.c | 3 +++ tests/sys/net/if_bridge_test.sh | 47 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 04d773a58b45..71830b0589a9 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -3024,6 +3024,9 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) } \ } \ m->m_pkthdr.rcvif = iface; \ + if (!V_member_ifaddrs || \ + ((iface) == bifp && sc->sc_ifaddr == NULL)) \ + M_SETFIB(m, (iface)->if_fib); \ if ((iface) == ifp) { \ /* Skip bridge processing... src == dest */ \ return (m); \ diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 4b9293514176..a5fdd3471d7e 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -1459,6 +1459,52 @@ vlan_defuntagged_cleanup() vnet_cleanup } +atf_test_case "bridge_fib" "cleanup" +bridge_fib_head() +{ + atf_set descr 'unicast to a bridge uses the FIB of the bridge' + atf_set require.user root +} + +bridge_fib_body() +{ + vnet_init + vnet_init_bridge + + epair=$(vnet_mkepair) + + vnet_mkjail jbridge ${epair}a + vnet_mkjail jmember ${epair}b + + sysctl -j jbridge net.link.bridge.member_ifaddrs=0 + sysctl -j jbridge net.fibs=2 + + # The member stays in FIB 0, the bridge is in FIB 1, so the only + # route to 192.0.2.0/24 is in FIB 1. + bridge=$(ifconfig -j jbridge bridge create) + ifconfig -j jbridge ${bridge} fib 1 + ifconfig -j jbridge ${bridge} addm ${epair}a + ifconfig -j jbridge ${epair}a up + ifconfig -j jbridge ${bridge} 192.0.2.1/24 up + + ifconfig -j jmember ${epair}b 192.0.2.2/24 up + + # Sanity check: the route only exists in the FIB of the bridge. + atf_check -s exit:0 -o ignore \ + route -j jbridge -n get -fib 1 192.0.2.2 + atf_check -s not-exit:0 -o ignore -e ignore \ + route -j jbridge -n get -fib 0 192.0.2.2 + + # The echo reply is routed using the FIB of the received request, so + # this fails if the request is left in the FIB of the member. + atf_check -s exit:0 -o ignore jexec jmember ping -c 3 -t 1 192.0.2.1 +} + +bridge_fib_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -1489,4 +1535,5 @@ atf_init_test_cases() atf_add_test_case "vlan_untagged" atf_add_test_case "vlan_defuntagged" atf_add_test_case "bridge_svi_in_bridge" + atf_add_test_case "bridge_fib" }