缥缈峰一座01号

梁二伯的窝

  DonewsBlog  |  Donews首页  |  Donews社区  |  Donews邮箱  |  我的首页  |  联系作者  |  聚合   |  登录
  86篇文章 :: 0篇收藏:: 27篇评论:: 0个Trackbacks

公告

Equality && Free

文章

收藏

相册

存档


正在读取评论……


/net/ipv4/ip_input.c
377 /*
378  *  Main IP Receive routine.
379  */
380 int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_devi    ce *orig_dev)
381 {
...        //this is the NF_IP_PRE_ROUTING hook
444     return NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, dev, NULL,
445                ip_rcv_finish);
...
453 }


/include/linux/netfilter.h

255 #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
256     NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN)
257

243 #define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh)         \
244 ({int __ret;                                       \
245 if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh, 1)) == 1)\
246     __ret = (okfn)(skb);                               \
247 __ret;})


191 /**
192  *  nf_hook_thresh - call a netfilter hook
193  * 
194  *  Returns 1 if the hook has allowed the packet to pass.  The function
195  *  okfn must be invoked by the caller in this case.  Any other return
196  *  value indicates the packet has been consumed by the hook.
197  */
198 static inline int nf_hook_thresh(int pf, unsigned int hook,
199                  struct sk_buff **pskb,
200                  struct net_device *indev,
201                  struct net_device *outdev,
202                  int (*okfn)(struct sk_buff *), int thresh,
203                  int cond)
204 {
205     if (!cond)
206         return 1;
207 #ifndef CONFIG_NETFILTER_DEBUG
208     if (list_empty(&nf_hooks[pf][hook]))
209         return 1;
210 #endif
211     return nf_hook_slow(pf, hook, pskb, indev, outdev, okfn, thresh);
212 }


Notice:the dts is someting about route ,such as /include/net/dst.h

Trackback: http://tb.donews.net/TrackBack.aspx?PostId=1177950


[点击此处收藏本文]  发表于2007年06月21日 12:15 AM




正在读取评论……

发表评论

大名:
网址:
验证码
评论