Browse code

core: cleanup resolver defines, no function change

cleanup core resolver defines, they were set since 2007 for a bit additional debugging,
no change in functionality

Henning Westerholt authored on 08/06/2018 21:52:29
Showing 2 changed files
... ...
@@ -950,9 +950,7 @@ again:
950 950
 	if (flags & RES_AR){
951 951
 		flags&=~RES_AR;
952 952
 		answers_no=ntohs((unsigned short)buff.hdr.nscount);
953
-#ifdef RESOLVE_DBG
954 953
 		LM_DBG("skipping %d NS (p=%p, end=%p)\n", answers_no, p, end);
955
-#endif
956 954
 		for (r=0; (r<answers_no) && (p<end); r++){
957 955
 			/* skip over the ns records */
958 956
 			if ((p=dns_skipname(p, end))==0) {
... ...
@@ -965,9 +963,7 @@ again:
965 963
 			p+=2+2+4+2+ntohs(rdlength);
966 964
 		}
967 965
 		answers_no=ntohs((unsigned short)buff.hdr.arcount);
968
-#ifdef RESOLVE_DBG
969 966
 		LM_DBG("parsing %d ARs (p=%p, end=%p)\n", answers_no, p, end);
970
-#endif
971 967
 		goto again; /* add also the additional records */
972 968
 	}
973 969
 
... ...
@@ -1152,12 +1148,10 @@ int naptr_proto_preferred(char new_proto, char old_proto)
1152 1148
 int naptr_choose (struct naptr_rdata** crt, char* crt_proto,
1153 1149
 									struct naptr_rdata* n , char n_proto)
1154 1150
 {
1155
-#ifdef NAPTR_DBG
1156 1151
 	LM_DBG("o:%d w:%d p:%d, o:%d w:%d p:%d\n",
1157 1152
 			*crt?(int)(*crt)->order:-1, *crt?(int)(*crt)->pref:-1,
1158 1153
 			(int)*crt_proto,
1159 1154
 			(int)n->order, (int)n->pref, (int)n_proto);
1160
-#endif
1161 1155
 	if ((*crt==0) || ((*crt_proto!=n_proto) && 
1162 1156
 						( naptr_proto_preferred(n_proto, *crt_proto))) )
1163 1157
 			goto change;
... ...
@@ -1166,14 +1160,10 @@ int naptr_choose (struct naptr_rdata** crt, char* crt_proto,
1166 1160
 								(n->pref < (*crt)->pref)))){
1167 1161
 			goto change;
1168 1162
 	}
1169
-#ifdef NAPTR_DBG
1170 1163
 	LM_DBG("no change\n");
1171
-#endif
1172 1164
 	return 0;
1173 1165
 change:
1174
-#ifdef NAPTR_DBG
1175 1166
 	LM_DBG("changed\n");
1176
-#endif
1177 1167
 	*crt_proto=n_proto;
1178 1168
 	*crt=n;
1179 1169
 	return 1;
... ...
@@ -1220,10 +1210,8 @@ struct hostent* srv_sip_resolvehost(str* name, int zt, unsigned short* port,
1220 1210
 		he=0;
1221 1211
 		goto end;
1222 1212
 	}
1223
-#ifdef RESOLVE_DBG
1224 1213
 	LM_DBG("%.*s:%d proto=%d\n", name->len, name->s,
1225 1214
 			port?(int)*port:-1, proto?(int)*proto:-1);
1226
-#endif
1227 1215
 	if (is_srv){
1228 1216
 		/* skip directly to srv resolving */
1229 1217
 		srv_proto=(proto)?*proto:0;
... ...
@@ -1289,10 +1277,8 @@ do_srv:
1289 1277
 				he=resolvehost(srv->name);
1290 1278
 				if (he!=0){
1291 1279
 					/* we found it*/
1292
-#ifdef RESOLVE_DBG
1293 1280
 					LM_DBG("found SRV(%s) = %s:%d in AR\n",
1294 1281
 							srv_target, srv->name, srv->port);
1295
-#endif
1296 1282
 					*port=srv->port;
1297 1283
 					/* cleanup on exit */
1298 1284
 					goto end;
... ...
@@ -1310,10 +1296,8 @@ do_srv:
1310 1296
 				he=resolvehost(srv->name);
1311 1297
 				if (he!=0){
1312 1298
 					/* we found it*/
1313
-#ifdef RESOLVE_DBG
1314 1299
 					LM_DBG("SRV(%s) = %s:%d\n",
1315 1300
 							srv_target, srv->name, srv->port);
1316
-#endif
1317 1301
 					*port=srv->port;
1318 1302
 					/* cleanup on exit */
1319 1303
 					goto end;
... ...
@@ -1326,10 +1310,8 @@ do_srv:
1326 1310
 				goto end;
1327 1311
 			}
1328 1312
 			/* cleanup on exit */
1329
-#ifdef RESOLVE_DBG
1330 1313
 			LM_DBG("no SRV record found for %.*s," 
1331 1314
 					" trying 'normal' lookup...\n", name->len, name->s);
1332
-#endif
1333 1315
 		}
1334 1316
 	}
