mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-12-10 08:46:40 +08:00
Several source comment changes.
This commit is contained in:
parent
73a095572e
commit
5df9545dcc
@ -4,8 +4,10 @@
|
|||||||
*
|
*
|
||||||
* Functionally, ARP is divided into two parts. The first maps an IP address
|
* Functionally, ARP is divided into two parts. The first maps an IP address
|
||||||
* to a physical address when sending a packet, and the second part answers
|
* to a physical address when sending a packet, and the second part answers
|
||||||
* requests from other machines.
|
* requests from other machines for our physical address.
|
||||||
*
|
*
|
||||||
|
* This implementation complies with RFC 826 (Ethernet ARP) and supports
|
||||||
|
* Gratuitious ARP from RFC3220 (IP Mobility Support for IPv4) section 4.6.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -497,9 +499,9 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
|||||||
* returned, ready to be sent.
|
* returned, ready to be sent.
|
||||||
*
|
*
|
||||||
* If ARP does not have the Ethernet address in cache the packet is
|
* If ARP does not have the Ethernet address in cache the packet is
|
||||||
* queued and a ARP request is sent (on a best-effort basis). This
|
* queued (if enabled and space available) and a ARP request is sent.
|
||||||
* ARP request is returned as a pbuf, which should be sent by the
|
* This ARP request is returned as a pbuf, which should be sent by
|
||||||
* caller.
|
* the caller.
|
||||||
*
|
*
|
||||||
* If ARP failed to allocate resources, NULL is returned.
|
* If ARP failed to allocate resources, NULL is returned.
|
||||||
*
|
*
|
||||||
@ -509,7 +511,8 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
|||||||
* @param ipaddr The IP address of the packet destination.
|
* @param ipaddr The IP address of the packet destination.
|
||||||
* @param pbuf The pbuf(s) containing the IP packet to be sent.
|
* @param pbuf The pbuf(s) containing the IP packet to be sent.
|
||||||
*
|
*
|
||||||
* @return If non-NULL, a packet ready to be sent.
|
* @return If non-NULL, a packet ready to be sent by caller.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
struct pbuf *
|
struct pbuf *
|
||||||
etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
||||||
@ -535,9 +538,9 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
|||||||
/* assume unresolved Ethernet address */
|
/* assume unresolved Ethernet address */
|
||||||
dest = NULL;
|
dest = NULL;
|
||||||
/* Construct Ethernet header. Start with looking up deciding which
|
/* Construct Ethernet header. Start with looking up deciding which
|
||||||
MAC address to use as a destination address. Broadcasts and
|
MAC address to use as a destination address. Broadcasts and
|
||||||
multicasts are special, all other addresses are looked up in the
|
multicasts are special, all other addresses are looked up in the
|
||||||
ARP table. */
|
ARP table. */
|
||||||
|
|
||||||
/* destination IP address is an IP broadcast address? */
|
/* destination IP address is an IP broadcast address? */
|
||||||
if (ip_addr_isany(ipaddr) ||
|
if (ip_addr_isany(ipaddr) ||
|
||||||
@ -549,7 +552,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
|||||||
else if (ip_addr_ismulticast(ipaddr)) {
|
else if (ip_addr_ismulticast(ipaddr)) {
|
||||||
/* Hash IP multicast address to MAC address. */
|
/* Hash IP multicast address to MAC address. */
|
||||||
mcastaddr.addr[0] = 0x01;
|
mcastaddr.addr[0] = 0x01;
|
||||||
mcastaddr.addr[1] = 0x0;
|
mcastaddr.addr[1] = 0x00;
|
||||||
mcastaddr.addr[2] = 0x5e;
|
mcastaddr.addr[2] = 0x5e;
|
||||||
mcastaddr.addr[3] = ip4_addr2(ipaddr) & 0x7f;
|
mcastaddr.addr[3] = ip4_addr2(ipaddr) & 0x7f;
|
||||||
mcastaddr.addr[4] = ip4_addr3(ipaddr);
|
mcastaddr.addr[4] = ip4_addr3(ipaddr);
|
||||||
@ -577,7 +580,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Ethernet address for IP destination address is in ARP cache? */
|
/* Ethernet address for IP destination address is in ARP cache? */
|
||||||
for(i = 0; i < ARP_TABLE_SIZE; ++i) {
|
for (i = 0; i < ARP_TABLE_SIZE; ++i) {
|
||||||
/* match found? */
|
/* match found? */
|
||||||
if (arp_table[i].state == ETHARP_STATE_STABLE &&
|
if (arp_table[i].state == ETHARP_STATE_STABLE &&
|
||||||
ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {
|
ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {
|
||||||
@ -588,6 +591,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
|||||||
/* could not find the destination Ethernet address in ARP cache? */
|
/* could not find the destination Ethernet address in ARP cache? */
|
||||||
if (dest == NULL) {
|
if (dest == NULL) {
|
||||||
/* ARP query for the IP address, submit this IP packet for queueing */
|
/* ARP query for the IP address, submit this IP packet for queueing */
|
||||||
|
/* TODO: How do we handle netif->ipaddr == ipaddr? */
|
||||||
etharp_query(netif, ipaddr, q);
|
etharp_query(netif, ipaddr, q);
|
||||||
/* return nothing */
|
/* return nothing */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user