summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2015-03-13 13:46:50 +0000
committerae <ae@FreeBSD.org>2015-03-13 13:46:50 +0000
commit14e86687711fe0ff15cfbfaa6fbfcae8aecb13a3 (patch)
tree230ac44305c1e3f1ec6d104c1acc16c5f49af0ec /sbin/ipfw
parent7d384a730d948641100cfd48e162ca4e46dcf75e (diff)
downloadFreeBSD-src-14e86687711fe0ff15cfbfaa6fbfcae8aecb13a3.zip
FreeBSD-src-14e86687711fe0ff15cfbfaa6fbfcae8aecb13a3.tar.gz
Properly initialize scope zone id when next hop address stored
directly in the O_FORWARD_IP6 opcode. Use getnameinfo(3) to formatting the IPv6 addresses of such opcodes. Obtained from: Yandex LLC Sponsored by: Yandex LLC
Diffstat (limited to 'sbin/ipfw')
-rw-r--r--sbin/ipfw/ipfw2.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index d16d9e7..9a0bd9e 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -1525,11 +1525,14 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo,
case O_FORWARD_IP6:
{
- char buf[4 + INET6_ADDRSTRLEN + 1];
+ char buf[INET6_ADDRSTRLEN + IF_NAMESIZE + 2];
ipfw_insn_sa6 *s = (ipfw_insn_sa6 *)cmd;
- bprintf(bp, "fwd %s", inet_ntop(AF_INET6,
- &s->sa.sin6_addr, buf, sizeof(buf)));
+ bprintf(bp, "fwd ");
+ if (getnameinfo((const struct sockaddr *)&s->sa,
+ sizeof(struct sockaddr_in6), buf, sizeof(buf),
+ NULL, 0, NI_NUMERICHOST) == 0)
+ bprintf(bp, "%s", buf);
if (s->sa.sin6_port)
bprintf(bp, ",%d", s->sa.sin6_port);
}
@@ -3741,8 +3744,8 @@ chkarg:
p->sa.sin6_family = AF_INET6;
p->sa.sin6_port = port_number;
p->sa.sin6_flowinfo = 0;
- p->sa.sin6_scope_id = 0;
- /* No table support for v6 yet. */
+ p->sa.sin6_scope_id =
+ ((struct sockaddr_in6 *)&result)->sin6_scope_id;
bcopy(&((struct sockaddr_in6*)&result)->sin6_addr,
&p->sa.sin6_addr, sizeof(p->sa.sin6_addr));
} else {
OpenPOWER on IntegriCloud