<div dir="ltr"><div dir="ltr"><div dir="ltr">my five cents about this.<br>Link local addresses generated using MAC address of NIC.<br>If server use VLAN interface, then server will have two or more NICs with same MAC address and two or more same IPv6 link local addresses.<div><br></div><div>In this case kamailio will bind to first NIC with this IPv6 address. When server use VLAN, then ipv6_get_netif_scope will give unexpected results. </div><div><br></div><div>Think need change this code</div><div><br></div><div><div><font face="monospace, monospace">                        /* strip the interface name after */</font></div><div><font face="monospace, monospace">                        for(i=0; ipaddr[i]; i++) {</font></div><div><font face="monospace, monospace">                                if(ipaddr[i]=='%') {</font></div><div><font face="monospace, monospace">                                        ipaddr[i]='\0';</font></div><div><font face="monospace, monospace">                                        break;</font></div><div><font face="monospace, monospace">                                }</font></div><div><font face="monospace, monospace">                        }</font></div><div><font face="monospace, monospace">                        /* if the ips matche, get scope index from interface name */</font></div><div><font face="monospace, monospace">                        if(strcmp(ipaddr, ipval)==0){</font></div><div><font face="monospace, monospace">                                iscope=if_nametoindex(netif->ifa_name);</font></div><div><font face="monospace, monospace">                                goto done;</font></div><div><font face="monospace, monospace">                        }</font></div></div><div><br></div><div><br></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 23, 2019 at 8:16 AM Juha Heinanen <<a href="mailto:jh@tutpro.com">jh@tutpro.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Daniel-Constantin Mierla writes:<br>
<br>
> Anyhow, your code has hardcoded interface name, I added a helper<br>
> function that tries to get the scope by matching the ip address when<br>
> walking over network interfaces. The commit:<br>
> <br>
> <a href="https://github.com/kamailio/kamailio/commit/ce1138d2d8962296de2867d5751abf770b035da3" rel="noreferrer" target="_blank">https://github.com/kamailio/kamailio/commit/ce1138d2d8962296de2867d5751abf770b035da3</a><br>
> <br>
> Can you try using that function to get the scope id?<br>
<br>
I tried by changing my udp_server.c test line:<br>
<br>
        addr->sin6.sin6_scope_id = if_nametoindex("wlp1s0");<br>
<br>
to<br>
<br>
        addr->sin6.sin6_scope_id = addr->ipv6_get_netif_scope("fe80::6e29:95ff:fe7d:37e6");<br>
<br>
and the test again worked fine:<br>
<br>
Apr 23 08:10:41 salmon sip-proxy[21888]: Listening on<br>
Apr 23 08:10:41 salmon sip-proxy[21888]:   udp: FE80:0:0:0:6E29:95FF:FE7D:37E6 [FE80:0:0:0:6E29:95FF:FE7D:37E6]:5060<br>
<br>
So rather than skipping link local addresses, ipv6_get_netif_scope could<br>
be used to find the scope id.<br>
<br>
-- Juha<br>
<br>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>