From b5d27a8197012ac2b1b52621be2cfe0b5fc2b47e Mon Sep 17 00:00:00 2001
From: Guy Harris <guy@alum.mit.edu>
Date: Tue, 19 Nov 2013 10:45:42 -0800
Subject: [PATCH] Handle using cooked mode for DLT_NETLINK in activate_new().
That's how we handle it elsewhere; if that can be cleaned up, especially
if we can avoid opening a raw socket in the cooked-mode case, that would
be nice.
Note this in comments.
(cherry picked from eeb0348fe8d74800af37759618270fb8bed17443)
Conflicts:
pcap-linux.c
---
pcap-linux.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/pcap-linux.c b/pcap-linux.c
index e6343b0..a0e543c 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -2941,7 +2941,9 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok)
/* Don't expect IP packet out of this interfaces... */
handle->linktype = DLT_LINUX_IRDA;
/* We need to save packet direction for IrDA decoding,
- * so let's use "Linux-cooked" mode. Jean II */
+ * so let's use "Linux-cooked" mode. Jean II
+ *
+ * XXX - this is handled in activate_new(). */
//handlep->cooked = 1;
break;
@@ -2982,8 +2984,11 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok)
* We need to use cooked mode, so that in sll_protocol we
* pick up the netlink protocol type such as NETLINK_ROUTE,
* NETLINK_GENERIC, NETLINK_FIB_LOOKUP, etc.
+ *
+ * XXX - this is now handled in activate_new()
*/
- handle->cooked = 1;
+
+ /* handlep->cooked = 1; */
break;
default:
@@ -3122,6 +3127,7 @@ activate_new(pcap_t *handle)
handle->linktype == DLT_LINUX_SLL ||
handle->linktype == DLT_LINUX_IRDA ||
handle->linktype == DLT_LINUX_LAPD ||
+ handle->linktype == DLT_NETLINK ||
(handle->linktype == DLT_EN10MB &&
(strncmp("isdn", device, 4) == 0 ||
strncmp("isdY", device, 4) == 0))) {
--
2.4.3