Module: kamailio Branch: 5.2 Commit: f7540ffb88bbeb07956c43665874dae82c2ac969 URL: https://github.com/kamailio/kamailio/commit/f7540ffb88bbeb07956c43665874dae8...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2018-12-04T09:06:31+01:00
dispatcher: flag 16 (1<<4) for destinations with host not having A/AAAA record
- use it for addresses that should not be resolved with an A/AAAA query at startup (e.g., it is a NAPTR or SRV only record for that specific hostname) - such addresses will not match when using ds_is_from_list(...) - GH #1743
(cherry picked from commit 9eba5b673cc1a80434642b280e6f7d53e310338e)
---
Modified: src/modules/dispatcher/dispatch.c Modified: src/modules/dispatcher/dispatch.h
---
Diff: https://github.com/kamailio/kamailio/commit/f7540ffb88bbeb07956c43665874dae8... Patch: https://github.com/kamailio/kamailio/commit/f7540ffb88bbeb07956c43665874dae8...
---
diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c index cb8fe6ea81..59cf1d9302 100644 --- a/src/modules/dispatcher/dispatch.c +++ b/src/modules/dispatcher/dispatch.c @@ -424,11 +424,17 @@ ds_dest_t *pack_dest(str iuri, int flags, int priority, str *attrs) /* Do a DNS-Lookup for the Host-Name: */ he = resolvehost(hn); if(he == 0) { - LM_ERR("could not resolve %.*s\n", puri.host.len, puri.host.s); - goto err; + if(dp->flags & DS_NODNSARES_DST) { + dp->irmode |= DS_IRMODE_NOIPADDR; + } else { + LM_ERR("could not resolve %.*s (missing no-probing flag?!?)\n", + puri.host.len, puri.host.s); + goto err; + } + } else { + /* Store hostent in the dispatcher structure */ + hostent2ip_addr(&dp->ip_address, he, 0); } - /* Free the hostname */ - hostent2ip_addr(&dp->ip_address, he, 0);
/* Copy the port out of the URI */ dp->port = puri.port_no; @@ -2957,8 +2963,8 @@ int ds_is_addr_from_list(sip_msg_t *_m, int group, str *uri, int mode)
if(group == -1) { - rc = ds_is_addr_from_set_r( - _m, pipaddr, tport, tproto, _ds_list, mode, 1); + rc = ds_is_addr_from_set_r(_m, pipaddr, tport, tproto, _ds_list, + mode, 1); } else { list = ds_avl_find(_ds_list, group); if(list) { diff --git a/src/modules/dispatcher/dispatch.h b/src/modules/dispatcher/dispatch.h index 0675b3ccd3..1c89c756e6 100644 --- a/src/modules/dispatcher/dispatch.h +++ b/src/modules/dispatcher/dispatch.h @@ -44,7 +44,8 @@ #define DS_TRYING_DST 2 /*!< temporary trying destination */ #define DS_DISABLED_DST 4 /*!< admin disabled destination */ #define DS_PROBING_DST 8 /*!< checking destination */ -#define DS_STATES_ALL 15 /*!< all bits for the states of destination */ +#define DS_NODNSARES_DST 16 /*!< no DNS A/AAAA resolve for host in uri */ +#define DS_STATES_ALL 31 /*!< all bits for the states of destination */
#define ds_skip_dst(flags) ((flags) & (DS_INACTIVE_DST|DS_DISABLED_DST))
@@ -68,6 +69,8 @@
#define DS_XAVP_CTX_SKIP_CNT 1
+#define DS_IRMODE_NOIPADDR 1 + /* clang-format on */
extern str ds_db_url; @@ -185,16 +188,17 @@ typedef struct _ds_latency_stats { } ds_latency_stats_t;
typedef struct _ds_dest { - str uri; - int flags; - int priority; - int dload; - ds_attrs_t attrs; - ds_latency_stats_t latency_stats; - struct socket_info * sock; - struct ip_addr ip_address; /*!< IP-Address of the entry */ - unsigned short int port; /*!< Port of the URI */ - unsigned short int proto; /*!< Protocol of the URI */ + str uri; /*!< address/uri */ + int flags; /*!< flags */ + int priority; /*!< priority */ + int dload; /*!< load */ + ds_attrs_t attrs; /*!< the atttributes */ + ds_latency_stats_t latency_stats; /*!< latency statistics */ + int irmode; /*!< internal runtime mode (flags) */ + struct socket_info *sock; /*!< pointer to local socket */ + struct ip_addr ip_address; /*!< IP of the address */ + unsigned short int port; /*!< port of the URI */ + unsigned short int proto; /*!< protocol of the URI */ int message_count; struct _ds_dest *next; } ds_dest_t;