Commit be26995f authored by Pekka Pessi's avatar Pekka Pessi

soa.c: use address specified in SOATAG_ADDRESS() as is.

darcs-hash:20060724205059-65a35-ca3c0f11eb40c3a0489a06e6be3d11fb369c743c.gz
parent a5688995
......@@ -1770,6 +1770,30 @@ soa_init_sdp_connection(soa_session_t *ss,
if (ss == NULL || c == NULL)
return su_seterrno(EFAULT), -1;
address = ss->ss_address;
if (host_is_ip_address(address)) {
/* Use the application-specified address -
* do not check that it is found from the local address list */
c->c_nettype = sdp_net_in;
if (host_is_ip4_address(address))
c->c_addrtype = sdp_addr_ip4;
else
c->c_addrtype = sdp_addr_ip6;
if (!host_is_ip6_reference(address)) {
c->c_address = strcpy(buffer, address);
}
else {
/* Remove brackets [] around the reference */
size_t len = strlen(address + 1);
c->c_address = memcpy(buffer, address + 1, len - 1);
buffer[len - 1] = '\0';
}
return 0;
}
/* XXX - using LI_SCOPE_LINK requires some tweaking */
hints->li_scope = LI_SCOPE_GLOBAL | LI_SCOPE_SITE /* | LI_SCOPE_LINK */;
......@@ -1812,8 +1836,6 @@ soa_init_sdp_connection(soa_session_t *ss,
else if (c->c_addrtype == sdp_addr_ip6)
ip6 = 2, ip4 = 1;
address = ss->ss_address;
if (address)
SU_DEBUG_3(("%s: searching for %s from list \"%s\"\n",
__func__, ip6 && !ip4 ? "IP6 " : !ip6 && ip4 ? "IP4 " : "",
......
......@@ -369,6 +369,8 @@ int test_static_offer_answer(struct context *ctx)
n = soa_set_params(b,
SOATAG_LOCAL_SDP_STR("m=audio 5004 RTP/AVP 8"),
SOATAG_AF(SOA_AF_IP4_ONLY),
SOATAG_ADDRESS("1.2.3.4"),
TAG_END());
n = soa_generate_answer(b, test_completed); TEST(n, 0);
......@@ -378,6 +380,7 @@ int test_static_offer_answer(struct context *ctx)
n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 1);
TEST_1(answer != NULL && answer != NONE);
TEST_1(strstr(answer, "c=IN IP4 1.2.3.4"));
n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment