Changeset 0123ccfecf3ddefa9fa80e0755a40090b06cf976
- Timestamp:
- 10/26/11 00:16:14 (2 years ago)
- git-parent:
[82dc7d35bbaadf8d6f995fa74cd2135e6764188d], [470b93f1c4a81c167145f7551c3c015de74669f2]
- Files:
-
- src/modules/dns.c (modified) (6 diffs)
- src/modules/dns.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/modules/dns.c
rf91ddca r470b93f 81 81 dns_free(h->ctx); 82 82 } 83 static dns_ctx_handle_t *dns_ctx_alloc(const char *ns ) {83 static dns_ctx_handle_t *dns_ctx_alloc(const char *ns, int port) { 84 84 void *vh; 85 85 dns_ctx_handle_t *h = NULL; … … 105 105 if(dns_add_serv(h->ctx, NULL) < 0) failed++; 106 106 if(dns_add_serv(h->ctx, ns) < 0) failed++; 107 } 108 if(port && port != DNS_PORT) { 109 dns_set_opt(h->ctx, DNS_OPT_PORT, port); 107 110 } 108 111 if(dns_open(h->ctx) < 0) failed++; … … 305 308 } 306 309 dns_free(pctx); 307 if(dns_ctx_alloc(NULL ) == NULL) {310 if(dns_ctx_alloc(NULL, 0) == NULL) { 308 311 noitL(nlerr, "Error setting up default dns resolver context.\n"); 309 312 return -1; … … 606 609 const char *rtype = NULL; 607 610 const char *nameserver = NULL; 611 int port = 0; 612 const char *port_str = NULL; 608 613 const char *want_sort = NULL; 609 614 const char *ctype = "IN"; … … 639 644 query = "%[name]"; 640 645 } 646 647 if(noit_hash_retr_str(check->config, "port", strlen("port"), 648 &port_str)) { 649 port = atoi(port_str); 650 } 651 641 652 #define CONFIG_OVERRIDE(a) \ 642 653 if(noit_hash_retr_str(check->config, #a, strlen(#a), \ … … 688 699 } 689 700 /* use the cached one, unless we don't have one */ 690 if(!ci->h) ci->h = dns_ctx_alloc(nameserver );701 if(!ci->h) ci->h = dns_ctx_alloc(nameserver, port); 691 702 if(!ci->h) ci->error = strdup("bad nameserver"); 692 703 src/modules/dns.xml
rb553f9a r470b93f 12 12 default="%[target_ip] or determined from underlying system" 13 13 allowed=".+">The domain name server to query. If the name of the check is in-addr.arpa, the system default nameserver is used. Otherwise, the nameserver is the %[target_ip] of the the check. If set to the string "default" the underlying system default nameserver is used.</parameter> 14 <parameter name="port" 15 required="optional" 16 default="53" 17 allowed="\d+">The port on which the remote server's DNS service is running.</parameter> 14 18 <parameter name="ctype" 15 19 required="optional"
