Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException: null for tun0 interface (is my fix reasonable?) #37

Closed
mclaudt opened this issue Apr 21, 2015 · 13 comments
Labels

Comments

@mclaudt
Copy link

mclaudt commented Apr 21, 2015

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Pcap4J
[INFO] Pcap4J Core
[INFO] Pcap4J Packet Test
[INFO] Pcap4J Static Packet Factory
[INFO] Pcap4J Properties-Based Packet Factory
[INFO] Pcap4J Sample
[INFO] Pcap4J Distribution
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Pcap4J 1.4.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ pcap4j ---
[INFO] 
[INFO] --- maven-javadoc-plugin:2.9:aggregate-jar (aggregate-jar) @ pcap4j ---
[INFO] 
Loading source files for package org.pcap4j...
Loading source files for package org.pcap4j.core...
Loading source files for package org.pcap4j.packet...
Loading source files for package org.pcap4j.packet.constant...
Loading source files for package org.pcap4j.packet.factory...
Loading source files for package org.pcap4j.packet.namednumber...
Loading source files for package org.pcap4j.util...
Loading source files for package org.pcap4j.sample...
Constructing Javadoc information...
Standard Doclet version 1.7.0_80
Building tree for all the packages and classes...
Generating /root/IdeaProjects/pcap4j/target/apidocs/org/pcap4j/Pcap4jPropertiesLoader.html...
<<skipped other "Generating">>
Generating /root/IdeaProjects/pcap4j/target/apidocs/help-doc.html...
2 warnings
[WARNING] Javadoc Warnings
[WARNING] /root/IdeaProjects/pcap4j/pcap4j-core/src/main/java/org/pcap4j/packet/factory/PacketFactory.java:42: warning - Tag @link: can't find newInstance(byte[], NamedNumber) in org.pcap4j.packet.factory.PacketFactory
[WARNING] /root/IdeaProjects/pcap4j/pcap4j-core/src/main/java/org/pcap4j/packet/factory/PacketFactory.java:49: warning - Tag @link: can't find newInstance(byte[]) in org.pcap4j.packet.factory.PacketFactory
[INFO] Building jar: /root/IdeaProjects/pcap4j/target/pcap4j-1.4.1-SNAPSHOT-javadoc.jar
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ pcap4j ---
[INFO] Installing /root/IdeaProjects/pcap4j/pom.xml to /root/.m2/repository/org/pcap4j/pcap4j/1.4.1-SNAPSHOT/pcap4j-1.4.1-SNAPSHOT.pom
[INFO] Installing /root/IdeaProjects/pcap4j/target/pcap4j-1.4.1-SNAPSHOT-javadoc.jar to /root/.m2/repository/org/pcap4j/pcap4j/1.4.1-SNAPSHOT/pcap4j-1.4.1-SNAPSHOT-javadoc.jar
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Pcap4J Core 1.4.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ pcap4j-core ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ pcap4j-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ pcap4j-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 191 source files to /root/IdeaProjects/pcap4j/pcap4j-core/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ pcap4j-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ pcap4j-core ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.15:test (default-test) @ pcap4j-core ---
[INFO] Surefire report directory: /root/IdeaProjects/pcap4j/pcap4j-core/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.pcap4j.core.PcapHandleTest
14:03:51,341 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
14:03:51,341 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-test.xml] at [file:/root/IdeaProjects/pcap4j/pcap4j-core/target/test-classes/logback-test.xml]
14:03:51,414 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
14:03:51,417 |-INFO in ch.qos.logback.core.joran.action.StatusListenerAction - Adding status listener of type [ch.qos.logback.core.status.OnConsoleStatusListener]
14:03:51,434 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
14:03:51,438 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
14:03:51,471 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
14:03:51,524 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.FileAppender]
14:03:51,526 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
14:03:51,533 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
14:03:51,535 |-INFO in ch.qos.logback.core.FileAppender[FILE] - File property is set to [target/test/test.log]
14:03:51,536 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.pcap4j.core] to DEBUG
14:03:51,537 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [org.pcap4j.core] to true
14:03:51,537 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[org.pcap4j.core]
14:03:51,538 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
14:03:51,538 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
14:03:51,540 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@736afade - Registering current configuration as safe fallback point
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.859 sec <<< FAILURE! - in org.pcap4j.core.PcapHandleTest
testGetStats(org.pcap4j.core.PcapHandleTest)  Time elapsed: 0.29 sec  <<< ERROR!
java.lang.NullPointerException: null
    at org.pcap4j.core.PcapNetworkInterface.<init>(PcapNetworkInterface.java:55)
    at org.pcap4j.core.PcapNetworkInterface.newInstance(PcapNetworkInterface.java:115)
    at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:84)
    at org.pcap4j.core.PcapHandleTest.setUp(PcapHandleTest.java:34)

