From 0a51c441700be676a20353a72f019d13673ab0fb Mon Sep 17 00:00:00 2001 From: Henri Herscher Date: Tue, 20 Jun 2006 20:21:27 +0000 Subject: Changed the Filter interface so that filters can also receive capture events, not just audio chunks. git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@267 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkaudio/audiocaptureplugins/voip/VoIp.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'orkaudio/audiocaptureplugins/voip/VoIp.cpp') diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index f925a21..9df7a8b 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -453,12 +453,22 @@ void HandlePacket(u_char *param, const struct pcap_pkthdr *header, const u_char IpHeaderStruct* 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 be wrapped into a 802.1Q VLAN or MPLS header (add 4 bytes) - ipHeader = (IpHeaderStruct*)((u_char*)ipHeader+4); + // If not, the IP packet might have been captured using the tcpdump -i switch + ipHeader = (IpHeaderStruct*)((u_char*)ipHeader+2); if(ipHeader->ip_v != 4) { - // Still not an IP packet V4, drop it - return; + // If not, the IP packet might be wrapped into a 802.1Q VLAN or MPLS header (add 4 bytes, ie 2 bytes on top of previous 2) + ipHeader = (IpHeaderStruct*)((u_char*)ipHeader+2); + if(ipHeader->ip_v != 4) + { + // If not, the IP packet might be tcpdump -i as well as VLAN, add another 2 bytes + ipHeader = (IpHeaderStruct*)((u_char*)ipHeader+2); + if(ipHeader->ip_v != 4) + { + // Still not an IP packet V4, drop it + return; + } + } } } int ipHeaderLength = ipHeader->ip_hl*4; -- cgit v1.2.3