mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 14:29:39 +00:00
netif.h, netif.c: A new NETIF_FLAG_ETHARP flag is defined in netif.h, to allow to initialize a network interface's flag with. It tell this interface is an ethernet device, and we can use ARP with it to do a "gratuitous ARP" (RFC 3220 "IP Mobility Support for IPv4" section 4.6) when interface is "up" with netif_set_up().
This commit is contained in:
parent
4aee4c1ac7
commit
cd1c96db56
@ -23,6 +23,12 @@ HISTORY
|
||||
|
||||
++ New features:
|
||||
|
||||
2007-03-28 Frédéric Bernon
|
||||
* netif.h, netif.c: A new NETIF_FLAG_ETHARP flag is defined in netif.h, to allow to
|
||||
initialize a network interface's flag with. It tell this interface is an ethernet
|
||||
device, and we can use ARP with it to do a "gratuitous ARP" (RFC 3220 "IP Mobility
|
||||
Support for IPv4" section 4.6) when interface is "up" with netif_set_up().
|
||||
|
||||
2007-03-26 Frédéric Bernon, Jonathan Larmour
|
||||
* opt.h, tcpip.c: New configuration option LWIP_ARP allow to disable ARP init at build
|
||||
time if you only use PPP or SLIP. The default is enable. Note we don't have to call
|
||||
|
@ -44,6 +44,11 @@
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/snmp.h"
|
||||
|
||||
#if LWIP_ARP
|
||||
#include "netif/etharp.h"
|
||||
#endif /* LWIP_ARP */
|
||||
|
||||
|
||||
struct netif *netif_list = NULL;
|
||||
struct netif *netif_default = NULL;
|
||||
|
||||
@ -219,14 +224,6 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
||||
snmp_insert_ipaddridx_tree(netif);
|
||||
snmp_insert_iprteidx_tree(0,netif);
|
||||
|
||||
#if 0 /* only allowed for Ethernet interfaces TODO: how can we check? */
|
||||
/** 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.
|
||||
*/
|
||||
etharp_query(netif, ipaddr, NULL);
|
||||
#endif
|
||||
LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: IP address of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
|
||||
netif->name[0], netif->name[1],
|
||||
ip4_addr1(&netif->ip_addr),
|
||||
@ -296,11 +293,24 @@ void netif_set_up(struct netif *netif)
|
||||
|
||||
#if LWIP_SNMP
|
||||
snmp_get_sysuptime(&netif->ts);
|
||||
#endif
|
||||
#endif /* LWIP_SNMP */
|
||||
|
||||
#if LWIP_NETIF_CALLBACK
|
||||
if ( netif->status_callback )
|
||||
(netif->status_callback)( netif );
|
||||
#endif /* LWIP_NETIF_CALLBACK */
|
||||
|
||||
#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) == 0) {
|
||||
etharp_query(netif, &(netif->ip_addr), NULL);
|
||||
}
|
||||
#endif /* LWIP_ARP */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,8 @@
|
||||
/** if set, the interface has an active link
|
||||
* (set by the network interface driver) */
|
||||
#define NETIF_FLAG_LINK_UP 0x10U
|
||||
/** if set, the netif is an device using ARP */
|
||||
#define NETIF_FLAG_ETHARP 0x20U
|
||||
|
||||
/** Generic data structure used for all lwIP network interfaces.
|
||||
* The following fields should be filled in by the initialization
|
||||
@ -101,7 +103,7 @@ struct netif {
|
||||
#if LWIP_DHCP
|
||||
/** the DHCP client state information for this netif */
|
||||
struct dhcp *dhcp;
|
||||
#endif
|
||||
#endif /* LWIP_DHCP */
|
||||
/** number of bytes used in hwaddr */
|
||||
u8_t hwaddr_len;
|
||||
/** link level hardware address of this interface */
|
||||
@ -130,11 +132,11 @@ struct netif {
|
||||
u32_t ifoutucastpkts;
|
||||
u32_t ifoutnucastpkts;
|
||||
u32_t ifoutdiscards;
|
||||
#endif
|
||||
#endif /* LWIP_SNMP */
|
||||
#if LWIP_IGMP
|
||||
/* This function could be called to add or delete a entry in the multicast filter table of the ethernet MAC.*/
|
||||
err_t (*igmp_mac_filter)( struct netif *netif, struct ip_addr *group, u8_t action);
|
||||
#endif
|
||||
#endif /* LWIP_IGMP */
|
||||
};
|
||||
|
||||
/** The list of network interfaces. */
|
||||
|
Loading…
Reference in New Issue
Block a user