[sr-dev] git:master:6285b5eb: core: dns - print index and remove per record type printing added previously

Daniel-Constantin Mierla miconda at gmail.com
Thu May 3 20:49:09 CEST 2018


Module: kamailio
Branch: master
Commit: 6285b5ebe02d39bf77baa8f29d16de246dc1ad77
URL: https://github.com/kamailio/kamailio/commit/6285b5ebe02d39bf77baa8f29d16de246dc1ad77

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-05-03T20:47:37+02:00

core: dns - print index and remove per record type printing added previously

- type is already printed at the top of the structure

---

Modified: src/core/dns_cache.c

---

Diff:  https://github.com/kamailio/kamailio/commit/6285b5ebe02d39bf77baa8f29d16de246dc1ad77.diff
Patch: https://github.com/kamailio/kamailio/commit/6285b5ebe02d39bf77baa8f29d16de246dc1ad77.patch

---

diff --git a/src/core/dns_cache.c b/src/core/dns_cache.c
index 0c53ebd50d..bff6ecfb97 100644
--- a/src/core/dns_cache.c
+++ b/src/core/dns_cache.c
@@ -3804,6 +3804,7 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
 	ticks_t now;
 	str s;
 	int i;
+	int n;
 
 	now=get_ticks_raw();
 	expires = (s_ticks_t)(e->expire-now)<0?-1: TICKS_TO_S(e->expire-now);
@@ -3824,16 +3825,12 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
 						TICKS_TO_S(now-e->last_used));
 	rpc->rpl_printf(ctx, "%snegative entry: %s", SPACE_FORMAT,
 						(e->ent_flags & DNS_FLAG_BAD_NAME) ? "yes" : "no");
-	
+	n = 0;
 	for (rr=e->rr_lst; rr; rr=rr->next) {
+		rpc->rpl_printf(ctx, "%srr idx: %d", SPACE_FORMAT, n++);
 		switch(e->type) {
 			case T_A:
 			case T_AAAA:
-				if(e->type==T_A) {
-				  rpc->rpl_printf(ctx, "%srr type: a", SPACE_FORMAT);
-				} else {
-				  rpc->rpl_printf(ctx, "%srr type: aaaa", SPACE_FORMAT);
-				}
 				if (dns_rr2ip(e->type, rr, &ip)==0){
 				  rpc->rpl_printf(ctx, "%srr ip: %s", SPACE_FORMAT,
 									ip_addr2a(&ip) );
@@ -3843,7 +3840,6 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
 				}
 				break;
 			case T_SRV:
-				rpc->rpl_printf(ctx, "%srr type: srv", SPACE_FORMAT);
 				rpc->rpl_printf(ctx, "%srr name: %s", SPACE_FORMAT,
 							((struct srv_rdata*)(rr->rdata))->name);
 				rpc->rpl_printf(ctx, "%srr port: %d", SPACE_FORMAT,
@@ -3854,7 +3850,6 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
 							((struct srv_rdata*)(rr->rdata))->weight);
 				break;
 			case T_NAPTR:
-				rpc->rpl_printf(ctx, "%srr type: naptr", SPACE_FORMAT);
 				rpc->rpl_printf(ctx, "%srr order: %d", SPACE_FORMAT,
 							((struct naptr_rdata*)(rr->rdata))->order);
 				rpc->rpl_printf(ctx, "%srr preference: %d", SPACE_FORMAT,
@@ -3877,12 +3872,10 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
 									SPACE_FORMAT, s.len, s.s);
 				break;
 			case T_CNAME:
-				rpc->rpl_printf(ctx, "%srr type: cname", SPACE_FORMAT);
 				rpc->rpl_printf(ctx, "%srr name: %s", SPACE_FORMAT,
 							((struct cname_rdata*)(rr->rdata))->name);
 				break;
 			case T_TXT:
-				rpc->rpl_printf(ctx, "%srr type: txt", SPACE_FORMAT);
 				for (i=0; i<((struct txt_rdata*)(rr->rdata))->cstr_no;
 						i++){
 					rpc->rpl_printf(ctx, "%stxt[%d]: %s", SPACE_FORMAT, i,
@@ -3890,7 +3883,6 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
 				}
 				break;
 			case T_EBL:
-				rpc->rpl_printf(ctx, "%srr type: ebl", SPACE_FORMAT);
 				rpc->rpl_printf(ctx, "%srr position: %d", SPACE_FORMAT,
 							((struct ebl_rdata*)(rr->rdata))->position);
 				rpc->rpl_printf(ctx, "%srr separator: %s", SPACE_FORMAT,
@@ -3899,7 +3891,6 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
 							((struct ebl_rdata*)(rr->rdata))->apex);
 				break;
 			case T_PTR:
-				rpc->rpl_printf(ctx, "%srr type: ptr", SPACE_FORMAT);
 				rpc->rpl_printf(ctx, "%srr name: %s", SPACE_FORMAT,
 							((struct ptr_rdata*)(rr->rdata))->ptrdname);
 				break;




More information about the sr-dev mailing list