From nobody Tue Nov 19 00:28:19 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 4Xslhh07hCz5dGbm; Tue, 19 Nov 2024 00:28:20 +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 4Xslhg4B3pz4gVx; Tue, 19 Nov 2024 00:28:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731976099; 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=UX+9uAsT22dBhXc0aXjuWlv23/bl7sWfkF0ozUiOccY=; b=yxIO9ZK/3MyJOS7VIoKLHAMHtaIxbwBo+ExzWJ/C/JfCotuv8OkdqXaIJOy3et0sVSdEMe xkNHalmzlKQl0oKpJOQuwU9y4HVIgYI8kkgbV9OQNLmlO6sT+jjqp1/74QVKnJxhox5H9v PPJLxODCnAA6X4RZ/fsZv0z4xs20XT8qT2MqHR4qdRxPD3wh+PyqeSL2D8Gv4eotKdNfsY sww9Kz1sGS1O8XobsKu2nc1txcGIgydBvMU0+8ASHELHMLG/ljkd5Gbt0+sOcN+70ZCsUp gc6cOqFPW9f8r2D6wqpfDyl3BZ2zMl2oWBA/gvnv9hPbT0erjtF0QP3TScwfoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731976099; 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=UX+9uAsT22dBhXc0aXjuWlv23/bl7sWfkF0ozUiOccY=; b=r3HNeN2+pAutSYo/NLDiALqOy1cA3fECYU0yvV8nLq2i2quPmyvbxvMDbeBGjJq0GRQaYp ibNFguK0Ui0FbQSuu4iR8jsNLpCafsIWt1apYafrxXypLPXruBn7aOtUpxzCT9ZnAH3orE //ZfSdikHyKagSAfotn90MQkHuZQf+YTabXCb0Y60PNBI+xPMV1TZm85aC9U3muxSQwnyp CYpTPbmW/hwwHwB8ZF4rZa7RauM+ZQgxsvmNz4CqXMCxHyqiAhjgh0I6xAK8PytrinNtpB hX+iXVGbLfQ1zuYHSIMsSbPK1LDqN3DAFENOYe3kw8Pr04cTwLqoF9mFn3vTsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731976099; a=rsa-sha256; cv=none; b=dSy+a7QlFVgL7biPNM1VnhtsdKAveHsueW/TLbcpEyYffXU3s7CJXisW08e77WM86cS/b5 zKJzFrilci0iB8ncQzWApC6hMA4OeCYNhz+DDd7JA8u2xSU9kCUhOVaXNDEzY26Bfmz1mg QvdrEiN+yuxrT07p/wOJ6zuZcxDAluF5J5wbo/zC+UJIUqvZOjahnWTvRp9FnLJQjwyznZ s61FrrZvY0ZsujdDzTF5ScksXKVtMChPBdYlRuR5k0IiwgpoHaSoRd0FBvPGHwX0QyEk5F xkfXZYqjaNMkevF6fcnJpMk8jmgfnkSlnyz19/eR3GmGhlWMj2STBRU3HF0vBQ== 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 4Xslhg3grnz12yN; Tue, 19 Nov 2024 00:28:19 +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 4AJ0SJDC064903; Tue, 19 Nov 2024 00:28:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AJ0SJnF064900; Tue, 19 Nov 2024 00:28:19 GMT (envelope-from git) Date: Tue, 19 Nov 2024 00:28:19 GMT Message-Id: <202411190028.4AJ0SJnF064900@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: 16d1a55b63f5 - stable/13 - ipfilter: Include the IP address 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: 16d1a55b63f5e2a9e1b5307cad1c91da9cf9bd5d Auto-Submitted: auto-generated The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=16d1a55b63f5e2a9e1b5307cad1c91da9cf9bd5d commit 16d1a55b63f5e2a9e1b5307cad1c91da9cf9bd5d Author: Cy Schubert AuthorDate: 2024-11-08 16:30:53 +0000 Commit: Cy Schubert CommitDate: 2024-11-19 00:27:07 +0000 ipfilter: Include the IP address in error message Include the IP address in the message when a hashnode add error occurs. This helps to identify the ippool.conf statement that the error occurred. (cherry picked from commit 9da30a23a5ecae151ae1db045354fab105c69e12) --- sbin/ipf/libipf/load_hashnode.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sbin/ipf/libipf/load_hashnode.c b/sbin/ipf/libipf/load_hashnode.c index bf22edb9be87..12b11687710d 100644 --- a/sbin/ipf/libipf/load_hashnode.c +++ b/sbin/ipf/libipf/load_hashnode.c @@ -53,9 +53,28 @@ load_hashnode(int unit, char *name, iphtent_t *node, int ttl, if (err != 0) if (!(opts & OPT_DONOTHING)) { - char msg[80]; + char msg[255]; + char ipaddr[80], mask_msg[10], mask[8]; - snprintf(msg, sizeof(msg), "%s node from lookup hash table(%s)", what, name); + inet_ntop(ipe.ipe_family, + ipe.ipe_addr.vptr, ipaddr, + sizeof(ipaddr)); +#ifdef USE_INET6 + if (ipe.ipe_family == AF_INET) { +#endif + inet_ntop(ipe.ipe_family, + ipe.ipe_mask.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 node from lookup hash table(%s) node(%s%s)", what, name, ipaddr, mask_msg); return (ipf_perror_fd(pool_fd(), iocfunc, msg)); } return (0);