<!-- Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio....
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.or...
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
Note that an issue report may be closed automatically after about 2 months if there is no interest from developers or community users on pursuing it, being considered expired. In such case, it can be reopened by writing a comment that includes the token `/notexpired`. About two weeks before considered expired, the issue is marked with the label `stale`, trying to notify the submitter and everyone else that might be interested in it. To remove the label `stale`, write a comment that includes the token `/notstale`. Also, any comment postpone the `expire` timeline, being considered that there is interest in pursuing the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment). -->
### Description
When `auto_bind_ipv6` is enabled on a system without ipv6, kamailio starts, enumerates all interfaces but does not perform no listening at all. In addition, no errors are reported, see below from final part of boot log, no other infos are logged.
While this can be worked around by putting that config value behind a definition and autodetection by an external script, should not it work and just start on ipv4 if ipv6 is not available?
### Troubleshooting
#### Reproduction
<!-- If the issue can be reproduced, describe how it can be done. -->
Just start Kam as root, with no `listen` directives (to let it listen on all ipv4) and `auto_bind_ipv6` set to 1.
#### Log Messages
<!-- Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site). -->
``` 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: lo Fam: 2 Flg: 10049 Adr: 127.0.0.1 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: enp81s0u1u4 Fam: 2 Flg: 11043 Adr: 192.168.1.222 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: wlp0s20f3 Fam: 2 Flg: 11043 Adr: 192.168.1.196 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: br-65b842ff8266 Fam: 2 Flg: 1003 Adr: 192.168.49.1 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: br-kamnet Fam: 2 Flg: 11043 Adr: 172.23.42.1 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: br-f1829eb65bac Fam: 2 Flg: 1003 Adr: 172.18.0.1 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: br-f521fee918b4 Fam: 2 Flg: 1003 Adr: 172.19.0.1 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: docker0 Fam: 2 Flg: 1003 Adr: 172.17.0.1 0(1) DEBUG: <core> [core/socket_info.c:1507]: build_iface_list(): received 728 byles 0(1) DEBUG: <core> [core/socket_info.c:1507]: build_iface_list(): received 20 byles 0(1) DEBUG: <core> [core/socket_info.c:1510]: build_iface_list(): done receiving netlink info 0(1) DEBUG: <core> [core/socket_info.c:1542]: build_iface_list(): trying network interface index: 1 (n: 0) 0(1) DEBUG: <core> [core/socket_info.c:1559]: build_iface_list(): iface <IFA_ADDRESS> address is '127.0.0.1' 0(1) DEBUG: <core> [core/socket_info.c:1569]: build_iface_list(): iface <IFA_LOCAL> address is '127.0.0.1' 0(1) DEBUG: <core> [core/socket_info.c:1573]: build_iface_list(): iface name is lo 0(1) DEBUG: <core> [core/socket_info.c:1542]: build_iface_list(): trying network interface index: 3 (n: 1) 0(1) DEBUG: <core> [core/socket_info.c:1559]: build_iface_list(): iface <IFA_ADDRESS> address is '192.168.1.222' 0(1) DEBUG: <core> [core/socket_info.c:1569]: build_iface_list(): iface <IFA_LOCAL> address is '192.168.1.222' 0(1) DEBUG: <core> [core/socket_info.c:1573]: build_iface_list(): iface name is enp81s0u1u4 0(1) DEBUG: <core> [core/socket_info.c:1542]: build_iface_list(): trying network interface index: 4 (n: 2) 0(1) DEBUG: <core> [core/socket_info.c:1559]: build_iface_list(): iface <IFA_ADDRESS> address is '192.168.1.196' 0(1) DEBUG: <core> [core/socket_info.c:1569]: build_iface_list(): iface <IFA_LOCAL> address is '192.168.1.196' 0(1) DEBUG: <core> [core/socket_info.c:1573]: build_iface_list(): iface name is wlp0s20f3 0(1) DEBUG: <core> [core/socket_info.c:1542]: build_iface_list(): trying network interface index: 5 (n: 3) 0(1) DEBUG: <core> [core/socket_info.c:1559]: build_iface_list(): iface <IFA_ADDRESS> address is '192.168.49.1' 0(1) DEBUG: <core> [core/socket_info.c:1569]: build_iface_list(): iface <IFA_LOCAL> address is '192.168.49.1' 0(1) DEBUG: <core> [core/socket_info.c:1573]: build_iface_list(): iface name is br-65b842ff8266 0(1) DEBUG: <core> [core/socket_info.c:1542]: build_iface_list(): trying network interface index: 6 (n: 4) 0(1) DEBUG: <core> [core/socket_info.c:1559]: build_iface_list(): iface <IFA_ADDRESS> address is '172.23.42.1' 0(1) DEBUG: <core> [core/socket_info.c:1569]: build_iface_list(): iface <IFA_LOCAL> address is '172.23.42.1' 0(1) DEBUG: <core> [core/socket_info.c:1573]: build_iface_list(): iface name is br-kamnet 0(1) DEBUG: <core> [core/socket_info.c:1542]: build_iface_list(): trying network interface index: 7 (n: 5) 0(1) DEBUG: <core> [core/socket_info.c:1559]: build_iface_list(): iface <IFA_ADDRESS> address is '172.18.0.1' 0(1) DEBUG: <core> [core/socket_info.c:1569]: build_iface_list(): iface <IFA_LOCAL> address is '172.18.0.1' 0(1) DEBUG: <core> [core/socket_info.c:1573]: build_iface_list(): iface name is br-f1829eb65bac 0(1) DEBUG: <core> [core/socket_info.c:1542]: build_iface_list(): trying network interface index: 8 (n: 6) 0(1) DEBUG: <core> [core/socket_info.c:1559]: build_iface_list(): iface <IFA_ADDRESS> address is '172.19.0.1' 0(1) DEBUG: <core> [core/socket_info.c:1569]: build_iface_list(): iface <IFA_LOCAL> address is '172.19.0.1' 0(1) DEBUG: <core> [core/socket_info.c:1573]: build_iface_list(): iface name is br-f521fee918b4 0(1) DEBUG: <core> [core/socket_info.c:1542]: build_iface_list(): trying network interface index: 9 (n: 7) 0(1) DEBUG: <core> [core/socket_info.c:1559]: build_iface_list(): iface <IFA_ADDRESS> address is '172.17.0.1' 0(1) DEBUG: <core> [core/socket_info.c:1569]: build_iface_list(): iface <IFA_LOCAL> address is '172.17.0.1' 0(1) DEBUG: <core> [core/socket_info.c:1573]: build_iface_list(): iface name is docker0 0(1) DEBUG: <core> [core/socket_info.c:1507]: build_iface_list(): received 1740 byles ```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` head of 5.8 branch as of today ```
* **Operating System**:
<!-- Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...; Kernel details (output of `lsb_release -a` and `uname -a`) -->
``` ubuntu noble (in a docker container) ```
a very minimal config that exposes the issue: ``` #!KAMAILIO debug=3 log_stderror=yes fork=yes
auto_bind_ipv6=1
request_route { exit; } ```
Seems a container-related stuff. Even on podman. Running the same on a standard machine w/o ipv6 enabled work as expected, even with the `auto_bind_ipv6` flag on.
What happens is that the netlink message `RTM_GETADDR` with AF_INET6 type get sent correctly, but kamailio is stuck on waiting (in socket_info.c). A quick test shows that enabling the non blocking flag on the netlink socket, the `recv` on the above message will fail with `EWOULDBLOCK` (but not on AF_INET type)
Now, I'm not an expert on such matter and right now don't know what is the best approach :thinking:
Thanks for the report. The easiest approach is probably to just document it in the cookbook that it don't work on container environments without IPv6. The auto_bind_ipv6 is not enabled by default.
Yup, in background I'm trying to understand, because a minimal program that do a similar thing using a netlink socket message/receive on af_inet6 works, so something is happening there.
Can you try with latest git master branch? I pushed a commit to timeout if nothing is received from netlink socket in 4sec.
Tried,
seems to work (progress after the 4sec timeout), but bind on localhost does not happen (127.0.0.1) with the example config above. If `auto_bind_ipv6` is removed or set to `0` kam listens to all ips, even looopback ones.
Not a real issue, but maybe it should work?
I tried to simulate a no-ipv6 system by running docker with `--sysctl net.ipv6.conf.all.disable_ipv6=1`, it waits 4sec for the timeout, then goes on and it listens on 127.0.0.1 (printed in the logs, sockets list, and I tested also sending a message with sipsak). It might be something specific to your environment.
In my case, I'm not actively disabling ipv6 on docker, but just leaving the param on the config set, regardless on how it configured docker.
On Mon, Jan 20, 2025 at 3:57 PM Daniel-Constantin Mierla < ***@***.***> wrote:
I tried to simulate a no-ipv6 system by running docker with --sysctl net.ipv6.conf.all.disable_ipv6=1, it waits 4sec for the timeout, then goes on and it listens on 127.0.0.1 (printed in the logs, sockets list, and I tested also sending a message with sipsak). It might be something specific to your environment.
— Reply to this email directly, view it on GitHub https://github.com/kamailio/kamailio/issues/4098#issuecomment-2602637302, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQKXMHRX45W57MHVK343T2LUFG7AVCNFSM6AAAAABUXPJAFWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBSGYZTOMZQGI . You are receiving this because you authored the thread.Message ID: ***@***.***>