Ensure that a valid bind host is specified for transports.
authorJoshua Colp <jcolp@digium.com>
Mon, 8 Jul 2013 19:53:13 +0000 (19:53 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 8 Jul 2013 19:53:13 +0000 (19:53 +0000)
(closes issue ASTERISK-22017)
Reported by: Rusty Newton

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393833 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_sip/config_transport.c

index 30c1362..b601f79 100644 (file)
@@ -101,6 +101,11 @@ static int transport_apply(const struct ast_sorcery *sorcery, void *obj)
                return -1;
        }
 
+       if (transport->host.addr.sa_family != PJ_AF_INET && transport->host.addr.sa_family != PJ_AF_INET6) {
+               ast_log(LOG_ERROR, "Transport '%s' could not be started as binding not specified\n", ast_sorcery_object_get_id(obj));
+               return -1;
+       }
+
        /* Set default port if not present */
        if (!pj_sockaddr_get_port(&transport->host)) {
                pj_sockaddr_set_port(&transport->host, (transport->type == AST_TRANSPORT_TLS) ? 5061 : 5060);