From nobody Tue Nov 19 00:26:50 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 4Xslfz14p1z5dGbL; Tue, 19 Nov 2024 00:26:51 +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 4Xslfy5wkYz4dPb; Tue, 19 Nov 2024 00:26:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731976010; 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=tfhh/ZfPgTazw1fTM4pfKtq66HAKdDXZumv4Ob9JPf0=; b=OFg8XLCCA4b0q7wvew+XAyLofhGmqWhWA9Pshd61eWF48f6gjACGMtOBN3Ngvxz54pwJRg 4a3PcL1FlIjPW9DoQjRHG4KDV6vjLIy2NJANNYz1NBRLiok8o57pN8dsYioV3btPwMJQ6J F8dQl8XQwmI/FYyRI3MO50PotDqXIn9wEBRNT+L9Dozs/juBKh7iFRX0zI1ZGYQzN1Wf4W UYlGG13bEUw6zdAX3fHZYenUi+N77gMfsq0SwahZ+MBO5GKgDvC7iN4ZOP673RO8wBZykz 0llt4U/BoyY93veBUzrRCttFjLlx5LMYn+CAxYG4N9fd4xsrLEPBesZ7toY3oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731976010; 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=tfhh/ZfPgTazw1fTM4pfKtq66HAKdDXZumv4Ob9JPf0=; b=KuoFc60qD/FTs7lca5PJukLNIAHtjSgKbniAU4Wme4Xu/YBFLVDHq0QJeoFOy1VGuKj4VW 14opc4Yfid92lPUGbfbhelI297A+ZRRGvl6weNhDS1VivddoMMNdwDn3tkIIgzfCrRHNmd X4AxoYyEt3Vg2jSfydqGclZqp4BjSDzxfl/W4slpwtWRJ4PtrIWdjGr71v3ydPxgR8x0vJ 5r2eNEQQa8AEo2KzxNDGYvMjYg1arH8XlYSKQsD8E9zltUA+v2CoYLuD9uYPCjLVb0E2i0 pMgqZzeaU/hwB+Gtmt93QdXAbGXrdQubRm/T137/Hx8fw7BFt7sA2p3C3+Rn1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731976010; a=rsa-sha256; cv=none; b=qCYowtPhw1UPIM9E3dPlN1oNXl0193vnQNdhCKOADPOChu6v/kt1jNJpPNSZVCSJd7AmcC 1qbQfTvP36v83kd0oGEMBMZaZ63gr+me+8Komv7cHgc7XGD9W6i44HuqZbbIh1JQWowGu+ ULwU25/gVsPYRXYiUaBVtEVypMR8f6LPOGWWTkPlUI/U8Neeu3e+T1RQhJ1dyecaV2qM1G BHwVf9ynsYxq93APTshQHP+srBdKwUCCSxQzMQjRfrKzpDdD49Z2Y5ffBvBKUUnpdyIBMx FGrgsl4QRgoaFDlmAp0+aBwdtofzUqOwywCbVr1UEXZAM9PqaI4hs96ItPxhpw== 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 4Xslfy5VYjz11qF; Tue, 19 Nov 2024 00:26:50 +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 4AJ0QovP063887; Tue, 19 Nov 2024 00:26:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AJ0Qove063884; Tue, 19 Nov 2024 00:26:50 GMT (envelope-from git) Date: Tue, 19 Nov 2024 00:26:50 GMT Message-Id: <202411190026.4AJ0Qove063884@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: 17c21e9e5205 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 17c21e9e520559087658cb171774afb310744a81 Auto-Submitted: auto-generated The branch stable/14 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=17c21e9e520559087658cb171774afb310744a81 commit 17c21e9e520559087658cb171774afb310744a81 Author: Cy Schubert AuthorDate: 2024-11-08 07:39:11 +0000 Commit: Cy Schubert CommitDate: 2024-11-19 00:26:05 +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)); } }