Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport interface: force socket binding to network interface #217

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pdepaulis
Copy link

@pdepaulis pdepaulis commented May 17, 2023

Address an issue seen in openWRT 22 (kernel 5.10) whereas the transport socket would not properly bind to an interface, almost at random, in a multi-homed system with a failover SIP profile.
This caused the Sofia failover profile to bind to the primary interface, and thus the failover to still attempting to use the primary interface on a failover.
By forcing the socket to bind to the interface explicitly (SO_BINDTODEVICE), the proper interface binding is achieved.
Resolves #218

@seven1240
Copy link
Contributor

seems SO_BINDTODEVICE only works on Linux so need to make sure it doesn't break Windows or macOS etc.

Also, maybe make it optional and only enable it if some option is set?

@pdepaulis
Copy link
Author

@seven1240 et. al. I'm trying to figure out where Sofia transport options go so I can add one as you suggested in your previous comment.

@freeswitch-ci-system
Copy link

@pdepaulis
Copy link
Author

I now added a tp_params tag tpp_socket_bind_ifc (Linux only), that is used in the tport_xyz_init_primary() via TPTAG_SOCKET_BIND_IFC to optionally apply this (default is zero (0) so N/A by default).
So, basically, to eliminate any risk for most users, as this is written, there is no change in socket-binding behavior. One can then change the default parameter value for tpp_socket_bind_ifc to one (1) if need be. In the future this behavior could be controlled via same in mod_sofia and passed in nua_create(), but that hasn't yet been implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transport interface: socket binding to wrong network interface at random
2 participants