From e65b01d5ab171473740286d0c380892c1e0ec8bb Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 16 Jul 2020 12:46:26 -0400 Subject: [PATCH] TT#86850 support DNS lookup for advertised address closes #969 Change-Id: I3712a0977700719765bbd45985306e598067c0af --- daemon/main.c | 9 +++++++-- daemon/rtpengine.pod | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/daemon/main.c b/daemon/main.c index 8095ef30d..9dd84dcfd 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -276,8 +276,13 @@ static int if_addr_parse(GQueue *q, char *s, struct ifaddrs *ifas) { ZERO(adv); if (c) { - if (sockaddr_parse_any(&adv, c)) - return -1; + if (sockaddr_parse_any(&adv, c)) { + ilog(LOG_DEBUG, "Could not parse '%s' as an address, attempting DNS lookup", c); + if (sockaddr_getaddrinfo(&adv, c)) { + ilog(LOG_WARN, "DNS lookup for '%s' failed", c); + return -1; + } + } if (is_addr_unspecified(&adv)) return -1; } diff --git a/daemon/rtpengine.pod b/daemon/rtpengine.pod index 902fb63c2..006112985 100644 --- a/daemon/rtpengine.pod +++ b/daemon/rtpengine.pod @@ -702,8 +702,8 @@ The command-line options B<-i> or B<--interface>, or equivalently the B config file option, specify local network interfaces for RTP. At least one must be given, but multiple can be specified. The format of the value is [IB]I[!I] with I being -either an IPv4 address, an IPv6 address, or the name of a system network -interface (such as I). +either an IPv4 address, an IPv6 address, the name of a system network interface +(such as I), or a DNS host name (such as I). The possibility of configuring a network interface by name rather than by address should not be confused with the logical interface name used @@ -717,6 +717,9 @@ I, you would use the syntax I. (Unless omitted, the second I token used for the advertised address must be an actual network address and cannot be an interface name.) +If DNS host names are used instead of addresses or interface names, the lookup +will be done only once during daemon start-up. + To configure multiple interfaces using the command-line options, simply present multiple B<-i> or B<--interface> options. When using the config file, only use a single B line,