diff options
author | Will Thompson <will@willthompson.co.uk> | 2020-05-26 07:35:57 +0100 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2020-06-05 09:24:02 +0100 |
commit | a9028b370588486a3a1aa30ad3324417dc1eb461 (patch) | |
tree | 2f9a8beb88de2ccc590e9bc4e6e5578097bf3fde | |
parent | 06a34ec11448366565b16588dc72aecc41682e2c (diff) |
reader: Check link type
-rw-r--r-- | c-sources/pcap-reader.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/c-sources/pcap-reader.c b/c-sources/pcap-reader.c index 8d03245..cc12f24 100644 --- a/c-sources/pcap-reader.c +++ b/c-sources/pcap-reader.c @@ -250,6 +250,17 @@ initable_init ( /* Now owned by pcap_in */ self->filep = NULL; + + int dlt = pcap_datalink (self->pcap_in); + if (dlt != DLT_DBUS) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, + "Unexpected link type %s", + pcap_datalink_val_to_name (dlt)); + bustle_pcap_reader_close (self); + return FALSE; + } + return TRUE; } |