Arp

Package: inet.networklayer.arp.ipv4

Arp

simple module

Implements the Address Resolution Protocol for IPv4 and IEEE 802 6-byte MAC addresses.

ARP packets are represented by the ArpPacket class.

Communication Between ARP and IPv4 modules: IPv4 module call the ARP::getMACAddressFor(ipv4Address) method for get the MACAddress of next hop. If this method could not resolve an IPv4 address to MAC address, then IPv4 uses the Arp::startAddressResolution() method. ARP emit a arpResolutionCompleted signal, when added/modified an entry in ARP table. ARP emit a arpResolutionFailed signal when an ARP request failed (ARP request sent retryCount times and retryTimeout elapsed).

ARP resolution is used over broadcast interfaces only, that is, over interfaces that have the isBroadcast() flag set in NetworkInterface (see InterfaceTable). Since routing files (.irt or .mrt files, given as parameter to Ipv4RoutingTable) may modify the default interface configuration, you must take care that these files don't contain the word BROADCAST e.g. for PPP interfaces.

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Parameters

Name Type Default value Description
interfaceTableModule string

The path to the InterfaceTable module

routingTableModule string
retryTimeout double 1s

number seconds ARP waits between retries to resolve an IPv4 address

retryCount int 3

number of times ARP will attempt to resolve an IPv4 address

cacheTimeout double 120s

number seconds unused entries in the cache will time out

proxyArpInterfaces string "*"

list of interfaces that proxy ARP is enabled (all interfaces by default)

Properties

Name Value Description
display i=block/layer

Gates

Name Direction Size Description
netwIn input

incoming ARP requests and replies

netwOut output

outgoing ARP requests/replies, and datagrams with resolved next hop

ifIn input
ifOut output

Signals

Name Type Unit
arpReplySent inet::Packet
arpResolutionInitiated inet::IArp::Notification
arpResolutionFailed inet::IArp::Notification
arpRequestSent inet::Packet
arpResolutionCompleted inet::IArp::Notification

Statistics

Name Title Source Record Unit Interpolation Mode
arpReplySent ARP replies sent arpReplySent count, sum(packetBytes), vector(packetBytes)
arpResolutionInitiated ARP initiated resolutions count
arpResolutionFailed ARP failed resolutions count
arpRequestSent ARP request sent arpRequestSent count, sum(packetBytes), vector(packetBytes)
arpResolutionCompleted ARP completed resolutions count

Scheduled messages (observed)

msgkindctrltagsmsgnamecontext
omnetpp::cMessage0ARP timeoutfilled

Direct method calls (observed)

call tofunctioninfo
MessageDispatcherinet::MessageDispatcher::arrivedarrived
MessageDispatcherinet::MessageDispatcher::handleRegisterProtocolhandleRegisterProtocol
Ipv4inet::Ipv4::receiveSignalarpResolutionCompleted
Ipv4inet::Ipv4::receiveSignalarpResolutionFailed
Ipv4RoutingTableinet::Ipv4RoutingTable::getInterfaceForDestAddrgetInterfaceForDestAddr(%u.%u.%u.%u)
Ipv4RoutingTableinet::Ipv4RoutingTable::isLocalAddressisLocalAddress(%u.%u.%u.%u)

Called methods (observed)

functioninfocall from
inet::Arp::handleOperationStagehandleOperationStageScenarioManager, SimpleEpEnergyManagement, SimpleEpEnergyStorage
inet::Arp::resolveL3AddressresolveMACAddress(%s,%s)Ipv4

Incoming messages (observed)

gatemsgkindctrlsrcModuletags
ifInPacket0MessageDispatcherDirectionTag, DispatchProtocolReq, EncapsulationProtocolInd, InterfaceInd, MacAddressInd, PacketProtocolTag, DropEligibleInd?, PcpInd?, UserPriorityInd?, VlanInd?
ifInPacket0AckingMacDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag, ErrorRateInd?, InterfaceReq?, MacAddressReq?, SignalPowerInd?, SignalTimeInd?, SnirInd?
ifInPacket0BMacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
ifInPacket0CsmaCaMacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd, UserPriorityInd
ifInPacket0EthernetEncapsulationDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
ifInPacket0Ieee80211LlcEpdDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd, Ieee80211ChannelInd, Ieee80211ModeInd
ifInPacket0Ieee80211LlcLpdDispatchProtocolReq, ErrorRateInd, Ieee802SapInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd, UserPriorityInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
ifInPacket0Ieee802154MacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
ifInPacket0LMacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
ifInPacket0ShortcutMacDispatchProtocolReq, InterfaceInd, PacketProtocolTag
ifInPacket0VirtualTunnelDirectionTag, DispatchProtocolReq, DropEligibleInd, EncapsulationProtocolInd, InterfaceInd, MacAddressInd, PacketProtocolTag, PcpInd, UserPriorityInd, VlanInd
ifInPacket0XMacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd

