arp - Linux ARP kernel module of

description

This module implements the core protocol defined in RFC826 Address Resolution Protocol [translation: TCP / IP address translation protocol layer to the first layer, the third], for reversing the second hardware address and Ipv4 protocol layer in the network directly connected to the conversion between address. Unless the user wants to configure it, or generally not directly operate this module.

In fact, it provides services in other core agreements.

Users can use the process Packet (. 7) of the sockets, receiving an ARP packet (translation: a translation of a packet). Another mechanism is to use NetLink (7) Sockets, in user space ARP cache management mechanism. We can also (2) ioctl control any PF_INET ARP table on the socket

 

ARP module maintains a cache protocol address to hardware address mapping. This buffer is limited in size, it is not commonly used and old records (Entry) will be cleared garbage collector (garbage-collected), the garbage collector never delete marked as a permanent record. We can use direct manipulation ioctls buffer, and which can be adjusted by the following traits defined sysctl.

If the limited time (see below sysctl) inside, an existing map has no affirmative feedback that the buffer layer adjacent to the recording failure. In order to send data to the target again, ARP will first try to ask a local arp process app_solicit times to get the updated MAC (Media Access Control) address. If it fails, and the old MAC address is known, the transmission ucast_solicit times unicast probe. If that fails, the network will broadcast a new ARP request, this time to be sending data queue

If a Linux received address request, and forwards this address points to the address of Linux, the interface to open and receives proxy arp, Linux will automatically add a non-persistent agent arp record; refuse to the destination if a route exists, the agent is not added arp records.

 

IOCTLS

There are three ioctl can be used for all PF_INET Sockets in. They point to a struct arpreq pointer as a parameter thereof.

 

struct arpreq
{
struct sockaddr arp_pa; / * protocol address (protocol address) * /
struct sockaddr arp_ha; / * hardware address (hardware address) * /
int arp_flags; / * Flag (flags) * /
struct sockaddr arp_netmask; 
/ * Protocol address netmask (netmask of protocol address) * /
char arp_dev[16];
};

SIOCSARP , SIOCDARP and SIOCGARP can decibel settings, delete and get an ARP mapping. Setting and deleting ARP maps are franchise operations, only those with CAP_NET_ADMIN process privileges or effective UID 0 for the process can be performed.

arp_pa must be AF_INET Socket, and arp_ha must have and arp_dev . the same device type specified. arp_dev is a null-terminated string device name.

 

arp_flags
Flag (flag) Meaning (meaning)
ATF_COM Find complete (Lookup complete)
ATF_PERM Permanent Record (Permanent entry)
ATF_PUBL Post Record (Publish entry)
ATF_USETRAILERS Requires suffix (Trailers requested)
ATF_NETMASK Use netmask (Use a netmask)
ATF_DONTPUB Do not reply (Do not answer)

 

 

If you set ATF_NETMASK flag, then arp_netmask must be valid. Linux 2.2 does not support proxy network ARP records, therefore, be set to 0xffffffff, or 0 to remove an existing proxy arp records. Here we do not use the existing proxy arp records. ATF_USETRAILERS obsolete and should not continue to use.

 

 

SYSCTLS

ARP supports a sysctl interface to configure global parameters can be formulated individually or to a network interface. This can sysctl / proc / sys / net / ipv4 / neigh / * / * file or use sysctl (2) interface to access. Each interface system in / proc / sys / net / ipv4 / neigh /. Has its own directory. `default 'directory is provided for all new equipment. sysctl relevant time is in seconds, unless otherwise declared.

anycast_delay
IPv6 neighbor of the maximum delay time of the request reply information; is not yet supported anycast. The default value is one second.
app_solicit
This is prior to detection using multicast (multicast probe), connected over a network to the user space daemon's ARP probe (Probe) The maximum number (see mcast_solicit ). The default value is 0.
base_reachable_time
Once adjacent recording, at least in a period between base_reachable_time / 2 * and. 3 base_reachable_time within a random time between / 2, the record is valid. If you receive positive feedback upper layer protocol, then the recording period will be extended. The default value is 30 seconds.
delay_first_probe_time
After the discovery of an adjacent layer record is invalid (stale), the first time sent a probe to wait. The default value is 5 seconds.
gc_interval
Collecting garbage collection operation cycle useless recording layer adjacent to the recording, default is 30 seconds.
gc_stale_time
We decided to check the validity of a cycle of recording layers adjacent. When the adjacent recording layer failure before sending the data to it, more analytical. The default value is 60 seconds.
gc_thresh1
In the ARP cache of a minimum number of layers, if less than this number, the garbage collector will not run. The default value is 128.
gc_thresh2
Record up soft limit stored in the ARP cache. Before starting the garbage collector to collect, the number of records allowed to exceed this figure 5 seconds. The default value is 512.
gc_thresh3
Hard limit up to record-keeping in the ARP cache, the cache once the number is higher than this, the garbage collector will run immediately. The default is 1024.
lock hour
ARP records the minimum time (Jiffy number) stored in the cache in order to prevent the presence of a plurality of possible mapping (potential mapping), bumps ARP cache system (often due to errors caused by the network configuration). The default value is one second.
mcast_solicit
Before the record is marked as non-arrival, parse the maximum number of addresses with multicast / broadcast (multicast / broadcast) mode. The default is 3.
proxy_delay
Upon receiving a request known in the ARP proxy ARP requests, Jiffy response can be delayed before (time unit, see BUG) number. Thus, to prevent network storm. The default value is 0.8 seconds.
proxy_qlen
The maximum number of data packets can be placed in the ARP proxy queues (proxy-ARP addresses) of. The default value is 64.
retrans_time
Jiffy retransmission waiting before a request (time unit, see BUG) number. The default value is one second.
ucast_solicit
Ask before ARP daemon, the number of transmissions single probe (unicast probe) attempts. (See app_solicit ). The default value is 3 seconds.
unres_qlen
Each has not been resolved other network layer address, can be stored in the queue the maximum number of packets. The default is 3.

 

BUGS

Clock time unit set jiffy, with related hardware system. On Alpha, a jiffy is 1/1024 second, in other machines, is 1/100 sec.

There is no way to send a positive feedback from user space. This means that the protocol (connection oriented protocols) implemented in user space, connection-oriented will produce large amounts of ARP traffic. Because ndisc will re-detect MAC address. NFS kernel also achieve the same problem. 

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11076326.html
ARP