summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw
diff options
context:
space:
mode:
authormlaier <mlaier@FreeBSD.org>2006-06-02 05:17:17 +0000
committermlaier <mlaier@FreeBSD.org>2006-06-02 05:17:17 +0000
commit5b7662dfe9883a7e44fa22ced316b437cc59aaeb (patch)
tree7845b99c65305674b095dda8673eba9b73c31a2f /sbin/ipfw
parent7a24ed8d3de63a5444cfb1f19073a0b4f47172d3 (diff)
downloadFreeBSD-src-5b7662dfe9883a7e44fa22ced316b437cc59aaeb.zip
FreeBSD-src-5b7662dfe9883a7e44fa22ced316b437cc59aaeb.tar.gz
Print dynamic rules for IPv6 as well.
PR: bin/98349 Submitted by: Mark Andrews MFC after: 2 weeks
Diffstat (limited to 'sbin/ipfw')
-rw-r--r--sbin/ipfw/ipfw2.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 36c3282..ddaf4ac 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -1965,6 +1965,7 @@ show_dyn_ipfw(ipfw_dyn_rule *d, int pcwidth, int bcwidth)
struct protoent *pe;
struct in_addr a;
uint16_t rulenum;
+ char buf[INET6_ADDRSTRLEN];
if (!do_expired) {
if (!d->expire && !(d->dyn_type == O_LIMIT_PARENT))
@@ -1993,11 +1994,20 @@ show_dyn_ipfw(ipfw_dyn_rule *d, int pcwidth, int bcwidth)
else
printf(" proto %u", d->id.proto);
- a.s_addr = htonl(d->id.src_ip);
- printf(" %s %d", inet_ntoa(a), d->id.src_port);
-
- a.s_addr = htonl(d->id.dst_ip);
- printf(" <-> %s %d", inet_ntoa(a), d->id.dst_port);
+ if (d->id.addr_type == 4) {
+ a.s_addr = htonl(d->id.src_ip);
+ printf(" %s %d", inet_ntoa(a), d->id.src_port);
+
+ a.s_addr = htonl(d->id.dst_ip);
+ printf(" <-> %s %d", inet_ntoa(a), d->id.dst_port);
+ } else if (d->id.addr_type == 6) {
+ printf(" %s %d", inet_ntop(AF_INET6, &d->id.src_ip6, buf,
+ sizeof(buf)), d->id.src_port);
+ printf(" <-> %s %d", inet_ntop(AF_INET6, &d->id.dst_ip6, buf,
+ sizeof(buf)), d->id.dst_port);
+ } else
+ printf(" UNKNOWN <-> UNKNOWN\n");
+
printf("\n");
}
OpenPOWER on IntegriCloud