Linux kernel 如何在较新的内核中替换struct tcp_opt?

Linux kernel 如何在较新的内核中替换struct tcp_opt?,linux-kernel,kernel-module,Linux Kernel,Kernel Module,我正在为内核2.4.x开发一个旧模块,并想为内核4.15.0.19重写它 有一个声明在编译过程中导致错误: struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); 我检查了较新的内核,没有在任何地方定义tcp_opt结构,tp_pinfo union和af_tcp都没有定义 在2.4.x内核中,它在struct sock中声明如下: union { struct tcp_opt af_tcp; #if defin

我正在为内核2.4.x开发一个旧模块,并想为内核4.15.0.19重写它

有一个声明在编译过程中导致错误:

struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
我检查了较新的内核,没有在任何地方定义tcp_opt结构,tp_pinfo union和af_tcp都没有定义

在2.4.x内核中,它在struct sock中声明如下:

    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;
第一次初始化(在问题的开头)的目的是什么?在较新的内核中如何替换


编辑:

我通过以下方法解决了这个问题:

const struct tcp_sock *tp = tcp_sk(sk);
然后通过以下方式访问TCP选项:

tp->rx_opt.rcv_tsval