LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1244|回复: 2

请教无法收到源IP与本机相同的包的问题

[复制链接]
发表于 2007-6-14 14:51:27 | 显示全部楼层 |阅读模式
小弟在两个主机上测试IP冲突的情况
两台主机ip相同,我在一台上用udp广播,另一台上监听udp广播
结果tcpdump结果显示收到了该广播包,但是上层却收不到
应该是在从底层向上传送时将包丢弃的,但是我看了内核源码
在ip_rcv和ip_rcv_finish里都没有相关的操作
请教下牛人具体是在哪个函数里将其丢弃的啊
发表于 2007-6-15 07:52:52 | 显示全部楼层
感觉是在这里(从ip_rcv_finish过来的):
ip_rcv_finish:
if (skb->dst == NULL) {
                int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos,
                                         skb->dev);
...
}
(skb->dst may contain information about the route to be taken by the packet to get to its destination. If that information is not known yet, the function asks the routing subsystem where to send the packet, and if the latter says the destination is unreachable, the packet is dropped.)
ip_route_input
ip_route_input_slow
ip_mkroute_input
ip_mkroute_input_def
__mkroute_input
fib_validate_source

/* Given (packet source, input interface) and optional (dst, oif, tos):
   - (main) check, that source is valid i.e. not broadcast or our local
     address.
   - figure out what "logical" interface this packet arrived
     and calculate "specific destination" address.
   - check, that packet arrived from expected physical interface.
*/

int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
                        struct net_device *dev, __be32 *spec_dst, u32 *itag)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-6-15 13:01:16 | 显示全部楼层
太感谢了,解决小弟的大问题了,赞!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表