Because of the feedback in this thread I decided to implement the capturing in a more fault-tolerant way.
Pull request: https://github.com/openhab/openhab2-addons/pull/1379
Because of the feedback in this thread I decided to implement the capturing in a more fault-tolerant way.
Pull request: https://github.com/openhab/openhab2-addons/pull/1379
root@raspberrypi3:/home/pi# java -jar d3612-pcap4j-sample-0.0.1-snapshot-jar-with-dependencies.jar
8 Devices found:
eth0 (192.168.2.237, fd00:0:0:0:ec03:f2b7:c580:32e2, fe80:0:0:0:cc13:7303:fe0b:5efd) Capturing: WORKS!
any (Pseudo-device that captures on all interfaces) Capturing: WORKS!
lo (127.0.0.1, 0:0:0:0:0:0:0:1) Capturing: WORKS!
wlan0 (fe80:0:0:0:991a:d12c:ffca:b278) Capturing: WORKS!
bluetooth0 (Bluetooth adapter number 0) Capturing: WORKS!
nflog (Linux netfilter log (NFLOG) interface) Capturing: WORKS!
nfqueue (Linux netfilter queue (NFQUEUE) interface) Capturing: WORKS!
usbmon1 (USB bus number 1) Capturing: DENIED! Message: usbmon1: Can't open USB bus file /sys/kernel/debug/usbmon/1t: Datei oder Verzeichnis nicht gefunden
as non root user
Upps … woke up at 02:30 in the morning, too tired to concentrate
pi@raspberrypi3:~ $ java -jar d3612-pcap4j-sample-0.0.1-snapshot-jar-with-dependencies.jar
8 Devices found:
eth0 (192.168.2.237, fd00:0:0:0:ec03:f2b7:c580:32e2, fe80:0:0:0:cc13:7303:fe0b:5efd) Capturing: DENIED! Message: eth0: You don't have permission to capture on that device (socket: Die Operation ist nicht erlaubt)
any (Pseudo-device that captures on all interfaces) Capturing: DENIED! Message: any: You don't have permission to capture on that device (socket: Die Operation ist nicht erlaubt)
lo (127.0.0.1, 0:0:0:0:0:0:0:1) Capturing: DENIED! Message: lo: You don't have permission to capture on that device (socket: Die Operation ist nicht erlaubt)
wlan0 (fe80:0:0:0:991a:d12c:ffca:b278) Capturing: DENIED! Message: wlan0: You don't have permission to capture on that device (socket: Die Operation ist nicht erlaubt)
bluetooth0 (Bluetooth adapter number 0) Capturing: WORKS!
nflog (Linux netfilter log (NFLOG) interface) Capturing: DENIED! Message: nflog: NFULNL_CFG_CMD_PF_UNBIND: Die Operation ist nicht erlaubt
nfqueue (Linux netfilter queue (NFQUEUE) interface) Capturing: DENIED! Message: nfqueue: NFQNL_CFG_CMD_PF_UNBIND: Die Operation ist nicht erlaubt
usbmon1 (USB bus number 1) Capturing: DENIED! Message: usbmon1: Can't open USB bus file /sys/kernel/debug/usb/usbmon/1t: Keine Berechtigung
Nevermind. Are you sure that you run the application with the java binary you granted the cap capabilities to?
Can you try this please:
/usr/lib/jvm/java-8-oracle/bin/java -jar d3612-pcap4j-sample-0.0.1-snapshot-jar-with-dependencies.jar
I have no idea because it is the first time I heard about setcap …
What I did yesterday:
sudo setcap cap_net_raw,cap_net_admin=eip /usr/lib/jvm/java-8-oracle/bin/java
pi@raspberrypi3:~ $ /usr/lib/jvm/java-8-oracle/bin/java -jar d3612-pcap4j-sample-0.0.1-snapshot-jar-with-dependencies.jar
8 Devices found:
eth0 (192.168.2.237, fd00:0:0:0:ec03:f2b7:c580:32e2, fe80:0:0:0:cc13:7303:fe0b:5efd) Capturing: WORKS!
any (Pseudo-device that captures on all interfaces) Capturing: WORKS!
lo (127.0.0.1, 0:0:0:0:0:0:0:1) Capturing: WORKS!
wlan0 (fe80:0:0:0:991a:d12c:ffca:b278) Capturing: WORKS!
bluetooth0 (Bluetooth adapter number 0) Capturing: WORKS!
nflog (Linux netfilter log (NFLOG) interface) Capturing: WORKS!
nfqueue (Linux netfilter queue (NFQUEUE) interface) Capturing: WORKS!
usbmon1 (USB bus number 1) Capturing: DENIED! Message: usbmon1: Can't open USB bus file /sys/kernel/debug/usb/usbmon/1t: Keine Berechtigung
Ok, obviously the Java binary in your path is not /usr/lib/jvm/java-8-oracle/bin/java.
So you granted the capabilities to the wrong Java binary.
No idea about that. Everything worked right out of the box before, so I never had to even think about this.
What should I do now?
Which one is it then?
Edit: the VERY first step I did was:
sudo setcap cap_net_raw,cap_net_admin=eip /usr/lib/jvm/java-8-oracle-arm32-vfp-hflt/bin/java
2nd Edit:
pi@raspberrypi3:~ $ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode)
This is the command for my RPi3:
setcap cap_net_raw,cap_net_admin=eip /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java
Easier way to resolve the path of your java:
sudo setcap cap_net_raw,cap_net_admin=eip `realpath /usr/bin/java`
I realise that the suggested command in the docs may have a conflict with the Network binding, since setcap may overwrite previous settings (i.e. cap_net_bind service=+ep
) @oliver would you agree that for these people the command should be:
sudo setcap 'cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep' `realpath /usr/bin/java`
I have to admit that I just don’t know if this is the correct command, but I gues you are right. I updated the README: https://github.com/openhab/openhab2-addons/pull/1388
Thx, that worked for me, dash button is up and running.
ac-63-be - Germany - Nov. 2017
I have two with b4:7c:9c in Germany
Doesn’t work with my rpi3 with the last openhabian version and the dash binding. Tried everything, it doesn’t find “the thing”. And the same errors when start to search:
2017-08-11 20:00:40.535 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.inet, use default value: null
2017-08-11 20:00:40.536 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.inet6, use default value: null
2017-08-11 20:00:40.538 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.packet, use default value: null
2017-08-11 20:00:40.539 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.link, use default value: null
2017-08-11 20:00:40.662 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.dlt.raw, use default value: null
My dash macs:
FC:A6:67:41:C9:--
68:37:E9:22:95:--
B4:7C:9C:93:05:--
40:B4:CD:8A:AA:--
68:37:E9:84:63:--
Anyone got this working with openhabian?
Execute the java setcap again and it should start working:
sudo setcap cap_net_raw,cap_net_admin=eip $(realpath /usr/bin/java)
I already tried that.
But anyway, I did it again. Nothing.
Is it possible to be a zulu java issue?
[14:28:13] openhabian@openHABianPi:~$ sudo setcap cap_net_raw,cap_net_admin=eip $(realpath /usr/bin/java)
[14:28:29] openhabian@openHABianPi:~$ sudo getcap $(realpath /usr/bin/java)
/usr/lib/jvm/zulu-embedded-8-armhf/bin/java = cap_net_admin,cap_net_raw+eip
[14:28:38] openhabian@openHABianPi:~$ sudo setcap cap_net_raw,cap_net_admin=eip $(realpath /usr/bin/java)
Its interesting that it doesn’t find the dash but my iphone receive the command and as I use the network binding to other stuff, and openhab does recognize the dash as a network interface and its command. But no with the dash binding. I did a full clean install with only dash binding, no network binding, and no recognition. I’m getting crazy about it. lol
fc:a6:67
b4:7c:9c
68:37:e9