3. Directed ARP
Directed ARP uses the normal ARP packet format, and is consistent with ARP procedures, as defined in [1] and [2], and with routers and hosts that implement those procedures.
3.1. ARP Helper Address
Hosts and routers maintain routing information, logically organized as a routing table. Each routing table entry associates one or more destination IP addresses with a next-hop IP address and a physical interface used to forward a packet to the next-hop IP address. If the destination IP address is local (i.e., can be reached without the aid of a router), the next-hop IP address is NULL (or a logical equivalent, such as the IP address of the associated physical interface). Otherwise, the next-hop IP address is the address of a next-hop router.
A host or router that implements Directed ARP procedures associates an ARP Helper Address with each routing table entry. If the host or router has been configured to resolve the next-hop IP address to its associated link level address (or to resolve the destination IP address, if the next-hop IP address is NULL), the associated ARP Helper Address is NULL. Otherwise, the ARP Helper Address is the IP address of the router that provided the routing information indicating that the next-hop address was on the same link level network as the associated physical interface. Section 4 provides detailed examples of the determination of ARP Helper Addresses by dynamic routing procedures.
3.2. Address Resolution Procedures
To forward an IP packet, a host or router searches its routing table for an entry that is the best match based on the destination IP address and perhaps other factors (e.g., Type of Service). The selected routing table entry includes the IP address of a next-hop router (which may be NULL), the physical interface through which the IP packet should be forwarded, an ARP Helper Address (which may be NULL), and other information. The routing function passes the next-hop IP address, the physical interface, and the ARP Helper Address to the address resolution function. The address resolution function must then resolve the next-hop IP address (or destination IP address if the next-hop IP address is NULL) to its associated link level address. The IP packet, the link level address to which the packet should be forwarded, and the interface through which the packet should be forwarded are then passed to the link level driver associated with the physical interface. The link level driver encapsulates the IP packet in one or more link level frames (i.e., may do fragmentation) addressed to the associated link level address, and forwards the frame(s) through the appropriate physical interface. The details of the functions performed are described via C pseudo-code below.
The procedures are organized as two functions, Route() and Resolve(), corresponding to routing and address resolution. In addition, the following low level functions are also used:
Get_Route(IP_Add,Other) returns a pointer to the routing table
entry with the destination field that best matches IP_Add. If no
matching entry is found, NULL is returned. Other information such
as Type of Service may be considered in selecting the best route.
Forward(Packet,Link_Level_Add,Phys_Int) fragments Packet (if
needed), and encapsulates Packet in one or more Link Level Frames
addressed to Link_Level_Add, and forwards the frame(s) through
interface, Phys_Int.
Look_Up_Add_Res_Table(IP_Add,Phys_Int) returns a pointer to the
link level address associated with IP_Add in the address
resolution table associated with interface, Phys_Int. If IP_Add
is not found in the address resolution table, NULL is returned.
Local_Add_Res(IP_Add,Phys_Int) returns a pointer to the Link Level
address associated with IP_Add, using address resolution
procedures associated with address, IP_Add, and interface,
Phys_Int. If address resolution is unsuccessful, NULL is
returned. Note that different address resolution procedures may
be used for different IP networks.
Receive_ARP_Response(IP_Add,Phys_Int) returns a pointer to an ARP
Response received through interface, Phys_Int, that resolves
IP_Add. If no ARP response is received, NULL is returned.
Dest_IP_Add(IP_Packet) returns the IP destination address from
IP_Packet.
Next_Hop(Entry) returns the IP address in the next-hop field of
(routing table) Entry.
Interface(Entry) returns the physical interface field of (routing
table) Entry.
ARP_Helper_Add(Entry) returns the IP address in the ARP Helper
Address field of (routing table) Entry.
ARP_Request(IP_Add) returns an ARP Request packet with IP_Add as
the Target IP address.
Source_Link_Level(ARP_Response) returns the link level address of
the sender of ARP_Response.
ROUTE(IP_Packet)
{
Entry = Get_Route(Dest_IP_Add(IP_Packet),Other(IP_Packet));
If (Entry == NULL) /* No matching entry in routing table */
Return; /* Discard IP_Packet */
else
{ /* Resolve next-hop IP address to link level address */
If (Next_Hop(Entry) != NULL) /* Route packet via next-hop router */
Next_IP = Next_Hop(Entry);
else /* Destination is local */
Next_IP = Dest_IP_Add(IP_Packet);
L_L_Add = Resolve(Next_IP,Interface(Entry),ARP_Helper_Add(Entry));
If (L_L_Add != NULL)
Forward(IP_Packet,L_L_Add,Interface(Entry));
else /* Couldn't resolve next-hop IP address */
Return; /* Discard IP_Packet */
Return;
}
}
Figure 1: C Pseudo-Code for the Routing function.
Resolve(IP_Add,Interface,ARP_Help_Add)
{
If ((L_L_Add = Look_Up_Add_Res_Table(IP_Add,Interface)) != NULL)
{ /* Found it in Address Resolution Table */
Return L_L_Add;
}
else
{
If (ARP_Help_Add == NULL)
{ /* Do local Address Resolution Procedure */
Return Local_Add_Res(IP_Add,Interface);
}
else /* ARP_Help_Add != NULL */
{
L_L_ARP_Help_Add = Look_Up_Add_Res_Table(ARP_Help_Add,Interface);
If (L_L_ARP_Help_Add == NULL)
/* Not in Address Resolution Table */
L_L_ARP_Help_Add = Local_Add_Res(ARP_Help_Add,Interface);
If (L_L_ARP_Help_Add == NULL) /* Can't Resolve ARP Helper Add */
Return NULL; /* Address Resolution Failed */
else
{ /* ARP for IP_Add */
Forward(ARP_Request(IP_Add),L_L_ARP_Help_Add,Interface);
ARP_Resp = Receive_ARP_Response(IP_Add,Interface);
If (ARP_Resp == NULL) /* No ARP Response (after persistence) */
Return NULL; /* Address Resolution Failed */
else
Return Source_Link_Level(ARP_Resp);
}
}
}
}
}
Figure 2: C Pseudo-Code for Address Resolution function.
3.3. Forwarding ARP Requests
A host that implements Directed ARP procedures uses normal procedures to process received ARP Requests. That is, if the Target IP address is the host's address, the host uses normal procedures to respond to the ARP Request. If the Target IP address is not the host's address, the host silently discards the ARP Request.
If the Target IP address of an ARP Request received by a router is the router's address, the router uses normal procedures to respond to the ARP Request. But if the Target IP address is not the router's address, the router may forward the ARP Request back through the same interface it was received from, addressed to a Link Level Address that corresponds to an ARP Helper Address in the router's routing table. The procedures used to process an ARP Request are described via C pseudo-code below. The function Receive() describes procedures followed by hosts and routers, and the function Direct() describes additional procedures followed by routers. In addition, the following low level functions are also used:
Is_Local_IP_Add(IP_Add,Phys_Int) returns TRUE if Phys_Int has been
assigned IP address, IP_Add. Otherwise, returns FALSE.
Do_ARP_Processing(ARP_Request,Interface) processes ARP_Request
using ARP procedures described in [2].
I_Am_Router returns TRUE if device is a router and False if device
is a host.
Target_IP(ARP_Request) returns the Target IP address from
ARP_Request.
Filter(ARP_Request,Phys_Int) returns TRUE if ARP_Request passes
filtering constraints, and FALSE if filtering constraints are not
passed. See section 3.4.
Forward(Packet,Link_Level_Add,Phys_Int) fragments Packet (if
needed), and encapsulates Packet in one or more Link Level Frames
addressed to Link_Level_Add, and forwards the frame(s) through
interface, Phys_Int.
Look_Up_Next_Hop_Route_Table(IP_Add) returns a pointer to the
routing table entry with the next-hop field that matches IP_Add.
If no matching entry is found, NULL is returned.
Look_Up_Dest_Route_Table(IP_Add) returns a pointer to the routing
table entry with the destination field that best matches IP_Add.
If no matching entry is found, NULL is returned.
Link_Level_ARP_Req_Add(IP_Add,Phys_Int) returns the link level
address to which an ARP Request to resolve IP_Add should be
forwarded. If ARP is not used to perform local address resolution
of IP_Add, NULL is returned.
Local_Add_Res(IP_Add,Phys_Int) returns a pointer to the Link Level
address associated with IP_Add, using address resolution
procedures associated with address, IP_Add, and interface,
Phys_Int. If address resolution is unsuccessful, NULL is
returned. Note that different address resolution procedures may
be used for different IP networks.
Next_Hop(Entry) returns the IP address in the next-hop field of
(routing table) Entry.
Interface(Entry) returns the physical interface field of (routing
table) Entry.
ARP_Helper_Add(Entry) returns the IP address in the ARP Helper
Address field of (routing table) Entry.
Source_Link_Level(ARP_Request) returns the link level address of
the sender of ARP_Request.
Receive(ARP_Request,Interface)
{
If (Is_Local_IP_Add(Target_IP(ARP_Request),Interface))
Do_ARP_Processing(ARP_Request,Interface);
else /* Not my IP Address */
If (I_Am_Router) /* Hosts don't Direct ARP Requests */
If (Filter(ARP_Request,Interface)) /* Passes Filter Test */
/* See Section 3.4 */
Direct(ARP_Request,Interface); /* Directed ARP Procedures */
Return;
}
Figure 3: C Pseudo-Code for Receiving ARP Requests.
Direct(ARP_Request,Phys_Int)
{
Entry = Look_Up_Next_Hop_Route_Table(Target_IP(ARP_Request));
If (Entry == NULL) /* Target_IP Address is not a next-hop */
{ /* in Routing Table */
Entry = Look_Up_Dest_Route_Table(Target_IP(ARP_Request));
If (Entry == NULL) /* Not a destination either */
Return; /* Discard ARP Request */
else
If (Next_Hop(Entry) != NULL) /* Not a next-hop and Not local */
Return; /* Discard ARP Request */
}
If (Interface(Entry) != Phys_Int)
/* Must be same physical interface */
Return; /* Discard ARP Request */
If (ARP_Helper_Add(Entry) != NULL)
{
L_L_ARP_Helper_Add = Resolve(ARP_Helper_Add(Entry),Phys_Int,NULL);
If (L_L_ARP_Helper_Add != NULL)
Forward(ARP_Request,L_L_ARP_Helper_Add,Phys_Int);
/* Forward ARP_Request to ARP Helper Address */
Return;
}
else /* Do local address resolution. */
{
L_L_ARP_Req_Add =
Link_Level_ARP_Req_Add(Target_IP(ARP_Request),Phys_Int);
If (L_L_ARP_Req_Add != NULL)
{ /* Local address resolution procedure is ARP. */
/* Forward ARP_Request. */
Forward(ARP_Request,L_L_ARP_Req_Add,Phys_Int);
Return;
}
else
{ /* Local address resolution procedure is not ARP. */
/* Do "published ARP" on behalf of Target IP Address */
Target_Link_Level =
Local_Add_Res(Target_IP(ARP_Request),Phys_Int);
If (Target_Link_Level != NULL) /* Resolved Address */
{
Forward(ARP_Response,Source_Link_Level(ARP_Request),Phys_Int);
}
Return;
}
}
}
Figure 4: C Pseudo_Code for Directing ARP Requests.
3.4. Filtering Procedures
A router performing Directed ARP procedures must filter the propagation of ARP Request packets to constrain the scope of potential "ARP floods" caused by misbehaving routers or hosts, and to terminate potential ARP loops that may occur during periods of routing protocol instability or as a result of inappropriate manual configurations. Specific procedures to filter the propagation of ARP Request packets are beyond the scope of this document. The following procedures are suggested as potential implementations that should be sufficient. Other procedures may be better suited to a particular implementation.
To control the propagation of an "ARP flood", a router performing Directed ARP procedures could limit the number of identical ARP Requests (i.e., same Source IP address and same Target IP address) that it would forward per small time interval (e.g., no more than one ARP Request per second). This is consistent with the procedure suggested in [5] to prevent ARP flooding.
Forwarding of ARP Request packets introduces the possibility of ARP loops. The procedures used to control the scope of potential ARP floods may terminate some ARP loops, but additional procedures are needed if the time required to traverse a loop is longer than the timer used to control ARP floods. A router could refuse to forward more than N identical ARP Requests per T minutes, where N and T are administered numbers. If T and N are chosen so that T/N minutes is greater than the maximum time required to traverse a loop, such a filter would terminate the loop. In some cases a host may send more than one ARP Request with the same Source IP address,Target IP address pair (i.e., N should be greater than 1). For example, the first ARP Request might be lost. However, once an ARP Response is received, a host would normally save the associated information, and therefore would not generate an identical ARP Request for a period of time on the order of minutes. Therefore, T may be large enough to ensure that T/N is much larger than the time to traverse any loop.
In some implementations the link level destination address of a frame used to transport an ARP Request to a router may be available to the router's Directed ARP filtering process. An important class of simple ARP loops will be prevented from starting if a router never forwards an ARP Request to the same link level address to which the received ARP Request was addressed. Of course, other procedures such as the one described in the paragraph above will stop all loops, and are needed, even if filters are implemented that prevent some loops from starting.
Host requirements [5] specify that "the packet receive interface between the IP layer and the link layer MUST include a flag to indicate whether the incoming packet was addressed to a link-level broadcast address." An important class of simple ARP floods can be eliminated if routers never forward ARP Requests that were addressed to a link-level broadcast address.