mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
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 9da30a23a5)
This commit is contained in:
parent
17c21e9e52
commit
43d49c178e
1 changed files with 21 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue