Network Binding - arping - wrong source interface

Hello!
I was using with success Network Binding and arping, since I added a new interface (for Docker) arping use the wrong interface:

32392 ?        Ssl   62:40 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dfelix.cm.dir=/var/lib/openhab2/config -Djava.library.path=/var/lib/openhab2/tmp/lib -Djetty.
29678 ?        S      0:00  \_ arping -w 2 -c 1 -I docker0 192.168.5.3
29683 ?        S      0:00  \_ arping -w 2 -c 1 -I docker0 192.168.5.5

How I can set the correct source interface (eth0 and not docker0)

Regards
Sim

I’m trying this temporary solution…
The “false” arping skip request if it contains the word “docker”

services/network.cfg

[..]
#binding.network:arpPingToolPath=arping
binding.network:arpPingToolPath=/etc/openhab2/arping.sh
[..]

/etc/openhab2/arping.sh

#!/bin/bash
STRING="$@"

if [[ ${STRING} != *"docker"* ]];then
        exec /usr/bin/arping $STRING
fi

I’ll let you know…

Just by curiosity I had a look to the source code. As far as I understand the source code the binding detects all available network interfaces and uses all of them. It is not possible to configure the network interface that is to be used. I think this is because of one user might want to use all of them while the other one only wants to use one. Doing a query on all the interfaces solves this.

I wanted to do it myself but I didn’t find the time. Thank you :slight_smile:

The problem is in this “full” example…

"A"   S      0:00  \_ arping -w 2 -c 1 -I docker0 192.168.5.3
"B"   S      0:00  \_ arping -w 2 -c 1 -I eth0 192.168.5.5

The process “B” end immediately with “ON”, but the process “A” wait the timeout (-w) and overwrites the value. Result … the IP 192.168.5.3 is “OFF”.

If the code will not be changed with the possibility to select the interface, the solution is my “fake arping” /etc/openhab2/arping.sh

1 Like

Hmm, the trouble is that for any target device, a ping is likely to fail on one interface on any non-trivial network. That wouldn’t usually matter (the other one worked!) but of course this binding takes positive action by design and reports the failure?

I noticed that it doesn’t work properly.
Here a fix…

/etc/openhab2/arping.sh

#!/bin/bash
STRING="$@"

if [[ ${STRING} != *"docker0"* ]];then
        exec /usr/bin/arping $STRING
else
        exec /usr/bin/arping ${STRING/docker0/eth0}
fi

where docker0 is the wrong interface and eth0 the right.