From ce3ed1caa182a916189bac5a1eba0208b217bb2b Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Wed, 7 Oct 2009 09:07:06 +0000 Subject: [PATCH] Add parsing code for TCP UTO (User Timeout Option). Submitted by: fangwang@ Obtained from: //depot/projects/soc2009/tcputo/ --- contrib/tcpdump/print-tcp.c | 12 ++++++++++++ contrib/tcpdump/tcp.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/contrib/tcpdump/print-tcp.c b/contrib/tcpdump/print-tcp.c index 5b0a7969a58..4200c319372 100644 --- a/contrib/tcpdump/print-tcp.c +++ b/contrib/tcpdump/print-tcp.c @@ -124,6 +124,7 @@ struct tok tcp_option_values[] = { { TCPOPT_CCECHO, "" }, { TCPOPT_SIGNATURE, "md5" }, { TCPOPT_AUTH, "enhanced auth" }, + { TCPOPT_UTO, "uto" }, { 0, NULL } }; @@ -613,6 +614,17 @@ tcp_print(register const u_char *bp, register u_int length, */ break; + case TCPOPT_UTO: + datalen = 2; + LENCHECK(datalen); + uint utoval = EXTRACT_16BITS(cp); + if (utoval & 0x0001) + utoval = (utoval >> 1) * 60; + else + utoval >>= 1; + (void)printf(" %u", utoval); + break; + default: datalen = len - 2; for (i = 0; i < datalen; ++i) { diff --git a/contrib/tcpdump/tcp.h b/contrib/tcpdump/tcp.h index db7dd44775e..1393a277cd9 100644 --- a/contrib/tcpdump/tcp.h +++ b/contrib/tcpdump/tcp.h @@ -83,6 +83,8 @@ struct tcphdr { #define TCPOLEN_SIGNATURE 18 #define TCP_SIGLEN 16 /* length of an option 19 digest */ #define TCPOPT_AUTH 20 /* Enhanced AUTH option */ +#define TCPOPT_UTO 28 /* tcp user timeout (rfc5482) */ +#define TCPOLEN_UTO 4 #define TCPOPT_TSTAMP_HDR \ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)