Coder Social home page Coder Social logo

arping's Issues

Dropping privileges prevents arping from working on Android

arping drops all privileges, but since Android uses predefined group ids to allow access to various things (enforced by the kernel), dropping all group ids causes arping to fail even though the user has access to raw sockets (inet(3003)).

Fail message:

arping: libnet_get_hwaddr(): socket: Permission denied

Note that it's not about opening raw sockets, that works fine before dropping privileges. Here's the offending syscall:

setgroups32(0, [])                      = 0
setgid32(65534)                         = 0
setuid32(65534)                         = 0
...
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = -1 EACCES (Permission denied)

Maybe it could be solved by making privilege drop optional?

Make arping compile on Windows again

I (Thomas) will probably not be doing this. I'm adding this issue in case someone else wants to take it on.

It shouldn't be that much work. Arping 2.05 compiled on Windows (not by me and I don't know how, but I have the .exe so I know it worked) and there haven't been that many changes since then.

No replies received using vlan option with older libpcap

arping is displaying Timeout on CentOS-7.6.1810, but I can see the arp reply packages (gratuitous) in tcpdump.

# arping -v
ARPing 2.20, by Thomas Habets <[email protected]>
usage: arping [ -0aAbdDeFpPqrRuUv ] [ -w <sec> ] [ -W <sec> ] [ -S <host/ip> ]
              [ -T <host/ip ] [ -s <MAC> ] [ -t <MAC> ] [ -c <count> ]
              [ -C <count> ] [ -i <interface> ] [ -m <type> ] [ -g <group> ]
              [ -V <vlan> ] [ -Q <priority> ] <host/ip/MAC | -B>
For complete usage info, use --help or check the manpage.

# arping -i eth1 -V 217 -0 10.10.217.1 -c 1 -vvvvvvvv -W3 -p
arping: libnet_init(eth1)
arping: clock_getres() = 0s 1ns
arping: libnet_init(eth1)
arping: libnet_init(eth1)
Timestamp types:
  Name               Description
  host               Host
  adapter            Adapter
  adapter_unsynced   Adapter, not synced with system time
arping: Successfully chrooted to /var/empty/sshd
arping: Successfully dropped uid/gid to 99/99.
arping: pcap_get_selectable_fd(): 4
This box:   Interface: eth1  IP: 255.255.255.255   MAC address: c8:1f:66:ed:74:bd
ARPING 10.10.217.1
arping: sending packet at time 1758649.485481600
arping: receiving packets...
arping: listen for replies for 2.999999530 sec
arping: received response for IP ping
arping: listen for replies for 2.916730013 sec
arping: received response for IP ping
arping: listen for replies for 2.816205510 sec
arping: received response for IP ping
arping: listen for replies for 2.787156679 sec
arping: received response for IP ping
arping: listen for replies for 2.787077017 sec
arping: received response for IP ping
arping: listen for replies for 2.787055684 sec
arping: received response for IP ping
arping: listen for replies for 2.786988205 sec
arping: received response for IP ping
arping: listen for replies for 2.786933507 sec
arping: received response for IP ping
arping: listen for replies for 2.786873469 sec
arping: received response for IP ping
arping: listen for replies for 2.786816478 sec
arping: received response for IP ping
arping: listen for replies for 2.786760759 sec
arping: received response for IP ping
arping: listen for replies for 2.786681887 sec
arping: received response for IP ping
arping: listen for replies for 2.715661653 sec
arping: received response for IP ping
arping: listen for replies for 2.615118869 sec
arping: received response for IP ping
arping: listen for replies for 2.342780055 sec
arping: received response for IP ping
arping: listen for replies for 2.286985953 sec
arping: received response for IP ping
arping: listen for replies for 2.286956056 sec
arping: received response for IP ping
arping: received response for IP ping
arping: listen for replies for 2.286846593 sec
arping: received response for IP ping
arping: listen for replies for 2.286797412 sec
arping: received response for IP ping
arping: listen for replies for 2.286731494 sec
arping: received response for IP ping
arping: listen for replies for 2.286683799 sec
arping: received response for IP ping
arping: listen for replies for 2.286625684 sec
arping: received response for IP ping
arping: received response for IP ping
arping: received response for IP ping
arping: listen for replies for 1.786932023 sec
arping: received response for IP ping
arping: listen for replies for 1.786897342 sec
arping: received response for IP ping
arping: listen for replies for 1.786807094 sec
arping: received response for IP ping
arping: listen for replies for 1.786702378 sec
arping: received response for IP ping
arping: received response for IP ping
arping: listen for replies for 1.286978173 sec
arping: received response for IP ping
arping: listen for replies for 1.286950859 sec
arping: received response for IP ping
arping: listen for replies for 1.286866687 sec
arping: received response for IP ping
arping: listen for replies for 1.286834573 sec
arping: received response for IP ping
arping: received response for IP ping
arping: listen for replies for 0.787018896 sec
Timeout

--- 10.10.217.1 statistics ---
1 packets transmitted, 0 packets received, 100% unanswered (0 extra)

# ldd /usr/local/bin/arping
	linux-vdso.so.1 =>  (0x00007fff2ddc0000)
	libpcap.so.1 => /lib64/libpcap.so.1 (0x00007f6c1c03c000)
	libnet.so.1 => /lib64/libnet.so.1 (0x00007f6c1be22000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f6c1bc1a000)
	libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f6c1ba00000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f6c1b6fe000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f6c1b331000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6c1b115000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f6c1c27d000)

# ethtool -i eth1
driver: tg3
version: 3.137
firmware-version: FFV7.8.16 bc 5720-v1.32
expansion-rom-version: 
bus-info: 0000:01:00.1
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

