diff options
author | Will Thompson <will@willthompson.co.uk> | 2016-01-27 22:20:44 +0000 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2016-01-27 22:34:37 +0000 |
commit | 4168158511abbdb450cc86b5eb6e09bedd98cfcf (patch) | |
tree | 8090369d95f880e43d665e47cfb12ca4194bda5b | |
parent | 710e53c9f844875ef2ce1c2a6a852a11d312c34b (diff) |
Use DLT_DBUS in pcap dumps
Back in 2011 I don't think the magic number had been specified.
Thanks to Jaap Keuter for the prompt.
-rw-r--r-- | Bustle/Loader/Pcap.hs | 3 | ||||
-rw-r--r-- | c-sources/pcap-monitor.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/Bustle/Loader/Pcap.hs b/Bustle/Loader/Pcap.hs index 26a8f5b..f59e902 100644 --- a/Bustle/Loader/Pcap.hs +++ b/Bustle/Loader/Pcap.hs @@ -254,4 +254,7 @@ readPcap :: FilePath readPcap path = try $ do p <- openOffline path + -- TODO: check link type header is DLT_DBUS or DLT_NULL (for + -- backwards-compatibility) + liftM partitionEithers $ evalStateT (mapBodies p convert) Map.empty diff --git a/c-sources/pcap-monitor.c b/c-sources/pcap-monitor.c index c9623ae..0a19d96 100644 --- a/c-sources/pcap-monitor.c +++ b/c-sources/pcap-monitor.c @@ -23,6 +23,11 @@ #include <string.h> #include <pcap/pcap.h> +#ifndef DLT_DBUS +# define DLT_DBUS 231 +#endif + + typedef struct { struct timeval ts; GByteArray *blob; @@ -428,8 +433,7 @@ initable_init ( return FALSE; } - /* FIXME: use DLT_DBUS when it makes it into libpcap. */ - priv->p = pcap_open_dead (DLT_NULL, 1 << 27); + priv->p = pcap_open_dead (DLT_DBUS, 1 << 27); if (priv->p == NULL) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, |