Browse code

dns_cache.c: logging: DBG -> LM_DBG

Ovidiu Sas authored on 13/01/2015 17:39:58
Showing 1 changed files
... ...
@@ -534,8 +534,7 @@ inline static struct dns_hash_entry* _dns_hash_find(str* name, int type,
534 534
 again:
535 535
 	*h=dns_hash_no(name->s, name->len, type);
536 536
 #ifdef DNS_CACHE_DEBUG
537
-	DBG("dns_hash_find(%.*s(%d), %d), h=%d\n", name->len, name->s,
538
-												name->len, type, *h);
537
+	LM_DBG("(%.*s(%d), %d), h=%d\n", name->len, name->s, name->len, type, *h);
539 538
 #endif
540 539
 	clist_foreach_safe(&dns_hash[*h], e, tmp, next){
541 540
 		if (
... ...
@@ -795,7 +794,7 @@ inline static int dns_cache_add(struct dns_hash_entry* e)
795 795
 	atomic_inc(&e->refcnt);
796 796
 	h=dns_hash_no(e->name, e->name_len, e->type);
797 797
 #ifdef DNS_CACHE_DEBUG
798
-	DBG("dns_cache_add: adding %.*s(%d) %d (flags=%0x) at %d\n",
798
+	LM_DBG("adding %.*s(%d) %d (flags=%0x) at %d\n",
799 799
 			e->name_len, e->name, e->name_len, e->type, e->ent_flags, h);
800 800
 #endif
801 801
 	LOCK_DNS_HASH();
... ...
@@ -837,7 +836,7 @@ inline static int dns_cache_add_unsafe(struct dns_hash_entry* e)
837 837
 	atomic_inc(&e->refcnt);
838 838
 	h=dns_hash_no(e->name, e->name_len, e->type);
839 839
 #ifdef DNS_CACHE_DEBUG
840
-	DBG("dns_cache_add: adding %.*s(%d) %d (flags=%0x) at %d\n",
840
+	LM_DBG("adding %.*s(%d) %d (flags=%0x) at %d\n",
841 841
 			e->name_len, e->name, e->name_len, e->type, e->ent_flags, h);
842 842
 #endif
843 843
 	*dns_cache_mem_used+=e->total_size; /* no need for atomic ops, written
... ...
@@ -862,8 +861,7 @@ inline static struct dns_hash_entry* dns_cache_mk_bad_entry(str* name,
862 862
 	ticks_t now;
863 863
 
864 864
 #ifdef DNS_CACHE_DEBUG
865
-	DBG("dns_cache_mk_bad_entry(%.*s, %d, %d, %d)\n", name->len, name->s,
866
-									type, ttl, flags);
865
+	LM_DBG("(%.*s, %d, %d, %d)\n", name->len, name->s, type, ttl, flags);
867 866
 #endif
868 867
 	size=sizeof(struct dns_hash_entry)+name->len-1+1;
869 868
 	e=shm_malloc(size);
... ...
@@ -1209,8 +1207,7 @@ inline static struct dns_hash_entry* dns_cache_mk_rd_entry(str* name, int type,
1209 1209
 	*tail=0; /* mark the end of our tmp_lst */
1210 1210
 	if (size==0){
1211 1211
 #ifdef DNS_CACHE_DEBUG
1212
-		DBG("dns_cache_mk_rd_entry: entry %.*s (%d) not found\n",
1213
-				name->len, name->s, type);
1212
+		LM_DBG("entry %.*s (%d) not found\n", name->len, name->s, type);
1214 1213
 #endif
1215 1214
 		return 0;
1216 1215
 	}
... ...
@@ -1740,7 +1737,7 @@ inline static struct dns_hash_entry* dns_get_related(struct dns_hash_entry* e,
1740 1740
 	ret=0;
1741 1741
 	l=e;
1742 1742
 #ifdef DNS_CACHE_DEBUG
1743
-	DBG("dns_get_related(%p (%.*s, %d), %d, *%p) (%d)\n", e,
1743
+	LM_DBG("(%p (%.*s, %d), %d, *%p) (%d)\n", e,
1744 1744
 			e->name_len, e->name, e->type, type, *records, cname_chain_len);
1745 1745
 #endif
1746 1746
 	clist_init(l, next, prev);
... ...
@@ -1907,7 +1904,7 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
1907 1907
 					((struct cname_rdata*)l->prev->rr_lst->rdata)->name;
1908 1908
 				cname_val.len=
1909 1909
 					((struct cname_rdata*)l->prev->rr_lst->rdata)->name_len;
1910
-				DBG("dns_cache_do_request: cname detected: %.*s (%d)\n",
1910
+				LM_DBG("cname detected: %.*s (%d)\n",
1911 1911
 						cname_val.len, cname_val.s, cname_val.len);
1912 1912
 			}
1913 1913
 			/* add all the records to the hash */
... ...
@@ -1971,7 +1968,7 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
1971 1971
 			UNLOCK_DNS_HASH();
1972 1972
 			/* if only cnames found => try to resolve the last one */
1973 1973
 			if (cname_val.s){
1974
-				DBG("dns_cache_do_request: dns_get_entry(cname: %.*s (%d))\n",
1974
+				LM_DBG("dns_get_entry(cname: %.*s (%d))\n",
1975 1975
 						cname_val.len, cname_val.s, cname_val.len);
1976 1976
 				e=dns_get_entry(&cname_val, type);
1977 1977
 			}
... ...
@@ -2160,7 +2157,7 @@ error:
2160 2160
  *    *no=0;
2161 2161
  *    now=get_ticks_raw();
2162 2162
  *    while(rr=dns_entry_get_rr(e, no, now){
2163
- *       DBG("address %d\n", *no);
2163
+ *       LM_DBG("address %d\n", *no);
2164 2164
  *       *no++;  ( get the next address next time )
2165 2165
  *     }
2166 2166
  *  }
... ...
@@ -2236,7 +2233,7 @@ inline static unsigned dns_srv_random(unsigned max)
2236 2236
  *    srv_reset_tried(&tried);
2237 2237
  *    now=get_ticks_raw();
2238 2238
  *    while(rr=dns_srv_get_nxt_rr(e, &tried, &no, now){
2239
- *       DBG("address %d\n", *no);
2239
+ *       LM_DBG("address %d\n", *no);
2240 2240
  *     }
2241 2241
  *  }
2242 2242
  *
... ...
@@ -2330,7 +2327,7 @@ retry:
2330 2330
 	for (i=0; (i<idx) && (r_sums[i].r_sum<rand_w); i++);
2331 2331
 found:
2332 2332
 #ifdef DNS_CACHE_DEBUG
2333
-	DBG("dns_srv_get_nxt_rr(%p, %lx, %d, %u): selected %d/%d in grp. %d"
2333
+	LM_DBG("(%p, %lx, %d, %u): selected %d/%d in grp. %d"
2334 2334
 			" (rand_w=%d, rr=%p rd=%p p=%d w=%d rsum=%d)\n",
2335 2335
 		e, (unsigned long)*tried, *no, now, i, idx, n, rand_w, r_sums[i].rr,
2336 2336
 		(r_sums[i].rr)?r_sums[i].rr->rdata:0,
... ...
@@ -2395,7 +2392,7 @@ inline static struct hostent* dns_entry2he(struct dns_hash_entry* e)
2395 2395
 				memcpy(p_addr[i], ((struct a_rdata*)rr->rdata)->ip, len);
2396 2396
 	}
2397 2397
 	if (i==0){
2398
-		DBG("DEBUG: dns_entry2he: no good records found (%d) for %.*s (%d)\n",
2398
+		LM_DBG("no good records found (%d) for %.*s (%d)\n",
2399 2399
 				rr_no, e->name_len, e->name, e->type);
2400 2400
 		return 0; /* no good record found */
2401 2401
 	}
... ...
@@ -2731,9 +2728,8 @@ struct naptr_rdata* dns_naptr_sip_iterate(struct dns_rr* naptr_head,
2731 2731
 			continue; /* already tried */
2732 2732
 		}
2733 2733
 #ifdef DNS_CACHE_DEBUG
2734
-		DBG("naptr_iterate: found a valid sip NAPTR rr %.*s,"
2735
-					" proto %d\n", naptr->repl_len, naptr->repl,
2736
-					(int)naptr_proto);
2734
+		LM_DBG("found a valid sip NAPTR rr %.*s, proto %d\n",
2735
+				naptr->repl_len, naptr->repl, (int)naptr_proto);
2737 2736
 #endif
2738 2737
 		if ((naptr_proto_supported(naptr_proto))){
2739 2738
 			if (naptr_choose(&naptr_saved, &saved_proto,
... ...
@@ -2745,9 +2741,8 @@ struct naptr_rdata* dns_naptr_sip_iterate(struct dns_rr* naptr_head,
2745 2745
 	if (naptr_saved){
2746 2746
 		/* found something */
2747 2747
 #ifdef DNS_CACHE_DEBUG
2748
-		DBG("naptr_iterate: choosed NAPTR rr %.*s, proto %d"
2749
-					" tried: 0x%x\n", naptr_saved->repl_len,
2750
-					naptr_saved->repl, (int)saved_proto, *tried);
2748
+		LM_DBG("choosed NAPTR rr %.*s, proto %d tried: 0x%x\n",
2749
+			naptr_saved->repl_len, naptr_saved->repl, (int)saved_proto, *tried);
2751 2750
 #endif
2752 2751
 		*tried|=1<<idx;
2753 2752
 		*proto=saved_proto;
... ...
@@ -2812,7 +2807,7 @@ struct hostent* dns_naptr_sip_resolvehost(str* name, unsigned short* port,
2812 2812
 												&srv_name, &n_proto)){
2813 2813
 			if ((he=dns_srv_get_he(&srv_name, port, dns_flags))!=0){
2814 2814
 #ifdef DNS_CACHE_DEBUG
2815
-				DBG("dns_naptr_sip_resolvehost(%.*s, %d, %d) srv, ret=%p\n",
2815
+				LM_DBG("(%.*s, %d, %d) srv, ret=%p\n",
2816 2816
 							name->len, name->s, (int)*port, (int)*proto, he);
2817 2817
 #endif
2818 2818
 				dns_hash_put(e);
... ...
@@ -2928,8 +2923,7 @@ inline static int dns_a_resolve( struct dns_hash_entry** e,
2928 2928
 		ret=-E_DNS_EOR;
2929 2929
 	}
2930 2930
 error:
2931
-	DBG("dns_a_resolve(%.*s, %d) returning %d\n",
2932
-			name->len, name->s, *rr_no, ret);
2931
+	LM_DBG("(%.*s, %d) returning %d\n", name->len, name->s, *rr_no, ret);
2933 2932
 	return ret;
2934 2933
 }
2935 2934
 
... ...
@@ -3170,7 +3164,7 @@ inline static int dns_srv_resolve_ip(struct dns_srv_handle* h,
3170 3170
 	}while(ret<0);
3171 3171
 error:
3172 3172
 #ifdef DNS_CACHE_DEBUG
3173
-	DBG("dns_srv_resolve_ip(\"%.*s\", %d, %d), ret=%d, ip=%s\n",
3173
+	LM_DBG("(\"%.*s\", %d, %d), ret=%d, ip=%s\n",
3174 3174
 			name->len, name->s, h->srv_no, h->ip_no, ret,
3175 3175
 			ip?ZSW(ip_addr2a(ip)):"");
3176 3176
 #endif
... ...
@@ -3262,7 +3256,7 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h,  str* name,
3262 3262
 						{
3263 3263
 							h->proto = *proto = srv_proto_list[i].proto;
3264 3264
 #ifdef DNS_CACHE_DEBUG
3265
-							DBG("dns_srv_sip_resolve(%.*s, %d, %d), srv0, ret=%d\n",
3265
+							LM_DBG("(%.*s, %d, %d), srv0, ret=%d\n",
3266 3266
 								name->len, name->s, h->srv_no, h->ip_no, ret);
3267 3267
 #endif
3268 3268
 							return ret;
... ...
@@ -3281,7 +3275,7 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h,  str* name,
3281 3281
 			ret=dns_srv_resolve_ip(h, &srv_name, ip, port, flags);
3282 3282
 			if (proto)
3283 3283
 				*proto=h->proto;
3284
-			DBG("dns_srv_sip_resolve(%.*s, %d, %d), srv, ret=%d\n",
3284
+			LM_DBG("(%.*s, %d, %d), srv, ret=%d\n",
3285 3285
 					name->len, name->s, h->srv_no, h->ip_no, ret);
3286 3286
 			return ret;
3287 3287
 	}
... ...
@@ -3295,7 +3289,7 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h,  str* name,
3295 3295
 	if (proto)
3296 3296
 		*proto=h->proto;
3297 3297
 #ifdef DNS_CACHE_DEBUG
3298
-	DBG("dns_srv_sip_resolve(%.*s, %d, %d), ip, ret=%d\n",
3298
+	LM_DBG("(%.*s, %d, %d), ip, ret=%d\n",
3299 3299
 			name->len, name->s, h->srv_no, h->ip_no, ret);
3300 3300
 #endif
3301 3301
 	return ret;
... ...
@@ -3370,7 +3364,7 @@ inline static int dns_naptr_sip_resolve(struct dns_srv_handle* h,  str* name,
3370 3370
 									from previous dns_srv_sip_resolve calls */
3371 3371
 			if ((ret=dns_srv_resolve_ip(h, &srv_name, ip, port, flags))>=0){
3372 3372
 #ifdef DNS_CACHE_DEBUG
3373
-				DBG("dns_naptr_sip_resolve(%.*s, %d, %d), srv0, ret=%d\n",
3373
+				LM_DBG("(%.*s, %d, %d), srv0, ret=%d\n",
3374 3374
 								name->len, name->s, h->srv_no, h->ip_no, ret);
3375 3375
 #endif
3376 3376
 				dns_hash_put(e);
... ...
@@ -3917,7 +3911,7 @@ void dns_cache_flush(int del_permanent)
3917 3917
 	struct dns_hash_entry* e;
3918 3918
 	struct dns_hash_entry* tmp;
3919 3919
 
3920
-	DBG("dns_cache_flush(): removing elements from the cache\n");
3920
+	LM_DBG("removing elements from the cache\n");
3921 3921
 	LOCK_DNS_HASH();
3922 3922
 		for (h=0; h<DNS_HASH_SIZE; h++){
3923 3923
 			clist_foreach_safe(&dns_hash[h], e, tmp, next){