Exemple #1
0
/** Send ARP/IGMP/MLD/RS events, e.g. on link-up/netif-up or addr-change
 */
static void
netif_issue_reports(struct netif* netif, u8_t report_type)
{
#if LWIP_IPV4
  if ((report_type & NETIF_REPORT_TYPE_IPV4) &&
      !ip4_addr_isany_val(*netif_ip4_addr(netif))) {
#if LWIP_ARP
    /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
    if (netif->flags & (NETIF_FLAG_ETHARP)) {
      etharp_gratuitous(netif);
    }
#endif /* LWIP_ARP */

#if LWIP_IGMP
    /* resend IGMP memberships */
    if (netif->flags & NETIF_FLAG_IGMP) {
      igmp_report_groups(netif);
    }
#endif /* LWIP_IGMP */
  }
#endif /* LWIP_IPV4 */

#if LWIP_IPV6
  if (report_type & NETIF_REPORT_TYPE_IPV6) {
#if LWIP_IPV6_MLD
    /* send mld memberships */
    mld6_report_groups(netif);
#endif /* LWIP_IPV6_MLD */
#if LWIP_IPV6_SEND_ROUTER_SOLICIT
    /* Send Router Solicitation messages. */
    netif->rs_count = LWIP_ND6_MAX_MULTICAST_SOLICIT;
#endif /* LWIP_IPV6_SEND_ROUTER_SOLICIT */
  }
#endif /* LWIP_IPV6 */
}
Exemple #2
0
/**
 * Called by a driver when its link goes up
 */
void
if_set_link_up (struct interface *netif)
{
    if (!(netif->flags & NETIF_FLAG_LINK_UP))
    {
        netif->flags |= NETIF_FLAG_LINK_UP;

#if LWIP_DHCP
        if (netif->dhcp)
        {
            dhcp_network_changed (netif);
        }
#endif /* LWIP_DHCP */

#if LWIP_AUTOIP
        if (netif->autoip)
        {
            autoip_network_changed (netif);
        }
#endif /* LWIP_AUTOIP */

        if (netif->flags & NETIF_FLAG_UP)
        {
#if LWIP_ARP
            /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
            if (netif->flags & NETIF_FLAG_ETHARP)
            {
                etharp_gratuitous (netif);
            }
#endif /* LWIP_ARP */

#if LWIP_IGMP
            /* resend IGMP memberships */
            if (netif->flags & NETIF_FLAG_IGMP)
            {
                igmp_report_groups (netif);
            }
#endif /* LWIP_IGMP */
#if LWIP_IPV6 && LWIP_IPV6_MLD
      /* send mld memberships */
      mld6_report_groups( netif);
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
    }
    NETIF_LINK_CALLBACK(netif);
  }
}
Exemple #3
0
/**
 * Bring an interface up, available for processing
 * traffic.
 * 
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */
void
if_set_up (struct interface *netif)
{
    if (!(netif->flags & NETIF_FLAG_UP))
    {
        netif->flags |= NETIF_FLAG_UP;

#if LWIP_SNMP
        snmp_get_sysuptime (&netif->ts);
#endif /* LWIP_SNMP */

        NETIF_STATUS_CALLBACK (netif);

        if (netif->flags & NETIF_FLAG_LINK_UP)
        {
#ifdef CONFIG_OPENSWITCH_TCP_IP
#if LWIP_ARP
            /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
            if (netif->flags & (NETIF_FLAG_ETHARP))
            {
                etharp_gratuitous (netif);
            }
#endif /* LWIP_ARP */
#endif

#if 0
            /* resend IGMP memberships */
            if (netif->flags & NETIF_FLAG_IGMP)
            {
                igmp_report_groups (netif);
            }
#endif /* LWIP_IGMP */
#if LWIP_IPV6 && LWIP_IPV6_MLD
      /* send mld memberships */
      mld6_report_groups( netif);
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */

#if LWIP_IPV6_SEND_ROUTER_SOLICIT
      /* Send Router Solicitation messages. */
      netif->rs_count = LWIP_ND6_MAX_MULTICAST_SOLICIT;
#endif /* LWIP_IPV6_SEND_ROUTER_SOLICIT */

    }
  }
}