235 |
{ |
{ |
236 |
u8_t i, k; |
u8_t i, k; |
237 |
#if ARP_QUEUEING |
#if ARP_QUEUEING |
238 |
|
struct pbuf *p; |
239 |
struct eth_hdr *ethhdr; |
struct eth_hdr *ethhdr; |
240 |
#endif |
#endif |
241 |
DEBUGF(ETHARP_DEBUG, ("update_arp_entry()")); |
DEBUGF(ETHARP_DEBUG, ("update_arp_entry()")); |
271 |
arp_table[i].ctime = 0; |
arp_table[i].ctime = 0; |
272 |
#if ARP_QUEUEING |
#if ARP_QUEUEING |
273 |
/* queued packet present? */ |
/* queued packet present? */ |
274 |
if(arp_table[i].p != NULL) { |
if((p = arp_table[i].p) != NULL) { |
275 |
|
/* Null out attached buffer immediately */ |
276 |
|
arp_table[i].p = NULL; |
277 |
/* fill-in Ethernet header */ |
/* fill-in Ethernet header */ |
278 |
ethhdr = arp_table[i].p->payload; |
ethhdr = p->payload; |
279 |
for(k = 0; k < 6; ++k) { |
for(k = 0; k < 6; ++k) { |
280 |
ethhdr->dest.addr[k] = ethaddr->addr[k]; |
ethhdr->dest.addr[k] = ethaddr->addr[k]; |
281 |
} |
} |
282 |
ethhdr->type = htons(ETHTYPE_IP); |
ethhdr->type = htons(ETHTYPE_IP); |
283 |
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: sending queued IP packet.\n")); |
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: sending queued IP packet.\n")); |
284 |
/* send the queued IP packet */ |
/* send the queued IP packet */ |
285 |
netif->linkoutput(netif, arp_table[i].p); |
netif->linkoutput(netif, p); |
286 |
/* free the queued IP packet */ |
/* free the queued IP packet */ |
287 |
pbuf_free(arp_table[i].p); |
pbuf_free(p); |
|
/* remove queued packet from ARP entry (must be freed by the caller) */ |
|
|
arp_table[i].p = NULL; |
|
288 |
} |
} |
289 |
#endif |
#endif |
290 |
return NULL; |
return NULL; |