My K host is behind a mobile WiFi hotspot and I tried to make K listen at the IPv6 address fe80::6e29:95ff:fe7d:37e6/64 that the host has received from the hotspot.
Using that address on listen line gives error:
Apr 21 08:55:18 salmon /usr/bin/sip-proxy[6887]: ERROR: <core> [core/udp_server.c:395]: udp_init(): bind(8, 0x7ff97dfb3fe4, 28) on FE80:0:0:0:6E29:95FF:FE7D:37E6: Invalid argument Apr 21 08:55:18 salmon /usr/bin/sip-proxy[6887]: ERROR: <core> [core/udp_server.c:401]: udp_init(): might be caused by using a link local address, try site local or global
I can ping that address like this:
$ ping6 fe80::6e29:95ff:fe7d:37e6%wlp1s0 PING fe80::6e29:95ff:fe7d:37e6%wlp1s0(fe80::6e29:95ff:fe7d:37e6%wlp1s0) 56 data bytes 64 bytes from fe80::6e29:95ff:fe7d:37e6%wlp1s0: icmp_seq=1 ttl=64 time=0.030 ms
I then tried to add %wlp1s0 suffix to the listen address, but got error:
Apr 21 09:10:35 salmon sip-proxy[7896]: 0(7948) CRITICAL: <core> [core/cfg.y:3510]: yyerror_at(): parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 408, column 34: ip address, interface name or hostname expected
Did I do something wrong? If not, why is it that K cannot listen at a link local address? It is something that Linux networking stack does not support?
-- Juha
Juha Heinanen writes:
Did I do something wrong? If not, why is it that K cannot listen at a link local address? It is something that Linux networking stack does not support?
I did more tests and found out that I can even ssh to the link local address:
$ ssh fe80::6e29:95ff:fe7d:37e6%wlp1s0
which means that sshd is listening at it.
How can I make K to listen at that address?
-- Juha
This thread discusses the same problem with apache web server:
https://serverfault.com/questions/751170/apache-linux-httpd-listen-on-link-l...
The conclusion was that this kind of syntax works:
/etc/httpd/conf/httpd.conf:Listen fe80::a00:16ff:fe89:420f%3:80
that is, ipv6 address without the brackets followed by the interface name.
I could try that with K, but it does not accept that kind of listen address syntax.
-- Juha
How are you setting the listen= param for ipv6?
On Sun, Apr 21, 2019 at 10:16 Juha Heinanen jh@tutpro.com wrote:
This thread discusses the same problem with apache web server:
https://serverfault.com/questions/751170/apache-linux-httpd-listen-on-link-l...
The conclusion was that this kind of syntax works:
/etc/httpd/conf/httpd.conf:Listen fe80::a00:16ff:fe89:420f%3:80
that is, ipv6 address without the brackets followed by the interface name.
I could try that with K, but it does not accept that kind of listen address syntax.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Joel Serrano writes:
How are you setting the listen= param for ipv6?
I have tried with these three:
listen=[fe80::6e29:95ff:fe7d:37e6]:5060 listen=[fe80::6e29:95ff:fe7d:37e6%wlp1s0]:5060 listen=fe80::6e29:95ff:fe7d:37e6%wlp1s0:5060
The last one works in apache. K does not accept the syntax of the last two.
-- Juha
You didn’t set a protocol, like:
listen=udp:[2a02:1850:1:1::13]:5060
On Sun, 21 Apr 2019 at 18:32, Juha Heinanen jh@tutpro.com wrote:
Joel Serrano writes:
How are you setting the listen= param for ipv6?
I have tried with these three:
listen=[fe80::6e29:95ff:fe7d:37e6]:5060 listen=[fe80::6e29:95ff:fe7d:37e6%wlp1s0]:5060 listen=fe80::6e29:95ff:fe7d:37e6%wlp1s0:5060
The last one works in apache. K does not accept the syntax of the last two.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
David Villasmil writes:
You didn’t set a protocol, like:
listen=udp:[2a02:1850:1:1::13]:5060
From the wiki:
listen
Set the network addresses the SIP server should listen to. It can be an IP address, hostname or network iterface id or combination of protocol:address:port (e.g., udp:10.10.10.10:5060).
Adding the proto does not help, e.g.:
listen=udp:[fe80::6e29:95ff:fe7d:37e6]:5060
gives
Apr 21 21:14:48 salmon /usr/bin/sip-proxy[8567]: ERROR: <core> [core/udp_server.c:395]: udp_init(): bind(8, 0x7fddbb836fe4, 28) on FE80:0:0:0:6E29:95FF:FE7D:37E6: Invalid argument Apr 21 21:14:48 salmon /usr/bin/sip-proxy[8567]: ERROR: <core> [core/udp_server.c:401]: udp_init(): might be caused by using a link local address, try site local or global
-- Juha
The error is clear, we might need to wait until one of the core-devs replies :/
I’m using IPv6 without an issue, but I do not listen on link-local addresses...
On Sun, Apr 21, 2019 at 11:19 Juha Heinanen jh@tutpro.com wrote:
David Villasmil writes:
You didn’t set a protocol, like:
listen=udp:[2a02:1850:1:1::13]:5060
From the wiki:
listen
Set the network addresses the SIP server should listen to. It can be an IP address, hostname or network iterface id or combination of protocol:address:port (e.g., udp:10.10.10.10:5060).
Adding the proto does not help, e.g.:
listen=udp:[fe80::6e29:95ff:fe7d:37e6]:5060
gives
Apr 21 21:14:48 salmon /usr/bin/sip-proxy[8567]: ERROR: <core> [core/udp_server.c:395]: udp_init(): bind(8, 0x7fddbb836fe4, 28) on FE80:0:0:0:6E29:95FF:FE7D:37E6: Invalid argument Apr 21 21:14:48 salmon /usr/bin/sip-proxy[8567]: ERROR: <core> [core/udp_server.c:401]: udp_init(): might be caused by using a link local address, try site local or global
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Listening at interface does not work either:
$ ip addr ... 2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 6c:29:95:7d:37:e6 brd ff:ff:ff:ff:ff:ff inet 192.168.43.98/24 brd 192.168.43.255 scope global wlp1s0 valid_lft forever preferred_lft forever inet6 fe80::6e29:95ff:fe7d:37e6/64 scope link valid_lft forever preferred_lft forever
config line:
listen=wlp1s0:5060
omits inet6 address of the interface:
Apr 21 21:55:05 salmon sip-proxy[10903]: Listening on Apr 21 21:55:05 salmon sip-proxy[10903]: udp: 192.168.43.98 [192.168.43.98]:5060 Apr 21 21:55:05 salmon sip-proxy[10903]: tcp: 192.168.43.98 [192.168.43.98]:5060 Apr 21 21:55:05 salmon sip-proxy[10903]: tls: 192.168.43.98 [192.168.43.98]:5061
This starts to look like a bug.
-- Juha
Digging a bit more into this, it appears that in case of link local ipv6 address. also sin6_scope_id of sockaddr_in6 needs to be set:
struct sockaddr_in6 { __SOCKADDR_COMMON (sin6_); in_port_t sin6_port; /* Transport layer port # */ uint32_t sin6_flowinfo; /* IPv6 flow information */ struct in6_addr sin6_addr; /* IPv6 address */ uint32_t sin6_scope_id; /* IPv6 scope-id */ };
and there is function if_nametoindex() in <net/if.h> that can be used to convert interface name (in my case wlp1s0) into the scope id.
-- Juha
Also, quick question: if you don’t actively set a listening address, kamailio listens on all. If you do that, does it bind to the ipv6b
On Sun, 21 Apr 2019 at 20:33, Juha Heinanen jh@tutpro.com wrote:
Digging a bit more into this, it appears that in case of link local ipv6 address. also sin6_scope_id of sockaddr_in6 needs to be set:
struct sockaddr_in6 { __SOCKADDR_COMMON (sin6_); in_port_t sin6_port; /* Transport layer port # */ uint32_t sin6_flowinfo; /* IPv6 flow information */ struct in6_addr sin6_addr; /* IPv6 address */ uint32_t sin6_scope_id; /* IPv6 scope-id */ };
and there is function if_nametoindex() in <net/if.h> that can be used to convert interface name (in my case wlp1s0) into the scope id.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
And you could also try with “::” as IPv6? I wonder if that would catch the link-local?
On Sun, Apr 21, 2019 at 15:33 David Villasmil < david.villasmil.work@gmail.com> wrote:
Also, quick question: if you don’t actively set a listening address, kamailio listens on all. If you do that, does it bind to the ipv6b
On Sun, 21 Apr 2019 at 20:33, Juha Heinanen jh@tutpro.com wrote:
Digging a bit more into this, it appears that in case of link local ipv6 address. also sin6_scope_id of sockaddr_in6 needs to be set:
struct sockaddr_in6 { __SOCKADDR_COMMON (sin6_); in_port_t sin6_port; /* Transport layer port # */ uint32_t sin6_flowinfo; /* IPv6 flow information */ struct in6_addr sin6_addr; /* IPv6 address */ uint32_t sin6_scope_id; /* IPv6 scope-id */ };
and there is function if_nametoindex() in <net/if.h> that can be used to convert interface name (in my case wlp1s0) into the scope id.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
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
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/ce1138d2d8962296de2867d5751abf77...
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@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Daniel-Constantin Mierla writes:
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/ce1138d2d8962296de2867d5751abf77...
Can you try using that function to get the scope id?
I tried by changing my udp_server.c test line:
addr->sin6.sin6_scope_id = if_nametoindex("wlp1s0");
to
addr->sin6.sin6_scope_id = addr->ipv6_get_netif_scope("fe80::6e29:95ff:fe7d:37e6");
and the test again worked fine:
Apr 23 08:10:41 salmon sip-proxy[21888]: Listening on 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
So rather than skipping link local addresses, ipv6_get_netif_scope could be used to find the scope id.
-- Juha
my five cents about this. Link local addresses generated using MAC address of NIC. 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.
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.
Think need change this code
/* strip the interface name after */ for(i=0; ipaddr[i]; i++) { if(ipaddr[i]=='%') { ipaddr[i]='\0'; break; } } /* if the ips matche, get scope index from interface name */ if(strcmp(ipaddr, ipval)==0){ iscope=if_nametoindex(netif->ifa_name); goto done; }
On Tue, Apr 23, 2019 at 8:16 AM Juha Heinanen jh@tutpro.com wrote:
Daniel-Constantin Mierla writes:
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/ce1138d2d8962296de2867d5751abf77...
Can you try using that function to get the scope id?
I tried by changing my udp_server.c test line:
addr->sin6.sin6_scope_id = if_nametoindex("wlp1s0");
to
addr->sin6.sin6_scope_id =
addr->ipv6_get_netif_scope("fe80::6e29:95ff:fe7d:37e6");
and the test again worked fine:
Apr 23 08:10:41 salmon sip-proxy[21888]: Listening on 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
So rather than skipping link local addresses, ipv6_get_netif_scope could be used to find the scope id.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Can you try without hard coding the IP address there, but use the value from the listen address? That will show if works properly with the config based values.
As I said, the link local might be tricky to deal with on some operating systems and are not commonly used for traffic, so having an option to disable/enable binding to it seems appropriate here. Also, finding the scope id requires walking though networking interfaces for all IPv6 addresses, which can be a costly at startup.
Cheers, Daniel
On 23.04.19 07:16, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
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/ce1138d2d8962296de2867d5751abf77...
Can you try using that function to get the scope id?
I tried by changing my udp_server.c test line:
addr->sin6.sin6_scope_id = if_nametoindex("wlp1s0");
to
addr->sin6.sin6_scope_id = addr->ipv6_get_netif_scope("fe80::6e29:95ff:fe7d:37e6");
and the test again worked fine:
Apr 23 08:10:41 salmon sip-proxy[21888]: Listening on 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
So rather than skipping link local addresses, ipv6_get_netif_scope could be used to find the scope id.
-- Juha
Daniel-Constantin Mierla writes:
Can you try without hard coding the IP address there, but use the value from the listen address? That will show if works properly with the config based values.
I used constant address, since I was not able to easily figure out, where the address string is in addr->sin6 struct, I can try find it when I have more time.
-- Juha
Daniel-Constantin Mierla writes:
Can you try without hard coding the IP address there, but use the value from the listen address? That will show if works properly with the config based values.
I tried like this:
addr->sin6.sin6_scope_id = ipv6_get_netif_scope(sock_info->address_str.s);
and it failed:
Apr 23 20:45:12 salmon /usr/bin/sip-proxy[12701]: ERROR: <core> [core/udp_server.c:400]: udp_init(): bind(8, 0x7f88340f6fe4, 28) on FE80:0:0:0:6E29:95FF:FE7D:37E6: Invalid argument
Then I went and tried all these:
addr->sin6.sin6_scope_id = // ipv6_get_netif_scope(sock_info->address_str.s); // ipv6_get_netif_scope("fe80::6e29:95ff:fe7d:37e6"); // ipv6_get_netif_scope("fe80:0:0:0:6e29:95ff:fe7d:37e6"); ipv6_get_netif_scope("fe80::6e29:95ff:fe7d:37e6"); // ipv6_get_netif_scope("FE80::6E29:95FF:FE7D:37E6");
The only version that worked is the one not commented out. So the address needs to be exactly as shown by 'ip addr':
2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 6c:29:95:7d:37:e6 brd ff:ff:ff:ff:ff:ff inet 192.168.43.98/24 brd 192.168.43.255 scope global wlp1s0 valid_lft forever preferred_lft forever inet6 fe80::6e29:95ff:fe7d:37e6/64 scope link valid_lft forever preferred_lft forever
i.e., same case and omitting of zero fields.
It would be better to use the name of the interface (in above wlp1s0) with call if_nametoindex(ifname). Is the name available?
-- Juha
also one example of same IPv6 addresses fe80::1:2:3:4 and fe80::1:02:003:0004
On Tue, Apr 23, 2019 at 9:01 PM Juha Heinanen jh@tutpro.com wrote:
Daniel-Constantin Mierla writes:
Can you try without hard coding the IP address there, but use the value from the listen address? That will show if works properly with the config based values.
I tried like this:
addr->sin6.sin6_scope_id = ipv6_get_netif_scope(sock_info->address_str.s);
and it failed:
Apr 23 20:45:12 salmon /usr/bin/sip-proxy[12701]: ERROR: <core> [core/udp_server.c:400]: udp_init(): bind(8, 0x7f88340f6fe4, 28) on FE80:0:0:0:6E29:95FF:FE7D:37E6: Invalid argument
Then I went and tried all these:
addr->sin6.sin6_scope_id =
// ipv6_get_netif_scope(sock_info->address_str.s); // ipv6_get_netif_scope("fe80::6e29:95ff:fe7d:37e6"); // ipv6_get_netif_scope("fe80:0:0:0:6e29:95ff:fe7d:37e6"); ipv6_get_netif_scope("fe80::6e29:95ff:fe7d:37e6"); // ipv6_get_netif_scope("FE80::6E29:95FF:FE7D:37E6");
The only version that worked is the one not commented out. So the address needs to be exactly as shown by 'ip addr':
2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 6c:29:95:7d:37:e6 brd ff:ff:ff:ff:ff:ff inet 192.168.43.98/24 brd 192.168.43.255 scope global wlp1s0 valid_lft forever preferred_lft forever inet6 fe80::6e29:95ff:fe7d:37e6/64 scope link valid_lft forever preferred_lft forever
i.e., same case and omitting of zero fields.
It would be better to use the name of the interface (in above wlp1s0) with call if_nametoindex(ifname). Is the name available?
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
I pushed a patch to compare ips using parsed structure. Initial version was using string comparison, which is not safe for ipv6, but I was looking for a quick proof of a solution.
The role of this ip comparison is to figure out what is the interface name for which to get scope id. So we get the ifname by walking all of the network interfaces and seeing which one has the respective ip assigned to it.
Can you try and see if now works better?
Cheers, Daniel
On 23.04.19 20:14, Juha Heinanen wrote:
Juha Heinanen writes:
It would be better to use the name of the interface (in above wlp1s0) with call if_nametoindex(ifname). Is the name available?
In baresip ifname is available and I can use the if_nametoindex() call. I don't know where it got the name,
-- Juha
Daniel-Constantin Mierla writes:
I pushed a patch to compare ips using parsed structure. Initial version was using string comparison, which is not safe for ipv6, but I was looking for a quick proof of a solution.
The role of this ip comparison is to figure out what is the interface name for which to get scope id. So we get the ifname by walking all of the network interfaces and seeing which one has the respective ip assigned to it.
Can you try and see if now works better?
Thanks, now this code in udp_server.c works:
} else if (addr->s.sa_family==AF_INET6){ if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_TCLASS, (void*)&optval, sizeof(optval)) ==-1) { LM_WARN("setsockopt v6 tos: %s\n", strerror(errno)); /* continue since this is not critical */ } LM_INFO("Setting scope of %s\n", sock_info->address_str.s); addr->sin6.sin6_scope_id = ipv6_get_netif_scope(sock_info->address_str.s); }
-- Juha
OK, thanks for testing and feedback! Have you also tried for tcp/tls?
Cheers, Daniel
On 24.04.19 13:03, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
I pushed a patch to compare ips using parsed structure. Initial version was using string comparison, which is not safe for ipv6, but I was looking for a quick proof of a solution.
The role of this ip comparison is to figure out what is the interface name for which to get scope id. So we get the ifname by walking all of the network interfaces and seeing which one has the respective ip assigned to it.
Can you try and see if now works better?
Thanks, now this code in udp_server.c works:
} else if (addr->s.sa_family==AF_INET6){ if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_TCLASS, (void*)&optval, sizeof(optval)) ==-1) { LM_WARN("setsockopt v6 tos: %s\n", strerror(errno)); /* continue since this is not critical */ } LM_INFO("Setting scope of %s\n", sock_info->address_str.s); addr->sin6.sin6_scope_id = ipv6_get_netif_scope(sock_info->address_str.s); }
-- Juha
Daniel-Constantin Mierla writes:
OK, thanks for testing and feedback! Have you also tried for tcp/tls?
Yes, with this kind of code in tcp_main.c:
} else if(sock_info->address.af==AF_INET6){ if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_TCLASS, (void*)&optval, sizeof(optval)) ==-1) { LM_WARN("setsockopt v6 tos: %s (%d)\n", strerror(errno), tos); /* continue since this is not critical */ } LM_INFO("Setting scope of %s\n", sock_info->address_str.s); addr->sin6.sin6_scope_id = ipv6_get_netif_scope(sock_info->address_str.s); }
-- Juha
Hello,
can you try with latest master and set the next global parameter?
bind_ipv6_link_local=1
Along with the usual listen on a link local ipv6 address.
Let me know if it works.
Cheers, Daniel
On 24.04.19 16:38, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
OK, thanks for testing and feedback! Have you also tried for tcp/tls?
Yes, with this kind of code in tcp_main.c:
} else if(sock_info->address.af==AF_INET6){ if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_TCLASS, (void*)&optval, sizeof(optval)) ==-1) { LM_WARN("setsockopt v6 tos: %s (%d)\n", strerror(errno), tos); /* continue since this is not critical */ } LM_INFO("Setting scope of %s\n", sock_info->address_str.s); addr->sin6.sin6_scope_id = ipv6_get_netif_scope(sock_info->address_str.s); }
-- Juha
Daniel-Constantin Mierla writes:
can you try with latest master and set the next global parameter?
bind_ipv6_link_local=1
Along with the usual listen on a link local ipv6 address.
Let me know if it works.
It worked at least with UDP. I was not able to test with TCP or TLS. I tried TCP with sipp, but got error:
$ sipp [fe80::6e29:95ff:fe7d:37e6] -p 5050 -m 1 -sf register.sipp -t t1 -i [fe80::6e29:95ff:fe7d:37e6] -p 5050 -m 1
Call-rate(length) Port Total-time Total-calls Remote-host 10.0(0 ms)/1.000s 0 0.00 s 0 fe80::6e29:95ff:fe7d:37e6:5060(TCP) ... 2019-04-30 16:46:12.027044 1556631972.027044: Unable to bind main socket, errno = 22 (Invalid argument).
telnet connects
$ telnet -6 fe80::6e29:95ff:fe7d:37e6%wlp1s0 5060 Trying fe80::6e29:95ff:fe7d:37e6%wlp1s0... Connected to fe80::6e29:95ff:fe7d:37e6%wlp1s0.
so looks like K is properly listening also using tcp.
-- Juha
That because to bind link local address need to define used NIC like
sipp -sn uas -i fe80::b951:ef1f:76c8:e5a2%eth0
On Tue, Apr 30, 2019 at 4:49 PM Juha Heinanen jh@tutpro.com wrote:
Daniel-Constantin Mierla writes:
can you try with latest master and set the next global parameter?
bind_ipv6_link_local=1
Along with the usual listen on a link local ipv6 address.
Let me know if it works.
It worked at least with UDP. I was not able to test with TCP or TLS. I tried TCP with sipp, but got error:
$ sipp [fe80::6e29:95ff:fe7d:37e6] -p 5050 -m 1 -sf register.sipp -t t1 -i [fe80::6e29:95ff:fe7d:37e6] -p 5050 -m 1
Call-rate(length) Port Total-time Total-calls Remote-host 10.0(0 ms)/1.000s 0 0.00 s 0 fe80::6e29:95ff:fe7d:37e6:5060(TCP) ... 2019-04-30 16:46:12.027044 1556631972.027044: Unable to bind main socket, errno = 22 (Invalid argument).
telnet connects
$ telnet -6 fe80::6e29:95ff:fe7d:37e6%wlp1s0 5060 Trying fe80::6e29:95ff:fe7d:37e6%wlp1s0... Connected to fe80::6e29:95ff:fe7d:37e6%wlp1s0.
so looks like K is properly listening also using tcp.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Sergey Safarov writes:
That because to bind link local address need to define used NIC like
sipp -sn uas -i fe80::b951:ef1f:76c8:e5a2%eth0
Yes, this kind of syntax worked:
$ sipp fe80::6e29:95ff:fe7d:37e6%wlp1s0 -p 5050 -m 1 -sf register.sipp -t t1 -i fe80::6e29:95ff:fe7d:37e6%wlp1s0 -p 5050 -m 1
and K reported successful registration.
-- Juha
OK, thanks for testing and feedback.
I thought that maybe we should also add a way to specify the interface name via config, like full specs for listen to be:
listen=proto:ip:port iface xyz advertise ...
'iface' being a reserved token, similar to 'advertise'. In this way we can avoid looping via all interfaces and cope with the case of virtual interfaces sharing same ip (iirc, it was mentioned in one of the messages on this discussion thread).
The parameter bind_ipv6_link_local is still useful, at least for auto_bind_ipv6=1.
Speaking of that, can someone test with both:
auto_bind_ipv6=1
bind_ipv6_link_local=1
And see if kamailio listen on all available IPv6 addresses, including the link local ones?
Cheers, Daniel
On 30.04.19 16:32, Juha Heinanen wrote:
Sergey Safarov writes:
That because to bind link local address need to define used NIC like
sipp -sn uas -i fe80::b951:ef1f:76c8:e5a2%eth0
Yes, this kind of syntax worked:
$ sipp fe80::6e29:95ff:fe7d:37e6%wlp1s0 -p 5050 -m 1 -sf register.sipp -t t1 -i fe80::6e29:95ff:fe7d:37e6%wlp1s0 -p 5050 -m 1
and K reported successful registration.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello Daniel,
Am 30.04.19 um 16:59 schrieb Daniel-Constantin Mierla:
OK, thanks for testing and feedback.
I thought that maybe we should also add a way to specify the interface name via config, like full specs for listen to be:
listen=proto:ip:port iface xyz advertise ...
'iface' being a reserved token, similar to 'advertise'. In this way we can avoid looping via all interfaces and cope with the case of virtual interfaces sharing same ip (iirc, it was mentioned in one of the messages on this discussion thread).
the 'iface' token sounds like a good addition to our cfg language.
Cheers,
Henning
The parameter bind_ipv6_link_local is still useful, at least for auto_bind_ipv6=1.
Speaking of that, can someone test with both:
auto_bind_ipv6=1
bind_ipv6_link_local=1
And see if kamailio listen on all available IPv6 addresses, including the link local ones?
Cheers, Daniel
On 30.04.19 16:32, Juha Heinanen wrote:
Sergey Safarov writes:
That because to bind link local address need to define used NIC like
sipp -sn uas -i fe80::b951:ef1f:76c8:e5a2%eth0
Yes, this kind of syntax worked:
$ sipp fe80::6e29:95ff:fe7d:37e6%wlp1s0 -p 5050 -m 1 -sf register.sipp -t t1 -i fe80::6e29:95ff:fe7d:37e6%wlp1s0 -p 5050 -m 1
and K reported successful registration.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
How it will correlate to listen=proto:ifname:port advertise ...
is possible to parse old behavior, like
listen=proto:[linklocalip%nic]:port advertise ...
On Tue, Apr 30, 2019 at 6:00 PM Daniel-Constantin Mierla miconda@gmail.com wrote:
OK, thanks for testing and feedback.
I thought that maybe we should also add a way to specify the interface name via config, like full specs for listen to be:
listen=proto:ip:port iface xyz advertise ...
'iface' being a reserved token, similar to 'advertise'. In this way we can avoid looping via all interfaces and cope with the case of virtual interfaces sharing same ip (iirc, it was mentioned in one of the messages on this discussion thread).
The parameter bind_ipv6_link_local is still useful, at least for auto_bind_ipv6=1.
Speaking of that, can someone test with both:
auto_bind_ipv6=1
bind_ipv6_link_local=1
And see if kamailio listen on all available IPv6 addresses, including the link local ones?
Cheers, Daniel
On 30.04.19 16:32, Juha Heinanen wrote:
Sergey Safarov writes:
That because to bind link local address need to define used NIC like
sipp -sn uas -i fe80::b951:ef1f:76c8:e5a2%eth0
Yes, this kind of syntax worked:
$ sipp fe80::6e29:95ff:fe7d:37e6%wlp1s0 -p 5050 -m 1 -sf register.sipp
-t t1 -i fe80::6e29:95ff:fe7d:37e6%wlp1s0 -p 5050 -m 1
and K reported successful registration.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@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
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Daniel-Constantin Mierla writes:
Speaking of that, can someone test with both:
auto_bind_ipv6=1
bind_ipv6_link_local=1
And see if kamailio listen on all available IPv6 addresses, including the link local ones?
You mean start K without any listen directives?
I tried and it failed like this:
May 1 09:10:28 host sip-proxy[3810]: 0(3873) INFO: <core> [core/sctp_core.c:74]: sctp_core_check_support(): SCTP API not enabled - if you want to use it, load sctp module May 1 09:10:28 host sip-proxy[3810]: 0(3873) ERROR: <core> [core/socket_info.c:1043]: get_flags(): Interface with index 1 has flags 65609 May 1 09:10:28 host sip-proxy[3810]: 0(3873) ERROR: <core> [core/socket_info.c:1043]: get_flags(): Interface with index 2 has flags 69699 May 1 09:10:28 host sip-proxy[3810]: 0(3873) ERROR: <core> [core/socket_info.c:1043]: get_flags(): Interface with index 1 has flags 65609 May 1 09:10:28 host sip-proxy[3810]: 0(3873) ERROR: <core> [core/socket_info.c:1043]: get_flags(): Interface with index 2 has flags 69699 May 1 09:10:28 host sip-proxy[3810]: 0(3873) ERROR: <core> [core/resolve.h:229]: str2ip(): invalid name, no conversion to IP address possible May 1 09:10:28 host sip-proxy[3810]: 0(3873) ERROR: <core> [core/resolve.h:284]: str2ip6(): invalid name, no conversion to IP address possible May 1 09:10:28 host sip-proxy[3810]: 0(3873) ERROR: <core> [core/socket_info.c:1350]: fix_hostname(): could not resolve root@host:/usr/local# May 1 09:10:28 host sip-proxy[3810]: 0(3873) ERROR: <core> [core/socket_info.c:1910]: fix_all_socket_lists(): fix_socket_list udp failed May 1 09:10:28 host sip-proxy[3810]: failed to initialize list addresses
-- Juha