linux路由内核实现分析(四)---路由缓存机制(2)
2013-07-10 12:31
531 查看
dst_entry结构
struct dst_entry
{
struct rcu_head rcu_head;
struct dst_entry *child;
struct net_device *dev;
short error;
short obsolete;
int flags;
#define DST_HOST 1
#define DST_NOXFRM 2
#define DST_NOPOLICY 4
#define DST_NOHASH 8
unsigned long expires;
unsigned short header_len;
unsigned short nfheader_len;
unsigned short trailer_len;
u32 metrics[RTAX_MAX];
struct dst_entry *path;
unsigned long rate_last;
unsigned long rate_tokens;
struct neighbour *neighbour;
struct hh_cache *hh;
struct xfrm_state *xfrm;
int (*input)(struct sk_buff*);
int (*output)(struct sk_buff*);
#ifdef CONFIG_NET_CLS_ROUTE
__u32 tclassid;
#endif
struct dst_ops *ops;
unsigned long lastuse;
atomic_t __refcnt;
int __use;
union {
struct dst_entry *next;
struct rtable *rt_next;
struct rt6_info *rt6_next;
struct dn_route *dn_next;
};
char info[0];
};
struct net_device *dev; //用于网络接口的指针
int __use; //该表项已经被使用的次数(即缓存查找返回该表项的次数)
short error; //当fib_lookup失败时,错误值被保存在error(用一个正值)
中,在ip_error成员中使用该值来决定如何处理本次路由查找失败(即决定生成哪一类ICMP消息)。
struct neighbour *neighbour; //这个路由路径上下一个neighbour结构的指针。
int (*input)(struct sk_buff*);
int (*output)(struct sk_buff*);
//input 和 output 分别对应着在IP层的输入和输出函数,output对应着下一层发送数据的函数(dev_queue_xmit),input对应着向上一层发送数据的函数(例如tcp_recv)
这几个结构的关系如下:
用rt_hash_bucket来管理一张哈希表,存储了rtable结构,rtable结构中内含的dst_entry结构可以找出邻居节点,用以确认next hop
struct dst_entry
{
struct rcu_head rcu_head;
struct dst_entry *child;
struct net_device *dev;
short error;
short obsolete;
int flags;
#define DST_HOST 1
#define DST_NOXFRM 2
#define DST_NOPOLICY 4
#define DST_NOHASH 8
unsigned long expires;
unsigned short header_len;
unsigned short nfheader_len;
unsigned short trailer_len;
u32 metrics[RTAX_MAX];
struct dst_entry *path;
unsigned long rate_last;
unsigned long rate_tokens;
struct neighbour *neighbour;
struct hh_cache *hh;
struct xfrm_state *xfrm;
int (*input)(struct sk_buff*);
int (*output)(struct sk_buff*);
#ifdef CONFIG_NET_CLS_ROUTE
__u32 tclassid;
#endif
struct dst_ops *ops;
unsigned long lastuse;
atomic_t __refcnt;
int __use;
union {
struct dst_entry *next;
struct rtable *rt_next;
struct rt6_info *rt6_next;
struct dn_route *dn_next;
};
char info[0];
};
struct net_device *dev; //用于网络接口的指针
int __use; //该表项已经被使用的次数(即缓存查找返回该表项的次数)
short error; //当fib_lookup失败时,错误值被保存在error(用一个正值)
中,在ip_error成员中使用该值来决定如何处理本次路由查找失败(即决定生成哪一类ICMP消息)。
struct neighbour *neighbour; //这个路由路径上下一个neighbour结构的指针。
int (*input)(struct sk_buff*);
int (*output)(struct sk_buff*);
//input 和 output 分别对应着在IP层的输入和输出函数,output对应着下一层发送数据的函数(dev_queue_xmit),input对应着向上一层发送数据的函数(例如tcp_recv)
这几个结构的关系如下:
用rt_hash_bucket来管理一张哈希表,存储了rtable结构,rtable结构中内含的dst_entry结构可以找出邻居节点,用以确认next hop
相关文章推荐
- linux路由内核实现分析(四)---路由缓存机制(1)
- linux路由内核实现分析(四)---路由缓存机制(3)
- linux路由内核实现分析(四)---路由缓存机制(4)
- linux路由内核实现分析(四)---路由缓存机制
- Linux内核抢占实现机制分析(转)
- Linux内核抢占实现机制分析
- linux路由内核实现分析(二)---FIB相关数据结构(3)
- Linux内核抢占实现机制分析(转)
- Linux内核抢占实现机制分析
- Linux内核抢占实现机制分析
- linux路由内核实现分析(二)---FIB相关数据结构(4)
- linux路由内核实现分析(一)----邻居子节点
- linux路由内核实现分析(三)---路由查找过程
- linux内核抢占实现机制分析
- linux路由内核实现分析(二)---FIB相关数据结构
- linux路由内核实现分析(三)---路由查找过程
- linux路由内核实现分析(一)----邻居子节点(1)
- Linux2.6内核 ACL 机制数据结构和实现分析
- Linux 2.6内核ACL机制数据结构和实现分析
- linux路由内核实现分析(一)----邻居子节点(2)