FIX: Setting the 'flags' to 0 will overwrite NETIF_FLAG_BROADCAST, see ethernetif.c line 140. Also, the IGMP check is redundant( see netif.c line 153).

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@731 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
mbbill 2010-05-23 19:25:06 +00:00
parent 0eaf2098b8
commit 289aa30c76

View File

@ -63,13 +63,13 @@
#define NETIF_STATUS_CALLBACK(n) { if (n->status_callback) (n->status_callback)(n); } #define NETIF_STATUS_CALLBACK(n) { if (n->status_callback) (n->status_callback)(n); }
#else #else
#define NETIF_STATUS_CALLBACK(n) { /* NOP */ } #define NETIF_STATUS_CALLBACK(n) { /* NOP */ }
#endif /* LWIP_NETIF_STATUS_CALLBACK */ #endif /* LWIP_NETIF_STATUS_CALLBACK */
#if LWIP_NETIF_LINK_CALLBACK #if LWIP_NETIF_LINK_CALLBACK
#define NETIF_LINK_CALLBACK(n) { if (n->link_callback) (n->link_callback)(n); } #define NETIF_LINK_CALLBACK(n) { if (n->link_callback) (n->link_callback)(n); }
#else #else
#define NETIF_LINK_CALLBACK(n) { /* NOP */ } #define NETIF_LINK_CALLBACK(n) { /* NOP */ }
#endif /* LWIP_NETIF_LINK_CALLBACK */ #endif /* LWIP_NETIF_LINK_CALLBACK */
struct netif *netif_list; struct netif *netif_list;
struct netif *netif_default; struct netif *netif_default;
@ -101,7 +101,8 @@ netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
netif->ip_addr.addr = 0; netif->ip_addr.addr = 0;
netif->netmask.addr = 0; netif->netmask.addr = 0;
netif->gw.addr = 0; netif->gw.addr = 0;
netif->flags = 0; /* netif->flags = 0; */
#if LWIP_DHCP #if LWIP_DHCP
/* netif not under DHCP control by default */ /* netif not under DHCP control by default */
netif->dhcp = NULL; netif->dhcp = NULL;
@ -389,17 +390,17 @@ netif_set_default(struct netif *netif)
/** /**
* Bring an interface up, available for processing * Bring an interface up, available for processing
* traffic. * traffic.
* *
* @note: Enabling DHCP on a down interface will make it come * @note: Enabling DHCP on a down interface will make it come
* up once configured. * up once configured.
* *
* @see dhcp_start() * @see dhcp_start()
*/ */
void netif_set_up(struct netif *netif) void netif_set_up(struct netif *netif)
{ {
if ( !(netif->flags & NETIF_FLAG_UP )) { if ( !(netif->flags & NETIF_FLAG_UP )) {
netif->flags |= NETIF_FLAG_UP; netif->flags |= NETIF_FLAG_UP;
#if LWIP_SNMP #if LWIP_SNMP
snmp_get_sysuptime(&netif->ts); snmp_get_sysuptime(&netif->ts);
#endif /* LWIP_SNMP */ #endif /* LWIP_SNMP */
@ -408,7 +409,7 @@ void netif_set_up(struct netif *netif)
NETIF_STATUS_CALLBACK(netif); NETIF_STATUS_CALLBACK(netif);
#if LWIP_ARP #if LWIP_ARP
/* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */ /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
if (netif->flags & NETIF_FLAG_ETHARP) { if (netif->flags & NETIF_FLAG_ETHARP) {
etharp_gratuitous(netif); etharp_gratuitous(netif);
} }
@ -428,9 +429,9 @@ void netif_set_up(struct netif *netif)
* *
* @note: Enabling DHCP on a down interface will make it come * @note: Enabling DHCP on a down interface will make it come
* up once configured. * up once configured.
* *
* @see dhcp_start() * @see dhcp_start()
*/ */
void netif_set_down(struct netif *netif) void netif_set_down(struct netif *netif)
{ {
if ( netif->flags & NETIF_FLAG_UP ) if ( netif->flags & NETIF_FLAG_UP )
@ -439,7 +440,7 @@ void netif_set_down(struct netif *netif)
#if LWIP_SNMP #if LWIP_SNMP
snmp_get_sysuptime(&netif->ts); snmp_get_sysuptime(&netif->ts);
#endif #endif
NETIF_LINK_CALLBACK(netif); NETIF_LINK_CALLBACK(netif);
NETIF_STATUS_CALLBACK(netif); NETIF_STATUS_CALLBACK(netif);
} }
@ -447,7 +448,7 @@ void netif_set_down(struct netif *netif)
/** /**
* Ask if an interface is up * Ask if an interface is up
*/ */
u8_t netif_is_up(struct netif *netif) u8_t netif_is_up(struct netif *netif)
{ {
return (netif->flags & NETIF_FLAG_UP)?1:0; return (netif->flags & NETIF_FLAG_UP)?1:0;
@ -486,7 +487,7 @@ void netif_set_link_up(struct netif *netif )
if (netif->flags & NETIF_FLAG_UP) { if (netif->flags & NETIF_FLAG_UP) {
#if LWIP_ARP #if LWIP_ARP
/* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */ /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
if (netif->flags & NETIF_FLAG_ETHARP) { if (netif->flags & NETIF_FLAG_ETHARP) {
etharp_gratuitous(netif); etharp_gratuitous(netif);
} }
@ -513,7 +514,7 @@ void netif_set_link_down(struct netif *netif )
/** /**
* Ask if a link is up * Ask if a link is up
*/ */
u8_t netif_is_link_up(struct netif *netif) u8_t netif_is_link_up(struct netif *netif)
{ {
return (netif->flags & NETIF_FLAG_LINK_UP) ? 1 : 0; return (netif->flags & NETIF_FLAG_LINK_UP) ? 1 : 0;