Reads or creates new arp entries so that hardware addresses can be resolved.
int arpresolve_common ( ac, m, arpwhohas, dst, hwaddr, szhwaddr, extra, if_dependent)
register struct arpcom *ac;
struct mbuf *m;
int (*arpwhohas)(register struct arpcom *ac,
struct in_addr *addr, int skipbestif, void *extra),
struct sockaddr_in *dst;
u_char * hwaddr;
int szhwaddr;
void *extra;
union if_dependent *if_dependent;
The arpresolve_common subroutine reads or creates new arp entries so that hardware addresses can be resolved. It is called by arpresolve from the IF layer of the interface. If the arp entry is complete, then arpresolve_common returns the address pointed to by hwaddr and the data pointed to by if_dependent if if_dependent is true. If the arp entry is not complete, then this subroutine adds the memory buffer pointed to by mbuf to at_hold. at_hold holds one or more packets that are waiting for the arp entry to complete so they can be transmitted.
If an arp entry does not exist, arpresolve_common creates a new entry by calling arptnew and then adds the memory buffer pointed to by mbuf to at_hold. This subroutine calls arpwhohas when it creates a new arp entry or when the timer for the incomplete arp entry (with the IP address that is pointed to by dst) has expired.
Item | Description |
---|---|
ac | Points to the arpcom structure. |
m | Points to the memory buffer (mbuf), which will be added to the list awaiting completion of the arp table entry. |
arpwhohas | Points to the arpwhohas subroutine. |
addr | Points to the in_addr structure's address. |
extra | A void pointer that can be used in the future so that IF layers can pass extra structures to arpwhohas. |
dst | Points to the sockaddr_in structure. This structure has the destination IP address. |
hwaddr | Points to the buffer. This buffer contains the hardware address if it finds a completed entry. |
szhwaddr | Size of the buffer pointed to by hwaddr. |
if_dependent | Pointer to the if_dependent structure. arpresolve_common uses this to pass the if_dependent data, which is part of the arptab entry, to the calling function. |
Item | Description |
---|---|
ARP_MBUF | The arp entry is not complete. |
ARP_HWADDR | The hwaddr buffer is filled with the hardware address. |
ARP_FLG_NOARP | The arp entry does not exist, and the IFF_NOARP flag is set only if the value of if_type is IFT_ETHER. |