aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2018-12-10 15:42:13 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2018-12-10 15:42:13 +0000
commit5f9c94c592ce49d967632eb912cb3c3c33ef5f9e (patch)
treee1a33d635259f21aaccbc897c4cd0fc07f3141cc
parentbe2bd024de2e67ecbb787998fb85457d81b2c836 (diff)
downloadsrc-5f9c94c592ce49d967632eb912cb3c3c33ef5f9e.tar.gz
src-5f9c94c592ce49d967632eb912cb3c3c33ef5f9e.zip
Use correct size for IPv4 address in gethostbyaddr().
When u_long is 8 bytes, it returns EINVAL and 'ipfw -N show' doesn't work. Reported by: Claudio Eichenberger <cei at yourshop.com> MFC after: 1 week
Notes
Notes: svn path=/head/; revision=341798
-rw-r--r--sbin/ipfw/ipfw2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 1092d5e22719..4bc91ee26980 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -1256,7 +1256,8 @@ print_ip(struct buf_pr *bp, const struct format_opts *fo, ipfw_insn_ip *cmd)
(cmd->o.opcode == O_IP_SRC || cmd->o.opcode == O_IP_DST) ?
32 : contigmask((uint8_t *)&(a[1]), 32);
if (mb == 32 && co.do_resolv)
- he = gethostbyaddr((char *)&(a[0]), sizeof(u_long), AF_INET);
+ he = gethostbyaddr((char *)&(a[0]), sizeof(in_addr_t),
+ AF_INET);
if (he != NULL) /* resolved to name */
bprintf(bp, "%s", he->h_name);
else if (mb == 0) /* any */