- 论坛徽章:
- 9
|
回复 4# contestjia
给你查到了。从PRE_ROUTING的定义点,我们可以看出,混杂模式收到包都已经被扔了。- /* IP Hooks */
- /* After promisc drops, checksum checks. */
- #define NF_IP_PRE_ROUTING 0
- /* If the packet is destined for this box. */
- #define NF_IP_LOCAL_IN 1
- /* If the packet is destined for another interface. */
- #define NF_IP_FORWARD 2
- /* Packets coming from a local process. */
- #define NF_IP_LOCAL_OUT 3
- /* Packets about to hit the wire. */
- #define NF_IP_POST_ROUTING 4
- #define NF_IP_NUMHOOKS 5
复制代码- int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
- {
- struct iphdr *iph;
- u32 len;
- if (dev->nd_net != &init_net)
- goto drop;
- /* When the interface is in promisc. mode, drop all the crap
- * that it receives, do not try to analyse it.
- */
- if (skb->pkt_type == PACKET_OTHERHOST)
- goto drop;
- 。。。。。。
- /* Remove any debris in the socket control block */
- memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
- return NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, dev, NULL,
- ip_rcv_finish);
- inhdr_error:
- IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
- drop:
- kfree_skb(skb);
- out:
- return NET_RX_DROP;
复制代码 以上代码的内核版本为2.6.34.10
|
|