title: no member th_seq in struct tcphdr (working with pcap)
body: <p>I'm working on an assignment of which one part involves capturing packets with pcap.
  I followed a <a href="http://www.tcpdump.org/pcap.html" rel="nofollow">tutorial</a>, and am now trying some code i found <a href="http://recursos.aldabaknocking.com/libpcapHakin9LuisMartinGarcia.pdf" rel="nofollow">here</a>, which is similiar to this:</p>
  
  <pre><code>//#define __USE_BSD
  //#define __FAVOR_BSD
  #define MAXBYTES2CAPTURE 2048
  #define SIZE_ETHERNET 14
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;libnet.h&gt;
  #include &lt;string.h&gt;
  #include &lt;pcap.h&gt;
  #include &lt;netinet/tcp.h&gt;
  #include &lt;netinet/ip.h&gt;
  
  int main(){
      int count = 0;
      bpf_u_int32 netaddr=0, mask=0;
      pcap_t *descr = NULL;
      struct bpf_program filter;
      struct ip *iphdr = NULL;
      struct tcphdr *tcphdr = NULL;
      struct pcap_pkthdr pkthdr;
      const unsigned char *packet = NULL;
      char pcap_errbuf[PCAP_ERRBUF_SIZE];
  
      descr = pcap_open_live("eth0", MAXBYTES2CAPTURE, 0, 512, pcap_errbuf );
      pcap_lookupnet("eth0", &amp;netaddr, &amp;mask, pcap_errbuf );
      pcap_compile( descr, &amp;filter, "port 111", 1, mask );
      pcap_setfilter( descr, &amp;filter);
  
      packet = pcap_next(descr, &amp;pkthdr );
      iphdr = (struct ip *)(packet+14);
      tcphdr = (struct tcphdr *)(packet+14+20);
      printf("SEQ: %d:\n", ntohl(tcphdr-&gt;th_seq) );
      pcap_close(descr);
      return(0);
  }
  </code></pre>
  
  <p>The problem is that I get a compile error: </p>
  
  <blockquote>
    <p>‘struct tcphdr’ has no member named ‘th_seq’. </p>
  </blockquote>
  
  <p>I found more people asking about this and some replies suggested to include:</p>
  
  <pre><code>#define __USE_BSD
  #define __FAVOR_BSD
  </code></pre>
  
  <p>but I get the error regardless of whether I add that. th_seq is supposed to be included in <code>netinet/tcp.h</code> right? I tested the code on Ubuntu 12.04 and linux 3.2, both give the error.</p>
  
  <p>Anyone knows how to fix this?</p>