diff options
author | Henri Herscher <henri@oreka.org> | 2006-04-14 19:54:05 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2006-04-14 19:54:05 +0000 |
commit | 12ed4e413577cdfabe7123dc8bfe70df05b87fe9 (patch) | |
tree | 916e707d575290e6a10b893eb64185d5b647d564 | |
parent | b0af05c3689995aad5ccfdb4befea81b75290b10 (diff) |
Now manages to decode IP packets wrapped into 802.1Q VLAN packets
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@216 09dcff7a-b715-0410-9601-b79a96267cd0
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIp.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index e8702c0..c2c51a2 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -383,6 +383,16 @@ 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)); + 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 (add 4 bytes) + ipHeader = (IpHeaderStruct*)((u_char*)ipHeader+4); + if(ipHeader->ip_v != 4) + { + // Still not an IP packet V4, drop it + return; + } + } int ipHeaderLength = ipHeader->ip_hl*4; u_char* ipPacketEnd = (u_char*)ipHeader + ipHeader->ip_len; |