third_party/lwip/repo/lwip/src/core/netif.c
/**
 * Remove a network interface from the list of lwIP netifs.
 *
 * @param netif the network interface to remove
 */
Remove a network interface from the list of lwIP netifs.
@param netif the network interface to remove
Remove a network interface from the list of lwIP netifs . @param netif the network interface to remove
void
netif_remove(struct netif *netif)
{
  if (netif == NULL) {
    return;
  }
#if LWIP_IGMP
  if (netif->flags & NETIF_FLAG_IGMP) {
    igmp_stop(netif);
  }
#endif 
#if LWIP_IPV6 && LWIP_IPV6_MLD
  mld6_stop(netif);
#endif 
  if (netif_is_up(netif)) {
    netif_set_down(netif);
  }
  snmp_delete_ipaddridx_tree(netif);
  if (netif_list == netif) {
    netif_list = netif->next;
  } else {
    struct netif * tmpNetif;
    for (tmpNetif = netif_list; tmpNetif != NULL; tmpNetif = tmpNetif->next) {
      if (tmpNetif->next == netif) {
        tmpNetif->next = netif->next;
        break;
      }
    }
    if (tmpNetif == NULL)
      return; 
  }
  snmp_dec_iflist();
  if (netif_default == netif) {
    netif_set_default(NULL);
  }
#if LWIP_NETIF_REMOVE_CALLBACK
  if (netif->remove_callback) {
    netif->remove_callback(netif);
  }
#endif 
  LWIP_DEBUGF( NETIF_DEBUG, ("netif_remove: removed netif\n") );
}
void netif_remove ( struct netif * netif ) { if ( netif == NULL ) { return ; } #if LWIP_IGMP if ( netif -> flags & NETIF_FLAG_IGMP ) { igmp_stop ( netif ) ; } #endif #if LWIP_IPV6 && LWIP_IPV6_MLD mld6_stop ( netif ) ; #endif if ( netif_is_up ( netif ) ) { netif_set_down ( netif ) ; } snmp_delete_ipaddridx_tree ( netif ) ; if ( netif_list == netif ) { netif_list = netif -> next ; } else { struct netif * tmpNetif ; for ( tmpNetif = netif_list ; tmpNetif != NULL ; tmpNetif = tmpNetif -> next ) { if ( tmpNetif -> next == netif ) { tmpNetif -> next = netif -> next ; break ; } } if ( tmpNetif == NULL ) return ; } snmp_dec_iflist ( ) ; if ( netif_default == netif ) { netif_set_default ( NULL ) ; } #if LWIP_NETIF_REMOVE_CALLBACK if ( netif -> remove_callback ) { netif -> remove_callback ( netif ) ; } #endif LWIP_DEBUGF ( NETIF_DEBUG , ( " \n " ) ) ; }
Remove a network interface from the list of lwIP netifs.
Remove a network interface from the list of lwIP netifs .
/* stop IGMP processing */ /* LWIP_IGMP */ /* stop MLD processing */ /* LWIP_IPV6 && LWIP_IPV6_MLD */ /* set netif down before removing (call callback function) */ /*  is it the first netif? */ /*  look for netif further down the list */ /*  we didn't find any netif today */ /* this netif is default? */ /* reset default netif */ /* LWIP_NETIF_REMOVE_CALLBACK */