From nobody Fri Apr 28 12:27:24 2023 X-Original-To: dev-commits-src-main@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 4Q7Bgw6BZnz48QKM; Fri, 28 Apr 2023 12:27:24 +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 4Q7Bgw5Zgqz3lW4; Fri, 28 Apr 2023 12:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682684844; 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=uvWptB/alw0w6gQbsnekd+EGnLHekgA+VCDA+QsLpd0=; b=Oqe4VdjT9z2BGfnNMS7XXtDQiWsqd8gah/pHEa3QfQfYZH68MEQspiEHdPrpVpIydtM8hJ n+balKzVzoSy9p+6VQXq5ZITq9fRSW6svxnWgOhkB0utc1gfxLqeLgo2dKMEHN+KfTFoHH dJ+wuikDcJGpgi4HHn3cs1ZUjXVz6bZdumegLlEMUqoR527E4lAg9XGt7l4yjS7q8/WhHZ NJs5TbzUHSx+Lgw3Wr31btKO+mmvHG7PSAsrAKP2D2WKykD78Zguinrn38ln0bEBATcOAa SZMt/oJ9oYLN7zqI1DiuZ40GlPUPmLTwwG89F/NLF3m281Hcz6Qv2JF0rP4F1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682684844; 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=uvWptB/alw0w6gQbsnekd+EGnLHekgA+VCDA+QsLpd0=; b=Kl96rdrNRJULvUwvg6weZXEHLRfsWLkIfkKVuprKLPw2vMGk1A3B0d4KEdQ3ngRgp96YwQ SxgkkYYv0kI4DipF8c11vf5w6PggeQ16i8KjhqiCbbvw5dQtN1wK+EtBqp6N9cSB+wHhrL L9JDdCfaWeVfeo6Xwos1UMpKiZkJDbXAQ4gRoYWltaLCYjEKgJamz52xbw9YLNNYu7xR+G WMr1JlBumy45N8P1HwkJ3WdljMYzm5vtq1F8IhIa3WQmBIE5myI8fAlQ2M6hZo1ohZNmGQ JE3lysWwLWuQPJn5fGvUoPGQijnSUsYefrTYfJlfjPWuqQw7H4fTbYRu2Yu+GQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682684844; a=rsa-sha256; cv=none; b=fBRAbRV5dburyNDERphkd7B8hI7Jjb/KIkf9VYk3x0VGM+vbN1119imSx2WQZXfm1x2wFP iNfrTHwBUi6UFQrrV3V2v9TE46RvOGbAQibRJ6TOZWB+vuNXdXZytYHWzdHyIAI0sAncHo zsCl/wAxcVlyXwPuq1US5LYmAtNxDD9Uom1cDw+nUZfOksyK6fz4cYD87IouQK8eQL74E8 GNcp/OrPu6vfkYDgMibECp1ECMXh+RN81r8UPfE8cAk8tVsNc3J1Q8txdveeAKSzX+dkIE 2MksQ3RB1BVM5QLMCllOVN2Bbaaob7OQSeelENiu3aVR0BUzMay7FeaAEFrqqQ== 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 4Q7Bgw4dFLz1099; Fri, 28 Apr 2023 12:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33SCROj4065377; Fri, 28 Apr 2023 12:27:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33SCRO72065376; Fri, 28 Apr 2023 12:27:24 GMT (envelope-from git) Date: Fri, 28 Apr 2023 12:27:24 GMT Message-Id: <202304281227.33SCRO72065376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 95bc3ba7fec5 - main - libifconfig: fix incorrect carp output List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95bc3ba7fec52dd410921544a597aebe8797d60a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=95bc3ba7fec52dd410921544a597aebe8797d60a commit 95bc3ba7fec52dd410921544a597aebe8797d60a Author: Kristof Provost AuthorDate: 2023-04-28 11:24:44 +0000 Commit: Kristof Provost CommitDate: 2023-04-28 12:27:11 +0000 libifconfig: fix incorrect carp output If one interface has a carp address configured on it ifconfig would show this information on all interfaces. That's because the kernel does (as one would expect) not return any carp data for interface without carp configuration. However, this wound up not overwriting the data passed in by the caller, and leaving the (now stale) information in pace. As a result the caller thought carp was configured on the interface. Zero out the input structure before making the call to the kernel, so that we correctly return 0 if there is no carp configuration on the queried interface. Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/libifconfig/libifconfig_carp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libifconfig/libifconfig_carp.c b/lib/libifconfig/libifconfig_carp.c index 501ca81782eb..2b612f0ba51b 100644 --- a/lib/libifconfig/libifconfig_carp.c +++ b/lib/libifconfig/libifconfig_carp.c @@ -77,6 +77,8 @@ _ifconfig_carp_get(ifconfig_handle_t *h, const char *name, ifconfig_error_clear(h); + bzero(carp, sizeof(*carp) * ncarp); + if (! snl_init(&ss, NETLINK_GENERIC)) { ifconfig_error(h, NETLINK, ENOTSUP); return (-1);