#### Type Of Change - [x] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: - [x] PR should be backported to stable branches - [x] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
Without the first commit, on my setup - which has lots of interfaces with lots of addresses - auto_bind_ipv6 will make kamailio stuck on startup. It actually happens in get_flags, where data sent back from kernel can't fit into 8K anymore.
Second commit is fixing obvious typo while we're at it. You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2595
-- Commit Summary --
* core: work around interface enum buffer overrun * core: fix unused argument in socket_info.c:get_flags
-- File Changes --
M src/core/socket_info.c (21)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2595.patch https://github.com/kamailio/kamailio/pull/2595.diff
Is this fix this issue too? https://github.com/kamailio/kamailio/issues/2404#issuecomment-661060298
when used ``` bind_ipv6_link_local=0 ```
Is this fix this issue too? [#2404 (comment)](https://github.com/kamailio/kamailio/issues/2404#issuecomment-661060298)
when used
bind_ipv6_link_local=0
I am not sure. The whole identification code is too convoluted for a casual analysis. If you can apply and test, we'll get the answer back.
As I said, this whole part will benefit from a rewrite. It'll be smaller, easier to analyze, more efficient and less error prone - for example, right now it's performing almost the same exchange with netlink twice and it can't handle dropped netlink messages.
@miconda commented on this pull request.
@@ -1184,6 +1189,16 @@ static int build_iface_list(void)
nll = 0; p = buf; while(1) { + // This (and the loop above in get_flags) is + // broken in more than one aspect. For example, + // if a receive is shorter than nlmsghdr, + // nlp->nlmsg_type will point at garbage. + // Proper fix for this (and static buffer sizing + // problem) would be to use libnl.
This comment does not belong in the source code.
If there is still any issue left after this commit, then report it in the issue tracker. The developers do not scan the code for comments pointing at possible issues.
@theraphim pushed 2 commits.
d2fd204b0ae35512a04702e480bb0d16878e98be core: work around interface enum buffer overrun 42f7702430c312b2c9caea8f617af4e3719ef12f core: fix unused argument in socket_info.c:get_flags
@theraphim commented on this pull request.
@@ -1184,6 +1189,16 @@ static int build_iface_list(void)
nll = 0; p = buf; while(1) { + // This (and the loop above in get_flags) is + // broken in more than one aspect. For example, + // if a receive is shorter than nlmsghdr, + // nlp->nlmsg_type will point at garbage. + // Proper fix for this (and static buffer sizing + // problem) would be to use libnl.
Removed.
Thanks! I am going to merge it.
Related to the comment, at a quick look, `libnl` seems to be linux specific, not usable on macos or *bsds. Anyhow, as I said, if something still needs to be fixed/tuned, report on issue tracker.
Merged #2595 into master.