### Description
As per my thread on sr-users: **Active/active keepalived - Kamailio includes non-local
virtual IP in "myself" which breaks DMQ call routing**, I am seeing issues due
to the behavior of `check_self` and more specifically `grep_sock_info`. I have attached a
patch with a proposed new feature that would allow changing this behaviour slightly,
although I've avoided changing any default behaviour.
I have a setup with keepalived in active/active mode, with two virtual IPs. The goal is
that each VIP is active only one one node at a time, but in the event of a failure, both
VIPs would become active on one node.
The issue I am facing is that in order for this to work, I need to have both nodes listen
on both virtual IPs at all times, but this means that both nodes always consider traffic
to those IPs local to themselves, even when that is not the case. This breaks many things,
basically anything with `uri == myself`. But even internally in Kamailio itself, this is
causing problems.
For example: PATH support is broken and this is not easily fixed in the config because
`lookup()` is actually using `check_self()` internally. I am sure there are many other
features which will not work right in the above scenario, and this is why I'm
proposing a change in the code itself, instead of just trying to solve it in the config.
I've attached a patch file with my proposed change and would appreciate any feedback
as to my overall approach. If this seems OK then I will put together a pull request for
your review.
Thanks!
### Expected behavior
Kamailio should detect what IP addresses are currently active locally on it's system
before considering the socket a match. If the IP is not currently there, it should ignore
the match as if it is not currently listening on this IP (because it really is not!)
#### Actual observed behavior
Right now, Kamailio looks blindly at all "listen" sockets and looks for a match,
regardless of if that IP is currently active locally or not, and this causes the false
results of `check_self`
### Possible Solutions
As mentioned, I'm attaching a patch showing my overall approach. Basically:
* I am using pre-existing functions as much as possible for best compatibility e.g. IPv6
and IPv4.
* I use `dns_resolvehost()` which seems to have a caching function built-in and so I am
hoping the performance impact of my change would be negligible.
* My code only makes a change _if_ the virtual flag is set, and if not, existing behaviour
is kept so as to avoid any breaking changes.
[
RT59671-kamailio-add-listen-virtual-check2.patch.txt](https://github.com/ka…
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2984
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/2984(a)github.com>