]> The Tcpdump Group git mirrors - libpcap/commitdiff
Check for data-over-UDP *after* we parse the URL.
authorGuy Harris <[email protected]>
Tue, 29 Jan 2019 19:02:06 +0000 (11:02 -0800)
committerGuy Harris <[email protected]>
Tue, 29 Jan 2019 19:02:06 +0000 (11:02 -0800)
Before we parse the URL, we don't know whether the URL requests TLS or
not, so we don't know whether we'll need DTLS (which we currently don't
support).

pcap-rpcap.c

index 88c4e75f095c92fb06e7d78e66caa6af69089666..d4ff3f9925918c48b806bb1c5dc065cd6a3cc6b8 100644 (file)
@@ -2215,16 +2215,6 @@ pcap_t *pcap_open_rpcap(const char *source, int snaplen, int flags, int read_tim
        pr = fp->priv;
        pr->rmt_flags = flags;
 
-       // Also, SSL is not supported with UDP at the moment, so if the user
-       // asks for both we'd better bail out now:
-       if (pr->uses_ssl && (pr->rmt_flags & PCAP_OPENFLAG_DATATX_UDP))
-       {
-               pcap_close(fp);
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
-                   "SSL not supported with UDP forward of remote packets");
-               return NULL;
-       }
-
        /*
         * determine the type of the source (NULL, file, local, remote)
         * You must have a valid source string even if we're in active mode, because otherwise
@@ -2243,6 +2233,19 @@ pcap_t *pcap_open_rpcap(const char *source, int snaplen, int flags, int read_tim
                return NULL;
        }
 
+       /*
+        * We don't yet support DTLS, so if the user asks for a TLS
+        * connection and asks for data packets to be sent over UDP,
+        * we have to give up.
+        */
+       if (pr->uses_ssl && (pr->rmt_flags & PCAP_OPENFLAG_DATATX_UDP))
+       {
+               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                   "TLS not supported with UDP forward of remote packets");
+               pcap_close(fp);
+               return NULL;
+       }
+
        /*
         * Warning: this call can be the first one called by the user.
         * For this reason, we have to initialize the WinSock support.