Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177548638
D61517.1794684792.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D61517.1794684792.diff
View Options
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -3024,6 +3024,9 @@
} \
} \
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
--- a/tests/sys/net/if_bridge_test.sh
+++ b/tests/sys/net/if_bridge_test.sh
@@ -1459,6 +1459,52 @@
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_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"
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 7:33 PM (13 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41730832
Default Alt Text
D61517.1794684792.diff (2 KB)
Attached To
Mode
D61517: if_bridge: Use bridge's FIB for incoming unicasts
Attached
Detach File
Event Timeline