lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #53803] nd6_cleanup_netif should set the auto-configur


From: hongchengyan
Subject: [lwip-devel] [bug #53803] nd6_cleanup_netif should set the auto-configured address to invalid
Date: Tue, 1 May 2018 09:02:10 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

URL:
  <http://savannah.nongnu.org/bugs/?53803>

                 Summary: nd6_cleanup_netif should set the auto-configured
address to invalid
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: yanhc
            Submitted on: Tue 01 May 2018 01:02:08 PM UTC
                Category: IPv6
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.0.2

    _______________________________________________________

Details:

nd6_cleanup_netif in nd6.c should set the auto-configured address to invalid.
nd6_cleanup_netif is called in netif_set_down.
I use my PC to send router advertisement (ra) packet to my board. My test
procedure is as follows:
(1)plug the ethernet cable and send ra with prefix A, new address will be
generated in slot 2 (slot 0 is link local and slot 1 is manually configured,
so slot 2 is for auto configuration);
(2)unplug the ethernet cable;
(3)re-plug the ethernet cable, and send ra with prefix B, no new address will
be generated.
I checked the state of the generated address of slot 2 and it is still
prefered when the cable is unplugged. So, when I re-plug the cable, even ND
receives a new prefix, it will not reconfigure the slot 2.
I think nd6_cleanup_netif should set the auto-configured address to invalid.
This is sound, since the prefix is removed and the auto-configured address
should also be removed.

I add the following routine (between macro LWIP_IPV6_AUTOCONFIG, same as in
nd6_tmr) in nd6_cleanup_netif as follows and everything goes fine.

void
nd6_cleanup_netif(struct netif *netif)
{
  u8_t i;
  s8_t router_index;
  for (i = 0; i < LWIP_ND6_NUM_PREFIXES; i++) {
    if (prefix_list[i].netif == netif) {
#if LWIP_IPV6_AUTOCONFIG        /* added by yanhc 2018.05.01 */
      /* If any addresses were configured with this prefix, remove them */
      if (prefix_list[i].flags & ND6_PREFIX_AUTOCONFIG_ADDRESS_GENERATED) {
        s8_t j;
                for (j = 1; j < LWIP_IPV6_NUM_ADDRESSES; j++) {
                  if ((netif_ip6_addr_state(prefix_list[i].netif, j) != 
IP6_ADDR_INVALID)
&&
                      ip6_addr_netcmp(&prefix_list[i].prefix,
netif_ip6_addr(prefix_list[i].netif, j))) {
                    netif_ip6_addr_set_state(prefix_list[i].netif, j, 
IP6_ADDR_INVALID);
                        prefix_list[i].flags = 0;
                        
                        /* Exit loop. */
            break;
                  }
                }
          }
#endif /* LWIP_IPV6_AUTOCONFIG */
      prefix_list[i].netif = NULL;
    }
  }




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?53803>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]