マシンから送信されるすべてのパケットの送信元 IP を、このカーネル モジュールで指定したものに変更しようとしていますが、nh.iph->saddrにアクセスしようとするたびに、コンパイル時にStruct sk_buff has no member
というエラーが表示されます名前付き nh
ここで何が間違っているのですか? ヘッダーか何かを見逃しましたか??
#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を実行していることに注意してください