[Click] [Patch] IPPrint tcp sequence fix

Eddie Kohler kohler at cs.ucla.edu
Wed Apr 9 13:52:43 EDT 2008


Thank you very much!  Unfortunately your fix has its own hug -- it doesn't 
consider iph->ip_hl (IP options).  So I checked in something related.

Eddie


Harald Schiöberg wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> IPPrint doesn't get the sequencenumber range of packets right.
> (the tcp-offset-field starts counting at the tcp-header, not the packet
> header)
> 
> Here is the fix:
> 
> diff --git a/elements/ip/ipprint.cc b/elements/ip/ipprint.cc
> index 2185b96..a620847 100644
> - --- a/elements/ip/ipprint.cc
> +++ b/elements/ip/ipprint.cc
> @@ -174,7 +174,7 @@ IPPrint::tcp_line(StringAccum &sa, const Packet *p,
> int transport_le
>         goto truncated_tcp;
> 
>      ip_len = ntohs(iph->ip_len);
> - -    seqlen = ip_len - (tcph->th_off << 2);
> +    seqlen = ip_len - sizeof(click_ip) - (tcph->th_off << 2);
>      if (tcph->th_flags & TH_SYN)
>         sa << 'S', seqlen++;
>      if (tcph->th_flags & TH_FIN)
> 
> 
> 
> 
> - --
> Harald Schiöberg
> Technische Universität Berlin | T-Laboratories | FG INET
> www: http://www.net.t-labs.tu-berlin.de
> Phone: +49-(0)30-8353-58476 | Fax: +49-(0)391 534 783 47
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFH/HwKJgyxs71kcx4RAkdiAJwK4ZmKbt7psZYUWfRvIWBHbGkULQCfWTot
> pOoqjYgl/wFepC6SlVFJc+0=
> =pOCd
> -----END PGP SIGNATURE-----
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click



More information about the click mailing list