From nobody Tue Nov 12 03:28:20 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 4XnX1c5Q73z5d42x; Tue, 12 Nov 2024 03: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 4XnX1c44nmz46GT; Tue, 12 Nov 2024 03:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731382100; 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=GQ7a8yegz0k9VT/sxXSWaH2bBp2T3vMjdR7gYFrqP3Y=; b=sRZQi3+K7cWBRi21z14Y8Ih45DK7Kr+9X7/dCDTDJRZx8A5aqPp5E8xLLmGqZYxal1AAax Iq+ad8KMosgUtYE5WooYOjocJkfthTC1erYWr4m59DFPwyJ+OyGSzhUYrBo6dVOzDPwkE0 QLgXD5clTTb7g8tVZaBTgHwo9o4PtfCtt9uTV2lHf/pCshgSy+DAXZkfHQY5ARUBouTgvb fYY0T18cGcAPoWLFJCP+muxH6xAtTWXG0DePX3JbBA9MPPJGBLnu3Pzq28LN1e+EdsLH4Y RSKIGat6eq+lKxAP/VCP4aI4M5iNc3LtlwcgD7/c91wsOK7Vdj3bs+zzt6ziGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731382100; 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=GQ7a8yegz0k9VT/sxXSWaH2bBp2T3vMjdR7gYFrqP3Y=; b=iG/Z5tMnusxpjXfOAyYiAj8pSWZXleiV0GFk2NIGTee1sS4KhAQ69N5LtIKgWdqhPqiwq4 GqzcY/IwgHeYbS2FEXooFkAJP/P2PGinRwYayPklmP43P5VF7oYIicJm7wZSA1tkYIaOQo sigA8kSaXcZbe9kUrtoHhs5MpNKKp3xzupUa04tTUYyWNqQjouM120r+Lox57Kp83tjnG9 s43g5bFU1CzgcH7S3fGyCe8iGp+7AuIb/zst/fOuBsqelQll+9zx3xa42LQXEMWibheVjI /hQ8V2Q3uK1zJNT9iHRWwhxjy8HFJ0kgf7wYe1UhARZqUSsp2tQANDNPpZUH+Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731382100; a=rsa-sha256; cv=none; b=OFKCrJgHJFyP+D7LmjLdHlhTxT5gtRhq+28tP9qotc4AnS4MU6PexJhpMijOYEvX4Q5MsA ItZ35GnS0Jkl21KMlBB4Ft765pOypgIb4EmKN8KQp94/rrZ555weVfvvh6or0JYr/OTxK1 //9fgp5BoTGmhbfHQ7PnjUYDi5O+QeOeyI6Q3spAqZvMUwqiQP4UI4YMmuJmpvHKWBfONJ fs39WMNLNvNO1WDlbejdaL1qD+rkUdY/AUHZGp+VHF8eHIrwjsJXleRRZ9rQDrpwYe+55g KpBbhwgWpPILYMJPK6qtVvRlaWsM4r/cvHHzg7sxRUhO3ZxwliWhdRyQqFcc/w== 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 4XnX1c3hZfzt9T; Tue, 12 Nov 2024 03:28:20 +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 4AC3SKi4078218; Tue, 12 Nov 2024 03:28:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AC3SKLh078215; Tue, 12 Nov 2024 03:28:20 GMT (envelope-from git) Date: Tue, 12 Nov 2024 03:28:20 GMT Message-Id: <202411120328.4AC3SKLh078215@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 9da30a23a5ec - main - 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/main X-Git-Reftype: branch X-Git-Commit: 9da30a23a5ecae151ae1db045354fab105c69e12 Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=9da30a23a5ecae151ae1db045354fab105c69e12 commit 9da30a23a5ecae151ae1db045354fab105c69e12 Author: Cy Schubert AuthorDate: 2024-11-08 16:30:53 +0000 Commit: Cy Schubert CommitDate: 2024-11-12 03:22:15 +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. MFC after: 1 week --- 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);