Date: Sun, 28 Jan 2024 17:57:18 GMT From: Michael Gmelin <grembo@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: e65182c7bc28 - stable/14 - libifconfig: Fix bridge status member list Message-ID: <202401281757.40SHvINt011883@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by grembo: URL: https://cgit.FreeBSD.org/src/commit/?id=e65182c7bc2835d847f363bf5d7ffc6e14426570 commit e65182c7bc2835d847f363bf5d7ffc6e14426570 Author: Michael Gmelin <grembo@FreeBSD.org> AuthorDate: 2023-12-20 20:21:55 +0000 Commit: Michael Gmelin <grembo@FreeBSD.org> CommitDate: 2024-01-28 17:55:56 +0000 libifconfig: Fix bridge status member list When this functionality was moved to libifconfig in 3dfbda3401abea84da9, the end of list calculation was modified for unknown reasons, practically limiting the number of bridge member returned to (about) 102. This patch changes the calculation back to what it was originally and adds a unit test to verify it works as expected. Reported by: Patrick M. Hausen (via ML) Reviewed by: kp Approved by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43135 (cherry picked from commit 3d36053ca6d6a17d408c8f92c504e6135dc9d8df) --- lib/libifconfig/libifconfig_bridge.c | 2 +- tests/sys/net/if_bridge_test.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/libifconfig/libifconfig_bridge.c b/lib/libifconfig/libifconfig_bridge.c index e4db90f373d6..2a9bbc35858b 100644 --- a/lib/libifconfig/libifconfig_bridge.c +++ b/lib/libifconfig/libifconfig_bridge.c @@ -111,7 +111,7 @@ ifconfig_bridge_get_bridge_status(ifconfig_handle_t *h, free(bridge); return (-1); } - if (members.ifbic_len <= len) + if ((members.ifbic_len + sizeof(*members.ifbic_req)) < len) break; } if (buf == NULL) { diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index cf0c81d6f682..44370a905223 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -663,6 +663,33 @@ vlan_cleanup() vnet_cleanup } +atf_test_case "many_bridge_members" "cleanup" +many_bridge_members_head() +{ + atf_set descr 'many_bridge_members ifconfig test' + atf_set require.user root +} + +many_bridge_members_body() +{ + vnet_init + + bridge=$(vnet_mkbridge) + ifcount=256 + for _ in $(seq 1 $ifcount); do + epair=$(vnet_mkepair) + ifconfig "${bridge}" addm "${epair}"a + done + + atf_check -s exit:0 -o inline:"$ifcount\n" \ + sh -c "ifconfig ${bridge} | grep member: | wc -l | xargs" +} + +many_bridge_members_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -677,4 +704,5 @@ atf_init_test_cases() atf_add_test_case "gif" atf_add_test_case "mtu" atf_add_test_case "vlan" + atf_add_test_case "many_bridge_members" }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401281757.40SHvINt011883>