Outgoing messages (observed)

gatemsgkindctrldestModuletags
ifOutPacket0ExampleQosClassifierInterfaceReq, MacAddressReq, PacketProtocolTag
ifOutPacket0QosClassifierInterfaceReq, MacAddressReq, PacketProtocolTag
ifOutPacket0EthernetEncapsulationDispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag
ifOutPacket0EthernetMacHeaderInserterDispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag
ifOutPacket0Ieee80211LlcEpdInterfaceReq, MacAddressReq, PacketProtocolTag
ifOutPacket0Ieee80211LlcLpdInterfaceReq, MacAddressReq, PacketProtocolTag
ifOutPacket0ShortcutMacInterfaceReq, MacAddressReq, PacketProtocolTag
ifOutPacket0VirtualTunnelInterfaceReq, MacAddressReq, PacketProtocolTag
ifOutPacket0VlanReqMapperDispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag
ifOutPacket0DropTailQueueInterfaceReq, MacAddressReq, PacketProtocolTag

Packet operations (observed)

chunkTypepacketAction
ArpPacketinsertAtFront, peekAtFront

Shared Tagging operations (observed)

tagTypetagAction
DispatchProtocolReqaddTag, removeTagIfPresent
InterfaceIndgetTag
InterfaceReqaddTag
MacAddressReqaddTag
PacketProtocolTagaddTag

Tagging operations (observed)

tagTypetagAction
inet::Ipv4InterfaceDatagetTag

Source code

//
// Implements the Address Resolution Protocol for IPv4 and IEEE 802 6-byte
// MAC addresses.
//
// ARP packets are represented by the ~ArpPacket class.
//
// Communication Between ARP and IPv4 modules:
// IPv4 module call the ARP::getMACAddressFor(ipv4Address) method for get the MACAddress
// of next hop. If this method could not resolve an IPv4 address to MAC address, then IPv4
// uses the Arp::startAddressResolution() method.
// ARP emit a arpResolutionCompleted signal, when added/modified an entry in ARP table.
// ARP emit a arpResolutionFailed signal when an ARP request failed (ARP request sent
// retryCount times and retryTimeout elapsed).
//
// ARP resolution is used over <i>broadcast</i> interfaces only,
// that is, over interfaces that have the <tt>isBroadcast()</tt> flag set in
// <tt>NetworkInterface</tt> (see ~InterfaceTable). Since routing files
// (<tt>.irt</tt> or <tt>.mrt</tt> files, given as parameter to ~Ipv4RoutingTable)
// may modify the default interface configuration, you must take care that
// these files don't contain the word <tt>BROADCAST</tt> e.g. for PPP
// interfaces.
//
simple Arp like IArp
{
    parameters:
        string interfaceTableModule;   // The path to the InterfaceTable module
        string routingTableModule;
        double retryTimeout @unit(s) = default(1s);   // number seconds ARP waits between retries to resolve an IPv4 address
        int retryCount = default(3);                  // number of times ARP will attempt to resolve an IPv4 address
        double cacheTimeout @unit(s) = default(120s); // number seconds unused entries in the cache will time out
        string proxyArpInterfaces = default("*");     // list of interfaces that proxy ARP is enabled (all interfaces by default)
        @display("i=block/layer");
        @signal[arpRequestSent](type=inet::Packet);
        @signal[arpReplySent](type=inet::Packet);
        @signal[arpResolutionInitiated](type=inet::IArp::Notification);
        @signal[arpResolutionCompleted](type=inet::IArp::Notification);
        @signal[arpResolutionFailed](type=inet::IArp::Notification);
        @statistic[arpRequestSent](title="ARP request sent"; source=arpRequestSent; record=count,"sum(packetBytes)","vector(packetBytes)");
        @statistic[arpReplySent](title="ARP replies sent"; source=arpReplySent; record=count,"sum(packetBytes)","vector(packetBytes)");
        @statistic[arpResolutionInitiated](title="ARP initiated resolutions"; record=count);
        @statistic[arpResolutionCompleted](title="ARP completed resolutions"; record=count);
        @statistic[arpResolutionFailed](title="ARP failed resolutions"; record=count);
    gates:
        input netwIn @labels(ArpPacket+Ieee802Ctrl); // incoming ARP requests and replies
        output netwOut @labels(ArpPacket+Ieee802Ctrl,Ipv4Header+Ieee802Ctrl);  // outgoing ARP requests/replies, and datagrams with resolved next hop
        input ifIn @labels(ArpPacket,Ieee802Ctrl);
        output ifOut @labels(ArpPacket,Ieee802Ctrl);
}

File: src/inet/networklayer/arp/ipv4/Arp.ned