1335 1317
 	if (likely(!zt)){
... ...
@@ -1340,11 +1322,9 @@ do_srv:
1340 1322
 		he=resolvehost(name->s);
1341 1323
 	}
1342 1324
 end:
1343
-#ifdef RESOLVE_DBG
1344 1325
 	LM_DBG("returning %p (%.*s:%d proto=%d)\n",
1345 1326
 			he, name->len, name->s,
1346 1327
 			port?(int)*port:-1, proto?(int)*proto:-1);
1347
-#endif
1348 1328
 	if (srv_head)
1349 1329
 		free_rdata_list(srv_head);
1350 1330
 	return he;
... ...
@@ -1402,10 +1382,8 @@ struct rdata* naptr_sip_iterate(struct rdata* naptr_head,
1402 1382
 			i++;
1403 1383
 			continue; /* already tried */
1404 1384
 		}
1405
-#ifdef NAPTR_DBG
1406 1385
 		LM_DBG("found a valid sip NAPTR rr %.*s, proto %d\n",
1407 1386
 					naptr->repl_len, naptr->repl, (int)naptr_proto);
1408
-#endif
1409 1387
 		if ((naptr_proto_supported(naptr_proto))){
1410 1388
 			if (naptr_choose(&naptr_saved, &saved_proto,
1411 1389
 								naptr, naptr_proto)) {
... ...
@@ -1417,11 +1395,9 @@ struct rdata* naptr_sip_iterate(struct rdata* naptr_head,
1417 1395
 	}
1418 1396
 	if (naptr_saved){
1419 1397
 		/* found something */
1420
-#ifdef NAPTR_DBG
1421 1398
 		LM_DBG("choosed NAPTR rr %.*s, proto %d tried: 0x%x\n",
1422 1399
 					naptr_saved->repl_len,
1423 1400
 					naptr_saved->repl, (int)saved_proto, *tried);
1424
-#endif
1425 1401
 		*tried|=1<<idx;
1426 1402
 		*proto=saved_proto;
1427 1403
 		srv_name->s=naptr_saved->repl;
... ...
@@ -1645,10 +1621,8 @@ struct hostent* naptr_sip_resolvehost(str* name,  unsigned short* port,
1645 1621
 			}
1646 1622
 		}
1647 1623
 		/*clean up on exit*/
1648
-#ifdef RESOLVE_DBG
1649 1624
 		LM_DBG("no NAPTR record found for %.*s, trying SRV lookup...\n",
1650 1625
 					name->len, name->s);
1651
-#endif
1652 1626
 	}
1653 1627
 	/* fallback to srv lookup */
1654 1628
 	if(proto) *proto = origproto;
... ...
@@ -50,12 +50,6 @@
50 50
 #endif
51 51
 
52 52
 
53
-/* define RESOLVE_DBG for debugging info (very noisy) */
54
-#define RESOLVE_DBG
55
-/* define NAPTR_DBG for naptr related debugging info (very noisy) */
56
-#define NAPTR_DBG
57
-
58
-
59 53
 #define MAX_QUERY_SIZE 8192
60 54
 #define ANS_SIZE       8192
61 55
 #define DNS_HDR_SIZE     12
... ...
@@ -257,10 +251,8 @@ static inline struct ip_addr* str2ip(str* st)
257 251
 	
258 252
 	return &ip;
259 253
 error_dots:
260
-#ifdef RESOLVE_DBG
261 254
 	DBG("str2ip: ERROR: too %s dots in [%.*s]\n", (i>3)?"many":"few", 
262 255
 			st->len, st->s);
263
-#endif
264 256
 	return 0;
265 257
  error_char:
266 258
 	/*
... ...
@@ -353,21 +345,15 @@ static inline struct ip_addr* str2ip6(str* st)
353 345
 	return &ip;
354 346
 
355 347
 error_too_many_colons:
356
-#ifdef RESOLVE_DBG
357 348
 	DBG("str2ip6: ERROR: too many colons in [%.*s]\n", st->len, st->s);
358
-#endif
359 349
 	return 0;
360 350
 
361 351
 error_too_few_colons:
362
-#ifdef RESOLVE_DBG
363 352
 	DBG("str2ip6: ERROR: too few colons in [%.*s]\n", st->len, st->s);
364
-#endif
365 353
 	return 0;
366 354
 
367 355
 error_colons:
368
-#ifdef RESOLVE_DBG
369 356
 	DBG("str2ip6: ERROR: too many double colons in [%.*s]\n", st->len, st->s);
370
-#endif
371 357
 	return 0;
372 358
 
373 359
 error_char: