.type = cpu_to_be16( ETH_P_ARP),
.func = arp_rcv,
};
{
neigh_table_init(& arp_tbl ); 初始化arp邻居表
dev_add_pack(&arp_packet_type); 注册三层处理协议类型 arp
arp_proc_init(); /proc文件系统相关arp部分创建
#ifdef CONFIG_SYSCTL
neigh_sysctl_register(NULL, &arp_tbl.parms, NET_IPV4,
NET_IPV4_NEIGH, "ipv4", NULL, NULL);
#endif
register_netdevice_notifier(&arp_netdev_notifier); 注册通知链
}
break;
}
tbl->next = neigh_tables;
neigh_tables = tbl;
{
struct neigh_table *next;
int family; 协议族
int entry_size; 邻居项的大小 为sizeof(struct neighbour) + 4 考虑到有零长数组
__u32 (*hash)(const void *pkey, const struct net_device *); hash函数
int (*constructor)(struct neighbour *);
int (*pconstructor)(struct pneigh_entry *);
void (*pdestructor)(struct pneigh_entry *);
void (*proxy_redo)(struct sk_buff *skb);
char *id;
struct neigh_parms parms;
/* HACK. gc_* shoul follow parms without a gap! */
int gc_interval; 常规的垃圾回收间隔时间 默认30秒
int gc_thresh1; 门限
int gc_thresh2;
int gc_thresh3;
unsigned long last_flush;
struct delayed_work gc_work; 常规的垃圾回收定时器
struct timer_list proxy_timer;
struct sk_buff_head proxy_queue;
atomic_t entries; 整个表中邻居项的个数 当entries大于hash_mask+1,哈希桶增长为原来的两倍
rwlock_t lock;
unsigned long last_rand;
struct kmem_cache *kmem_cachep;
struct neigh_statistics *stats;
struct neighbour **hash_buckets; 存放邻居项的哈希桶
unsigned int hash_mask; hash桶大
1402



被折叠的 条评论
为什么被折叠?



