zoukankan      html  css  js  c++  java
  • LwIP与IPv6

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

  • 相关阅读:
    PF不明内存泄露已解决,白头发也没了(转)
    第06篇 MEF部件的生命周期(PartCreationPolicy)
    [MEF]第05篇 MEF的目录(Catalog)筛选
    [MEF]第04篇 MEF的多部件导入(ImportMany)和目录服务
    [MEF]第03篇 MEF延迟加载导出部件及元数据
    [MEF]第02篇 MEF的导入导出契约
    关于android的设备管理器-DevicePolicyManager(二)
    android KK版本号收到短信后,点亮屏的操作
    windows server 2008 安装Microsoft ActiveSync 6.1提示缺少一个Windows Mobile设备中心所须要的Windows组件
    设计模式
  • 原文地址:https://www.cnblogs.com/yanhc/p/7638167.html
Copyright © 2011-2022 走看看