/**
 * Called by a driver when its link goes up
 */
void netif_set_link_up(struct netif *netif )
{
  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 */
  }
  NETIF_LINK_CALLBACK(netif);
}
/**
 * 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 netif_set_up(struct netif *netif)
{
  if ( !(netif->flags & NETIF_FLAG_UP )) {
    netif->flags |= NETIF_FLAG_UP;
    
#if LWIP_SNMP
    snmp_get_sysuptime(&netif->ts);
#endif /* LWIP_SNMP */

#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 */
  }

    //[MS_CHANGE - move this outside the if statement so we can be notified when DHCP gets an address]
    NETIF_LINK_CALLBACK(netif);
    NETIF_STATUS_CALLBACK(netif);
}
Esempio n. 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 netif_set_up(struct netif *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);
	//printf("netif flag is %d\n\r",(netif->flags& NETIF_FLAG_LINK_UP));
    if (netif->flags & NETIF_FLAG_LINK_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);
		//printf("etharp_gratuitous end\n\r");
      }
#endif /* LWIP_ARP */

#if LWIP_IGMP
      /* resend IGMP memberships */
      if (netif->flags & NETIF_FLAG_IGMP) {
        igmp_report_groups( netif);
      }
#endif /* LWIP_IGMP */
    }
  }
}
Esempio n. 4
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 */
}
Esempio n. 5
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 */

    }
  }
}
Esempio n. 6
0
/**
 * Called by a driver when its link goes up
 */
void netif_set_link_up(struct netif *netif )
{
  netif->flags |= NETIF_FLAG_LINK_UP;

#if LWIP_ARP
  /** For Ethernet network interfaces, we would like to send a
   *  "gratuitous ARP"; this is an ARP packet sent by a node in order
   *  to spontaneously cause other nodes to update an entry in their
   *  ARP cache. From RFC 3220 "IP Mobility Support for IPv4" section 4.6.
   */
  if (netif->flags & NETIF_FLAG_ETHARP) {
    etharp_query(netif, &(netif->ip_addr), NULL);
  }
#endif /* LWIP_ARP */

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

  NETIF_LINK_CALLBACK(netif);
}