ARP Address Resolution Protocol - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

ARP Address Resolution Protocol

Description:

The arpwhohas function is normally called by arpresolve to ... Delete unreferenced entries. arpresolve Function. Obtain the Ethernet address for an IP address ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 18
Provided by: Tai59
Category:

less

Transcript and Presenter's Notes

Title: ARP Address Resolution Protocol


1
ARP (Address Resolution Protocol)
2
Code Introduction
3
(No Transcript)
4
ARP Structure
5
ARP Functions
  • arpwhohas
  • arprequest
  • arpintr
  • in_arpinput
  • arptimer
  • arptfree
  • arpresolve
  • arplookup
  • arp_rtrequest

6
arpwhohas Function
  • The arpwhohas function is normally called by
    arpresolve to broadcast an ARP request.

7
arprequest Function
  • The arprequest function is called by arpwhohas to
    broadcast an ARP request.
  • Allocate and initialize mbuf

8
arprequest Function
  • Initialize pointers
  • Fill in Ethernet header
  • Set Ethernet destination address to Ethernet
    Broadcast Address
  • Ethernet type is ETHERTYPE_ARP
  • Fill in ARP fields
  • Fill in sa_family and call interface output
    function

9
arpintr Function
  • Process the Frame
  • Hardware type specifies Ethernet address
  • The size of frame gt the size of arphdr 2 HW
    address 2 protocol address
  • Call in_arpinput
  • ETHERTYPE_IP
  • ETHERTYPE_IPTRAILERS

10
in_arpinput Function
  • Its called by arpintr to process each received
    ARP request or ARP reply
  • Validate senders hardware address
  • Check senders IP address
  • Search routing table for match with senders IP
    address

11
  • Update existing entry or fill in new entry
  • Check if senders hardware address changed
  • Record senders hardware address
  • Update newly resolved ARP entry
  • If this host is the target
  • Check if this host is a proxy server for target
  • Form proxy reply
  • Complete construction of ARP reply packet
  • Fill in sockaddr with Ethernet header

12
arptimer Function
  • Called every 5 min.
  • Set next timeout
  • Check all ARP entries

13
arptfree Function
  • Invalidate entries in use
  • the link-layer address length is set to 0
  • the la_asked counter is reset to 0
  • the RTF_REJECT flag is cleared
  • Delete unreferenced entries

14
arpresolve Function
  • Obtain the Ethernet address for an IP address
  • If destination Ethernet address is known
  • allow ether_output to queue the IP datagram on
    the interfaces output queue
  • If doesnt know the Ethernet address
  • Held the datagram
  • Send ARP request
  • Avoid ARP flooding

15
  • Handle broadcast and multicast destinations
  • Check ARP entry for validity
  • the expiration time is 0 or the expiration time
    is greater than current time
  • the family of the socket address struct pointed
    to by rt_gateway is AF_LINK
  • the link-level address is nonzero
  • Hold only most recent IP datagram

16
  • Send ARP request but avoid ARP flooding
  • Never send s more than 1 ARP request in any
    second to a destination.
  • If a reply is not received after 5 ARP request,
    the RTF_REJECT flag in the routing table is set
    and the expiration timer is set for 20 sec.
  • After 20 sec. pause in ARP request, arpresolve
    will send ARP request to the destination again.

17
arplookup Function
  • It calls the routing function rtalloc1 to look up
    an ARP entry in the Internet routing table.
  • If arplookup succeeds, a pointer is return to the
    corresponding llinfo_arp structure
  • Otherwise a null pointer is return
  • A new entry should be created
Write a Comment
User Comments (0)
About PowerShow.com