From nobody Thu Dec 21 15:51:22 2023 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 4Swvzv1SdHz54wPH; Thu, 21 Dec 2023 15:51:23 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Swvzv120Bz3J04; Thu, 21 Dec 2023 15:51:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703173883; 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=cUE9f7XnU8qjOSJ4lX62LR/799h/qcqIty0ZN9uaVwo=; b=MF8GXQjj1CzvXyigpQvkzaaWg5CgMazvtTtB/NQ5CJOIrj+y070Ra3goMhrwAaELW20VI0 wPJDm1Gz2yKgWrrh7Lem5VrOMre/nd+0izwUtkVbJFnkKGZjXtZ+TWtHDsrZHgfrNX3OV3 7isnTyURmGpfq20xUrtAlVTXiIslKwItXap1uUmJcCOlS+xdFqK9jDjZtFneX0WY8VAWzN WaDnP7taYW05P/Sut9LDoxOiX1E5ZrB65f2tRCpsabOSkkeD95/amuJeK3PIBRGht2xHmO dnTHlc0CPSLiGPhr4sCJM3N2HF+88MG5MNWrnYM+lCURMPgSBo+qClolhEIr8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703173883; a=rsa-sha256; cv=none; b=LduaNBhr0PpBj6qd0m7Z8Q5tcX39S8LtKI9hcK5T0ivnjuLhqkj0W5GgEhNaK71QdJJszK /imSw73aBA6qVbp/YjmKuZ1PdZ156lZv2N+oYJ9oFLH6Kh7mmHRIMlVXr0CnOO8/lkN73k Z5/gv6yAqUDfOeKf6He5e2tfqomOGR03vI/B7+KqNL1j1uzvWylbcOWE45z6lGvC/4K3Gp Wan2SLDiZOvoO2D8SdQfdVv3yUCnhbNcVwjl8p6X8I+saAzJgh1oevz7ta1t3lJFfCrSo2 TMfKzvoHwdbVvqhA4stOmTsLwZm9zSuuTnEMQsIUI553a/ODaANiPUOQ/gXiJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703173883; 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=cUE9f7XnU8qjOSJ4lX62LR/799h/qcqIty0ZN9uaVwo=; b=ZEmFkywvcxDoj3z1IIyHKiURSDPtfR2gPgGB/uAWtcyHl2Nm8KzetVtU0ajh3mdf0uCn6x t9FPcFMqDpH5PLsshOcEIqL/2maDkJd6zNXXOBE8l0m0x4P6bMxmgmjxVqgI94irMqWX+o Nmqge/FxdASSY2x19OkyIpiOF8+aFI8ewxPTrBe7B+JEz4Ny14t5zX+TLQ7ez5cQilmq80 ToaPoddrYaxkBntLKlNKKQydyJqx/uTD1CK/1Nc9tPAUumpravM9dj41yvTc0HbrBIBKIu kJpP91Lsp097fU1s1oS2Q6TTycXynIYRtMuknVgDXppuHq+JbNUXS/Yuxr4gTw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Swvzt6wGbzf6M; Thu, 21 Dec 2023 15:51:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BLFpMvR093608; Thu, 21 Dec 2023 15:51:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BLFpM2e093605; Thu, 21 Dec 2023 15:51:22 GMT (envelope-from git) Date: Thu, 21 Dec 2023 15:51:22 GMT Message-Id: <202312211551.3BLFpM2e093605@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Gmelin Subject: git: 3d36053ca6d6 - main - libifconfig: Fix bridge status member list List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grembo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d36053ca6d6a17d408c8f92c504e6135dc9d8df Auto-Submitted: auto-generated The branch main has been updated by grembo: URL: https://cgit.FreeBSD.org/src/commit/?id=3d36053ca6d6a17d408c8f92c504e6135dc9d8df commit 3d36053ca6d6a17d408c8f92c504e6135dc9d8df Author: Michael Gmelin AuthorDate: 2023-12-20 20:21:55 +0000 Commit: Michael Gmelin CommitDate: 2023-12-21 15:50:27 +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 --- 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" }