全部博文(230)
发布时间:2008-04-17 09:49:56
......
phoenixcsl2015-05-26 09:57
hi,platinum,请问netfilter能够过滤arp的东西吗?我写了一些代码,在nf_arp_in和out捕获一些信息,但是为什么什么都抓不到?
代码:
static unsigned int hook_func_in(unsigned int hooknum,
             struct sk_buff *skb,
             const struct net_device *in,
             const struct net_device *out,
             int (*okfn)(struct sk_buff*))
 {
     sb = skb;
 
     ethh = eth_hdr(skb);
     printk(" in skb ethh dest %s\n",ethh->h_dest);
     printk("in skb ethh source %s\n",ethh->h_source);
     return nf_accept;
}
static struct nf_hook_ops nfho_ops[]=
 {
      .hook = hook_func_in,
      .owner = this_module,
      .pf =nf_arp,
      .hooknum = nf_arp_in,
      .priority = nf_ip_pri_first,
  }
static struct nf_hook_ops nfho_ops[]=
 {
      .hook = hook_func_in,
      .owner = this_module,
      .pf =nf_arp,
      .hooknum = nf_arp_in,
      .priority = nf_ip_pri_first,
  }
platinum2013-05-24 10:01
luodeke:博主你好,我有个问题想请教你,看你的博文里面你好像有看过内核代码,内核代码你是从哪里得到的呢?直接在kernel.org里面的源码包得到的吗?多谢
两种方法
1、去 kernel.org 下载
2、用 git 直接托追最新版:git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git