diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-05-06 09:56:46 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-05-06 09:56:46 +0000 |
commit | 15ca6453e8a60a907c2630bc450b8295a0ef2ed1 (patch) | |
tree | 1ec2eed29fb1b4b8243d1c775495e5eca846e98f /usr.sbin/tcpdump/print-rt6.c | |
parent | 8fd24f309580a8dd4b73d0cb9db1fae5eea4b5d0 (diff) |
Don't fail hard on non RH0 routing headers. The calculation of the length
of RH headers is always the same. Now tcpdump just prints the type, length
and segleft headers for unknown headers.
OK henning@ mcbride@
Diffstat (limited to 'usr.sbin/tcpdump/print-rt6.c')
-rw-r--r-- | usr.sbin/tcpdump/print-rt6.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/usr.sbin/tcpdump/print-rt6.c b/usr.sbin/tcpdump/print-rt6.c index 324cb07090b..4c8371479a4 100644 --- a/usr.sbin/tcpdump/print-rt6.c +++ b/usr.sbin/tcpdump/print-rt6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-rt6.c,v 1.1 2000/04/26 21:35:42 jakob Exp $ */ +/* $OpenBSD: print-rt6.c,v 1.2 2007/05/06 09:56:45 claudio Exp $ */ /* @@ -79,7 +79,7 @@ rt6_print(register const u_char *bp, register const u_char *bp2) printf("srcrt (len=%d, ", dp->ip6r_len); printf("type=%d, ", dp->ip6r_type); - printf("segleft=%d, ", dp->ip6r_segleft); + printf("segleft=%d", dp->ip6r_segleft); switch (dp->ip6r_type) { case IPV6_RTHDR_TYPE_0: @@ -87,7 +87,7 @@ rt6_print(register const u_char *bp, register const u_char *bp2) TCHECK(dp0->ip6r0_reserved); if (dp0->ip6r0_reserved || vflag) { - printf("rsv=0x%0x, ", + printf(", rsv=0x%0x", (u_int32_t)ntohl(dp0->ip6r0_reserved)); } @@ -101,21 +101,19 @@ rt6_print(register const u_char *bp, register const u_char *bp2) if ((u_char *)addr > ep - sizeof(*addr)) goto trunc; - printf("[%d]%s", i, ip6addr_string((u_char *)addr)); - if (i != len - 1) - printf(", "); - + printf(", [%d]%s", i, ip6addr_string((u_char *)addr)); } printf(")"); return((dp0->ip6r0_len + 1) << 3); - break; default: - goto trunc; - break; + if (bp + ((dp->ip6r_len + 1) << 3) > ep) + goto trunc; + printf(")"); + return((dp->ip6r_len + 1) << 3); } trunc: - fputs("[|srcrt]", stdout); + fputs(", [|srcrt]", stdout); return 65535; /* XXX */ } #endif /* INET6 */ |