# ifconfig eth1
eth1: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500
        ether c8:1f:66:ed:74:bd  txqueuelen 1000  (Ethernet)
        RX packets 4300320  bytes 295380129 (281.6 MiB)
        RX errors 0  dropped 34559  overruns 0  frame 0
        TX packets 1206  bytes 77622 (75.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 57 

Running tcpdump gives the following results

# tcpdump -i eth1 -ennvv "( ether src c8:1f:66:ed:74:bd or ether dst c8:1f:66:ed:74:bd )" or host 10.10.217.1 -s0 -nnvv -xx -tt
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
1645976679.181471 c8:1f:66:ed:74:bd > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 62: vlan 217, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.10.217.1 tell 0.0.0.0, length 44
	0x0000:  ffff ffff ffff c81f 66ed 74bd 8100 00d9
	0x0010:  0806 0001 0800 0604 0001 c81f 66ed 74bd
	0x0020:  0000 0000 0000 0000 0000 0a0a d901 0000
	0x0030:  0000 0000 0000 0000 0000 0000 0000
1645976679.285097 e4:3e:c6:45:4f:e8 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 64: vlan 217, p 6, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.10.217.1 is-at e4:3e:c6:45:4f:e8, length 46
	0x0000:  ffff ffff ffff e43e c645 4fe8 8100 c0d9
	0x0010:  0806 0001 0800 0604 0002 e43e c645 4fe8
	0x0020:  0a0a d901 ffff ffff ffff 0a0a d901 0000
	0x0030:  0000 0000 0000 0000 0000 0000 0000 0000
1645976679.838619 fa:16:3e:fc:76:01 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 217, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.10.217.1 tell 10.10.217.100, length 42
	0x0000:  ffff ffff ffff fa16 3efc 7601 8100 00d9
	0x0010:  0806 0001 0800 0604 0001 fa16 3efc 7601
	0x0020:  0a0a d964 0000 0000 0000 0a0a d901 0000
	0x0030:  0000 0000 0000 0000 0000 0000
1645976684.333373 e4:3e:c6:45:4f:e8 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 64: vlan 217, p 6, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.10.217.1 is-at e4:3e:c6:45:4f:e8, length 46
	0x0000:  ffff ffff ffff e43e c645 4fe8 8100 c0d9
	0x0010:  0806 0001 0800 0604 0002 e43e c645 4fe8
	0x0020:  0a0a d901 ffff ffff ffff 0a0a d901 0000
	0x0030:  0000 0000 0000 0000 0000 0000 0000 0000
1645976689.315901 e4:3e:c6:45:4f:e8 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 64: vlan 217, p 6, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.10.217.1 is-at e4:3e:c6:45:4f:e8, length 46
	0x0000:  ffff ffff ffff e43e c645 4fe8 8100 c0d9
	0x0010:  0806 0001 0800 0604 0002 e43e c645 4fe8
	0x0020:  0a0a d901 ffff ffff ffff 0a0a d901 0000
	0x0030:  0000 0000 0000 0000 0000 0000 0000 0000
^C
5 packets captured
5 packets received by filter
0 packets dropped by kernel

Also here are the current kernel parameters, which may help

# sysctl -a 2>&1|grep eth1
net.ipv4.conf.eth1.accept_local = 0
net.ipv4.conf.eth1.accept_redirects = 1
net.ipv4.conf.eth1.accept_source_route = 0
net.ipv4.conf.eth1.arp_accept = 0
net.ipv4.conf.eth1.arp_announce = 1
net.ipv4.conf.eth1.arp_filter = 0
net.ipv4.conf.eth1.arp_ignore = 1
net.ipv4.conf.eth1.arp_notify = 0
net.ipv4.conf.eth1.bootp_relay = 0
net.ipv4.conf.eth1.disable_policy = 0
net.ipv4.conf.eth1.disable_xfrm = 0
net.ipv4.conf.eth1.force_igmp_version = 0
net.ipv4.conf.eth1.forwarding = 1
net.ipv4.conf.eth1.log_martians = 0
net.ipv4.conf.eth1.mc_forwarding = 0
net.ipv4.conf.eth1.medium_id = 0
net.ipv4.conf.eth1.promote_secondaries = 1
net.ipv4.conf.eth1.proxy_arp = 0
net.ipv4.conf.eth1.proxy_arp_pvlan = 0
net.ipv4.conf.eth1.route_localnet = 0
net.ipv4.conf.eth1.rp_filter = 0
net.ipv4.conf.eth1.secure_redirects = 1
net.ipv4.conf.eth1.send_redirects = 1
net.ipv4.conf.eth1.shared_media = 1
net.ipv4.conf.eth1.src_valid_mark = 0
net.ipv4.conf.eth1.tag = 0
net.ipv4.neigh.eth1.anycast_delay = 100
net.ipv4.neigh.eth1.app_solicit = 0
net.ipv4.neigh.eth1.base_reachable_time_ms = 30000
net.ipv4.neigh.eth1.delay_first_probe_time = 5
net.ipv4.neigh.eth1.gc_stale_time = 60
net.ipv4.neigh.eth1.locktime = 100
net.ipv4.neigh.eth1.mcast_solicit = 3
net.ipv4.neigh.eth1.proxy_delay = 80
net.ipv4.neigh.eth1.proxy_qlen = 64
net.ipv4.neigh.eth1.retrans_time_ms = 1000
net.ipv4.neigh.eth1.ucast_solicit = 3
net.ipv4.neigh.eth1.unres_qlen = 31
net.ipv4.neigh.eth1.unres_qlen_bytes = 65536
net.ipv6.conf.eth1.accept_dad = 0
net.ipv6.conf.eth1.accept_ra = 0
net.ipv6.conf.eth1.accept_ra_defrtr = 0
net.ipv6.conf.eth1.accept_ra_pinfo = 0
net.ipv6.conf.eth1.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.eth1.accept_ra_rtr_pref = 0
net.ipv6.conf.eth1.accept_redirects = 1
net.ipv6.conf.eth1.accept_source_route = 0
net.ipv6.conf.eth1.autoconf = 1
net.ipv6.conf.eth1.dad_transmits = 1
net.ipv6.conf.eth1.disable_ipv6 = 0
net.ipv6.conf.eth1.enhanced_dad = 1
net.ipv6.conf.eth1.force_mld_version = 0
net.ipv6.conf.eth1.force_tllao = 0
net.ipv6.conf.eth1.forwarding = 0
net.ipv6.conf.eth1.hop_limit = 64
net.ipv6.conf.eth1.keep_addr_on_down = 0
net.ipv6.conf.eth1.max_addresses = 16
net.ipv6.conf.eth1.max_desync_factor = 600
net.ipv6.conf.eth1.mc_forwarding = 0
net.ipv6.conf.eth1.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.eth1.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.eth1.mtu = 1500
net.ipv6.conf.eth1.ndisc_notify = 0
net.ipv6.conf.eth1.optimistic_dad = 0
net.ipv6.conf.eth1.proxy_ndp = 0
net.ipv6.conf.eth1.regen_max_retry = 3
net.ipv6.conf.eth1.router_probe_interval = 60
net.ipv6.conf.eth1.router_solicitation_delay = 1
net.ipv6.conf.eth1.router_solicitation_interval = 4
net.ipv6.conf.eth1.router_solicitations = 3
sysctl: reading key "net.ipv6.conf.eth1.stable_secret"
net.ipv6.conf.eth1.temp_prefered_lft = 86400
net.ipv6.conf.eth1.temp_valid_lft = 604800
net.ipv6.conf.eth1.use_optimistic = 0
net.ipv6.conf.eth1.use_tempaddr = 0
net.ipv6.neigh.eth1.anycast_delay = 100
net.ipv6.neigh.eth1.app_solicit = 0
net.ipv6.neigh.eth1.base_reachable_time_ms = 30000
net.ipv6.neigh.eth1.delay_first_probe_time = 5
net.ipv6.neigh.eth1.gc_stale_time = 60
net.ipv6.neigh.eth1.locktime = 0
net.ipv6.neigh.eth1.mcast_solicit = 3
net.ipv6.neigh.eth1.proxy_delay = 80
net.ipv6.neigh.eth1.proxy_qlen = 64
net.ipv6.neigh.eth1.retrans_time_ms = 1000
net.ipv6.neigh.eth1.ucast_solicit = 3
net.ipv6.neigh.eth1.unres_qlen = 31
net.ipv6.neigh.eth1.unres_qlen_bytes = 65536

Optionally exit upon receiving first reply.

Use case: quickly check whether some devices are alive on a network. Currently arping waits for the timeout even when given -c 1 before exiting. So checking e.g. 50 devices would take quite some time.

unicast

Hello,

is this unicast thing is some redhat patch?

Unicast reply from 10.

False positives when the pinging machine receives ARP requests at the same time

We use arping on customer systems to ensure that the server IP isn't used by any other devices in the LAN. The command we use looks like this:

arping -r -c1 -C2 -w20000 -i INTERFACE IP

On one customer system, we've encountered a false positive - arping claims that the IP is used by the server itself:

server ~ # arping -r -c1 -C2 -w20000 -i eno1 192.168.67.2   
ac:1f:6b:79:04:0c
server ~ # ifconfig eno1
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.67.2  netmask 255.255.255.0  broadcast 192.168.67.255
        inet6 fe80::ae1f:6bff:fe79:40c  prefixlen 64  scopeid 0x20<link>
        ether ac:1f:6b:79:04:0c  txqueuelen 1000  (Ethernet)
        RX packets 24071813  bytes 32854407085 (30.5 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13176299  bytes 1780223344 (1.6 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xc7200000-c727ffff

(IMO this shouldn't happen, because the server doesn't actually respond to its own request, as you can see in the tshark output below.)

With tshark I was able to figure out that whenever the server sends an ARP lookup for its own IP, the DSL router automatically responds with its own ARP lookup for the server's IP, which the server then responds to:

server ~ # tshark -i eno1 -f 'arp' -n                                                    
Running as user "root" and group "root". This could be dangerous.                                        
tshark: Lua: Error during loading:                                                                    
 /usr/share/wireshark/init.lua:32: dofile has been disabled due to running Wireshark as superuser. See https://wiki.wireshark.org/CaptureSetup/CapturePrivileges for help in ru
nning Wireshark as an unprivileged user.                                                              
Capturing on 'eno1'                                                                                      
    1 0.000000000 ac:1f:6b:79:04:0c → ff:ff:ff:ff:ff:ff ARP 42 Gratuitous ARP for 192.168.67.2 (Request)
    2 0.000767760 20:f3:a3:80:2d:ad → ff:ff:ff:ff:ff:ff ARP 60 Who has 192.168.67.2? Tell 192.168.67.1   
    3 0.000778253 ac:1f:6b:79:04:0c → 20:f3:a3:80:2d:ad ARP 42 192.168.67.2 is at ac:1f:6b:79:04:0c   

arping is apparently confused by this and believes that the response (frame 3) to the DSL router's request (frame 2) is actually a response to its own request (frame 1).

This problem is easily reproducible by having one arping instance ping its own server, and then another arping instance on another server pinging the first server. For example, when I run this command on my test server to ping itself, it doesn't get any responses (as expected):

martin ~/arping/src (arping-2.x) # ifconfig enp1s0
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.56.10  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 2003:a:422:3b00:56::10  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::acff:fe11:fb18  prefixlen 64  scopeid 0x20<link>
        ether 02:00:ac:11:fb:18  txqueuelen 1000  (Ethernet)
        RX packets 1796471  bytes 966662387 (921.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1290814  bytes 1470807952 (1.3 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

martin ~/arping/src (arping-2.x) # arping -i enp1s0 172.17.56.10
ARPING 172.17.56.10
Timeout
Timeout
Timeout

But when I then run the following command on another server to ping my server:

another-server ~ # arping -i eth1 172.17.56.10
ARPING 172.17.56.10
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=0 time=14.506 msec
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=1 time=5.474 msec
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=2 time=636.879 usec
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=3 time=7.839 msec
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=4 time=15.339 msec
^C
--- 172.17.56.10 statistics ---
5 packets transmitted, 5 packets received,   0% unanswered (0 extra)
rtt min/avg/max/std-dev = 0.637/8.759/15.339/5.549 ms

Then suddenly the arping on my server shows responses:

martin ~/arping/src (arping-2.x) # arping -i enp1s0 172.17.56.10
ARPING 172.17.56.10
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=0 time=739.215 msec
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=1 time=750.790 msec
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=2 time=746.490 msec
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=3 time=738.272 msec
42 bytes from 02:00:ac:11:fb:18 (172.17.56.10): index=4 time=745.738 msec
Timeout
Timeout
^C
--- 172.17.56.10 statistics ---
16 packets transmitted, 5 packets received,  69% unanswered (0 extra)
rtt min/avg/max/std-dev = 738.272/744.101/750.790/4.711 ms

Drop privileges

setresuid() if available.

Drop capabilities if available.

Tests fail on Alpine Linux 3.6

Arping 2.19

$ ./configure --prefix=/usr
$ make

$ make check

The content of "test-suite.log" file is:

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: arping_test
=================
Running suite(s): Arping

60 bytes from 77:88:99:aa:bb:cc (18.52.86.120): index=1 time=592726.104 sec
arping: libnet_init(LIBNET_LINK, <null>):
FAIL arping_test (exit status: 1)

Harmonize flags between arping and iputils-arping

There is a conflict between these 2 packages options that can cause network trouble with ease.
iputils-arping use the option "-w" for timeout in second whereas arping use the same option for timeout in microseconds.

Installing a pgpool cluster (for example) from Ubuntu universe repository use by default the arping cmd for the gratuitous ARP Virtual IP.
arping_cmd = 'arping -U $IP$ -w 1'

Using by default the arping package instead of iputils-arping can cause serious trouble to you network (tremendous layer2 broadcast).

A quick fix could be switching the -W (second) and -w flag (microsecond) on arping package.
Seems to be a good idea to harmonize the flags for those 2 similar packages ?

libnet_get_hwaddr(): socket: Permission denied

When i run arping -i wlan0 192.x.x.x , get this error :
libnet_get_hwaddr(): socket: Permission denied.

I,m already use the root account to run it.
and i wrote simple test code to invoke libnet_get_hwaddr() ,there's no problem,and retun right hwcode. Or run other app that uses libnet‘s method,also no problem.
only run arping ,get this error.

My env. is linux chroot on android phone:
Linux kali 3.10.40-lasyka+ #30 SMP PREEMPT Sat Sep 29 19:40:50 CST 2018 armv7l GNU/Linux

-bash: ./configure: No such file or directory ?

I am quite new to linux and I was trying to install arping on my raspberry pi (Rasbian).

So I downloaded the latest arping version from here https://github.com/ThomasHabets/arping/releases), put it on my raspberry pi and extracted the .tar.gz file.

After that I tried to follow the instructions given in the Install file (https://github.com/ThomasHabets/arping/blob/arping-2.x/INSTALL)

When I try to follow the instructions I get this error:

[15:16:19] openhabian@openHABianPi:~$ cd arping-arping-2.19
[15:16:27] openhabian@openHABianPi:~/arping-arping-2.19$ ls
bootstrap.sh  doc    fuzz        INSTALL  Makefile.am         README
configure.ac  extra  HACKING.md  LICENSE  Makefile.am.common  src
[15:16:28] openhabian@openHABianPi:~/arping-arping-2.19$ ./configure
-bash: ./configure: No such file or directory
[15:17:51] openhabian@openHABianPi:~/arping-arping-2.19$ make
make: *** No targets specified and no makefile found.  Stop.
[15:17:51] openhabian@openHABianPi:~/arping-arping-2.19$ sudo make install
make: *** No rule to make target 'install'.  Stop.
[15:17:59] openhabian@openHABianPi:~/arping-arping-2.19$

Autoselect interface when pinging MAC address can fail if unused interface is UP

MacOSX keeps unconfigured wireless interfaces UP, tricking arping when pinging MAC address.

Conditions for failure:

  • Interface with no IP address is in state UP.
  • That interface is chosen by pcap_lookupdev(). (appears alphabetically before the desired interface)
  • -S not specified.
  • -i not specified.

When pinging MAC address getifaddrs() can't be used to automatically find the interface, and it'll fall back to pcap_lookupdev().

If pcap_lookupdev() returns an interface without an address configured (e.g. wireless interface on MacOSX) arping will fail to get the configured IP adress and fail.

Workaround is to specify -S or -i, but -S will just set the source address and still probably use the wrong interface.

Should arping in this case try to find another interface to use?

No buffer space available

Good afternoon.

I use the arping utility to check the availability of network nodes that do not respond to ping.
In the evenings I ran into the problem that arping does not work

arping: lib net_write(): libnet_write_link(): only -1 bytes written (No buffer space available)

During the day the macs in arp are about 4372 and in the evening when arping is not working about 4463
During the day, the traffic is about 4 Gbit/s and in the evening about 8 Gbit/s

net.ipv4.neigh.default.gc_thresh1 = 1280
net.ipv4.neigh.default.gc_thresh2 = 5120
net.ipv4.neigh.default.gc_thresh3 = 10240

I tried to increase gc_thresh by 2 times but it didn't help

Perhaps you need to make some kind of tuning of the linux kernel so that arping works in the evenings?

RFE: support the -f option for iputils arping compatibility

iputils arping has the -f option which would be nice to have in your arping as well for compatibility:

  -f : quit on first reply

Maybe just aliasing it to -C 1 (capital C) would be close enough/suffice, if mimicing the iputils behavior isn't feasible. For the iputils one, specifying -f in addition to -c 1 is useful as it makes the command return quicker, immediately on the first received reply.

configure: error: libnet 1.1.x not found

configure: error: libnet 1.1.x not found
434343

使用msys64编译缺少libnet 1.1.x命令库文件 这要咋办?
(Use msys64 compile lack libnet 1.1 x command libraries What's the deal?)

Retrieve unknown IP if Mac is known

Often I have a unknown router to fix. I connect the router via a cable to an external switch to my Debian machine. I use netdiscover to obtain the current IP address, but it works only after several router turn off and ons. Can I use arping for this task? I know the MAC address of the router (plate on the backside) and because of its the same Ethernet segment it should be possible? But I always get timeout as answer:

arping -c 4 -b -i eth0 00:11:22:33:44:55
arping -c 4 -B -i eth0 00:11:22:33:44:55
arping -c 4 -0 -i eth0 00:11:22:33:44:55
root@Debian:~# arping -c 4 -i eth0 00:11:22:33:44:55
arping: clock_getres() = 0 1
arping: libnet_init(eth0)
arping: libnet_init(eth0)
arping: Successfully chrooted to /var/run/sshd
arping: Successfully dropped uid/gid to 65534/65534.
arping: pcap_get_selectable_fd(): 4
This box:   Interface: eth0  IP: 192.168.1.2   MAC address: 00:11:22:33:44:55
ARPING 00:11:22:33:44:55
arping: sending packet at time 13129.152552669
Timeout
arping: sending packet at time 13130.153587683
Timeout
arping: sending packet at time 13131.154612564
Timeout
arping: sending packet at time 13132.155633321
Timeout

--- 00:11:22:33:44:55 statistics ---
4 packets transmitted, 0 packets received, 100% unanswered (0 extra)

In your FAQ, you say that /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts has to be 0 to get answers. I looked at several routers and they all are set to 1. I put a 0 into it on one of my routers and restarted /etc/init.d/network restart and tried arping, but its still timeout.

So I cannot use arping for my problem?

Calculation of lost packets off-by-one

The calculation of the number of lost packets is off by one. Here's a demonstration:

$ sudo arping -i en1 192.168.1.1
ARPING 192.168.1.1
^C
--- 192.168.1.1 statistics ---
1 packets transmitted, 0 packets received, 100% unanswered (0 extra)

What happens here is that I quit ARPing before it could receive the last response 'out in the air'. The calculation error is actually quite significant, as even for 1 packet out of 10, ARPing would show a 10% loss that actually isn't there.

For the calculation of the unanswered packets, ARPing shouldn't account for the last packet that is out in the air.

I am using ARPing 2.09 on OSX (via MacPorts).

Thank you in advance for considering this ticket.

arping: libnet_init(LIBNET_LINK, <null>): <no error message>

Hi, using arping 2.20 (or the latest commit from the 2.x branch, 0e5a10f), on macOS 10.3.6, I can't get arping to work:

$ arping 192.168.7.1
arping: libnet_init(LIBNET_LINK, <null>): <no error message>
arping: you may need to run as root
$ sudo arping 192.168.7.1
arping: libnet_init(LIBNET_LINK, <null>): <no error message>

Another user running macOS 10.14 reported the same error to me.

We are using libnet 1.1.6. (I see that libnet 1.2 is out but I haven't tried it yet; I was not sure if arping would be compatible with that since it mentions requiring libnet 1.1.x.)

Arping does not compile with libnet-1.2.x

I am trying to make a package with arping 2.24 for openwrt, but there's only libnet-1.2.x in library, so I typed noticed it as a dependency. When compiling I got the following output:

make[3]: Entering directory '/builddir/bloop_r2/build_dir/target-mipsel_24kc_musl_R2/arping-1.0.1'
make  all-recursive
make[4]: Entering directory '/builddir/bloop_r2/build_dir/target-mipsel_24kc_musl_R2/arping-1.0.1'
Making all in src
make[5]: Entering directory '/builddir/bloop_r2/build_dir/target-mipsel_24kc_musl_R2/arping-1.0.1/src'
mipsel-openwrt-linux-musl-gcc -DHAVE_CONFIG_H -I. -I..   -I/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include -I/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/include -I/builddir/bloop_r2/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/usr/include -I/builddir/bloop_r2/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include/fortify -I/builddir/bloop_r2/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include  -D_DEFAULT_SOURCE=1  -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/builddir/bloop_r2/build_dir/target-mipsel_24kc_musl_R2/arping-1.0.1:arping-1.0.1 -Wl,-z,now -Wl,-z,relro  -std=c99  -MT arping.o -MD -MP -MF .deps/arping.Tpo -c -o arping.o arping.c
In file included from /builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:90:0,
                 from /builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap.h:43,
                 from arping.c:125:
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/bpf.h:85:9: error: unknown type name 'u_int'
 typedef u_int bpf_u_int32;
         ^~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/bpf.h:105:2: error: unknown type name 'u_int'
  u_int bf_len;
  ^~~~~
In file included from /builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:90:0,
                 from /builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap.h:43,
                 from arping.c:125:
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/bpf.h:235:2: error: unknown type name 'u_short'
  u_short code;
  ^~~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/bpf.h:236:2: error: unknown type name 'u_char'
  u_char  jt;
  ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/bpf.h:237:2: error: unknown type name 'u_char'
  u_char  jf;
  ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/bpf.h:248:10: error: unknown type name 'u_int'
 PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
          ^~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/bpf.h:248:58: error: unknown type name 'u_char'
 PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
                                                          ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/bpf.h:248:68: error: unknown type name 'u_int'; did you mean '__u_int'?
 PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
                                                                    ^~~~~
                                                                    __u_int
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/bpf.h:248:75: error: unknown type name 'u_int'; did you mean '__u_int'?
 PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
                                                                           ^~~~~
                                                                           __u_int
In file included from /builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap.h:43:0,
                 from arping.c:125:
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:165:2: error: unknown type name 'u_short'
  u_short version_major;
  ^~~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:166:2: error: unknown type name 'u_short'
  u_short version_minor;
  ^~~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:211:2: error: unknown type name 'u_int'
  u_int ps_recv;  /* number of packets received */
  ^~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:212:2: error: unknown type name 'u_int'
  u_int ps_drop;  /* number of packets dropped */
  ^~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:213:2: error: unknown type name 'u_int'
  u_int ps_ifdrop; /* drops by interface -- only supported on some platforms */
  ^~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:286:30: error: unknown type name 'u_char'; did you mean '__u_char'?
 typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,
                              ^~~~~~
                              __u_char
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:287:15: error: unknown type name 'u_char'
         const u_char *);
               ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:411:65: error: unknown type name 'u_int'; did you mean '__u_int'?
 PCAP_API pcap_t *pcap_open_dead_with_tstamp_precision(int, int, u_int);
                                                                 ^~~~~
                                                                 __u_int
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:412:72: error: unknown type name 'u_int'; did you mean '__u_int'?
 PCAP_API pcap_t *pcap_open_offline_with_tstamp_precision(const char *, u_int, char *);
                                                                        ^~~~~
                                                                        __u_int
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:437:69: error: unknown type name 'u_int'; did you mean '__u_int'?
   PCAP_API pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
                                                                     ^~~~~
                                                                     __u_int
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:442:39: error: unknown type name 'pcap_handler'; did you mean 'pcap_addr_t'?
 PCAP_API int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
                                       ^~~~~~~~~~~~
                                       pcap_addr_t
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:442:53: error: unknown type name 'u_char'; did you mean '__u_char'?
 PCAP_API int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
                                                     ^~~~~~
                                                     __u_char
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:443:43: error: unknown type name 'pcap_handler'; did you mean 'pcap_addr_t'?
 PCAP_API int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
                                           ^~~~~~~~~~~~
                                           pcap_addr_t
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:443:57: error: unknown type name 'u_char'; did you mean '__u_char'?
 PCAP_API int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
                                                         ^~~~~~
                                                         __u_char
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:444:16: error: unknown type name 'u_char'
 PCAP_API const u_char *pcap_next(pcap_t *, struct pcap_pkthdr *);
                ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:445:67: error: unknown type name 'u_char'
 PCAP_API int  pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
                                                                   ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:453:46: error: unknown type name 'u_char'
 PCAP_API int pcap_sendpacket(pcap_t *, const u_char *, int);
                                              ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:464:40: error: unknown type name 'u_char'
      const struct pcap_pkthdr *, const u_char *);
                                        ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:517:25: error: unknown type name 'u_char'; did you mean '__u_char'?
 PCAP_API void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
                         ^~~~~~
                         __u_char
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:517:69: error: unknown type name 'u_char'
 PCAP_API void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
                                                                     ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:547:12: error: unknown type name 'u_int'
   PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
            ^~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:547:60: error: unknown type name 'u_char'
   PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
                                                            ^~~~~~
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:547:70: error: unknown type name 'u_int'; did you mean '__u_int'?
   PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
                                                                      ^~~~~
                                                                      __u_int
/builddir/bloop_r2/staging_dir/target-mipsel_24kc_musl_R2/usr/include/pcap/pcap.h:547:77: error: unknown type name 'u_int'; did you mean '__u_int'?
   PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
                                                                             ^~~~~
                                                                             __u_int
arping.c: In function 'drop_fs_root':
arping.c:446:13: warning: implicit declaration of function 'chroot'; did you mean 'chmod'? [-Wimplicit-function-declaration]
         if (chroot(pw->pw_dir)) {
             ^~~~~~
             chmod
arping.c: In function 'drop_uid':
arping.c:475:13: warning: implicit declaration of function 'setgroups'; did you mean 'getgroups'? [-Wimplicit-function-declaration]
         if (setgroups(0, NULL)) {
             ^~~~~~~~~
             getgroups
arping.c: In function 'do_pcap_open_live':
arping.c:860:18: error: 'PATH_MAX' undeclared (first use in this function); did you mean 'AF_MAX'?
         char buf[PATH_MAX];
                  ^~~~~~~~
                  AF_MAX
arping.c:860:18: note: each undeclared identifier is reported only once for each function it appears in
arping.c: In function 'pingip_recv':
arping.c:1603:29: error: 'u_char' undeclared (first use in this function); did you mean 'putchar'?
                 if (memcmp((u_char*)harp + sizeof(struct libnet_arp_hdr),
                             ^~~~~~
                             putchar
arping.c:1603:36: error: expected expression before ')' token
                 if (memcmp((u_char*)harp + sizeof(struct libnet_arp_hdr),
                                    ^
arping.c:1603:21: error: too few arguments to function 'memcmp'
                 if (memcmp((u_char*)harp + sizeof(struct libnet_arp_hdr),
                     ^~~~~~
In file included from /builddir/bloop_r2/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include/fortify/string.h:22:0,
                 from arping.c:42:
/builddir/bloop_r2/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include/string.h:28:5: note: declared here
 int memcmp (const void *, const void *, size_t);
     ^~~~~~
arping.c:1621:44: error: expected expression before ')' token
                 const uint8_t* p = (u_char*)harp
                                            ^
arping.c: At top level:
arping.c:1909:46: error: unknown type name 'pcap_handler'; did you mean 'pcap_addr_t'?
 ping_recv(pcap_t *pcap, uint32_t packetwait, pcap_handler func)
                                              ^~~~~~~~~~~~
                                              pcap_addr_t
arping.c: In function 'arping_main':
arping.c:2087:9: warning: implicit declaration of function 'srandom'; did you mean 'xrandom'? [-Wimplicit-function-declaration]
         srandom((unsigned)time(NULL));
         ^~~~~~~
         xrandom
arping.c:2416:11: warning: implicit declaration of function 'strdup'; did you mean 'strcmp'? [-Wimplicit-function-declaration]
    parm = strdup(libnet_addr2name4(dstip,0));
           ^~~~~~
           strcmp
arping.c:2416:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    parm = strdup(libnet_addr2name4(dstip,0));
         ^
arping.c:2457:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   parm = strdup(libnet_addr2name4(dstip,0));
        ^
arping.c:2657:25: warning: implicit declaration of function 'ping_recv'; did you mean 'pingip_recv'? [-Wimplicit-function-declaration]
                         ping_recv(pcap, w, (pcap_handler)pingip_recv);
                         ^~~~~~~~~
                         pingip_recv
arping.c:2657:45: error: 'pcap_handler' undeclared (first use in this function); did you mean 'pcap_addr'?
                         ping_recv(pcap, w, (pcap_handler)pingip_recv);
                                             ^~~~~~~~~~~~
                                             pcap_addr
arping.c:2657:58: error: expected ')' before 'pingip_recv'
                         ping_recv(pcap, w, (pcap_handler)pingip_recv);
                                                          ^~~~~~~~~~~
arping.c:2668:59: error: expected ')' before 'pingmac_recv'
                         ping_recv(pcap, w,  (pcap_handler)pingmac_recv);
                                                           ^~~~~~~~~~~~
make[5]: *** [Makefile:620: arping.o] Error 1
make[5]: Leaving directory '/builddir/bloop_r2/build_dir/target-mipsel_24kc_musl_R2/arping-1.0.1/src'
make[4]: *** [Makefile:377: all-recursive] Error 1
make[4]: Leaving directory '/builddir/bloop_r2/build_dir/target-mipsel_24kc_musl_R2/arping-1.0.1'
make[3]: *** [Makefile:317: all] Error 2
make[3]: Leaving directory '/builddir/bloop_r2/build_dir/target-mipsel_24kc_musl_R2/arping-1.0.1'
make[2]: *** [Makefile:37: /builddir/bloop_r2/build_dir/target-mipsel_24kc_musl_R2/arping-1.0.1/.built] Error 2
make[2]: Leaving directory '/builddir/bloop_r2/feeds/bloop_packages/arping'
time: package/feeds/bloop_packages/arping/compile#0.26#0.08#0.38
make[1]: *** [package/Makefile:113: package/feeds/bloop_packages/arping/compile] Error 2
make[1]: Leaving directory '/builddir/bloop_r2'
make: *** [/builddir/bloop_r2/include/toplevel.mk:227: package/arping/compile] Ошибка 2

unsupport libnet 1.2 and libnet 1.1.2.1

configure:4106: checking for libnet_name_resolve in -lnet
configure:4131: /Users/Kevin/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi18-clang -o conftest -Wall -I/Users/Kevin/Workspaces/Compile/libnet-1.2/autotools-build/libnet/armeabi-v7a/include -I/Users/Kevin/Workspaces/Compile/libpcap-1.9.1/autotools-build/libpcap/armeabi-v7a/include -Wall -I/Users/Kevin/Workspaces/Compile/libnet-1.2/autotools-build/libnet/armeabi-v7a/include -I/Users/Kevin/Workspaces/Compile/libpcap-1.9.1/autotools-build/libpcap/armeabi-v7a/include -D_DEFAULT_SOURCE=1 -static -L/Users/Kevin/Workspaces/Compile/libnet-1.2/autotools-build/libnet/armeabi-v7a/lib -L/Users/Kevin/Workspaces/Compile/libpcap-1.9.1/autotools-build/libpcap/armeabi-v7a/lib conftest.c -lnet >&5
/var/folders/0l/_d6bm6jn00qg6y8xm_mg10cc0000gn/T/conftest-1e4c45.o:conftest.c:function main: error: undefined reference to 'libnet_name_resolve'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Small spelling error in arping.8

Hi

There is a small spelling error in the manpage: explaination -> explanation

--- a/doc/arping.8
+++ b/doc/arping.8
@@ -16,7 +16,7 @@ One request is sent each second\&.
 .PP
 When pinging an IP an ARP who\-has query is sent\&. When pinging a MAC
 address a directed broadcast ICMP Echo request is sent\&. For more
-technical explaination and an FAQ, see the README file\&.
+technical explanation and an FAQ, see the README file\&.
 .PP
 \fINote on timing\fP
 .PP
--- a/doc/arping.yodl
+++ b/doc/arping.yodl
@@ -15,7 +15,7 @@ manpagedescription()

     When pinging an IP an ARP who-has query is sent. When pinging a MAC
     address a directed broadcast ICMP Echo request is sent. For more
-    technical explaination and an FAQ, see the README file.
+    technical explanation and an FAQ, see the README file.

     em(Note on timing)

Getting Timeout on mac and FreeBsd

arping is displaying Timeout on mac and FreeBSD. Not tried on other platform.

Example:-
$ ./a.out -i en0 -c 3 localhost or $ arping -i en0 -c 3 localhost
ARPING 127.0.0.1
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout

Got this comment from http://freshmeat.sourceforge.net/projects/arping
arping 2.13
Release Notes: This release prints "Timeout" when pings time out, fixes a bug with -w for fractions of seconds, works around a bug in libpcap on Solaris, and implements gratuitous ARP (-U).

arping on macOS 10.11.6 not working

macOS 10.11.6
libnet 1.2
no wireshark, no little snitch

sudo arping -i en0 192.168.1.1
Password:
arping: libnet_init(LIBNET_LINK, en0): libnet_bpf_open(): open(): (/dev/bpf0): Permission denied

ls -l bpf0
crw------- 1 root wheel 23, 0 5 Aug 15:30 bpf0

==============

sudo arping -vvvvv 192.168.1.1
arping: Using gettimeofday() for time measurements
arping: libnet_init()
arping: libnet_init(lo)
arping: libnet_init(LIBNET_LINK, ): libnet_bpf_open(): open(): (/dev/bpf0): Permission denied

==============

sudo tcpdump -i en0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on en0, link-type EN10MB (Ethernet), capture size 262144 bytes

==============

sudo dtruss arping 192.168.1.1

arping: libnet_init(LIBNET_LINK, ): libnet_bpf_open(): open(): (/dev/bpf0): Permission denied
SYSCALL(args) = return
thread_selfid(0x0, 0x0, 0x0) = 114667 0
csops(0x0, 0x0, 0x7FFF51F3BB10) = 0 0
issetugid(0x0, 0x0, 0x7FFF51F3BB10) = 1 0
shared_region_check_np(0x7FFF51F39A18, 0x0, 0x7FFF51F3BB10) = 0 0
stat64("/usr/lib/libpcap.A.dylib\0", 0x7FFF51F3ADA8, 0x7FFF51F3BB10) = 0 0
stat64("/usr/local/opt/libnet/lib/libnet.9.dylib\0", 0x7FFF51F3ADA8, 0x7FFF51F3BB10) = 0 0
open("/usr/local/opt/libnet/lib/libnet.9.dylib\0", 0x0, 0x0) = 3 0
pread(0x3, "\317\372\355\376\a\0", 0x1000, 0x0) = 4096 0
mmap(0x10DCD0000, 0xE000, 0x5, 0x12, 0x3, 0x0) = 0x10DCD0000 0
mmap(0x10DCDE000, 0x1000, 0x3, 0x12, 0x3, 0xE000) = 0x10DCDE000 0
mmap(0x10DCE1000, 0x3334, 0x1, 0x12, 0x3, 0xF000) = 0x10DCE1000 0
fcntl(0x3, 0x2C, 0x7FFF51F39148) = 0 0
close(0x3) = 0 0
stat64("/usr/lib/libSystem.B.dylib\0", 0x7FFF51F3ADA8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libcache.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libcommonCrypto.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libcompiler_rt.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148 = 0 0
stat64("/usr/lib/system/libcopyfile.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libcorecrypto.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libdispatch.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libdyld.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libkeymgr.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/liblaunch.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libmacho.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libquarantine.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libremovefile.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_asl.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_blocks.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_c.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_configuration.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_coreservices.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_coretls.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_dnssd.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_info.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148 = 0 0
stat64("/usr/lib/system/libsystem_kernel.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_m.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_malloc.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_network.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_networkextension.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_notify.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_platform.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_pthread.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_sandbox.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_secinit.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libsystem_trace.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libunc.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libunwind.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/system/libxpc.dylib\0", 0x7FFF51F3A8D8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/libobjc.A.dylib\0", 0x7FFF51F39BB8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/libauto.dylib\0", 0x7FFF51F39BB8, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/libc++abi.dylib\0", 0x7FFF51F39A98, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/libc++.1.dylib\0", 0x7FFF51F39A98, 0x7FFF51F39148) = 0 0
stat64("/usr/lib/libDiagnosticMessagesClient.dylib\0", 0x7FFF51F39988, 0x7FFF51F39148) = 0 0
getpid(0x7FFF85EE2740, 0x7FFF51F39988, 0x7FFF51F39148) = 17334 0
open("/dev/dtracehelper\0", 0x2, 0x7FFF51F3B9D0) = 3 0
ioctl(0x3, 0x80086804, 0x7FFF51F3B958) = 0 0
close(0x3) = 0 0
sysctl(0x7FFF51F3B070, 0x2, 0x7FFF51F3B080) = 0 0
thread_selfid(0x7FFF51F3B070, 0x2, 0x7FFF51F3B080) = 114667 0
bsdthread_register(0x7FFF8E3E8344, 0x7FFF8E3E8334, 0x2000) = 1073741887 0
mprotect(0x10DCE5000, 0x88, 0x1) = 0 0
mprotect(0x10DCE7000, 0x1000, 0x0) = 0 0
mprotect(0x10DCFD000, 0x1000, 0x0) = 0 0
mprotect(0x10DCFE000, 0x1000, 0x0) = 0 0
mprotect(0x10DD14000, 0x1000, 0x0) = 0 0
mprotect(0x10DD15000, 0x1000, 0x1) = 0 0
mprotect(0x10DCE5000, 0x88, 0x3) = 0 0
mprotect(0x10DCE5000, 0x88, 0x1) = 0 0
issetugid(0x10DCE5000, 0x88, 0x1) = 1 0
getpid(0x10DCE5000, 0x88, 0x1) = 17334 0
stat64("/AppleInternal/XBS/.isChrooted\0", 0x7FFF51F3AFD8, 0x1) = -1 Err#2
stat64("/AppleInternal\0", 0x7FFF51F3AF48, 0x1) = -1 Err#2
csops(0x43B6, 0x7, 0x7FFF51F3AA60) = -1 Err#22
sysctl(0x7FFF51F3AE20, 0x4, 0x7FFF51F3AB98) = 0 0
csops(0x43B6, 0x7, 0x7FFF51F3A350) = -1 Err#22
proc_info(0x2, 0x43B6, 0x11) = 56 0
socket(0x2, 0x2, 0x0) = 3 0
ioctl(0x3, 0xC00C6924, 0x7FFF51F38280) = 0 0
ioctl(0x3, 0xC0206911, 0x7FFF51F3C2A0) = 0 0
ioctl(0x3, 0xC0206911, 0x7FFF51F3C2A0) = 0 0
ioctl(0x3, 0xC0206911, 0x7FFF51F3C2A0) = 0 0
ioctl(0x3, 0xC0206911, 0x7FFF51F3C2A0) = 0 0
ioctl(0x3, 0xC0206921, 0x7FFF51F3C2A0) = 0 0
ioctl(0x3, 0xC0206911, 0x7FFF51F3C2A0) = 0 0
ioctl(0x3, 0xC0206921, 0x7FFF51F3C2A0) = -1 Err#49
ioctl(0x3, 0xC0206911, 0x7FFF51F3C2A0) = 0 0
ioctl(0x3, 0xC0206921, 0x7FFF51F3C2A0) = -1 Err#49
close(0x3) = 0 0
open("/dev/bpf0\0", 0x2, 0x10DCDD8BF) = -1 Err#13
socket(0x2, 0x2, 0x0) = 3 0
ioctl(0x3, 0xC0206911, 0x7FFF51F3C168) = -1 Err#6
close(0x3) = 0 0
write_nocancel(0x2, "arping: libnet_init(LIBNET_LINK, ): libnet_bpf_open(): open(): (/dev/bpf0): Permission denied\n\0", 0x64) = 100 0
getuid(0x2, 0x7FFF51F3BD70, 0x64) = 0 0

-t not changing Target MAC Address

So, i've tried creating an arp reply to 192.168.0.105 using this command:

arping -P -p -s 12:34:56:78:9a:bc -S 192.168.0.100 -t ba:98:76:54:32:10 192.168.0.105

Basically, i was trying to tell 192.168.0.105 which mac address belongs to 192.168.0.100. -t was supposted to change Target MAC Address of the ARP protocol, but only changed the Ethernet layer destination mac address. It should be the same on both fields.

Because of this, the Target MAC Address was 00:00:00:00:00:00 so 192.168.0.105 refused the arp reply. Is this expected behavior or i've found a bug? Thanks in advance.

Cross compiling Arping causes multiple definitions error

Hello,

I am in the task of cross compiling Arping for host arm-none-linux-gnueabi, when trying to do that libnet and libpcap were required as dependencies so I did the follow:

I download libpcap-1.9.0 and configure as follow:

./configure --build=x86_64-pc-linux-gnu --host=arm-none-linux-gnueabi --prefix=/home/uid32119/arping/libpcap-1.9.0/outp --disable-shared --enable-static

then make.

Now, when trying to cross compile Arping again, I am receiving multiple declarations errors as:

arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I.. -I/home/uid32119/arping/libnet-master/libnet/include -I/home/uid32119/arping/libpcap-1.9.0/pcap -D_DEFAULT_SOURCE=1 -g -O2 -MT arping.o -MD -MP -MF .deps/arping.Tpo -c -o arping.o arping.c
In file included from arping.c:111:0:
/home/uid32119/arping/libpcap-1.9.0/pcap/pcap.h:523:18: error: conflicting types for 'bpf_filter'
PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
^
In file included from /home/uid32119/arping/libpcap-1.9.0/pcap/pcap.h:88:0,
from arping.c:111:
/home/uid32119/arping/libnet-master/libnet/include/bpf.h:260:14: note: previous declaration of 'bpf_filter' was here
extern u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
^
Makefile:613: recipe for target 'arping.o' failed

So I decided to comment /home/uid32119/arping/libpcap-1.9.0/pcap/pcap.h:523 as:

#if !defined(NetBSD) && !defined(QNX)
// PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
#endif

But again, multiple declaration errors arrives:

/home/uid32119/arping/libpcap-1.9.0/.libs/libpcap.a(pcap.o): In function pcap_lookupdev': /home/uid32119/arping/libpcap-1.9.0/./pcap.c:1258: multiple definition of pcap_lookupdev'
mock_libpcap.o:/home/uid32119/arping/arping-arping-2.x/src/mock_libpcap.c:67: first defined here
/home/uid32119/arping/libpcap-1.9.0/.libs/libpcap.a(pcap.o): In function pcap_dispatch': /home/uid32119/arping/libpcap-1.9.0/./pcap.c:2564: multiple definition of pcap_dispatch'
mock_libpcap.o:/home/uid32119/arping/arping-arping-2.x/src/mock_libpcap.c:21: first defined here
/
.
.
.

This is how I configured for Arping:

./configure --build=x86_64-pc-linux-gnu --host=arm-none-linux-gnueabi --prefix=/home/uid32119/arping/arping-arping-2.x/ LDFLAGS="-L/home/uid32119/arping/libnet-master/libnet/src/.libs -L/home/uid32119/arping/libpcap-1.9.0/.libs" CPPFLAGS="-I/home/uid32119/arping/libnet-master/libnet/include -I/home/uid32119/arping/libpcap-1.9.0"

/home/uid32119/arping/libpcap-1.9.0/.libs is just a folder I create to have libpcap.a by itself.

I feel like I am doing something wrong in configure step, maybe you are able to tell me if I am using wrong configure?

Best Regards!

PD: config.log from arping added
config.log

arping_test compile failure

Hi!

I'm attempting to package arping for GNU Guix and am running into a failure upon make check:

starting phase `check'
Making check in src
make[1]: Entering directory '/tmp/guix-build-arping-2.21.drv-0/arping-2.21/src'
make  arping_test
make[2]: Entering directory '/tmp/guix-build-arping-2.21.drv-0/arping-2.21/src'
gcc -DHAVE_CONFIG_H -I. -I..   -D_DEFAULT_SOURCE=1  -g -O2  -MT arping_test.o -MD -MP -MF .deps/arping_test.Tpo -c -o arping_test.o arping_test.c
In file included from arping_test.c:29:0:
arping_test.c:239:8: error: ‘test_mkpacket’ redeclared as different kind of symbol
 MYTEST(test_mkpacket)
        ^
arping_test.c:239:1: note: in expansion of macro ‘MYTEST’
 MYTEST(test_mkpacket)
 ^~~~~~
arping_test.c:239:8: note: previous declaration of ‘test_mkpacket’ was here
 MYTEST(test_mkpacket)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
In file included from arping_test.c:29:0:
arping_test.c:264:8: error: ‘pingip_uninteresting_packet’ redeclared as different kind of symbol
 MYTEST(pingip_uninteresting_packet)
        ^
arping_test.c:264:1: note: in expansion of macro ‘MYTEST’
 MYTEST(pingip_uninteresting_packet)
 ^~~~~~
arping_test.c:264:8: note: previous declaration of ‘pingip_uninteresting_packet’ was here
 MYTEST(pingip_uninteresting_packet)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
In file included from arping_test.c:29:0:
arping_test.c:392:8: error: ‘pingip_interesting_packet’ redeclared as different kind of symbol
 MYTEST(pingip_interesting_packet)
        ^
arping_test.c:392:1: note: in expansion of macro ‘MYTEST’
 MYTEST(pingip_interesting_packet)
 ^~~~~~
arping_test.c:392:8: note: previous declaration of ‘pingip_interesting_packet’ was here
 MYTEST(pingip_interesting_packet)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
In file included from arping_test.c:29:0:
arping_test.c:452:8: error: ‘strip_newline_test’ redeclared as different kind of symbol
 MYTEST(strip_newline_test)
        ^
arping_test.c:452:1: note: in expansion of macro ‘MYTEST’
 MYTEST(strip_newline_test)
 ^~~~~~
arping_test.c:452:8: note: previous declaration of ‘strip_newline_test’ was here
 MYTEST(strip_newline_test)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
In file included from arping_test.c:29:0:
arping_test.c:472:8: error: ‘get_mac_addr_success’ redeclared as different kind of symbol
 MYTEST(get_mac_addr_success)
        ^
arping_test.c:472:1: note: in expansion of macro ‘MYTEST’
 MYTEST(get_mac_addr_success)
 ^~~~~~
arping_test.c:472:8: note: previous declaration of ‘get_mac_addr_success’ was here
 MYTEST(get_mac_addr_success)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
In file included from arping_test.c:29:0:
arping_test.c:504:8: error: ‘get_mac_addr_fail’ redeclared as different kind of symbol
 MYTEST(get_mac_addr_fail)
        ^
arping_test.c:504:1: note: in expansion of macro ‘MYTEST’
 MYTEST(get_mac_addr_fail)
 ^~~~~~
arping_test.c:504:8: note: previous declaration of ‘get_mac_addr_fail’ was here
 MYTEST(get_mac_addr_fail)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
In file included from arping_test.c:29:0:
arping_test.c:520:14: error: ‘libnet_init_bad_nolo’ redeclared as different kind of symbol
 MY_EXIT_TEST(libnet_init_bad_nolo)
              ^
arping_test.c:520:1: note: in expansion of macro ‘MY_EXIT_TEST’
 MY_EXIT_TEST(libnet_init_bad_nolo)
 ^~~~~~~~~~~~
arping_test.c:520:14: note: previous declaration of ‘libnet_init_bad_nolo’ was here
 MY_EXIT_TEST(libnet_init_bad_nolo)
              ^
arping_test.c:65:37: note: in definition of macro ‘MY_EXIT_TEST’
 #define MY_EXIT_TEST(a) static void a(int);__attribute__((constructor)) \
                                     ^
In file included from arping_test.c:29:0:
arping_test.c:528:14: error: ‘libnet_init_null_nolo_nonull’ redeclared as different kind of symbol
 MY_EXIT_TEST(libnet_init_null_nolo_nonull)
              ^
arping_test.c:528:1: note: in expansion of macro ‘MY_EXIT_TEST’
 MY_EXIT_TEST(libnet_init_null_nolo_nonull)
 ^~~~~~~~~~~~
arping_test.c:528:14: note: previous declaration of ‘libnet_init_null_nolo_nonull’ was here
 MY_EXIT_TEST(libnet_init_null_nolo_nonull)
              ^
arping_test.c:65:37: note: in definition of macro ‘MY_EXIT_TEST’
 #define MY_EXIT_TEST(a) static void a(int);__attribute__((constructor)) \
                                     ^
In file included from arping_test.c:29:0:
arping_test.c:535:8: error: ‘libnet_init_good’ redeclared as different kind of symbol
 MYTEST(libnet_init_good)
        ^
arping_test.c:535:1: note: in expansion of macro ‘MYTEST’
 MYTEST(libnet_init_good)
 ^~~~~~
arping_test.c:535:8: note: previous declaration of ‘libnet_init_good’ was here
 MYTEST(libnet_init_good)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
In file included from arping_test.c:29:0:
arping_test.c:542:8: error: ‘libnet_init_null_nolo’ redeclared as different kind of symbol
 MYTEST(libnet_init_null_nolo)
        ^
arping_test.c:542:1: note: in expansion of macro ‘MYTEST’
 MYTEST(libnet_init_null_nolo)
 ^~~~~~
arping_test.c:542:8: note: previous declaration of ‘libnet_init_null_nolo’ was here
 MYTEST(libnet_init_null_nolo)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
arping_test.c:239:8: warning: ‘test_mkpacket’ used but never defined
 MYTEST(test_mkpacket)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
arping_test.c:264:8: warning: ‘pingip_uninteresting_packet’ used but never defined
 MYTEST(pingip_uninteresting_packet)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
arping_test.c:392:8: warning: ‘pingip_interesting_packet’ used but never defined
 MYTEST(pingip_interesting_packet)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
arping_test.c:452:8: warning: ‘strip_newline_test’ used but never defined
 MYTEST(strip_newline_test)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
arping_test.c:472:8: warning: ‘get_mac_addr_success’ used but never defined
 MYTEST(get_mac_addr_success)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
arping_test.c:504:8: warning: ‘get_mac_addr_fail’ used but never defined
 MYTEST(get_mac_addr_fail)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
arping_test.c:520:14: warning: ‘libnet_init_bad_nolo’ used but never defined
 MY_EXIT_TEST(libnet_init_bad_nolo)
              ^
arping_test.c:65:37: note: in definition of macro ‘MY_EXIT_TEST’
 #define MY_EXIT_TEST(a) static void a(int);__attribute__((constructor)) \
                                     ^
arping_test.c:528:14: warning: ‘libnet_init_null_nolo_nonull’ used but never defined
 MY_EXIT_TEST(libnet_init_null_nolo_nonull)
              ^
arping_test.c:65:37: note: in definition of macro ‘MY_EXIT_TEST’
 #define MY_EXIT_TEST(a) static void a(int);__attribute__((constructor)) \
                                     ^
arping_test.c:535:8: warning: ‘libnet_init_good’ used but never defined
 MYTEST(libnet_init_good)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
arping_test.c:542:8: warning: ‘libnet_init_null_nolo’ used but never defined
 MYTEST(libnet_init_null_nolo)
        ^
arping_test.c:58:31: note: in definition of macro ‘MYTEST’
 #define MYTEST(a) static void a(int);__attribute__((constructor)) \
                               ^
make[2]: *** [Makefile:627: arping_test.o] Error 1

This is using GCC 7, check 0.14, libnet 1.2. I tried check 0.13 and libnet 1.1, but it made no difference. Any idea what I'm doing wrong?

Fail to ping device by MAC address

Probably this is not an issue but rather a question.

Setup:

Three interfaces which are combined into one bridge br0:

# brctl show br0
bridge name     bridge id               STP enabled     interfaces
br0             8000.1c3e84cf4999       no              eth0
                                                        eth1
                                                        wlan0

Linux host is directly attached to Netgear router:

# arp | grep netgear
netgear                  ether   2c:b0:5d:a6:8e:02   C                     br0

Doublecheking that the router is 1-hop away:

# traceroute netgear
traceroute to netgear (192.168.10.5), 30 hops max, 60 byte packets
 1  netgear (192.168.10.5)  0.281 ms  0.277 ms  0.356 ms

I have compiled arping from this repo at commit 75b5cdd.

The problem:

I am trying to use arping to check if the router is up and responding using its MAC address (192.168.10.10 is IP address of br0):

# /usr/local/sbin/arping -c 3 -S 192.168.10.10 -i eth0 2c:b0:5d:a6:8e:02
ARPING 2c:b0:5d:a6:8e:02
Timeout
Timeout
Timeout

--- 2c:b0:5d:a6:8e:02 statistics ---
3 packets transmitted, 0 packets received, 100% unanswered (0 extra)

Just in case I messed up the interfaces (although I am sure it is connected to eth0):

# /usr/local/sbin/arping -c 3 -S 192.168.10.10 -i eth1 2c:b0:5d:a6:8e:02
ARPING 2c:b0:5d:a6:8e:02
Timeout
Timeout
Timeout

--- 2c:b0:5d:a6:8e:02 statistics ---
3 packets transmitted, 0 packets received, 100% unanswered (0 extra)

What I do wrong?

Additional info:

I have read the following topics on the subject, most advising to scan or broadcast ping the network and then analyse arp table as a solution:

Nevertheless is MAC-ping possible in my scenario? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.