ARP ping presence detection produces NullPointerException

I’m seeing the following exception when trying to use the network binding with arpping for the presence detection on couple of mobiles:

In karaf I see the following error:

6:22:11 host karaf[27311]: Exception in thread "presenceDetectionARP_10.100.1.57 " java.lang.NullPointerException
6:22:11 host karaf[27311]:         at java.lang.ProcessBuilder.start(ProcessBuilder.java:1012)
6:22:11 host karaf[27311]:         at org.openhab.binding.network.internal.utils.NetworkUtils.nativeARPPing(NetworkUtils.java:316)
6:22:11 host karaf[27311]:         at org.openhab.binding.network.internal.PresenceDetection.performARPping(PresenceDetection.java:506)
6:22:11 host karaf[27311]:         at org.openhab.binding.network.internal.PresenceDetection.lambda$3(PresenceDetection.java:339)
6:22:11 host karaf[27311]:         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
6:22:11 host karaf[27311]:         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
6:22:11 host karaf[27311]:         at java.lang.Thread.run(Thread.java:748)

In openhab.log (with trace logging on the network binding) I see the following:

6:24:21.910 [TRACE] [g.network.internal.PresenceDetection] - Perform native ping presence detection for galaxy-s9
6:24:22.033 [TRACE] [g.network.internal.PresenceDetection] - Perform ARP ping presence detection for 10.100.1.57 on interface: null

I suspect that the issue is connected to the missing interface which is NULL and that creates the NullPointerException, but I’m not sure if there is anything I can do to fix inside the configuration or if this is an issue with the binding.

I’m currently running Openhab 2.5.0~S1525-1 (incl. addons) on debian. I beleave that I have seen some recent changes on the Network Binding by David, to not provide anymore the interface when the arping is being executed. For that reason I have tried both debian packages: arping and iputils-arping, as arping is requiring an interface name and in iputils-arping it is optional, but didn’t have any success in either case.

I have tried also to run Openhab as part of the root group, to prevent any permission issues and I have also setcap ‘cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep’ $(realpath /usr/bin/java).

chmod u+s on arping is set and arping can be executed as the openhab user which is running the service.

Here is the runtime configuration on the item (phone):

arp_state Disabled
dhcp_state Running normally
icmp_state IPUTILS_LINUX_PING
presence_detection_type
uses_ios_wakeup Yes

What else could be the problem?

Bug. Please file an issue on GitHub.

Done: https://github.com/openhab/openhab2-addons/issues/4966