A NAPTR record in dns cache may be skipped if all IPs are unreachable. The NAPTR record contains the internal parameter skip_record
. From outside, it is not possible to view the state of a certain NAPTR record.
Extend the return value of dns_cache_print_entry
with the parameter skip_record
.
The answer of kamcmd dns.view
shows yes
or no
depending on the internal state of skip_record
.
{
name: skipped.example.com
type: NAPTR
size_bytes: 208
reference_counter: 2
permanent: no
expires: 268
last_used: 29
negative_entry: no
records: {
{
rr_idx: 0
rr_order: 10
rr_preference: 10
-> rr_skip_record: yes
rr_flags: S
rr_service: SIPS+D2T
rr_regexp:
rr_regexp: _sips._tcp.skipped.example.com
rr_permanent: no
rr_expires: 268
}
}
}
{
name: valid.example.com
type: NAPTR
size_bytes: 328
reference_counter: 1
permanent: no
expires: 294
last_used: 5
negative_entry: no
records: {
{
rr_idx: 0
rr_order: 20
rr_preference: 20
-> rr_skip_record: no
rr_flags: S
rr_service: SIP+D2U
rr_regexp:
rr_regexp: _sip._udp.valid.example.com
rr_permanent: no
rr_expires: 294
}
{
rr_idx: 1
rr_order: 10
rr_preference: 10
-> rr_skip_record: no
rr_flags: S
rr_service: SIPS+D2T
rr_regexp:
rr_regexp: _sips._tcp.valid.example.com
rr_permanent: no
rr_expires: 294
}
}
}
At the moment it is not visible why a NAPTR record is not used.
The following patch extends the output of dns_cache_print_entry
with the parameter rr_skip_record
.
The patch has been tested locally.
From c4d559f12892fb5a2c3b572f9660b637299fcafb Mon Sep 17 00:00:00 2001
From: Mathias Schneuwly <mathias.schneuwly@ruag.ch>
Date: Tue, 11 Mar 2025 12:38:44 +0000
Subject: [PATCH] Print parameter skip_record in dns_cache_print_entry
---
src/core/dns_cache.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/core/dns_cache.c b/src/core/dns_cache.c
index 1507e89015..1bb95a2d41 100644
--- a/src/core/dns_cache.c
+++ b/src/core/dns_cache.c
@@ -3898,6 +3898,13 @@ int dns_cache_print_entry(rpc_t *rpc, void *ctx, struct dns_hash_entry *e)
rpc->fault(ctx, 500, "Internal error adding naptr order");
return -1;
}
+ if(rpc->struct_add(sh, "s", "rr_skip_record",
+ ((struct naptr_rdata *)(rr->rdata))->skip_record ? "yes" : "no")
+ < 0) {
+ rpc->fault(
+ ctx, 500, "Internal error adding naptr rr_skip_record");
+ return -1;
+ }
s.s = ((struct naptr_rdata *)(rr->rdata))->flags;
s.len = ((struct naptr_rdata *)(rr->rdata))->flags_len;
if(rpc->struct_add(sh, "S", "rr_flags", &s) < 0) {
--
2.44.1
kamailio -v
version: kamailio 5.8.4 (x86_64/linux) f1d83d
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: f1d83d
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.