summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbeg_g <beg_g@09dcff7a-b715-0410-9601-b79a96267cd0>2009-11-27 19:15:20 +0000
committerbeg_g <beg_g@09dcff7a-b715-0410-9601-b79a96267cd0>2009-11-27 19:15:20 +0000
commite727d533a411c5625d6c1361f3b5ee4bb514cb89 (patch)
tree3d7277eb49cab643be244ff109cdc7f5ac241aee
parent9f7eba0fec07b1c23bb40f3d5e82ccebbca11c55 (diff)
Added support for captured packets of with 802.1Q Virtual LAN headersHEADmaster
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@658 09dcff7a-b715-0410-9601-b79a96267cd0
-rw-r--r--orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h2
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIp.cpp12
2 files changed, 12 insertions, 2 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h b/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h
index 5ea6f45..cf88d90 100644
--- a/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h
+++ b/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h
@@ -26,7 +26,7 @@ typedef struct
{
unsigned char destinationMac[6];
unsigned char sourceMac[6];
- unsigned short length;
+ unsigned short type;
} EthernetHeaderStruct;
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
index 55a5443..2ee0b95 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
@@ -3046,7 +3046,17 @@ void HandlePacket(u_char *param, const struct pcap_pkthdr *header, const u_char
}
EthernetHeaderStruct* ethernetHeader = (EthernetHeaderStruct *)pkt_data;
- IpHeaderStruct* ipHeader = (IpHeaderStruct*)((char*)ethernetHeader + sizeof(EthernetHeaderStruct));
+ IpHeaderStruct* ipHeader = NULL;
+
+ if(ntohs(ethernetHeader->type) == 0x8100)
+ {
+ ipHeader = (IpHeaderStruct*)((char*)ethernetHeader + sizeof(EthernetHeaderStruct) + 4);
+ }
+ else
+ {
+ ipHeader = (IpHeaderStruct*)((char*)ethernetHeader + sizeof(EthernetHeaderStruct));
+ }
+
if(ipHeader->ip_v != 4) // sanity check, is it an IP packet v4
{
// If not, the IP packet might have been captured from multiple interfaces using the tcpdump -i switch