mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 09:12:44 +00:00
libifconfig: Fix bridge status member list
When this functionality was moved to libifconfig in3dfbda3401
, 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 commit3d36053ca6
)
This commit is contained in:
parent
5e78db7b45
commit
c2299997ce
@ -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) {
|
||||
|
@ -516,6 +516,33 @@ gif_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"
|
||||
@ -528,4 +555,5 @@ atf_init_test_cases()
|
||||
atf_add_test_case "mac_conflict"
|
||||
atf_add_test_case "stp_validation"
|
||||
atf_add_test_case "gif"
|
||||
atf_add_test_case "many_bridge_members"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user