git: 16d1a55b63f5 - stable/13 - ipfilter: Include the IP address in error message
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 Nov 2024 00:28:19 UTC
The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=16d1a55b63f5e2a9e1b5307cad1c91da9cf9bd5d commit 16d1a55b63f5e2a9e1b5307cad1c91da9cf9bd5d Author: Cy Schubert <cy@FreeBSD.org> AuthorDate: 2024-11-08 16:30:53 +0000 Commit: Cy Schubert <cy@FreeBSD.org> 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);