testListDatalinks(org.pcap4j.core.PcapHandleTest)  Time elapsed: 0.139 sec  <<< ERROR!
java.lang.NullPointerException: null
    at org.pcap4j.core.PcapNetworkInterface.<init>(PcapNetworkInterface.java:55)
    at org.pcap4j.core.PcapNetworkInterface.newInstance(PcapNetworkInterface.java:115)
    at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:84)
    at org.pcap4j.core.PcapHandleTest.setUp(PcapHandleTest.java:34)

testSetDlt(org.pcap4j.core.PcapHandleTest)  Time elapsed: 0.141 sec  <<< ERROR!
java.lang.NullPointerException: null
    at org.pcap4j.core.PcapNetworkInterface.<init>(PcapNetworkInterface.java:55)
    at org.pcap4j.core.PcapNetworkInterface.newInstance(PcapNetworkInterface.java:115)
    at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:84)
    at org.pcap4j.core.PcapHandleTest.setUp(PcapHandleTest.java:34)

Running org.pcap4j.core.PcapDumperTest
14:03:52.139 [main] DEBUG org.pcap4j.core.PcapDumper - Dumping a packet: [Ethernet Header (14 bytes)]
  Destination address: ff:ff:ff:ff:ff:ff
  Source address: fe:00:00:00:00:01
  Type: 0x0806 (ARP)
[ARP Header (28 bytes)]
  Hardware type: 1 (Ethernet (10Mb))
  Protocol type: 0x0800 (IPv4)
  Hardware address length: 6 [bytes]
  Protocol address length: 4 [bytes]
  Operation: 1 (REQUEST)
  Source hardware address: fe:00:00:00:00:01
  Source protocol address: /192.0.2.1
  Destination hardware address: ff:ff:ff:ff:ff:ff
  Destination protocol address: /192.0.2.2
[Ethernet Pad (18 bytes)]
  Hex stream: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

14:03:52.146 [main] DEBUG org.pcap4j.core.PcapDumper - Dumped a packet: ff ff ff ff ff ff fe 00 00 00 00 01 08 06 00 01 08 00 06 04 00 01 fe 00 00 00 00 01 c0 00 02 01 ff ff ff ff ff ff c0 00 02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
14:03:52.147 [main] INFO  org.pcap4j.core.PcapDumper - Closed.
14:03:52.147 [main] INFO  org.pcap4j.core.PcapHandle - Closed.
14:03:52.149 [main] INFO  org.pcap4j.core.PcapDumperTest - initialPosition: 24
14:03:52.149 [main] DEBUG org.pcap4j.core.PcapDumper - Dumping a packet: [Ethernet Header (14 bytes)]
  Destination address: ff:ff:ff:ff:ff:ff
  Source address: fe:00:00:00:00:01
  Type: 0x0806 (ARP)
[ARP Header (28 bytes)]
  Hardware type: 1 (Ethernet (10Mb))
  Protocol type: 0x0800 (IPv4)
  Hardware address length: 6 [bytes]
  Protocol address length: 4 [bytes]
  Operation: 1 (REQUEST)
  Source hardware address: fe:00:00:00:00:01
  Source protocol address: /192.0.2.1
  Destination hardware address: ff:ff:ff:ff:ff:ff
  Destination protocol address: /192.0.2.2
[Ethernet Pad (18 bytes)]
  Hex stream: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

