03-Nov-2020
08:01
- last edited on
04-Jun-2023
21:12
by
JimmyPackets
With RESOLV::lookup being deprecated as of version 15.1 in favor of the RESOLVER and DNSMSG namespaces, I am not finding detailed enough documentation and examples to convert my 14.1 iRule to the new 15.1 syntax. My end goal is to do a reverse lookup (PTR) of the IP::client_addr against two internal DNS servers, then log it.
14.1 Syntax
when CLIENT_ACCEPTED {
log local0. "The client source IP address is: [IP::client_addr]"
log local0. "[IP::client_addr] resolves in DNS (server1) to [RESOLV::lookup @192.168.1.1 -ptr "[IP::client_addr]"]"
log local0. "[IP::client_addr] resolves in DNS (server2) to [RESOLV::lookup @192.168.1.2 -ptr "[IP::client_addr]"]"
}
09-Nov-2020
08:28
- last edited on
21-Nov-2022
16:20
by
JimmyPackets
So this is a more object-orientated and scalable way of doing lookups - you can think of the response ($result) being a data object which you can then interrogate as you want to. Below is an example,
when CLIENT_ACCEPTED {
set result [RESOLVER::name_lookup "/Common/resolver1" [IP::client_addr PTR]
log local0.debug "Response code: [ DNSMSG::header $result rcode ]"
foreach rr { [RESOLVER::summarize $result] } {
log local0.debug "Response from resolver1 for [IP::client_addr]: $rr"
}
}