[SR-Users] listening at link local IPv6 address

Daniel-Constantin Mierla miconda at gmail.com
Mon Apr 22 20:29:24 CEST 2019


I could track that limitation down to commit c6b62bf8 from 2011.
Searching on the web, I found that is a little bit tricky with link
local addresses, especially related to porting on Linux and *BSDes
(e.g., https://danrl.com/blog/2016/struct-sockaddr-in6/).

Anyhow, your code has hardcoded interface name, I added a helper
function that tries to get the scope by matching the ip address when
walking over network interfaces. The commit:

  *
https://github.com/kamailio/kamailio/commit/ce1138d2d8962296de2867d5751abf770b035da3

Can you try using that function to get the scope id?

Then, if works, we can consider adding some parameter to control if link
local ipv6 addresses should be also bound automatically, so current
behaviour is preserved.

Cheers,
Daniel

On 22.04.19 09:11, Juha Heinanen wrote:
> I read K source code and found these kind of lines in sock_info.c:
>
> 			for(;RTA_OK(rtap, rtl);rtap=RTA_NEXT(rtap,rtl)){
> 				switch(rtap->rta_type){
> 					case IFA_ADDRESS:
> 						if((*(int*)RTA_DATA(rtap))== htons(0xfe80)){
> 							LM_DBG("Link Local Address, ignoring ...\n");
> 							is_link_local = 1;
> 							break;
> 						}
>
> and
>
> 					case IFA_LOCAL:
> 						if((*(int*)RTA_DATA(rtap))== htons(0xfe80)){
> 							LM_DBG("Link Local Address, ignoring ...\n");
> 							is_link_local = 1;
> 						}
>
> and
>
> 			if(is_link_local) {
> 				pkg_free(entry);
> 				continue;    /* link local addresses are not bindable */
> 			}
>
> The last comment is wrong.  Link local addresses ARE bindable.  They
> just require that sin6_scope_id is set.
>
> I made an experiment by setting sin6_scope_id scope_id in udp_server.c
> like this:
>
> 	} else if (addr->s.sa_family==AF_INET6){
>         ...
> 		addr->sin6.sin6_scope_id = if_nametoindex("wlp1s0");
>
> and looks like it worked.  The error message was gone and
>
>   listen=udp:[fe80::6e29:95ff:fe7d:37e6]:5060
>
> produced:
>
>   Apr 22 09:44:37 salmon sip-proxy[14003]: Listening on udp: FE80:0:0:0:6E29:95FF:FE7D:37E6 [FE80:0:0:0:6E29:95FF:FE7D:37E6]:5060
>
> -- Juha
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com




More information about the sr-users mailing list