14:03:52.156 [main] DEBUG org.pcap4j.core.PcapDumper - Dumped a packet: ff ff ff ff ff ff fe 00 00 00 00 01 08 06 00 01 08 00 06 04 00 01 fe 00 00 00 00 01 c0 00 02 01 ff ff ff ff ff ff c0 00 02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
14:03:52.156 [main] INFO  org.pcap4j.core.PcapDumperTest - position: 100
14:03:52.157 [main] INFO  org.pcap4j.core.PcapDumper - Closed.
14:03:52.157 [main] INFO  org.pcap4j.core.PcapHandle - Closed.
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 sec - in org.pcap4j.core.PcapDumperTest
Running org.pcap4j.core.PcapsTest
14:03:52.385 [main] INFO  org.pcap4j.core.PcapsTest - 湥び
14:03:52.393 [main] INFO  org.pcap4j.core.PcapsTest - 1 (Ethernet) name: EN10MB
14:03:52.395 [main] INFO  org.pcap4j.core.PcapsTest - 9 (PPP) name: PPP
14:03:52.396 [main] INFO  org.pcap4j.core.PcapsTest - 1 (Ethernet) descr: Ethernet
14:03:52.397 [main] INFO  org.pcap4j.core.PcapsTest - 9 (PPP) descr: PPP
14:03:52.398 [main] INFO  org.pcap4j.core.PcapsTest - err: Operation not permitted
14:03:52.399 [main] INFO  org.pcap4j.core.PcapsTest - ver: libpcap version 1.6.2
Tests run: 15, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.377 sec <<< FAILURE! - in org.pcap4j.core.PcapsTest
testFindAllDevs(org.pcap4j.core.PcapsTest)  Time elapsed: 0.14 sec  <<< ERROR!
java.lang.NullPointerException: null
    at org.pcap4j.core.PcapNetworkInterface.<init>(PcapNetworkInterface.java:55)
    at org.pcap4j.core.PcapNetworkInterface.newInstance(PcapNetworkInterface.java:115)
    at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:84)
    at org.pcap4j.core.PcapsTest.testFindAllDevs(PcapsTest.java:38)

Running org.pcap4j.core.PcapNetworkInterfaceTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.141 sec <<< FAILURE! - in org.pcap4j.core.PcapNetworkInterfaceTest
testOpenLive(org.pcap4j.core.PcapNetworkInterfaceTest)  Time elapsed: 0.139 sec  <<< ERROR!
java.lang.NullPointerException: null
    at org.pcap4j.core.PcapNetworkInterface.<init>(PcapNetworkInterface.java:55)
    at org.pcap4j.core.PcapNetworkInterface.newInstance(PcapNetworkInterface.java:115)
    at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:84)
    at org.pcap4j.core.PcapNetworkInterfaceTest.testOpenLive(PcapNetworkInterfaceTest.java:39)


Results :

Tests in error: 
  PcapHandleTest.setUp:34 » NullPointer
  PcapHandleTest.setUp:34 » NullPointer
  PcapHandleTest.setUp:34 » NullPointer
  PcapsTest.testFindAllDevs:38 » NullPointer
  PcapNetworkInterfaceTest.testOpenLive:39 » NullPointer

Tests run: 21, Failures: 0, Errors: 5, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Pcap4J ............................................ SUCCESS [12.034s]
[INFO] Pcap4J Core ....................................... FAILURE [7.915s]
[INFO] Pcap4J Packet Test ................................ SKIPPED
[INFO] Pcap4J Static Packet Factory ...................... SKIPPED
[INFO] Pcap4J Properties-Based Packet Factory ............ SKIPPED
[INFO] Pcap4J Sample ..................................... SKIPPED
[INFO] Pcap4J Distribution ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.422s
[INFO] Finished at: Tue Apr 21 14:03:52 MSK 2015
[INFO] Final Memory: 18M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test (default-test) on project pcap4j-core: There are test failures.
[ERROR] 
[ERROR] Please refer to /root/IdeaProjects/pcap4j/pcap4j-core/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :pcap4j-core

I have tun0 interface, he is the cause of problem

