summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f554fab)
raw | patch | inline | side by side (parent: f554fab)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 5 Dec 2006 20:42:16 +0000 (21:42 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 5 Dec 2006 20:42:16 +0000 (21:42 +0100) |
This is the ``Linux cooked capture encapsulation'', which is at least returned
when capturing the `any' device under Linux. This patch will strip off the
header and pass the packet to the IPv4 or IPv6 handler, whichever one is
ppropriate.
when capturing the `any' device under Linux. This patch will strip off the
header and pass the packet to the IPv4 or IPv6 handler, whichever one is
ppropriate.
src/utils_dns.c | patch | blob | history |
diff --git a/src/utils_dns.c b/src/utils_dns.c
index 221bac4bfdcb27c9022e75b20a406946e19bc842..e9aec38f6b8a010b6510652eb72cb6971c533bf7 100644 (file)
--- a/src/utils_dns.c
+++ b/src/utils_dns.c
return handle_ip((struct ip *) buf, len);
}
+#ifdef DLT_LINUX_SLL
+static int
+handle_linux_sll (const u_char *pkt, int len)
+{
+ struct sll_header
+ {
+ uint16_t pkt_type;
+ uint16_t dev_type;
+ uint16_t addr_len;
+ uint8_t addr[8];
+ uint16_t proto_type;
+ } *hdr;
+ uint16_t etype;
+
+ if (len < sizeof (struct sll_header))
+ return (0);
+
+ hdr = (struct sll_header *) pkt;
+ pkt = (u_char *) (hdr + 1);
+ len -= sizeof (struct sll_header);
+
+ etype = ntohs (hdr->proto_type);
+
+ if ((ETHERTYPE_IP != etype)
+ && (ETHERTYPE_IPV6 != etype))
+ return 0;
+
+ if (ETHERTYPE_IPV6 == etype)
+ return (handle_ipv6 ((struct ip6_hdr *) pkt, len));
+ else
+ return handle_ip((struct ip *) pkt, len);
+}
+#endif /* DLT_LINUX_SLL */
+
/* public function */
void handle_pcap(u_char *udata, const struct pcap_pkthdr *hdr, const u_char *pkt)
{
@@ -630,6 +664,11 @@ void handle_pcap(u_char *udata, const struct pcap_pkthdr *hdr, const u_char *pkt
case DLT_RAW:
status = handle_raw (pkt, hdr->caplen);
break;
+#endif
+#ifdef DLT_LINUX_SLL
+ case DLT_LINUX_SLL:
+ status = handle_linux_sll (pkt, hdr->caplen);
+ break;
#endif
case DLT_NULL:
status = handle_null (pkt, hdr->caplen);