]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
Handle rpcaps:// URLs as well, for rpcap-over-TLS.
[tcpdump] / tcpdump.c
index 3b4d84f9ae85e6ad7ebc59d108e4971d5c63be0a..1ed33461cd2710735680a064a5e3107905337861 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -81,7 +81,7 @@ The Regents of the University of California.  All rights reserved.\n";
  * in the opposite order works fine.
  */
 #ifdef HAVE_CAPSICUM
-#include <sys/capability.h>
+#include <sys/capsicum.h>
 #include <sys/ioccom.h>
 #include <net/bpf.h>
 #include <libgen.h>
@@ -624,6 +624,10 @@ show_remote_devices_and_exit(void)
 #define J_FLAG
 #endif /* PCAP_ERROR_TSTAMP_TYPE_NOTSUP */
 
+#ifdef USE_LIBSMI
+#define m_FLAG_USAGE "[ -m module ] ..."
+#endif
+
 #ifdef HAVE_PCAP_SETDIRECTION
 #define Q_FLAG "Q:"
 #define Q_FLAG_USAGE " [ -Q in|out|inout ]"
@@ -713,7 +717,7 @@ static const struct option longopts[] = {
 };
 
 #ifdef HAVE_PCAP_FINDALLDEVS_EX
-#define LIST_REMOTE_INTERFACES_USAGE "[ --list-remote-interfaces remote-source  ]"
+#define LIST_REMOTE_INTERFACES_USAGE "[ --list-remote-interfaces remote-source ]"
 #else
 #define LIST_REMOTE_INTERFACES_USAGE
 #endif
@@ -1184,9 +1188,10 @@ _U_
 
 #ifdef HAVE_PCAP_OPEN
 /*
- * Prefix for rpcap URLs.
+ * Prefixes for rpcap URLs.
  */
 static char rpcap_prefix[] = "rpcap://";
+static char rpcap_ssl_prefix[] = "rpcaps://";
 #endif
 
 static pcap_t *
@@ -1202,7 +1207,8 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
        /*
         * Is this an rpcap URL?
         */
-       if (strncmp(device, rpcap_prefix, sizeof(rpcap_prefix) - 1) == 0) {
+       if (strncmp(device, rpcap_prefix, sizeof(rpcap_prefix) - 1) == 0 ||
+           strncmp(device, rpcap_ssl_prefix, sizeof(rpcap_ssl_prefix) - 1) == 0) {
                /*
                 * Yes.  Open it with pcap_open().
                 */
@@ -2264,7 +2270,7 @@ DIAG_ON_CLANG(assign-enum)
                if (pdd == NULL)
                        error("%s", pcap_geterr(pd));
 #ifdef HAVE_CAPSICUM
-               set_dumper_capsicum_rights(p);
+               set_dumper_capsicum_rights(pdd);
 #endif
                if (Cflag != 0 || Gflag != 0) {
 #ifdef HAVE_CAPSICUM
@@ -3059,6 +3065,10 @@ print_usage(void)
 #ifdef HAVE_PCAP_FINDALLDEVS_EX
        (void)fprintf(stderr,
 "\t\t" LIST_REMOTE_INTERFACES_USAGE "\n");
+#endif
+#ifdef USE_LIBSMI
+       (void)fprintf(stderr,
+"\t\t" m_FLAG_USAGE "\n");
 #endif
        (void)fprintf(stderr,
 "\t\t[ -M secret ] [ --number ] [ --print ]" Q_FLAG_USAGE "\n");