]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap-dbus.c
Clean up the ether_hostton() stuff.
[libpcap] / pcap-dbus.c
index 8e92093da11070a88c078353061fc8cebad4e15d..b1fb548ff4b3f1dc336d628415037bcc7e29f08f 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <string.h>
@@ -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;
 }