X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/842012ab4d8188a66a4c03da66f1782ba31dcecb..4e145de1143f597ef8277b51c5524af1e994f277:/pcap-dbus.c?ds=inline diff --git a/pcap-dbus.c b/pcap-dbus.c index 8e92093d..b1fb548f 100644 --- a/pcap-dbus.c +++ b/pcap-dbus.c @@ -29,7 +29,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include @@ -211,6 +211,7 @@ dbus_activate(pcap_t *handle) handle->getnonblock_op = pcap_getnonblock_fd; handle->setnonblock_op = pcap_setnonblock_fd; handle->stats_op = dbus_stats; + handle->cleanup_op = dbus_cleanup; handle->selectable_fd = handle->fd = -1; @@ -222,6 +223,14 @@ dbus_activate(pcap_t *handle) return PCAP_ERROR_RFMON_NOTSUP; } + /* + * Turn a negative snapshot value (invalid), a snapshot value of + * 0 (unspecified), or a value bigger than the normal maximum + * value, into the maximum message length for D-Bus (128MB). + */ + if (handle->snapshot <= 0 || handle->snapshot > 134217728) + handle->snapshot = 134217728; + /* dbus_connection_set_max_message_size(handlep->conn, handle->snapshot); */ if (handle->opt.buffer_size != 0) dbus_connection_set_max_received_size(handlep->conn, handle->opt.buffer_size); @@ -268,11 +277,11 @@ dbus_create(const char *device, char *ebuf, int *is_ours) } int -dbus_findalldevs(pcap_if_t **alldevsp, char *err_str) +dbus_findalldevs(pcap_if_list_t *devlistp, char *err_str) { - if (pcap_add_if(alldevsp, "dbus-system", 0, "D-Bus system bus", err_str) < 0) + if (add_dev(devlistp, "dbus-system", 0, "D-Bus system bus", err_str) == NULL) return -1; - if (pcap_add_if(alldevsp, "dbus-session", 0, "D-Bus session bus", err_str) < 0) + if (add_dev(devlistp, "dbus-session", 0, "D-Bus session bus", err_str) == NULL) return -1; return 0; }