|
@@ -297,13 +297,13 @@ void fix_dns_flags(str *gname, str *name)
|
|
|
#ifdef DNS_SRV_LB
|
|
|
dns_flags|=DNS_SRV_RR_LB;
|
|
|
#else
|
|
|
- LOG(L_WARN, "WARNING: fix_dns_flags: SRV loadbalaning is set, but"
|
|
|
+ LM_WARN("SRV loadbalaning is set, but"
|
|
|
" support for it is not compiled -- ignoring\n");
|
|
|
#endif
|
|
|
}
|
|
|
if (cfg_get(core, core_cfg, dns_try_naptr)) {
|
|
|
#ifndef USE_NAPTR
|
|
|
- LOG(L_WARN, "WARNING: fix_dns_flags: NAPTR support is enabled, but"
|
|
|
+ LM_WARN("NAPTR support is enabled, but"
|
|
|
" support for it is not compiled -- ignoring\n");
|
|
|
#endif
|
|
|
dns_flags|=DNS_TRY_NAPTR;
|
|
@@ -316,8 +316,7 @@ void fix_dns_flags(str *gname, str *name)
|
|
|
int use_dns_failover_fixup(void *handle, str *gname, str *name, void **val)
|
|
|
{
|
|
|
if ((int)(long)(*val) && !cfg_get(core, handle, use_dns_cache)) {
|
|
|
- LOG(L_ERR, "ERROR: use_dns_failover_fixup(): "
|
|
|
- "DNS cache is turned off, failover cannot be enabled. "
|
|
|
+ LM_ERR("DNS cache is turned off, failover cannot be enabled. "
|
|
|
"(set use_dns_cache to 1)\n");
|
|
|
return -1;
|
|
|
}
|
|
@@ -330,14 +329,12 @@ int use_dns_failover_fixup(void *handle, str *gname, str *name, void **val)
|
|
|
int use_dns_cache_fixup(void *handle, str *gname, str *name, void **val)
|
|
|
{
|
|
|
if ((int)(long)(*val) && !dns_cache_init) {
|
|
|
- LOG(L_ERR, "ERROR: use_dns_cache_fixup(): "
|
|
|
- "DNS cache is turned off by dns_cache_init=0, "
|
|
|
+ LM_ERR("DNS cache is turned off by dns_cache_init=0, "
|
|
|
"it cannot be enabled runtime.\n");
|
|
|
return -1;
|
|
|
}
|
|
|
if (((int)(long)(*val)==0) && cfg_get(core, handle, use_dns_failover)) {
|
|
|
- LOG(L_ERR, "ERROR: use_dns_failover_fixup(): "
|
|
|
- "DNS failover depends on use_dns_cache, set use_dns_failover "
|
|
|
+ LM_ERR("DNS failover depends on use_dns_cache, set use_dns_failover "
|
|
|
"to 0 before disabling the DNS cache\n");
|
|
|
return -1;
|
|
|
}
|
|
@@ -369,7 +366,7 @@ int init_dns_cache()
|
|
|
ret=0;
|
|
|
/* sanity check */
|
|
|
if (E_DNS_CRITICAL>=sizeof(dns_str_errors)/sizeof(char*)){
|
|
|
- LOG(L_CRIT, "BUG: dns_cache_init: bad dns error table\n");
|
|
|
+ LM_CRIT("bad dns error table\n");
|
|
|
ret=E_BUG;
|
|
|
goto error;
|
|
|
}
|
|
@@ -430,7 +427,7 @@ int init_dns_cache()
|
|
|
if (dns_timer_interval){
|
|
|
timer_init(dns_timer_h, dns_timer, 0, 0); /* "slow" timer */
|
|
|
if (timer_add(dns_timer_h, S_TO_TICKS(dns_timer_interval))<0){
|
|
|
- LOG(L_CRIT, "BUG: dns_cache_init: failed to add the timer\n");
|
|
|
+ LM_CRIT("failed to add the timer\n");
|
|
|
timer_free(dns_timer_h);
|
|
|
dns_timer_h=0;
|
|
|
goto error;
|
|
@@ -481,7 +478,7 @@ int init_dns_cache_stats(int iproc_num)
|
|
|
((l)!=dns_last_used_lst))
|
|
|
|
|
|
#define dbg_lu_lst(txt, l) \
|
|
|
- LOG(L_CRIT, "BUG: %s: crt(%p, %p, %p)," \
|
|
|
+ LM_CRIT("%s: crt(%p, %p, %p)," \
|
|
|
" prev(%p, %p, %p), next(%p, %p, %p)\n", txt, \
|
|
|
(l), (l)->next, (l)->prev, \
|
|
|
(l)->prev, (l)->prev->next, (l)->prev->prev, \
|
|
@@ -617,8 +614,8 @@ again:
|
|
|
return the last cname */
|
|
|
/* this is a cname => retry using its value */
|
|
|
if (cname_chain> MAX_CNAME_CHAIN){
|
|
|
- LOG(L_ERR, "ERROR: _dns_hash_find: cname chain too long "
|
|
|
- "or recursive (\"%.*s\")\n", name->len, name->s);
|
|
|
+ LM_ERR("cname chain too long or recursive (\"%.*s\")\n",
|
|
|
+ name->len, name->s);
|
|
|
ret=0; /* error*/
|
|
|
*err=-1;
|
|
|
break;
|
|
@@ -814,12 +811,12 @@ inline static int dns_cache_add(struct dns_hash_entry* e)
|
|
|
#ifdef USE_DNS_CACHE_STATS
|
|
|
dns_cache_stats[process_no].dc_lru_cnt++;
|
|
|
#endif
|
|
|
- LOG(L_WARN, "WARNING: dns_cache_add: cache full, trying to free...\n");
|
|
|
+ LM_WARN("cache full, trying to free...\n");
|
|
|
/* free ~ 12% of the cache */
|
|
|
dns_cache_free_mem(*dns_cache_mem_used/16*14,
|
|
|
!cfg_get(core, core_cfg, dns_cache_del_nonexp));
|
|
|
if ((*dns_cache_mem_used+e->total_size)>=cfg_get(core, core_cfg, dns_cache_max_mem)){
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_add: max. cache mem size exceeded\n");
|
|
|
+ LM_ERR("max. cache mem size exceeded\n");
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
@@ -854,14 +851,14 @@ inline static int dns_cache_add_unsafe(struct dns_hash_entry* e)
|
|
|
#ifdef USE_DNS_CACHE_STATS
|
|
|
dns_cache_stats[process_no].dc_lru_cnt++;
|
|
|
#endif
|
|
|
- LOG(L_WARN, "WARNING: dns_cache_add: cache full, trying to free...\n");
|
|
|
+ LM_WARN("cache full, trying to free...\n");
|
|
|
/* free ~ 12% of the cache */
|
|
|
UNLOCK_DNS_HASH();
|
|
|
dns_cache_free_mem(*dns_cache_mem_used/16*14,
|
|
|
!cfg_get(core, core_cfg, dns_cache_del_nonexp));
|
|
|
LOCK_DNS_HASH();
|
|
|
if ((*dns_cache_mem_used+e->total_size)>=cfg_get(core, core_cfg, dns_cache_max_mem)){
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_add: max. cache mem size exceeded\n");
|
|
|
+ LM_ERR("max. cache mem size exceeded\n");
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
@@ -899,7 +896,7 @@ inline static struct dns_hash_entry* dns_cache_mk_bad_entry(str* name,
|
|
|
size=sizeof(struct dns_hash_entry)+name->len-1+1;
|
|
|
e=shm_malloc(size);
|
|
|
if (e==0){
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_mk_bad_entry: out of memory\n");
|
|
|
+ LM_ERR("out of memory\n");
|
|
|
return 0;
|
|
|
}
|
|
|
memset(e, 0, size); /* init with 0*/
|
|
@@ -940,7 +937,7 @@ inline static struct dns_hash_entry* dns_cache_mk_ip_entry(str* name,
|
|
|
sizeof(struct dns_rr)+ ip->len;
|
|
|
e=shm_malloc(size);
|
|
|
if (e==0){
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_mk_ip_entry: out of memory\n");
|
|
|
+ LM_ERR("out of memory\n");
|
|
|
return 0;
|
|
|
}
|
|
|
memset(e, 0, size); /* init with 0*/
|
|
@@ -993,7 +990,7 @@ static struct dns_hash_entry* dns_cache_mk_srv_entry(str* name,
|
|
|
|
|
|
e=shm_malloc(size);
|
|
|
if (e==0){
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_srv_ip_entry: out of memory\n");
|
|
|
+ LM_ERR("out of memory\n");
|
|
|
return 0;
|
|
|
}
|
|
|
memset(e, 0, size); /* init with 0*/
|
|
@@ -1232,8 +1229,7 @@ inline static struct dns_hash_entry* dns_cache_mk_rd_entry(str* name, int type,
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- LOG(L_CRIT, "BUG: dns_cache_mk_rd_entry: type %d not "
|
|
|
- "supported\n", type);
|
|
|
+ LM_CRIT("type %d not supported\n", type);
|
|
|
/* we don't know what to do with it, so don't
|
|
|
* add it to the tmp_lst */
|
|
|
return 0; /* error */
|
|
@@ -1250,7 +1246,7 @@ inline static struct dns_hash_entry* dns_cache_mk_rd_entry(str* name, int type,
|
|
|
size+=ROUND_POINTER(sizeof(struct dns_hash_entry)+name->len-1+1);
|
|
|
e=shm_malloc(size);
|
|
|
if (e==0){
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_mk_rd_entry: out of memory\n");
|
|
|
+ LM_ERR("out of memory\n");
|
|
|
return 0;
|
|
|
}
|
|
|
memset(e, 0, size); /* init with 0 */
|
|
@@ -1421,8 +1417,7 @@ inline static struct dns_hash_entry* dns_cache_mk_rd_entry(str* name, int type,
|
|
|
break;
|
|
|
default:
|
|
|
/* do nothing */
|
|
|
- LOG(L_CRIT, "BUG: dns_cache_mk_rd_entry: create: type %d not "
|
|
|
- "supported\n", type);
|
|
|
+ LM_CRIT("type %d not supported\n", type);
|
|
|
;
|
|
|
}
|
|
|
*tail_rr=0; /* terminate the list */
|
|
@@ -1498,8 +1493,7 @@ inline static struct dns_hash_entry* dns_cache_mk_rd_entry2(struct rdata* rd)
|
|
|
rec[r].rd->name_len-1+1);
|
|
|
no_records++;
|
|
|
}else{
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_mk_rd_entry2: too many records: %d\n",
|
|
|
- no_records);
|
|
|
+ LM_ERR("too many records: %d\n", no_records);
|
|
|
/* skip */
|
|
|
continue;
|
|
|
}
|
|
@@ -1550,8 +1544,7 @@ found:
|
|
|
PTR_RDATA_SIZE(*(struct ptr_rdata*)l->rdata));
|
|
|
break;
|
|
|
default:
|
|
|
- LOG(L_CRIT, "BUG: dns_cache_mk_rd_entry: type %d not "
|
|
|
- "supported\n", l->type);
|
|
|
+ LM_CRIT("type %d not supported\n", l->type);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1560,7 +1553,7 @@ found:
|
|
|
for (r=0; r<no_records; r++){
|
|
|
rec[r].e=shm_malloc(rec[r].size);
|
|
|
if (rec[r].e==0){
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_mk_rd_entry: out of memory\n");
|
|
|
+ LM_ERR("out of memory\n");
|
|
|
goto error;
|
|
|
}
|
|
|
memset(rec[r].e, 0, rec[r].size); /* init with 0*/
|
|
@@ -1915,8 +1908,7 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
|
|
|
goto end; /* the servers are down, needless to perform the query */
|
|
|
#endif
|
|
|
if (name->len>=MAX_DNS_NAME){
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_do_request: name too long (%d chars)\n",
|
|
|
- name->len);
|
|
|
+ LM_ERR("name too long (%d chars)\n", name->len);
|
|
|
goto end;
|
|
|
}
|
|
|
/* null terminate the string, needed by get_record */
|
|
@@ -2133,8 +2125,8 @@ inline static struct dns_hash_entry* dns_get_entry(str* name, int type)
|
|
|
|
|
|
e=0;
|
|
|
if (rec_cnt>MAX_CNAME_CHAIN){
|
|
|
- LOG(L_WARN, "WARNING: dns_get_entry: CNAME chain too long or"
|
|
|
- " recursive CNAMEs (\"%.*s\")\n", name->len, name->s);
|
|
|
+ LM_WARN("CNAME chain too long or recursive CNAMEs (\"%.*s\")\n",
|
|
|
+ name->len, name->s);
|
|
|
goto error;
|
|
|
}
|
|
|
rec_cnt++;
|
|
@@ -2414,7 +2406,7 @@ inline static struct hostent* dns_entry2he(struct dns_hash_entry* e)
|
|
|
len=16;
|
|
|
break;
|
|
|
default:
|
|
|
- LOG(L_CRIT, "BUG: dns_entry2he: wrong entry type %d for %.*s\n",
|
|
|
+ LM_CRIT("wrong entry type %d for %.*s\n",
|
|
|
e->type, e->name_len, e->name);
|
|
|
return 0;
|
|
|
}
|
|
@@ -2676,8 +2668,8 @@ struct hostent* dns_srv_sip_resolvehost(str* name, unsigned short* port,
|
|
|
*port=(srv_proto==PROTO_TLS)?SIPS_PORT:SIP_PORT; /* just in case we
|
|
|
don't find another */
|
|
|
if ((name->len+SRV_MAX_PREFIX_LEN+1)>MAX_DNS_NAME){
|
|
|
- LOG(L_WARN, "WARNING: dns_sip_resolvehost: domain name too long"
|
|
|
- " (%d), unable to perform SRV lookup\n", name->len);
|
|
|
+ LM_WARN("domain name too long (%d), unable to perform SRV lookup\n",
|
|
|
+ name->len);
|
|
|
}else{
|
|
|
/* check if it's an ip address */
|
|
|
if ( ((ip=str2ip(name))!=0)
|
|
@@ -2700,8 +2692,7 @@ struct hostent* dns_srv_sip_resolvehost(str* name, unsigned short* port,
|
|
|
create_srv_name(srv_proto, name, tmp);
|
|
|
break;
|
|
|
default:
|
|
|
- LOG(L_CRIT, "BUG: sip_resolvehost: unknown proto %d\n",
|
|
|
- (int)srv_proto);
|
|
|
+ LM_CRIT("unknown proto %d\n", (int)srv_proto);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -2713,7 +2704,7 @@ struct hostent* dns_srv_sip_resolvehost(str* name, unsigned short* port,
|
|
|
}
|
|
|
/*skip_srv:*/
|
|
|
if (name->len >= MAX_DNS_NAME) {
|
|
|
- LOG(L_ERR, "dns_sip_resolvehost: domain name too long\n");
|
|
|
+ LM_ERR("domain name too long\n");
|
|
|
return 0;
|
|
|
}
|
|
|
he=dns_get_he(name, dns_flags);
|
|
@@ -2758,7 +2749,7 @@ struct naptr_rdata* dns_naptr_sip_iterate(struct dns_rr* naptr_head,
|
|
|
for(l=naptr_head; l && (i<MAX_NAPTR_RRS); l=l->next){
|
|
|
naptr=(struct naptr_rdata*) l->rdata;
|
|
|
if (naptr==0){
|
|
|
- LOG(L_CRIT, "naptr_iterate: BUG: null rdata\n");
|
|
|
+ LM_CRIT("null rdata\n");
|
|
|
goto end;
|
|
|
}
|
|
|
/* check if valid and get proto */
|
|
@@ -2820,8 +2811,7 @@ struct hostent* dns_naptr_sip_resolvehost(str* name, unsigned short* port,
|
|
|
origproto=*proto;
|
|
|
he=0;
|
|
|
if (dns_hash==0){ /* not init => use normal, non-cached version */
|
|
|
- LOG(L_WARN, "WARNING: dns_sip_resolvehost: called before dns cache"
|
|
|
- " initialization\n");
|
|
|
+ LM_WARN("called before dns cache initialization\n");
|
|
|
return _sip_resolvehost(name, port, proto);
|
|
|
}
|
|
|
if (proto && port && (*proto==0) && (*port==0)){
|
|
@@ -3085,8 +3075,7 @@ inline static int dns_ip_resolve( struct dns_hash_entry** e,
|
|
|
dns_hash_put(orig);
|
|
|
}
|
|
|
}else{
|
|
|
- LOG(L_CRIT, "BUG: dns_ip_resolve: invalid record type %d\n",
|
|
|
- (*e)->type);
|
|
|
+ LM_CRIT("invalid record type %d\n", (*e)->type);
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
@@ -3232,8 +3221,7 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h, str* name,
|
|
|
|
|
|
origproto = *proto;
|
|
|
if (dns_hash==0){ /* not init => use normal, non-cached version */
|
|
|
- LOG(L_WARN, "WARNING: dns_srv_sip_resolve: called before dns cache"
|
|
|
- " initialization\n");
|
|
|
+ LM_WARN("called before dns cache initialization\n");
|
|
|
h->srv=h->a=0;
|
|
|
he=_sip_resolvehost(name, port, proto);
|
|
|
if (he){
|
|
@@ -3254,8 +3242,7 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h, str* name,
|
|
|
/* try SRV if initial call & no port specified
|
|
|
* (draft-ietf-sip-srv-06) */
|
|
|
if ((name->len+SRV_MAX_PREFIX_LEN+1)>MAX_DNS_NAME){
|
|
|
- LOG(L_WARN, "WARNING: dns_srv_sip_resolve: domain name too"
|
|
|
- " long (%d), unable to perform SRV lookup\n",
|
|
|
+ LM_WARN("domain name too long (%d), unable to perform SRV lookup\n",
|
|
|
name->len);
|
|
|
}else{
|
|
|
/* check if it's an ip address */
|
|
@@ -3284,8 +3271,7 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h, str* name,
|
|
|
create_srv_name(srv_proto_list[i].proto, name, tmp);
|
|
|
break;
|
|
|
default:
|
|
|
- LOG(L_CRIT, "BUG: dns_srv_sip_resolve: "
|
|
|
- "unknown proto %d\n", (int)srv_proto_list[i].proto);
|
|
|
+ LM_CRIT("unknown proto %d\n", (int)srv_proto_list[i].proto);
|
|
|
return -E_DNS_CRITICAL;
|
|
|
}
|
|
|
srv_name.s=tmp;
|
|
@@ -3318,7 +3304,7 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h, str* name,
|
|
|
return ret;
|
|
|
}
|
|
|
if (name->len >= MAX_DNS_NAME) {
|
|
|
- LOG(L_ERR, "dns_srv_sip_resolve: domain name too long\n");
|
|
|
+ LM_ERR("domain name too long\n");
|
|
|
return -E_DNS_NAME_TOO_LONG;
|
|
|
}
|
|
|
ret=dns_ip_resolve(&h->a, &h->ip_no, name, ip, flags);
|
|
@@ -3364,8 +3350,7 @@ inline static int dns_naptr_sip_resolve(struct dns_srv_handle* h, str* name,
|
|
|
ret=-E_DNS_NO_NAPTR;
|
|
|
origproto=*proto;
|
|
|
if (dns_hash==0){ /* not init => use normal, non-cached version */
|
|
|
- LOG(L_WARN, "WARNING: dns_sip_resolve: called before dns cache"
|
|
|
- " initialization\n");
|
|
|
+ LM_WARN("called before dns cache initialization\n");
|
|
|
h->srv=h->a=0;
|
|
|
he=_sip_resolvehost(name, port, proto);
|
|
|
if (he){
|
|
@@ -4027,8 +4012,7 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
|
|
|
rr_size = sizeof(struct dns_rr);
|
|
|
break;
|
|
|
default:
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_clone_entry: type %d not "
|
|
|
- "supported\n", e->type);
|
|
|
+ LM_ERR("type %d not supported\n", e->type);
|
|
|
return NULL;
|
|
|
}
|
|
|
} else {
|
|
@@ -4039,7 +4023,7 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
|
|
|
|
|
|
new=shm_malloc(rounded_size+rr_size+rdata_size);
|
|
|
if (!new) {
|
|
|
- LOG(L_ERR, "ERROR: dns_cache_clone_entry: out of memory\n");
|
|
|
+ LM_ERR("out of memory\n");
|
|
|
return NULL;
|
|
|
}
|
|
|
memset(new, 0, rounded_size+rr_size+rdata_size);
|
|
@@ -4167,13 +4151,12 @@ int dns_cache_add_record(unsigned short type,
|
|
|
rr_name.len = 0;
|
|
|
|
|
|
if (!cfg_get(core, core_cfg, use_dns_cache)){
|
|
|
- LOG(L_ERR, "ERROR: dns cache support disabled (see use_dns_cache)\n");
|
|
|
+ LM_ERR("dns cache support disabled (see use_dns_cache)\n");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
if ((type != T_A) && (type != T_AAAA) && (type != T_SRV)) {
|
|
|
- LOG(L_ERR, "ERROR: rr type %d is not implemented\n",
|
|
|
- type);
|
|
|
+ LM_ERR("rr type %d is not implemented\n", type);
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -4183,7 +4166,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
case T_A:
|
|
|
ip_addr = str2ip(value);
|
|
|
if (!ip_addr) {
|
|
|
- LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
|
|
|
+ LM_ERR("Malformed ip address: %.*s\n",
|
|
|
value->len, value->s);
|
|
|
return -1;
|
|
|
}
|
|
@@ -4191,7 +4174,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
case T_AAAA:
|
|
|
ip_addr = str2ip6(value);
|
|
|
if (!ip_addr) {
|
|
|
- LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
|
|
|
+ LM_ERR("Malformed ip address: %.*s\n",
|
|
|
value->len, value->s);
|
|
|
return -1;
|
|
|
}
|
|
@@ -4215,7 +4198,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
&& (old->ent_flags & DNS_FLAG_PERMANENT)
|
|
|
&& ((flags & DNS_FLAG_PERMANENT) == 0)
|
|
|
) {
|
|
|
- LOG(L_ERR, "ERROR: A non-permanent record cannot overwrite "
|
|
|
+ LM_ERR("A non-permanent record cannot overwrite "
|
|
|
"a permanent entry\n");
|
|
|
goto error;
|
|
|
}
|
|
@@ -4224,7 +4207,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
/* negative entry */
|
|
|
new = dns_cache_mk_bad_entry(name, type, ttl, flags);
|
|
|
if (!new) {
|
|
|
- LOG(L_ERR, "ERROR: Failed to create a negative "
|
|
|
+ LM_ERR("Failed to create a negative "
|
|
|
"DNS cache entry\n");
|
|
|
goto error;
|
|
|
}
|
|
@@ -4244,7 +4227,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
case T_AAAA:
|
|
|
new = dns_cache_mk_ip_entry(name, ip_addr);
|
|
|
if (!new) {
|
|
|
- LOG(L_ERR, "ERROR: Failed to create an A/AAAA record\n");
|
|
|
+ LM_ERR("Failed to create an A/AAAA record\n");
|
|
|
goto error;
|
|
|
}
|
|
|
/* fix the expiration time, dns_cache_mk_ip_entry() sets it
|
|
@@ -4257,7 +4240,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
new = dns_cache_mk_srv_entry(name, priority, weight, port,
|
|
|
&rr_name, ttl);
|
|
|
if (!new) {
|
|
|
- LOG(L_ERR, "ERROR: Failed to create an SRV record\n");
|
|
|
+ LM_ERR("Failed to create an SRV record\n");
|
|
|
goto error;
|
|
|
}
|
|
|
}
|
|
@@ -4284,7 +4267,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
/* the rr was found in the list */
|
|
|
new = dns_cache_clone_entry(old, 0, 0, 0);
|
|
|
if (!new) {
|
|
|
- LOG(L_ERR, "ERROR: Failed to clone an existing "
|
|
|
+ LM_ERR("Failed to clone an existing "
|
|
|
"DNS cache entry\n");
|
|
|
goto error;
|
|
|
}
|
|
@@ -4322,7 +4305,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
}
|
|
|
new = dns_cache_clone_entry(old, size, ttl, &rr);
|
|
|
if (!new) {
|
|
|
- LOG(L_ERR, "ERROR: Failed to clone an existing "
|
|
|
+ LM_ERR("Failed to clone an existing "
|
|
|
"DNS cache entry\n");
|
|
|
goto error;
|
|
|
}
|
|
@@ -4372,7 +4355,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
rr_p = &((*rr_p)->next)
|
|
|
);
|
|
|
if (!rr_p) {
|
|
|
- LOG(L_ERR, "ERROR: Failed to correct the orderd list of SRV resource records\n");
|
|
|
+ LM_ERR("Failed to correct the orderd list of SRV resource records\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -4389,7 +4372,7 @@ int dns_cache_add_record(unsigned short type,
|
|
|
|
|
|
LOCK_DNS_HASH();
|
|
|
if (dns_cache_add_unsafe(new)) {
|
|
|
- LOG(L_ERR, "ERROR: Failed to add the entry to the cache\n");
|
|
|
+ LM_ERR("Failed to add the entry to the cache\n");
|
|
|
UNLOCK_DNS_HASH();
|
|
|
goto error;
|
|
|
} else {
|
|
@@ -4470,13 +4453,12 @@ int dns_cache_delete_single_record(unsigned short type,
|
|
|
ip_addr = 0;
|
|
|
|
|
|
if (!cfg_get(core, core_cfg, use_dns_cache)){
|
|
|
- LOG(L_ERR, "ERROR: dns cache support disabled (see use_dns_cache)\n");
|
|
|
+ LM_ERR("dns cache support disabled (see use_dns_cache)\n");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
if ((type != T_A) && (type != T_AAAA) && (type != T_SRV)) {
|
|
|
- LOG(L_ERR, "ERROR: rr type %d is not implemented\n",
|
|
|
- type);
|
|
|
+ LM_ERR("rr type %d is not implemented\n", type);
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -4486,7 +4468,7 @@ int dns_cache_delete_single_record(unsigned short type,
|
|
|
case T_A:
|
|
|
ip_addr = str2ip(value);
|
|
|
if (!ip_addr) {
|
|
|
- LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
|
|
|
+ LM_ERR("Malformed ip address: %.*s\n",
|
|
|
value->len, value->s);
|
|
|
return -1;
|
|
|
}
|
|
@@ -4494,7 +4476,7 @@ int dns_cache_delete_single_record(unsigned short type,
|
|
|
case T_AAAA:
|
|
|
ip_addr = str2ip6(value);
|
|
|
if (!ip_addr) {
|
|
|
- LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
|
|
|
+ LM_ERR("Malformed ip address: %.*s\n",
|
|
|
value->len, value->s);
|
|
|
return -1;
|
|
|
}
|
|
@@ -4546,8 +4528,7 @@ int dns_cache_delete_single_record(unsigned short type,
|
|
|
* automatically destroyed when its refcnt will be 0*/
|
|
|
new = dns_cache_clone_entry(old, 0, 0, 0);
|
|
|
if (!new) {
|
|
|
- LOG(L_ERR, "ERROR: Failed to clone an existing "
|
|
|
- "DNS cache entry\n");
|
|
|
+ LM_ERR("Failed to clone an existing DNS cache entry\n");
|
|
|
dns_hash_put(old);
|
|
|
return -1;
|
|
|
}
|
|
@@ -4568,7 +4549,7 @@ delete:
|
|
|
if (new) {
|
|
|
/* delete the old entry only if the new one can be added */
|
|
|
if (dns_cache_add_unsafe(new)) {
|
|
|
- LOG(L_ERR, "ERROR: Failed to add the entry to the cache\n");
|
|
|
+ LM_ERR("Failed to add the entry to the cache\n");
|
|
|
UNLOCK_DNS_HASH();
|
|
|
if (old)
|
|
|
dns_hash_put(old);
|
|
@@ -4588,7 +4569,7 @@ delete:
|
|
|
return 0;
|
|
|
|
|
|
not_found:
|
|
|
- LOG(L_ERR, "ERROR: No matching record found\n");
|
|
|
+ LM_ERR("No matching record found\n");
|
|
|
if (old)
|
|
|
dns_hash_put(old);
|
|
|
return -1;
|