# ifconfig 
enp2s0    Link encap:Ethernet  HWaddr 38:2C:62:4A:7F:11  
          inet addr:192.168.5.35  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: fdc3:2c30:e480:0:3a2c:4faf:fe62:7f11/64 Scope:Global
          inet6 addr: fe80::3a2c:4aff:ef62:7f11/64 Scope:Link
          inet6 addr: fdc3:2c30:e408:0:3c82:6f64:abb1:9a71/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1492  Metric:1
          RX packets:304328 errors:0 dropped:0 overruns:0 frame:0
          TX packets:165721 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:381499233 (363.8 Mb)  TX bytes:12148624 (11.5 Mb)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:132121 errors:0 dropped:0 overruns:0 frame:0
          TX packets:132121 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:14190299 (13.5 Mb)  TX bytes:14190299 (13.5 Mb)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:172.16.20.20  P-t-P:1.1.1.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING  MTU:1284  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:328 (328.0 b)  TX bytes:226 (226.0 b)

I have found that changing PcapNetworkInterface.java
from

for (
      pcap_addr pcapAddr = pif.addresses;
      pcapAddr != null;
      pcapAddr = pcapAddr.next
    ) {

to

    for (
      pcap_addr pcapAddr = pif.addresses;
      (pcapAddr != null) && (pcapAddr.addr != null);
      pcapAddr = pcapAddr.next
    ) {

solves the problem and build goes fine.

@kaitoy
Copy link
Owner

kaitoy commented Apr 22, 2015

I had thought pcap_addr.addr is never null.
Could you tell me how you created the point-to-point tunnel tun0?
I created an ipip tunnel in my environment and ran pcap4j but I didn't see such a null pointer error.
I want to create the same kind of tunnel as yours to reproduce the error and investigate the detail.

@mclaudt
Copy link
Author

mclaudt commented Apr 22, 2015

This is f5fpc vpn client
https://support.f5.com/kb/en-us/products/big-ip_apm/manuals/product/apm-client-configuration-11-4-0/4.print.html
I'm not sure if it is available for download and if it is possible to create tunnel without their server, it's kind of corporate software.

Also found that with that fix I get some usb devices and even dbus stuff in findAllDevs() list.
Pcaps.findAllDevs() gives:

name: [enp0s25] description: [null] address: [/10.0.20.3] loopBack: [false]] local: [true]
name: [any] description: [Pseudo-device that captures on all interfaces] loopBack: [false]] local: [true]
name: [lo] description: [null] address: [/127.0.0.1] address: [/0:0:0:0:0:0:0:1] loopBack: [false]] local: [true]
name: [nflog] description: [Linux netfilter log (NFLOG) interface] loopBack: [false]] local: [true]
name: [nfqueue] description: [Linux netfilter queue (NFQUEUE) interface] loopBack: [false]] local: [true]
name: [dbus-system] description: [D-Bus system bus] loopBack: [false]] local: [true]
name: [dbus-session] description: [D-Bus session bus] loopBack: [false]] local: [true]
name: [usbmon1] description: [USB bus number 1] loopBack: [false]] local: [true]
name: [usbmon2] description: [USB bus number 2] loopBack: [false]] local: [true]
name: [usbmon3] description: [USB bus number 3] loopBack: [false]] local: [true]

@kaitoy
Copy link
Owner

kaitoy commented Apr 26, 2015

I installed f5fpc but couldn't create a tunnel. Probably it needs a server.
Instead, using this pcap-core.jar, could you execute java -cp pcap4j-core-1.4.1-20150426.042853-5.jar:jna.jar:slf4j-api.jar org.pcap4j.core.ListDevs on your machine and let me the outputs?

@mclaudt
Copy link
Author

mclaudt commented Apr 26, 2015

I have downloaded jna and slf4j-api jars manually (not using sbt, Idea, like in original case), here is the result:

java -cp pcap4j-core-1.4.1-20150426.042853-5.jar:jna-4.1.0.jar:slf4j-api-1.7.12.jar org.pcap4j.core.ListDevs

