LwIP与IPv6
2024-08-28 10:56:37
2.0.0中才开始支持IPv6,在此版本中改写了SNMP,但还没有IPv6的统计量。目前最新版本是2.0.2,其中SNMP也没有IPv6统计量(哪些?与IP的统计量有何区别?)
1.4.1中虽然有ip6.c,但是非常简单。
SNMP MIBs and IPv6,最初的MIB只支持IPv4地址长度,后来IPv6出现后,一开始,人们希望为IPv6增加新的OID,但后来,开始PVI(protocol-version independent)方向发展,即,新增加MIB,这些MIB是PVI的。
没去
(2.0.) ++ Application changes: * Changed netif "up" flag handling to be an administrative flag (as opposed to the previous meaning of
"ip4-address-valid", a netif will now not be used for transmission if not up) -> even a DHCP netif
has to be set "up" before starting the DHCP client
* Added IPv6 support (dual-stack or IPv4/IPv6 only)
* Changed ip_addr_t to be a union in dual-stack mode (use ip4_addr_t where referring to IPv4 only).
* Major rewrite of SNMP (added MIB parser that creates code stubs for custom MIBs);
supports SNMPv2c (experimental v3 support)
* Moved some core applications from contrib repository to src/apps (and include/lwip/apps)
两个版本netif结构体的对比:IPv6每个接口可以配置多个地址(默认3个),地址有状态区分
/** Generic data structure used for all lwIP network interfaces.
* The following fields should be filled in by the initialization
* function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
struct netif {
/** pointer to next in linked list */
struct netif *next; /** IP address configuration in network byte order */
ip_addr_t ip_addr;
ip_addr_t netmask;
ip_addr_t gw; /** Generic data structure used for all lwIP network interfaces.
* The following fields should be filled in by the initialization
* function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
struct netif {
/** pointer to next in linked list */
struct netif *next; #if LWIP_IPV4
/** IP address configuration in network byte order */
ip_addr_t ip_addr;
ip_addr_t netmask;
ip_addr_t gw;
#endif /* LWIP_IPV4 */
#if LWIP_IPV6
/** Array of IPv6 addresses for this netif. */
ip_addr_t ip6_addr[LWIP_IPV6_NUM_ADDRESSES];
/** The state of each IPv6 address (Tentative, Preferred, etc).
* @see ip6_addr.h */
u8_t ip6_addr_state[LWIP_IPV6_NUM_ADDRESSES];
#endif /* LWIP_IPV6 */
两个版本IPv6路由函数对比,新版本会判断是否是link local地址等等。
/* ip_route:
*
* Finds the appropriate network interface for a given IP address. It searches the
* list of network interfaces linearly. A match is found if the masked IP address of
* the network interface equals the masked IP address given to the function.
*/
struct netif *
ip_route(struct ip_addr *dest)
{
struct netif *netif; for(netif = netif_list; netif != NULL; netif = netif->next) {
if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
return netif;
}
}
return netif_default;
} /**
* Finds the appropriate network interface for a given IPv6 address. It tries to select
* a netif following a sequence of heuristics:
* 1) if there is only 1 netif, return it
* 2) if the destination is a link-local address, try to match the src address to a netif.
* this is a tricky case because with multiple netifs, link-local addresses only have
* meaning within a particular subnet/link.
* 3) tries to match the destination subnet to a configured address
* 4) tries to find a router
* 5) tries to match the source address to the netif
* 6) returns the default netif, if configured
*
* @param src the source IPv6 address, if known
* @param dest the destination IPv6 address for which to find the route
* @return the netif on which to send to reach dest
*/
struct netif *
ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
最新文章
- web项目中各种路径的获取
- 某app客户端数字签名分析
- maven web项目build失败
- .net 后台设置meta的属性(keywords,description)
- Oracle中对表的操作
- Spring安全框架 Spring Security
- 【ANT】taskdef class org.programmerplanet.ant.taskdefs.jmeter.JMeterTask cannot be found using the classloader AntClassLoader[]解决办法
- 对网易云音乐参数(params,encSecKey)的分析
- Android自定义底部带有动画的Dialog
- BZOJ_4439_[Swerc2015]Landscaping_最小割
- mysql-笔记-命名、索引规范
- Android Studio 常用快捷键及常用设置
- 准备学习wrf
- Java多线程(七)——线程休眠
- Node_初步了解(3)回调,作用域,上下文
- 初始C#(二)
- 【转】Entity Framework 复杂类型
- (转)IBM AppScan 安全漏洞问题修复(.net)
- pytest 入门及运行
- source insight完全卸载
热门文章
- python命名空间(namespace)
- Unable to open debugger port (127.0.0.1:57046): java.net.SocketException ";so
- eclipse git导入的项目 让修改后的文件带有黑色星标记样式
- pymysql 增
- 《爬虫学习》(二)(urllib库使用)
- maven报错:Return code is: 501 , ReasonPhrase:HTTPS Required
- Java中SMB的应用
- 嗯 想写个demo 苦于没数据
- 安全性与收尾工作 运用过滤器进行授权 精通ASP-NET-MVC-5-弗瑞曼
- 对于Makefile的基本使用