From 0929ebc962add1fe4e6f22d0d6efb3d676671466 Mon Sep 17 00:00:00 2001 From: Ingo Bauersachs Date: Sat, 7 Jan 2017 00:25:00 +0100 Subject: Properly log IPv6 frames into .pcap --- .../impl/packetlogging/PacketLoggingServiceImpl.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') 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( -- cgit v1.1