标签:one epo ack lag router ipv6 port members spl
当netif up或link up时,会调用netif_issue_reports,在这里面,对于nd,会重设rs_count,这样,链路启动之后,会重新发送rs。
1 static void 2 netif_issue_reports(struct netif* netif, u8_t report_type) 3 { 22 23 #if LWIP_IPV6 24 if (report_type & NETIF_REPORT_TYPE_IPV6) { 25 #if LWIP_IPV6_MLD 26 /* send mld memberships */ 27 mld6_report_groups(netif); 28 #endif /* LWIP_IPV6_MLD */ 29 #if LWIP_IPV6_SEND_ROUTER_SOLICIT 30 /* Send Router Solicitation messages. */ 31 netif->rs_count = LWIP_ND6_MAX_MULTICAST_SOLICIT; 32 #endif /* LWIP_IPV6_SEND_ROUTER_SOLICIT */ 33 } 34 #endif /* LWIP_IPV6 */ 35 }
当netif down时(link down没有),会清空nd的前缀、邻居、路由器、目的地缓存(IPv4会清空arp缓存)
1 void 2 netif_set_down(struct netif *netif) 3 { 4 if (netif->flags & NETIF_FLAG_UP) { 5 netif->flags &= ~NETIF_FLAG_UP; 6 MIB2_COPY_SYSUPTIME_TO(&netif->ts); 7 8 #if LWIP_IPV6 9 nd6_cleanup_netif(netif); 10 #endif /* LWIP_IPV6 */ 11 12 NETIF_STATUS_CALLBACK(netif); 13 } 14 }
在nd6_cleanup_netif中,
1 void 2 nd6_cleanup_netif(struct netif *netif) 3 { 4 u8_t i; 5 s8_t router_index; 6 for (i = 0; i < LWIP_ND6_NUM_PREFIXES; i++) { 7 if (prefix_list[i].netif == netif) { 8 prefix_list[i].netif = NULL; 9 prefix_list[i].flags = 0; 10 } 11 } 12 for (i = 0; i < LWIP_ND6_NUM_NEIGHBORS; i++) { 13 if (neighbor_cache[i].netif == netif) { 14 for (router_index = 0; router_index < LWIP_ND6_NUM_ROUTERS; router_index++) { 15 if (default_router_list[router_index].neighbor_entry == &neighbor_cache[i]) { 16 default_router_list[router_index].neighbor_entry = NULL; 17 default_router_list[router_index].flags = 0; 18 } 19 } 20 neighbor_cache[i].isrouter = 0; 21 nd6_free_neighbor_cache_entry(i); 22 } 23 } 24 }
标签:one epo ack lag router ipv6 port members spl
原文地址:https://www.cnblogs.com/yanhc/p/8970675.html