コード例 #1
0
ファイル: ethernetif.c プロジェクト: haitao52198/HD-Elastos
Int32 eth_device_init(struct eth_device * dev, char *name)
{
    UInt8 flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;

#if LWIP_DHCP
    /* DHCP support */
    flags |= NETIF_FLAG_DHCP;
#endif

#if LWIP_IGMP
    /* IGMP support */
    flags |= NETIF_FLAG_IGMP;
#endif

    return eth_device_init_with_flag(dev, name, flags);
}
コード例 #2
0
ファイル: ethernetif.c プロジェクト: gastonfeng/rt-thread
rt_err_t eth_device_init(struct eth_device * dev, char *name)
{
    rt_uint16_t flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;

#if LWIP_IPV6 && LWIP_IPV6_MLD
    /*
    * For hardware/netifs that implement MAC filtering.
    * All-nodes link-local is handled by default, so we must let the hardware know
    * to allow multicast packets in.
    * Should set mld_mac_filter previously. */
    if (netif->mld_mac_filter != NULL) {
        ip6_addr_t ip6_allnodes_ll;
        ip6_addr_set_allnodes_linklocal(&ip6_allnodes_ll);
        netif->mld_mac_filter(netif, &ip6_allnodes_ll, MLD6_ADD_MAC_FILTER);
    }
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */

#if LWIP_IGMP
    /* IGMP support */
    flags |= NETIF_FLAG_IGMP;
#endif

    return eth_device_init_with_flag(dev, name, flags);
}