title: How is replaced struct tcp_opt in the newer kernel?
body: <p>I working on an old module for kernel 2.4.x and want to rewrite it for kernel 4.15.0.19.</p>
  
  <p>There is a declaration which is causing an error during the compilation:</p>
  
  <pre><code>struct tcp_opt *tp = &amp;(sk-&gt;tp_pinfo.af_tcp);
  </code></pre>
  
  <p>I checked in the newer kernel and tcp_opt struct is not defined anywhere, neither tp_pinfo union nor af_tcp.</p>
  
  <p>From 2.4.x kernel, it is declared inside struct sock as follows:</p>
  
  <pre><code>    union {
      struct tcp_opt      af_tcp;
      #if defined(CONFIG_INET) || defined (CONFIG_INET_MODULE)
      struct raw_opt      tp_raw4;
      #endif
      #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
      struct raw6_opt     tp_raw;
      #endif /* CONFIG_IPV6 */
      #if defined(CONFIG_SPX) || defined (CONFIG_SPX_MODULE)
      struct spx_opt      af_spx; 
      #endif /* CONFIG_SPX */
  
  } tp_pinfo;
  </code></pre>
  
  <p>What is the purpose of the first initialisation (in the beginning of the question) and how is this replaced in the newer kernels?</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>I managed to solve this using:</p>
  
  <pre><code>const struct tcp_sock *tp = tcp_sk(sk);
  </code></pre>
  
  <p>And then accessing the TCP Options in this way:</p>
  
  <pre><code>tp-&gt;rx_opt.rcv_tsval
  </code></pre>