diff options
author | guy <guy> | 2001-02-21 09:05:39 +0000 |
---|---|---|
committer | guy <guy> | 2001-02-21 09:05:39 +0000 |
commit | 75dae9671418eed8db4246283b7e40588d7fb4bb (patch) | |
tree | c98d1d9ba7344672c674900407a090a35e8ae292 /print-cnfp.c | |
parent | 998f4f88c9e40ff0538b52d53e78a221925d67fa (diff) | |
download | tcpdump-75dae9671418eed8db4246283b7e40588d7fb4bb.tar.gz |
Patch from Harry Raaymakers <harryr@connect.com.au> to the Cisco NetFlow
printer to:
add v6 support;
fix the output so that the tcp ports and AS numbers don't run
into each other;
add the v6 encapsulation overhead bytes in the output.
Diffstat (limited to 'print-cnfp.c')
-rw-r--r-- | print-cnfp.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/print-cnfp.c b/print-cnfp.c index cba4fc04..e10e2478 100644 --- a/print-cnfp.c +++ b/print-cnfp.c @@ -34,7 +34,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.6 2000-09-23 08:26:32 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.7 2001-02-21 09:05:39 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -78,8 +78,8 @@ struct nfrec { u_int32_t ports; /* src,dst ports */ u_int32_t proto_tos; /* proto, tos, pad, flags(v5) */ u_int32_t asses; /* v1: flags; v5: src,dst AS */ - u_int32_t masks; /* src,dst addr prefix */ - + u_int32_t masks; /* src,dst addr prefix; v6: encaps */ + struct in_addr peer_nexthop; /* v6: IP address of the nexthop within the peer (FIB)*/ }; void @@ -108,7 +108,7 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp) (unsigned)ntohl(nh->msys_uptime)%1000, (unsigned)ntohl(nh->utc_sec), (unsigned)ntohl(nh->utc_nsec)); - if (ver == 5) { + if (ver == 5 || ver == 6) { printf("#%u, ", (unsigned)htonl(nh->sequence)); nr = (struct nfrec *)&nh[1]; snaplen -= 24; @@ -130,19 +130,19 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp) (unsigned)ntohl(nr->last_time)%1000); asbuf[0] = buf[0] = '\0'; - if (ver == 5) { + if (ver == 5 || ver == 6) { snprintf(buf, sizeof(buf), "/%u", (unsigned)(ntohl(nr->masks) >> 24) & 0xff); - snprintf(asbuf, sizeof(asbuf), "%u:", + snprintf(asbuf, sizeof(asbuf), ":%u", (unsigned)(ntohl(nr->asses) >> 16) & 0xffff); } printf("\n %s%s%s:%u ", inet_ntoa(nr->src_ina), buf, asbuf, (unsigned)ntohl(nr->ports) >> 16); - if (ver == 5) { + if (ver == 5 || ver ==6) { snprintf(buf, sizeof(buf), "/%d", (unsigned)(ntohl(nr->masks) >> 16) & 0xff); - snprintf(asbuf, sizeof(asbuf), "%u:", + snprintf(asbuf, sizeof(asbuf), ":%u", (unsigned)ntohl(nr->asses) & 0xffff); } printf("> %s%s%s:%u ", inet_ntoa(nr->dst_ina), buf, asbuf, @@ -173,9 +173,16 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp) if (flags) putchar(' '); } - printf("tos %u, %u (%u octets)", + + buf[0]='\0'; + if (ver == 6) { + snprintf(buf, sizeof(buf), "(%u<>%u encaps)", + (unsigned)(ntohl(nr->masks) >> 8) & 0xff, + (unsigned)(ntohl(nr->masks)) & 0xff); + } + printf("tos %u, %u (%u octets) %s", (unsigned)ntohl(nr->proto_tos) & 0xff, (unsigned)ntohl(nr->packets), - (unsigned)ntohl(nr->octets)); + (unsigned)ntohl(nr->octets), buf); } } |