【问题标题】:Changes of the sock struct in Linux kernel 2.6?Linux 内核 2.6 中 sock 结构的变化?
【发布时间】:2014-08-22 16:35:23
【问题描述】:

在Linux kernel 2.4.18中,socket的网络层表示即sock struct有saddrsportdaddrdport等字段,分别代表源IP地址和目的IP地址(港口)。但是,在内核 2.6.18 中,这些字段已被删除。我正在尝试修改基于 2.4.18 内核的模块,有人知道这些字段在网络堆栈中的保存位置吗?

【问题讨论】:

    标签: c sockets networking linux-kernel


    【解决方案1】:

    我认为您需要将 struct sock 转换为 struct inet_sock...

    struct inet_sock *inet;
    inet = inet_sk(sock);
    inet->daddr, inet->dport, etc.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-09-29
      • 1970-01-01
      • 2011-09-03
      • 2019-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多