dns: if no (valid) config is found, use defaults

This patch will set up probing parsers if no (valid) config is
found.

Add a warning in those cases.
pull/841/head
Victor Julien 12 years ago
parent ab10c0a099
commit a97662e08c

@ -605,10 +605,19 @@ void RegisterDNSTCPParsers(void) {
STREAM_TOSERVER, STREAM_TOSERVER,
DNSTcpProbingParser); DNSTcpProbingParser);
} else { } else {
AppLayerProtoDetectPPParseConfPorts("tcp", IPPROTO_TCP, int have_cfg = AppLayerProtoDetectPPParseConfPorts("tcp", IPPROTO_TCP,
proto_name, ALPROTO_DNS, proto_name, ALPROTO_DNS,
0, sizeof(DNSTcpHeader), 0, sizeof(DNSTcpHeader),
DNSTcpProbingParser); 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 { } else {
SCLogInfo("Protocol detection and parser disabled for %s protocol.", SCLogInfo("Protocol detection and parser disabled for %s protocol.",

@ -364,10 +364,19 @@ void RegisterDNSUDPParsers(void) {
STREAM_TOSERVER, STREAM_TOSERVER,
DNSUdpProbingParser); DNSUdpProbingParser);
} else { } else {
AppLayerProtoDetectPPParseConfPorts("udp", IPPROTO_UDP, int have_cfg = AppLayerProtoDetectPPParseConfPorts("udp", IPPROTO_UDP,
proto_name, ALPROTO_DNS, proto_name, ALPROTO_DNS,
0, sizeof(DNSHeader), 0, sizeof(DNSHeader),
DNSUdpProbingParser); 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 { } else {
SCLogInfo("Protocol detection and parser disabled for %s protocol.", SCLogInfo("Protocol detection and parser disabled for %s protocol.",

Loading…
Cancel
Save