]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dns: if no (valid) config is found, use defaults 841/head
authorVictor Julien <victor@inliniac.net>
Thu, 13 Feb 2014 14:53:08 +0000 (15:53 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 13 Feb 2014 15:00:54 +0000 (16:00 +0100)
This patch will set up probing parsers if no (valid) config is
found.

Add a warning in those cases.

src/app-layer-dns-tcp.c
src/app-layer-dns-udp.c

index 52982bbbea0a10981719faae5b8ce252f3508877..cc6dec5b4d11da665bf2eb42a930b3a64ad69a28 100644 (file)
@@ -605,10 +605,19 @@ void RegisterDNSTCPParsers(void) {
                                           STREAM_TOSERVER,
                                           DNSTcpProbingParser);
         } else {
-            AppLayerProtoDetectPPParseConfPorts("tcp", IPPROTO_TCP,
+            int have_cfg = AppLayerProtoDetectPPParseConfPorts("tcp", IPPROTO_TCP,
                                                 proto_name, ALPROTO_DNS,
                                                 0, sizeof(DNSTcpHeader),
                                                 DNSTcpProbingParser);
+            /* if we have no config, we enable the default port 53 */
+            if (!have_cfg) {
+                SCLogWarning(SC_ERR_DNS_CONFIG, "no DNS TCP config found, "
+                                                "enabling DNS detection on "
+                                                "port 53.");
+                AppLayerProtoDetectPPRegister(IPPROTO_TCP, "53",
+                                   ALPROTO_DNS, 0, sizeof(DNSTcpHeader),
+                                   STREAM_TOSERVER, DNSTcpProbingParser);
+            }
         }
     } else {
         SCLogInfo("Protocol detection and parser disabled for %s protocol.",
index 6a9e1cf50d3cd9e3cebb93dc4fc31d5147c46586..1d293c32b91d02b6f9c3dc0e580922cab547dd73 100644 (file)
@@ -364,10 +364,19 @@ void RegisterDNSUDPParsers(void) {
                                           STREAM_TOSERVER,
                                           DNSUdpProbingParser);
         } else {
-            AppLayerProtoDetectPPParseConfPorts("udp", IPPROTO_UDP,
+            int have_cfg = AppLayerProtoDetectPPParseConfPorts("udp", IPPROTO_UDP,
                                                 proto_name, ALPROTO_DNS,
                                                 0, sizeof(DNSHeader),
                                                 DNSUdpProbingParser);
+            /* if we have no config, we enable the default port 53 */
+            if (!have_cfg) {
+                SCLogWarning(SC_ERR_DNS_CONFIG, "no DNS UDP config found, "
+                                                "enabling DNS detection on "
+                                                "port 53.");
+                AppLayerProtoDetectPPRegister(IPPROTO_UDP, "53",
+                                   ALPROTO_DNS, 0, sizeof(DNSHeader),
+                                   STREAM_TOSERVER, DNSUdpProbingParser);
+            }
         }
     } else {
         SCLogInfo("Protocol detection and parser disabled for %s protocol.",