OH2 Network binding ping change

With the last couple nightly builds of OH2 and the v2 network binding, I have had to change the ping type in the network binding to use the system ping or the devices being monitored would never register as online.

Also, not sure if related or not, there was a change that went through to see devices come online quickly based on DHCP. I did not see anything special as far as permissions needed, but this is in my log file now:

[ERROR] [nding.network.service.NetworkService] - Cannot use DHCP listen: Permission denied

Anyone else seeing these changes?

Hey Jim,
I made the changes to the network binding.

Regarding the ping type: If you do not use the system ping mode, org.eclipse.smarthome.model.script.actions.Ping.checkVitality() is used. If that does not work, then there is a problem in Eclipse Smarthome / the underlying java implementation. For me the java ping does not work for windows OS’s and I prefer the system ping mode.

Regarding the DHCP functionality: This is documented in the readme file of the binding (https://github.com/openhab/openhab2-addons/tree/master/addons/binding/org.openhab.binding.network).
In a nutshell: The dhcp port is a system port (a port below 1024) and an application needs special permissions to open a socket on such a port.
In Linux you need the cap_net_bind_service capability. Acquire it with setcap ‘cap_net_bind_service=+ep’ /usr/bin/java.

Hi David,

Thanks for the quick response. I have no problem with using the system ping, I just found it curious that the default was no longer working. This is a Linux box by the way. Defaulting to the system ping would probably be preferred over using both. We don’t want to create traffic where it is not needed, especially if the traffic is going to fail anyway.

Running setcap on my java executable makes it no longer execute for some reason:

./start.sh 
Launching the openHAB runtime...
/opt/openHAB/runtime/karaf/bin/setenv: line 178: [: : integer expression expected
/opt/openHAB/runtime/karaf/bin/karaf: line 239: [: : integer expression expected
/opt/openHAB/runtime/karaf/bin/karaf: line 284: [: : integer expression expected
/usr/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

setting it back with -ep allows it to start again.

Shall we take this over to the github thread, or keep it here?

Just wanted to follow up on this. If you set +ep on an executable, it forces the executable to lose its LD_LIBRARY_PATH, a precaution to the elevated privileges granted. Since the JVM relies on this fairly heavily, it causes some problems. As always, it is the user’s choice. I just wanted to provide the information.

Hello!
When starting OpenHAB2 in the log began to appear such events:

2017-03-10 11:22:51.126 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber 'org.eclipse.smarthome.core.thing.link.ThingLinkManager@476e69e1' takes more than 5000ms.
2017-03-10 11:22:52.522 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber 'org.eclipse.smarthome.core.thing.link.ThingLinkManager@476e69e1' takes more than 5000ms.
2017-03-10 11:22:59.612 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber 'org.eclipse.smarthome.core.thing.link.ThingLinkManager@476e69e1' takes more than 5000ms.

This is normal? Previously, this was not.
Tanks!

Hi there, I’m running OpenHAB2.2.0 on Windows 10, and the network binding just won’t ever show my device as being offline when it should. The logs show that the device just keeps on increasing latency times (in the thousands) but never goes “offline”. My refresh interval is 3000ms, timeout is 4000ms and retries is 3.

Show Properties reveals the following:

|uses_dhcp_listen|no|
|dhcp_state|Running normally|
|presence_detection_type|ICMP_PING|
|arp_state|Disabled|
|uses_ios_wakeup|On|
|icmp_state|WINDOWS_PING|
|uses_arp_pings|no|

Can anybody shed light on this please?

Thanks.