From nobody Tue Nov 19 00:28:18 2024 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 4Xslhf4nhlz5dlJd; Tue, 19 Nov 2024 00:28:18 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xslhf34k7z4gHd; Tue, 19 Nov 2024 00:28:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731976098; 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=kTiVbUFhQbOcwURlelTbPL/1M8AG0UYfdpcgec5rUyg=; b=dnBYsCPivhixTHuM8oxYML7PkGSNH2giQoC0/RgE4//jBVHdaBnktW3DUZeFCM3aVJoeoK 7nC991GPXyxCvWM0ft/0oT1ks0x25pMTHGlim4vBykmDU3jZkDb+uJhyEKEogWX3eNDW6L 73LkdSNnQePrGIIFJ3WbGlmskZ/chBSdUAre1zDlvfR5SA12eOqnxD9+I8LSHQY8JG7R5X 2m0tlrbJRkxY3yM4HT6w8W7K//V0AvPWBcl/U7SeHXyTOaxaOebj70LCs2sIw2jd6iihd/ 5T7+Ed4QtzcFxPQr8kt4ejh/j4CuqH3dyy/XsXhxd+KoA6VNoA2k1+fOsukNww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731976098; 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=kTiVbUFhQbOcwURlelTbPL/1M8AG0UYfdpcgec5rUyg=; b=oZ+MLH3V73cgKjYdaM68Zio1G4AzvN2gRyNB+5vLEDboxJMc9/HYVqTsMet4aOfx2uJPoN w5q7LoPFQ/u1BlxDh8HJxcf69aVWnkJZHPwi+AeHCw5xLQaw6STmNn1ymgsVOxhm6k/i5f J5TBcYs22Fgd6UMBzRv7dKo6ddz7MS7CRvKNyqyHV6k3P3Thj3PV3RL6MYqKndL7vNuAPa lPK2JG5GLDWn0pM5VIr00VDkqsyMQRMaL/24qewYQ4pyPnn7wRZOfhAQfKrg1Rny/JXvm6 plWDG66cEl3wdxKNzcL42BmEx12VQz3/csT3hcMR3jgNErxcEtxxnBjDYWrVtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731976098; a=rsa-sha256; cv=none; b=g9ia8A2cuDvNvX+Yxx16CYIFfaFHM8B5rnCcf/fQIsF0hmyxGhGJ+5WFdQz3+NOadbe6Y/ myj9fWTCaCs/9gDv84y08vMIgBO9nF+morzcuvwlCR+gYQbYGxe8P626jWBkKIQE55b5dd E8rVX5oWclnPJJUtpyIAB1FLtYypeLo8fWnvrdriPgM+2kAQA5qIYlpfZUnRH5l35B5fT7 RqkaNV88Llr0kLSmRgtD1d6Oogje271nUEw/UM1cjqbrKkYNsCs4QKfAT0RSLQWUl2J3Zk saQudGNQ8yfmnuB+ZUcW6EuAyUPoYrm7IMAN4JjyJ04st/u+L53FRtBM6buHyA== 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 4Xslhf2fmBz12yM; Tue, 19 Nov 2024 00:28:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AJ0SIvK064848; Tue, 19 Nov 2024 00:28:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AJ0SItV064845; Tue, 19 Nov 2024 00:28:18 GMT (envelope-from git) Date: Tue, 19 Nov 2024 00:28:18 GMT Message-Id: <202411190028.4AJ0SItV064845@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 9bfba304a8a3 - stable/13 - ipfilter: Support printing of IPv6 addresses in error message 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9bfba304a8a36d3b2b8c8d2efa2caeb65955474e Auto-Submitted: auto-generated The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=9bfba304a8a36d3b2b8c8d2efa2caeb65955474e commit 9bfba304a8a36d3b2b8c8d2efa2caeb65955474e Author: Cy Schubert AuthorDate: 2024-11-08 07:39:11 +0000 Commit: Cy Schubert CommitDate: 2024-11-19 00:27:07 +0000 ipfilter: Support printing of IPv6 addresses in error message Replace inet_ntoa(3) with inet_ntop(3). This supporting the printing of IPv6 IP addresses in addition to IPv4 IP addresses in error message. (cherry picked from commit 3a2cb65b6e6dc1e71013db27ce143eb8670a1755) --- sbin/ipf/libipf/load_poolnode.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/sbin/ipf/libipf/load_poolnode.c b/sbin/ipf/libipf/load_poolnode.c index 0e41a3921b71..880a6cd1c681 100644 --- a/sbin/ipf/libipf/load_poolnode.c +++ b/sbin/ipf/libipf/load_poolnode.c @@ -53,11 +53,29 @@ load_poolnode(int role, char *name, ip_pool_node_t *node, int ttl, if (err != 0) { if ((opts & OPT_DONOTHING) == 0) { char msg[255]; + char ipaddr[80], mask_msg[10], mask[8]; - snprintf(msg, sizeof(msg), "%s pool(%s) node(%s/", what, - name, inet_ntoa(pn.ipn_addr.adf_addr.in4)); - strlcat(msg, inet_ntoa(pn.ipn_mask.adf_addr.in4), sizeof(msg)); - strcat(msg, ")"); + inet_ntop(pn.ipn_addr.adf_family, + pn.ipn_addr.adf_addr.vptr, ipaddr, + sizeof(ipaddr)); + +#ifdef USE_INET6 + if (pn.ipn_mask.adf_family == AF_INET) { +#endif + inet_ntop(pn.ipn_mask.adf_family, + pn.ipn_mask.adf_addr.vptr, mask, + sizeof(mask)); + mask_msg[0]='/'; + mask_msg[1]='\0'; + strlcat(mask_msg, mask, sizeof(mask_msg)); +#ifdef USE_INET6 + } else { + mask_msg[0]='\0'; + } +#endif + + snprintf(msg, sizeof(msg), "%s pool(%s) node(%s%s)", + what, name, ipaddr, mask_msg); return (ipf_perror_fd(pool_fd(), iocfunc, msg)); } }