根据下面的代码:
#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>
#include <linux/inet.h>
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 iphdr *ip_header;
struct tcphdr *tcp_header;
ip_header = ip_hdr(skb);
ip_header = (struct iphdr *)skb_network_header(skb);
skb_set_transport_header(skb, ip_header->ihl * 4);
tcp_header = (struct tcphdr *)skb_transport_header(skb);
...
...
return NF_ACCEPT;
}我们可以访问数据包,现在我想知道我是否可以在此处将IP选项字段附加到IP报头?
发布于 2014-05-11 04:57:49
struct iphdr *ip_header;
bind(hooknum,(sk_buff *) &ip_header,sizeof(ip_header));
struct tcphdr *tcp_header;
bind(hooknum,(sk_buff *) &tcp_header,sizeof(tcp_header));https://stackoverflow.com/questions/23586517
复制相似问题