Han 通过 Google 阅读器发送给您的内容: 浅析Linux Kernel 哈希路由表实现(二) 于 11-3-15 通过 basic coder 作者:levin 在向外发送数据包的时候,首先需要查询路由表来确定路由包的路由,主要由ip_route_output_key()函数来完成,该函数又调用了ip_route_output_flow(),而这个函数最终又调用了__ip_route_output_key()这个函数来进行路由的查询,下面主要来看一下这个函数: int __ip_route_output_key ( struct net * net , struct rtable ** rp , const struct flowi * flp ) { unsigned int hash ; int res ; struct rtable * rth ; if ( ! rt_caching ( net ) ) goto slow_output ; hash = rt_hash ( flp -> fl4_dst , flp -> fl4_src , flp -> oif , rt_genid ( net ) ) ; rcu_read_lock_bh ( ) ; for ( rth = rcu_dereference_bh ( rt_hash_table [ hash ] . chain ) ; rth ; rth = rcu_dereference_bh ( rth -> dst. rt_next ) ) { if ( rth -> fl. fl4_dst == flp -> fl4_dst && rth -> fl. fl4_src == flp -...
评论
发表评论