IP-address from sk_buff

前端 未结 6 1497
说谎
说谎 2021-02-02 17:43

I am writing a kernel module which registers a netfilter hook. I am trying to get the ip address of the caller by using the sk_buff->saddr member. Is there a way

6条回答
  •  有刺的猬
    2021-02-02 18:26

    /* Convinience union to __be32 to ip address  */
    union ip_address {
        u8 a[4];
        __be32 saddr;
    };
    

    IP Address could be obtained a[0].a[1].a[2].a[3]

提交回复
热议问题