aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Bauersachs <ingo@jitsi.org>2017-01-07 00:25:00 +0100
committerIngo Bauersachs <ingo@jitsi.org>2017-01-07 00:25:00 +0100
commit0929ebc962add1fe4e6f22d0d6efb3d676671466 (patch)
tree4cff4f0543b68a31ae1df9e12d901dfeacdc6686
parent0c47202e96e8461b6443d0b8f7cc2c5e0a93d654 (diff)
downloadjitsi-0929ebc962add1fe4e6f22d0d6efb3d676671466.zip
jitsi-0929ebc962add1fe4e6f22d0d6efb3d676671466.tar.gz
jitsi-0929ebc962add1fe4e6f22d0d6efb3d676671466.tar.bz2
Properly log IPv6 frames into .pcap
-rw-r--r--src/net/java/sip/communicator/impl/packetlogging/PacketLoggingServiceImpl.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/impl/packetlogging/PacketLoggingServiceImpl.java b/src/net/java/sip/communicator/impl/packetlogging/PacketLoggingServiceImpl.java
index 220f36b..1e459f1 100644
--- a/src/net/java/sip/communicator/impl/packetlogging/PacketLoggingServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/packetlogging/PacketLoggingServiceImpl.java
@@ -71,10 +71,17 @@ public class PacketLoggingServiceImpl
new byte[]{
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x08, (byte)0x00
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00
};
+ /** IEEE 802.3 EtherType for IPv4 */
+ private final static byte[] ipv4EtherType =
+ new byte[] { 0x08, 0x00 };
+
+ /** IEEE 802.3 EtherType for IPv6 */
+ private final static byte[] ipv6EtherType =
+ new byte[] { (byte)0x86, (byte)0xdd };
+
/**
* The fake ipv4 header we use as template.
*/
@@ -562,6 +569,7 @@ public class PacketLoggingServiceImpl
int tsSec = (int)(current/1000);
int tsUsec = (int)((current%1000) * 1000);
int feakHeaderLen = fakeEthernetHeader.length +
+ (isIPv4 ? ipv4EtherType : ipv6EtherType).length +
ipHeader.length + transportHeader.length;
int inclLen = packet.packetLength + feakHeaderLen;
int origLen = inclLen;
@@ -586,6 +594,7 @@ public class PacketLoggingServiceImpl
addInt(origLen);
outputStream.write(fakeEthernetHeader);
+ outputStream.write(isIPv4 ? ipv4EtherType : ipv6EtherType);
outputStream.write(ipHeader);
outputStream.write(transportHeader);
outputStream.write(