IP-address from sk_buff

前端 未结 6 1504
说谎
说谎 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:30

    You should use the %pI4 extended format specifiers provided by printk():

    printk(KERN_DEBUG "IP addres = %pI4\n", &local_ip);
    

提交回复
热议问题