From 417c40e02da3d4d2c2d907a6119f1ebb6498d601 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Fri, 15 Jul 2016 02:56:21 +0000 Subject: Re #1933: Updated pjnath sess_auth.c test to use loopback address on IPv6. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5385 74dad513-b988-da41-8d7b-12977e46ad98 --- pjnath/src/pjnath-test/sess_auth.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'pjnath/src/pjnath-test') diff --git a/pjnath/src/pjnath-test/sess_auth.c b/pjnath/src/pjnath-test/sess_auth.c index 626ac07a..055eaad6 100644 --- a/pjnath/src/pjnath-test/sess_auth.c +++ b/pjnath/src/pjnath-test/sess_auth.c @@ -290,11 +290,19 @@ static int create_std_server(pj_stun_auth_type auth_type, return -43; } - status = pj_gethostip(GET_AF(use_ipv6), &addr); - if (status != PJ_SUCCESS) { - destroy_server(); - return -45; - } + if (use_ipv6) { + /* pj_gethostip() may return IPv6 link-local and currently it will cause + * 'no route to host' error, so let's just hardcode to [::1] + */ + pj_sockaddr_init(pj_AF_INET6(), &addr, NULL, 0); + addr.ipv6.sin6_addr.s6_addr[15] = 1; + } else { + status = pj_gethostip(GET_AF(use_ipv6), &addr); + if (status != PJ_SUCCESS) { + destroy_server(); + return -45; + } + } pj_sockaddr_copy_addr(&server->addr, &addr); } -- cgit v1.2.3