]> The Tcpdump Group git mirrors - tcpdump/commitdiff
From Fang Wang:
authorGuy Harris <[email protected]>
Tue, 18 Aug 2009 22:02:37 +0000 (15:02 -0700)
committerGuy Harris <[email protected]>
Tue, 18 Aug 2009 22:02:37 +0000 (15:02 -0700)
RFC 5482 specifies a new TCP option -- the TCP User Timeout
Option (UTO) -- that allows one end of a TCP connection to
advertise its current user timeout value.  The Kind of UTO
option is 28 and the Length is 4.  The tcpdump currently does
not recognize UTO option.

CREDITS
print-tcp.c
tcp.h

diff --git a/CREDITS b/CREDITS
index 9220a950fa08f5b80a4245e172e5e0dcacef7cbf..3579d73caf62de2a2d76357edbc92cb25805a3ba 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -50,6 +50,7 @@ Additional people who have contributed patches:
        Don Ebright                     <Don dot Ebright at compuware dot com>
        Eddie Kohler                    <xexd at sourceforge dot net>
        Elmar Kirchner                  <elmar at juniper dot net>
+       Fang Wang                       <fangwang at sourceforge dot net>
        Florent Drouin                  <Florent dot Drouin at alcatel-lucent dot fr>
        Florian Forster                 <octo at verplant dot org>
        Francis Dupont                  <Francis dot Dupont at enst-bretagne dot fr>
index 8efe6c69c57a998a7dc7d17ae121aeae4f7d4990..b7a7448e85ef7199a8da9ed00a7c327d6be503db 100644 (file)
@@ -121,6 +121,7 @@ struct tok tcp_option_values[] = {
         { TCPOPT_CCECHO, "" },
         { TCPOPT_SIGNATURE, "md5" },
         { TCPOPT_AUTH, "enhanced auth" },
+        { TCPOPT_UTO, "uto" },
         { 0, NULL }
 };
 
@@ -610,6 +611,18 @@ tcp_print(register const u_char *bp, register u_int length,
                                  */
                                 break;
 
+                        case TCPOPT_UTO:
+                                datalen = 2;
+                                LENCHECK(datalen);
+                                uint utoval = EXTRACT_16BITS(cp);
+                                (void)printf("0x%x", utoval);
+                                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/tcp.h b/tcp.h
index 757bfd86b83192fa292adbded223c4df7806d6ca..ac83714fe29e08c050eef8d09906bc5fbd204dc6 100644 (file)
--- a/tcp.h
+++ b/tcp.h
@@ -83,6 +83,9 @@ 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)