diff options
author | Will Thompson <will@willthompson.co.uk> | 2017-07-24 12:21:15 +0100 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2017-07-24 12:21:15 +0100 |
commit | f62cf6bfa662af4ae39effbbd4891bc619e3b4e9 (patch) | |
tree | 7c36aa467a7108fba42cdad2f96312c6537d9fbf | |
parent | e56bca1dacec0de11dfef4b52801e7377dcfc630 (diff) |
Revert "Limit captured message size to 65535 bytes"
This reverts commit aa52f3c269046cc01d8340789caa1ffec4e202e7.
libpcap upstream has addressed the issue this was working around, so now
we can record and read back the full contents of D-Bus messages.
https://github.com/the-tcpdump-group/libpcap/commit/2be9c29
https://github.com/the-tcpdump-group/libpcap/commit/1a6b088
https://bugs.freedesktop.org/show_bug.cgi?id=100220
-rw-r--r-- | c-sources/pcap-monitor.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/c-sources/pcap-monitor.c b/c-sources/pcap-monitor.c index 1e82343..0a19d96 100644 --- a/c-sources/pcap-monitor.c +++ b/c-sources/pcap-monitor.c @@ -27,15 +27,6 @@ # define DLT_DBUS 231 #endif -// pcap has an arbitrary limit (at the time of writing, 2 ** 18) on snaplen. -// This is substantially lower than the theoretical limit on D-Bus messages -// (2 ** 27). Typical messages are much smaller, so we are generally okay. -// If the serialized message exceeds this limit (suggested by the pcap -// documentation) we replace its body with a warning. -#define SNAPLEN 65535 -#define TOO_LONG_FMT \ - "Message was %" G_GSIZE_FORMAT " bytes long. The maximum supported size " \ - "is " G_STRINGIFY (SNAPLEN) " bytes. Its body was dropped." typedef struct { struct timeval ts; @@ -303,33 +294,6 @@ filter ( "at least 32 bits wide"); g_return_val_if_reached (NULL); } - if (size > SNAPLEN) - { - GDBusMessage *truncated = NULL; - gchar *too_long = NULL; - - g_free (blob); - - truncated = g_dbus_message_copy (message, &error); - if (truncated == NULL) - { - g_critical ("Couldn't copy message to truncate it: %s", - error->message); - g_clear_error (&error); - g_return_val_if_reached (NULL); - } - too_long = g_strdup_printf (TOO_LONG_FMT, size); - g_dbus_message_set_body (truncated, g_variant_new ("(s)", too_long)); - g_free (too_long); - blob = g_dbus_message_to_blob (truncated, &size, self->priv->caps, &error); - g_clear_object (&truncated); - if (blob == NULL) - { - g_critical ("Couldn't marshal truncated message: %s", error->message); - g_clear_error (&error); - g_return_val_if_reached (NULL); - } - } ied.message.blob = g_byte_array_append ( g_byte_array_sized_new ((guint) size), blob, (guint) size); @@ -469,7 +433,7 @@ initable_init ( return FALSE; } - priv->p = pcap_open_dead (DLT_DBUS, SNAPLEN); + priv->p = pcap_open_dead (DLT_DBUS, 1 << 27); if (priv->p == NULL) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, |