大佬教程收集整理的这篇文章主要介绍了linux-kernel – 如何访问struct sk_buff成员?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/netfilter.h> #include <linux/netfilter_ipv4.h> #include <linux/skbuff.h> #include <linux/ip.h> /* For IP header */ #include <linux/inet.h> /* For in_aton(); htonl(); and other related Network utility functions */ static struct nf_hook_ops nfho; unsigned int hook_func(unsigned int hooknum,struct sk_buff **skb,const struct net_device *in,const struct net_device *out,int (*okfn)(struct sk_buff *)) { struct sk_buff *sb = *skb; struct in_addr masterIP; masterIP.s_addr = htonl (in_aton("192.168.1.10")); sb->nh.iph->saddr = masterIP.s_addr; return NF_ACCEPT; }
请注意,我正在运行Ubuntu 10.04 LTS 64位
内核2.6.32-33
以上是大佬教程为你收集整理的linux-kernel – 如何访问struct sk_buff成员?全部内容,希望文章能够帮你解决linux-kernel – 如何访问struct sk_buff成员?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。