uint8 * res_arp(
struct iface *iface, /* Pointer to interface block */
enum arp_hwtype hardware, /* Hardware type */
int32 target, /* Target IP address */
struct mbuf **bpp) /* IP datagram to be queued if unresolved */
{
register struct arp_tab *arp;
struct ip ip;
if((arp = arp_lookup(hardware,target)) != NULL && arp->state == ARP_VALID)
return arp->hw_addr;
if(arp != NULL){
/* Earlier packets are already pending, kick this one back
* as a source quench
*/
ntohip(&ip,bpp);
icmp_output(&ip,*bpp,ICMP_QUENCH,0,NULL);
free_p(bpp);
} else {
/* Create an entry and put the datagram on the
* queue pending an answer
*/
arp = arp_add(target,hardware,NULL,0);
enqueue(&arp->pending,bpp);
arp_output(iface,hardware,target);
}
return NULL;
}
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
全部0条评论
快来发表一下你的评论吧 !