summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-03-09 15:43:06 +0100
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-03-09 15:43:06 +0100
commit16cb24807db5b1bd20e2b31a15bda7940f1145bd (patch)
tree6988afc5958a9ae0bf8f63b6d579281dc7c061e6
parent8a415c3c09540caeeeffb2f8e24623ad25d23165 (diff)
downloadmonitoring-plugins-16cb24807db5b1bd20e2b31a15bda7940f1145bd.tar.gz
ignore CNAMEs in RDNS-mode #1460
Suppose your provider uses RFC 2317 (or RFC 4183 for that matter). The output of nslookup could look like the following: 2.120.22.172.in-addr.arpa canonical name = 2.0/26.120.22.172.in-addr.arpa. 2.0/26.120.22.172.in-addr.arpa name = rajesh.intern.prauscher.de. Without this filter, check_dns would check the string against "2.0/26.120.22.172.in-addr.arpa., rajesh.intern.prauscher.de." which will fail for obvious reasons. In forward DNS, this is achieved in line 165, as nslookup will print the address separate from the CNAME-resolving. Original commit by Patrick Rauscher (prauscher@prauscher.de), adapted here.
-rw-r--r--plugins/check_dns.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index a4c8e9b1..95f33083 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -128,6 +128,9 @@ int main(int argc, char **argv) {
128 } 128 }
129 129
130 if (strcasestr(chld_out.line[i], ".in-addr.arpa") || strcasestr(chld_out.line[i], ".ip6.arpa")) { 130 if (strcasestr(chld_out.line[i], ".in-addr.arpa") || strcasestr(chld_out.line[i], ".ip6.arpa")) {
131 if ((strstr(chld_out.line[i], "canonical name = ") != NULL)) {
132 continue;
133 }
131 char *temp_buffer = NULL; 134 char *temp_buffer = NULL;
132 if ((temp_buffer = strstr(chld_out.line[i], "name = "))) { 135 if ((temp_buffer = strstr(chld_out.line[i], "name = "))) {
133 addresses[n_addresses++] = strdup(temp_buffer + 7); 136 addresses[n_addresses++] = strdup(temp_buffer + 7);