arpupdate Subroutine

Purpose

Updates arp entries for a given IP address.

Syntax

int arpupdate (ac, m, hp, action, prm) 
      register struct arpcom *ac; 
      struct mbuf *m; 
      caddr_t hp; 
      int action; 
      struct arpupdate_parm *prm;

Description

The arpupdate subroutine updates arp entries for a given IP address. It is called by arpinput from the IF layer of the interface. This subroutine searches the arp table for an entry that matches the IP address. It then updates the arp entry for the given IP address. The arpupdate subroutine also performs reverse arp lookups.

The arpupdate subroutine enters a new address in arptab, pushing out the oldest entry from the bucket if there is no room. This subroutine always succeeds because no bucket can be completely filled with permanent entries (except when arpioctl tests whether another permanent entry can fit).

Depending on the action specified, the prm IP addresses isaddr, itaddr, and myaddr are used by the arpupdate subroutine.

Parameters

Item Description
ac Points to the arpcom structure.
m Points to the memory buffer (mbuf), that contains the arp response packet received by the interface.
hp Points to the buffer that is passed by the interrupt handler.
action Returns a value that indicates which action is taken:
LOOK
Looks for the isaddr IP address in the arp table and returns the hardware address and if_dependent structure.
LKPUB
Looks for the isaddr IP address in the arp table and returns the hardware address and if_dependent structure only if the ATF_PUBL is set.
UPDT
Updates the arp entry for an IP address (isaddr). If no arp entry is there, creates a new one and updates the if_dependent structure using the ptr function passed in the prm structure.
REVARP
Reverses the arp request. hwaddr contains the hardware address, szhwaddr indicates its size, and saddr returns the IP address if an entry is found.
prm Points to the arpudpate_parm structure. The values are:
LOOK or LKPUB
itaddr and myaddr are ignored. isaddr is used for arp table lookup.
UPDTE
isaddr points to the sender protocol address. itaddr points to the target protocol address. myaddr points to the protocol address of the interface that received the packet.

Return Values

Item Description
ARP_OK Lookup or update was successful.
ARP_FAIL Lookup or update failed.
ARP_NEWF New arp entry could not be created.