|
@@ -42,9 +42,10 @@ Iñaki Baz Castillo
|
|
|
4.14. dns_sys_match_ip(hostname, ipaddr)
|
|
|
4.15. dns_int_match_ip(hostname, ipaddr)
|
|
|
4.16. dns_query(hostname, pvid)
|
|
|
- 4.17. srv_query(srvcname, pvid)
|
|
|
- 4.18. naptr_query(domain, pvid)
|
|
|
- 4.19. dns_set_local_ttl(vttl)
|
|
|
+ 4.17. ptr_query(ip, pvid)
|
|
|
+ 4.18. srv_query(srvcname, pvid)
|
|
|
+ 4.19. naptr_query(domain, pvid)
|
|
|
+ 4.20. dns_set_local_ttl(vttl)
|
|
|
|
|
|
List of Examples
|
|
|
|
|
@@ -64,9 +65,10 @@ Iñaki Baz Castillo
|
|
|
1.14. dns_sys_match_ip usage
|
|
|
1.15. dns_int_match_ip usage
|
|
|
1.16. dns_query usage
|
|
|
- 1.17. srv_query usage
|
|
|
- 1.18. naptr_query usage
|
|
|
- 1.19. dns_set_local_ttl usage
|
|
|
+ 1.17. ptr_query usage
|
|
|
+ 1.18. srv_query usage
|
|
|
+ 1.19. naptr_query usage
|
|
|
+ 1.20. dns_set_local_ttl usage
|
|
|
|
|
|
Chapter 1. Admin Guide
|
|
|
|
|
@@ -97,9 +99,10 @@ Chapter 1. Admin Guide
|
|
|
4.14. dns_sys_match_ip(hostname, ipaddr)
|
|
|
4.15. dns_int_match_ip(hostname, ipaddr)
|
|
|
4.16. dns_query(hostname, pvid)
|
|
|
- 4.17. srv_query(srvcname, pvid)
|
|
|
- 4.18. naptr_query(domain, pvid)
|
|
|
- 4.19. dns_set_local_ttl(vttl)
|
|
|
+ 4.17. ptr_query(ip, pvid)
|
|
|
+ 4.18. srv_query(srvcname, pvid)
|
|
|
+ 4.19. naptr_query(domain, pvid)
|
|
|
+ 4.20. dns_set_local_ttl(vttl)
|
|
|
|
|
|
1. Overview
|
|
|
|
|
@@ -157,9 +160,10 @@ Chapter 1. Admin Guide
|
|
|
4.14. dns_sys_match_ip(hostname, ipaddr)
|
|
|
4.15. dns_int_match_ip(hostname, ipaddr)
|
|
|
4.16. dns_query(hostname, pvid)
|
|
|
- 4.17. srv_query(srvcname, pvid)
|
|
|
- 4.18. naptr_query(domain, pvid)
|
|
|
- 4.19. dns_set_local_ttl(vttl)
|
|
|
+ 4.17. ptr_query(ip, pvid)
|
|
|
+ 4.18. srv_query(srvcname, pvid)
|
|
|
+ 4.19. naptr_query(domain, pvid)
|
|
|
+ 4.20. dns_set_local_ttl(vttl)
|
|
|
|
|
|
4.1. is_ip (ip)
|
|
|
|
|
@@ -531,7 +535,39 @@ if(dns_query("test.com", "xyz"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-4.17. srv_query(srvcname, pvid)
|
|
|
+4.17. ptr_query(ip, pvid)
|
|
|
+
|
|
|
+ Store the hostname that correspond to an IP address (IPv4 or IPv6) in a
|
|
|
+ pseudo-variable variable $ptrquery(pvid=>hostname).
|
|
|
+
|
|
|
+ Note: Results will be in in $ptrquery(pvid=>key). key can be:
|
|
|
+ * addr - IP address
|
|
|
+ * type - type of IP address
|
|
|
+ * ipv4 - 1 if IPv4 address
|
|
|
+ * ipv6 - 1 if IPv6 address
|
|
|
+ * count - number of hostnames found
|
|
|
+ * hostname - hostname
|
|
|
+
|
|
|
+ Parameters:
|
|
|
+ * ip - string or pseudo-variable containing the ip.
|
|
|
+ * pvid - AVP id for script variable.
|
|
|
+
|
|
|
+ This function can be used from ANY_ROUTE.
|
|
|
+
|
|
|
+ Example 1.17. ptr_query usage
|
|
|
+...
|
|
|
+if(ptr_query("8.8.8.8","ip4"))
|
|
|
+{
|
|
|
+ xlog(" number of names: $ptrquery(ip4=>count)\n");
|
|
|
+ $var(j) = 0;
|
|
|
+ while($var(j)<$ptrquery(ip4=>count)) {
|
|
|
+ xlog(" #[$var(j)] name [ $ptrquery(ip4=>hostname) ]\n");
|
|
|
+ $var(j) = $var(j) + 1;
|
|
|
+ }
|
|
|
+}
|
|
|
+...
|
|
|
+
|
|
|
+4.18. srv_query(srvcname, pvid)
|
|
|
|
|
|
Queries DNS SRV records to resolve a service/protocol name into a list
|
|
|
of priorities, weights, ports, and targets sorted by priority and
|
|
@@ -557,7 +593,7 @@ if(dns_query("test.com", "xyz"))
|
|
|
* target [index] - target host name
|
|
|
* weight [index] - weight number as defined by RFC 2782
|
|
|
|
|
|
- Example 1.17. srv_query usage
|
|
|
+ Example 1.18. srv_query usage
|
|
|
...
|
|
|
if (srv_query ("_sip._udp.example.com", "udp") > 0) {
|
|
|
$var(cnt) = $srvquery(udp=>count);
|
|
@@ -572,7 +608,7 @@ if (srv_query ("_sip._udp.example.com", "udp") > 0) {
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-4.18. naptr_query(domain, pvid)
|
|
|
+4.19. naptr_query(domain, pvid)
|
|
|
|
|
|
Queries DNS NAPTR records to resolve a domain name into a list of
|
|
|
orders, preferences, flags, services, regex, replaces sorted by orders
|
|
@@ -600,7 +636,7 @@ if (srv_query ("_sip._udp.example.com", "udp") > 0) {
|
|
|
* regex [index] - regular expression
|
|
|
* replace [index] - replace
|
|
|
|
|
|
- Example 1.18. naptr_query usage
|
|
|
+ Example 1.19. naptr_query usage
|
|
|
...
|
|
|
if (naptr_query ("example.com", "res") > 0) {
|
|
|
$var(cnt) = $naptrquery(res=>count);
|
|
@@ -617,7 +653,7 @@ if (naptr_query ("example.com", "res") > 0) {
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-4.19. dns_set_local_ttl(vttl)
|
|
|
+4.20. dns_set_local_ttl(vttl)
|
|
|
|
|
|
Set local ttl for DNS query results. If vttl is 0, then the value of
|
|
|
the result and the core parameters are used.
|
|
@@ -628,7 +664,7 @@ if (naptr_query ("example.com", "res") > 0) {
|
|
|
|
|
|
This function can be used from ANY_ROUTE.
|
|
|
|
|
|
- Example 1.19. dns_set_local_ttl usage
|
|
|
+ Example 1.20. dns_set_local_ttl usage
|
|
|
...
|
|
|
dns_set_local_ttl("7200");
|
|
|
dns_query("test.com", "xyz")
|