提交 289aa30c 编写于 作者: M mbbill

FIX: Setting the 'flags' to 0 will overwrite NETIF_FLAG_BROADCAST, see...

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
上级 0eaf2098
......@@ -63,13 +63,13 @@
#define NETIF_STATUS_CALLBACK(n) { if (n->status_callback) (n->status_callback)(n); }
#else
#define NETIF_STATUS_CALLBACK(n) { /* NOP */ }
#endif /* LWIP_NETIF_STATUS_CALLBACK */
#endif /* LWIP_NETIF_STATUS_CALLBACK */
#if LWIP_NETIF_LINK_CALLBACK
#define NETIF_LINK_CALLBACK(n) { if (n->link_callback) (n->link_callback)(n); }
#else
#define NETIF_LINK_CALLBACK(n) { /* NOP */ }
#endif /* LWIP_NETIF_LINK_CALLBACK */
#endif /* LWIP_NETIF_LINK_CALLBACK */
struct netif *netif_list;
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->netmask.addr = 0;
netif->gw.addr = 0;
netif->flags = 0;
/* netif->flags = 0; */
#if LWIP_DHCP
/* netif not under DHCP control by default */
netif->dhcp = NULL;
......@@ -389,17 +390,17 @@ netif_set_default(struct netif *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 */
......@@ -408,7 +409,7 @@ void netif_set_up(struct netif *netif)
NETIF_STATUS_CALLBACK(netif);
#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) {
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
* up once configured.
*
*
* @see dhcp_start()
*/
*/
void netif_set_down(struct netif *netif)
{
if ( netif->flags & NETIF_FLAG_UP )
......@@ -439,7 +440,7 @@ void netif_set_down(struct netif *netif)
#if LWIP_SNMP
snmp_get_sysuptime(&netif->ts);
#endif
NETIF_LINK_CALLBACK(netif);
NETIF_STATUS_CALLBACK(netif);
}
......@@ -447,7 +448,7 @@ void netif_set_down(struct netif *netif)
/**
* Ask if an interface is up
*/
*/
u8_t netif_is_up(struct netif *netif)
{
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 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) {
etharp_gratuitous(netif);
}
......@@ -513,7 +514,7 @@ void netif_set_link_down(struct netif *netif )
/**
* Ask if a link is up
*/
*/
u8_t netif_is_link_up(struct netif *netif)
{
return (netif->flags & NETIF_FLAG_LINK_UP) ? 1 : 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册