3 |
* Address Resolution Protocol module for IP over Ethernet |
* Address Resolution Protocol module for IP over Ethernet |
4 |
* |
* |
5 |
* $Log$ |
* $Log$ |
6 |
|
* Revision 1.12 2002/11/28 09:26:18 likewise |
7 |
|
* All ARP queueing code is now conditionally compiled-in. |
8 |
|
* |
9 |
* Revision 1.11 2002/11/18 10:31:05 likewise |
* Revision 1.11 2002/11/18 10:31:05 likewise |
10 |
* Conditionally have ARP queue outgoing pbufs. |
* Conditionally have ARP queue outgoing pbufs. |
11 |
* |
* |
108 |
#ifndef ETHARP_SNOOP_UPDATES |
#ifndef ETHARP_SNOOP_UPDATES |
109 |
# define ETHARP_SNOOP_UPDATES 0 |
# define ETHARP_SNOOP_UPDATES 0 |
110 |
#endif |
#endif |
|
|
|
111 |
|
|
112 |
#define HWTYPE_ETHERNET 1 |
#define HWTYPE_ETHERNET 1 |
113 |
|
|
131 |
struct ip_addr ipaddr; |
struct ip_addr ipaddr; |
132 |
struct eth_addr ethaddr; |
struct eth_addr ethaddr; |
133 |
enum etharp_state state; |
enum etharp_state state; |
134 |
|
#if ARP_QUEUEING |
135 |
struct pbuf *p; |
struct pbuf *p; |
136 |
|
#endif |
137 |
u8_t ctime; |
u8_t ctime; |
138 |
}; |
}; |
139 |
|
|
181 |
(ctime - arp_table[i].ctime >= ARP_MAXPENDING)) { |
(ctime - arp_table[i].ctime >= ARP_MAXPENDING)) { |
182 |
DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired pending entry %u - dequeueing %p.\n", i, arp_table[i].p)); |
DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired pending entry %u - dequeueing %p.\n", i, arp_table[i].p)); |
183 |
arp_table[i].state = ETHARP_STATE_EMPTY; |
arp_table[i].state = ETHARP_STATE_EMPTY; |
184 |
|
#if ARP_QUEUEING |
185 |
/* remove any queued packet */ |
/* remove any queued packet */ |
186 |
pbuf_free(arp_table[i].p); |
pbuf_free(arp_table[i].p); |
187 |
arp_table[i].p = NULL; |
arp_table[i].p = NULL; |
188 |
|
#endif |
189 |
} |
} |
190 |
} |
} |
191 |
} |
} |
246 |
update_arp_entry(struct ip_addr *ipaddr, struct eth_addr *ethaddr, u8_t flags) |
update_arp_entry(struct ip_addr *ipaddr, struct eth_addr *ethaddr, u8_t flags) |
247 |
{ |
{ |
248 |
u8_t i, k; |
u8_t i, k; |
|
struct pbuf *p; |
|
249 |
struct eth_hdr *ethhdr; |
struct eth_hdr *ethhdr; |
250 |
|
#if ARP_QUEUEING |
251 |
|
struct pbuf *p; |
252 |
|
#endif |
253 |
|
|
254 |
/* Walk through the ARP mapping table and try to find an entry to |
/* Walk through the ARP mapping table and try to find an entry to |
255 |
update. If none is found, the IP -> MAC address mapping is |
update. If none is found, the IP -> MAC address mapping is |
278 |
} |
} |
279 |
arp_table[i].ctime = ctime; |
arp_table[i].ctime = ctime; |
280 |
arp_table[i].state = ETHARP_STATE_STABLE; |
arp_table[i].state = ETHARP_STATE_STABLE; |
281 |
|
#if ARP_QUEUEING |
282 |
p = arp_table[i].p; |
p = arp_table[i].p; |
283 |
// queued packet present? */ |
// queued packet present? */ |
284 |
if(p != NULL) { |
if(p != NULL) { |
297 |
} |
} |
298 |
/* return queued packet, if any */ |
/* return queued packet, if any */ |
299 |
return p; |
return p; |
300 |
|
#else |
301 |
|
/* ARP queueing disabled */ |
302 |
|
return NULL; |
303 |
|
#endif |
304 |
} |
} |
305 |
} |
} |
306 |
} |
} |