enp2s0: null
addr: 17, 00 00 02 00 00 00 01 00 00 06 38 2c 4a 62
broadaddr: 17, 00 00 02 00 00 00 01 00 00 06 ff ff ff ff
addr: 2, 00 00 c0 a8 01 23 00 00 00 00 00 00 00 00
netmask: 2, 00 00 ff ff 00 00 00 00 00 00 00 00 00 00
broadaddr: 2, 00 00 c0 a8 ff ff 00 00 00 00 00 00 00 00
addr: 10, 00 00 00 00 00 00 fd c3 2c 30 e4 08 00 00
netmask: 10, 00 00 00 00 00 00 ff ff ff ff ff ff ff ff
addr: 10, 00 00 00 00 00 00 fd c3 2c 30 e4 08 00 00
netmask: 10, 00 00 00 00 00 00 ff ff ff ff ff ff ff ff
addr: 10, 00 00 00 00 00 00 fd c3 2c 30 e4 08 00 00
netmask: 10, 00 00 00 00 00 00 ff ff ff ff ff ff ff ff
addr: 10, 00 00 00 00 00 00 fe 80 00 00 00 00 00 00
netmask: 10, 00 00 00 00 00 00 ff ff ff ff ff ff ff ff
tun0: null
addr: 2, 00 00 ac 10 1f 2a 00 00 00 00 00 00 00 00
netmask: 2, 00 00 ff ff ff ff 00 00 00 00 00 00 00 00
dstaddr: 2, 00 00 01 01 01 01 00 00 00 00 00 00 00 00
any: Pseudo-device that captures on all interfaces
lo: null
addr: 17, 00 00 01 00 00 00 04 03 00 06 00 00 00 00
addr: 2, 00 00 7f 00 00 01 00 00 00 00 00 00 00 00
netmask: 2, 00 00 ff 00 00 00 00 00 00 00 00 00 00 00
addr: 10, 00 00 00 00 00 00 00 00 00 00 00 00 00 00
netmask: 10, 00 00 00 00 00 00 ff ff ff ff ff ff ff ff
nflog: Linux netfilter log (NFLOG) interface
nfqueue: Linux netfilter queue (NFQUEUE) interface
dbus-system: D-Bus system bus
dbus-session: D-Bus session bus
usbmon1: USB bus number 1
usbmon2: USB bus number 2
usbmon3: USB bus number 3
usbmon4: USB bus number 4
usbmon5: USB bus number 5
usbmon6: USB bus number 6
usbmon7: USB bus number 7
usbmon8: USB bus number 8
usbmon9: USB bus number 9
usbmon10: USB bus number 10
usbmon11: USB bus number 11

java -version
openjdk version "1.8.0_40"
OpenJDK Runtime Environment (build 1.8.0_40-b25)
OpenJDK 64-Bit Server VM (build 25.40-b25, mixed mode)

@kaitoy
Copy link
Owner

kaitoy commented Apr 27, 2015

Thank you for your corporation. I found tun0 has a pcap_address which has only dstaddr and Pcap4J doesn't properly handle such one.
I made fixed version. Please try https://oss.sonatype.org/content/repositories/snapshots/org/pcap4j/pcap4j-distribution/1.4.1-SNAPSHOT/pcap4j-distribution-1.4.1-20150426.235851-6-bin.zip

@mclaudt
Copy link
Author

mclaudt commented Apr 30, 2015

It works now, and thanks a lot for a nice library!

@kaitoy
Copy link
Owner

kaitoy commented May 1, 2015

Thank you!

@kaitoy kaitoy closed this as completed May 1, 2015
@bruskli
Copy link

bruskli commented May 3, 2015

Same issue with openvpn tunnel, fix works too.

@kaitoy
Copy link
Owner

kaitoy commented May 4, 2015

Thank you for the information. I tried openvpn and found it makes the same kind of tunnel, and I confirmed pcap4j can list the addresses with the fix.

@kaitoy kaitoy added the bug label Jun 4, 2015
@wumo
Copy link

wumo commented Jan 19, 2018

with libtins, all the devices are

