博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
LwIP与IPv6
阅读量:6002 次
发布时间:2019-06-20

本文共 3453 字,大约阅读时间需要 11 分钟。

2.0.0中才开始支持IPv6,在此版本中改写了SNMP,但还没有IPv6的统计量。目前最新版本是2.0.2,其中SNMP也没有IPv6统计量(哪些?与IP的统计量有何区别?)

1.4.1中虽然有ip6.c,但是非常简单。

,最初的MIB只支持IPv4地址长度,后来IPv6出现后,一开始,人们希望为IPv6增加新的OID,但后来,开始PVI(protocol-version independent)方向发展,即,新增加MIB,这些MIB是PVI的。

没去

(2.0.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)

 

转载于:https://www.cnblogs.com/yanhc/p/7638167.html

你可能感兴趣的文章
Go语言标准库之JSON编解码
查看>>
winpcap 发送数据包
查看>>
cisco 出现 %Error opening tftp://255.255.255.255 错误解决办法
查看>>
VIM编辑器
查看>>
IE主页被篡改 地址框变灰
查看>>
linux上架设l2tp+ipsec ***服务器
查看>>
Facebook和用户界面会如何扭曲你说的话
查看>>
安卓混合开发之Cordova,NativeWebView两种实现
查看>>
git设置socks代理
查看>>
桶排序
查看>>
石化数字化交付
查看>>
如何用windows Live writer 撰写blog
查看>>
RHEL6入门系列之十九,硬盘分区与格式化
查看>>
Linux下升级 OpenSSH
查看>>
标准功能模块组件 -- 名片管理组件,C\S 版本的标准用例程序,可以参考权限实现方法...
查看>>
zygote进程图
查看>>
ldap快速配置
查看>>
docker之docker-machine用法
查看>>
IIS 7启用static JSON文件能POST方法
查看>>
P5205 【模板】多项式开根
查看>>