Interface name: {01D5D9AA-D59C-4BDA-940D-DE5DC767FB0A}
 ( (169.254.61.246)
Interface name: {5A35038F-CAD3-499D-97B9-1E27EA0CE6DA}
 (10.10.64.2)
Interface name: {8C0FB611-B3CC-11E7-8195-806E6F6E6963}
 (127.0.0.1)
Interface name: {98F24F57-DCBC-496F-A625-4893CF420DEE}
 (172.16.2.1)
Interface name: {B0CE1B3B-0EC3-4E61-BDE5-7AC4E103A202}
 (192.168.10.2)

But Pcap4j only gives the following devices

name: [\Device\NPF_{B0CE1B3B-0EC3-4E61-BDE5-7AC4E103A202}] description: [Qualcomm Atheros Ar81xx series PCI-E Ethernet Controller] address: [/fe80:0:0:0:ec95:12be:585e:fa68] address: [/192.168.10.2] link layer address: [[B@48eff760] loopBack: [false]] up: [false]] running: [false]] local: [true]
name: [\Device\NPF_{01D5D9AA-D59C-4BDA-940D-DE5DC767FB0A}] description: [Microsoft] address: [/fe80:0:0:0:101d:c721:f103:3df6] address: [/fe80:0:0:0:101d:c721:f103:3df6] link layer address: [[B@402f32ff] loopBack: [false]] up: [false]] running: [false]] local: [true]
name: [\Device\NPF_{5A35038F-CAD3-499D-97B9-1E27EA0CE6DA}] description: [TAP-Win32 Adapter V9] address: [/fe80:0:0:0:3d15:644a:fc7d:6b8] address: [/10.10.0.2] link layer address: [[B@573f2bb1] loopBack: [false]] up: [false]] running: [false]] local: [true]

The ppp 172.16.2.1 device is missing.
The version of Pcap4j is 1.7.3 and the I installed WinPcap 4.1.3 in my Windows 10 machine.

@wumo
Copy link

wumo commented Jan 19, 2018

ipconfig /all shows the following result

Ethernet adapter 以太网:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Killer E2200 Gigabit Ethernet Controller
   Physical Address. . . . . . . . . : FC-AA-14-95-F1-4F
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::ec95:12be:585e:fa68%10(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.10.2(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : January 19, 2018 22:03:21
   Lease Expires . . . . . . . . . . : January 20, 2018 22:03:21
   Default Gateway . . . . . . . . . : 192.168.10.1
   DHCP Server . . . . . . . . . . . : 192.168.10.1
   DHCPv6 IAID . . . . . . . . . . . : 66890260
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-67-E7-2E-FC-AA-14-95-F1-4F
   DNS Servers . . . . . . . . . . . : 114.114.115.115
                                       114.114.114.114
   NetBIOS over Tcpip. . . . . . . . : Enabled

PPP adapter bmxxxxxx:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : bmxxxxxx
   Physical Address. . . . . . . . . :
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 172.16.2.7(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.255
   Default Gateway . . . . . . . . . :
   DNS Servers . . . . . . . . . . . : 114.114.114.114
                                       8.8.8.8
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter 本地连接* 11:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : BM Win32 Network Adapter
   Physical Address. . . . . . . . . : 00-FF-5A-35-03-8F
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter 蓝牙网络连接:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
   Physical Address. . . . . . . . . : 00-19-86-00-05-62
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter 本地连接* 10:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Teredo Tunneling Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv6 Address. . . . . . . . . . . : 2001:0:9d38:6ab8:24b7:d5a3:2212:ac4e(Preferred)
   Link-local IPv6 Address . . . . . : fe80::24b7:d5a3:2212:ac4e%2(Preferred)
   Default Gateway . . . . . . . . . : ::
   DHCPv6 IAID . . . . . . . . . . . : 33554432
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-67-E7-2E-FC-AA-14-95-F1-4F
   NetBIOS over Tcpip. . . . . . . . : Disabled

I'm interested in the PPP adapter bmxxxxxx , but can't find by Pcap4j.

@kaitoy
Copy link
Owner

kaitoy commented Mar 3, 2018

Sorry for late response.
You still seeing the issue?
Could you see if Wireshark can detect the PPP interface?

@wumo
Copy link

wumo commented Mar 10, 2018

@kaitoy no. my mistake. I can parse PPP now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants