-
Notifications
You must be signed in to change notification settings - Fork 956
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
Path MTU handling - suggested solution for IPv6 #3119
Comments
It is not a hack, it is in the specs, see https://datatracker.ietf.org/doc/html/rfc3261#section-18.1.1:
If someone wants to implement your suggestions, they are more than welcome, but it should be controlled by a parameter. Should nobody commit to implement this feature request in one month or so, the track item may be closed. |
Thanks for pointing out that part of RFC 3261. I wonder how this this would work with a UDP-registered phone, and an assumption that it will have taken precautions to also be reachable over TCP. Not an issue in IPv4 if you Do Fragment, but possibly breaking for IPv6 reachability. (That's why I reported as a bug, not a feature request.) |
Iirc, TCP is mandatory, but I can say that many phones don't do it. For more details on UDP-To-TCP specs, you may ask on IETF SIP Core group or SIP Implementors mailing lists. I labeled it feature request because it is not a bug in the existing C code per se, but something missing as an implementation. After all there are many IETF RFCs that are not implemented in Kamailio, lack of having them is not a bug, but missing features. We work based on community collaboration, usually who needs a feature implements it and makes PRs to get it merge or helps to implement it (e.g., collaborates with other developers). We also close the feature requests that don't get interest from developers, because the tracker is open for everyone to submit and it will get filled with requests which will make it hard to focus on actual issues after a while. |
Fair enough. I will do what I can to help, but may not collect the confidence to do this in Kamailio, at least not without backup from a core developer. I have started some tooling to measure these problems, available here.
I will continue to do these experiments outside of Kamailio, to avoid its complexity. If this works, it is most likely after integration with immediate resends. |
I have been exploring the code to find a place to send with a lower MTU than the MRU for a socket. That is probably more efficient than learning about Path MTU on every sending attempt. Feedback welcomed! I think an extension to My work now is to construct dual sockets, set different MTUs and see this idea work. I will do that in the MTU games repo. Notes:
|
@vanrein: tanks for tackling this one further! I am rather busy these days and I am not sure if any other developer wants to look deeper in it. My suggestion is to make a pull request with the changes you would consider to do, ideally controlling the new behaviour with a parameter. It might be easier to understand what changes are proposed, review them and merge if all ok. |
I got one thing wrong, and that saves bundles of work. Here's from experimental code,
I'm documenting it here, so that the knowledge is not lost on the project. This is difficult stuff. It would seem that Path MTU discovery is not maintained per socket (which would benefit locality and proper cleanup of the knowledge) but as a global kernel property for the route (which benefits reuse of the knowledge, IWO a useful form of caching). Conclusions for Kamailio on IPv6
Perfection for Kamailio over IPv6
|
- For IPv4, DF is an option; for IPv6 it is always active - This makes pmtu_discover an IPv4-only option - This means that we should set IPV6_MTU_DISCOVER to IPV6_PMTUDISC_WANT - Unconnected UDP sockets can now learn from ICMPv6 "Packet too Big" - As a result, hitting a Path MTU upper bound is a learning process - This should stop consistent SIP packet drops due to Path MTU
- For IPv4, DF is an option; for IPv6 it is always active - This makes pmtu_discover an IPv4-only option - This means that we should set IPV6_MTU_DISCOVER to IPV6_PMTUDISC_WANT - Unconnected UDP sockets can now learn from ICMPv6 "Packet too Big" - As a result, hitting a Path MTU upper bound is a learning process - This should stop consistent SIP packet drops due to Path MTU
@vanrein the PR was merged, so I think there should be a good improvement for IPv6 now available in the upcoming version. Is there anything else that you want to consider in this feature request? |
Probably this should be closed, if there is anything new to be discussed/added, a new item can be created. |
It looks like the And yes, I will close it now. |
Description
Larger SIP frames get dropped when sent over UDP and IPv6. The sending side has MTU 1500 and the receiving side has MTU 1492. This is an IPv6-only setup, so this is problematic. Also, pulling down the MTU of a general server for a tunneled peer would smear like an oil stain. The suggestion to fallback on TCP feels like a hack.
Troubleshooting
Reproduction
Send a SIP message to a network interface with a lower MTU than the submitted frame size.
Debugging Data
None, transmission works fine.
Log Messages
None, transmission works fine.
SIP Traffic
Irrelevant.
Code Investigation
I explored the Kamailio source code for MTU handling.
kamailio/src/core/udp_server.c
Lines 340 to 349 in 81265e4
IPV6_MTU_DISCOVER
kamailio/src/core/udp_server.c
Lines 331 to 339 in 81265e4
IPV6_RECVERR
recvmsg()
with a flagMSG_ERRQUEUE
, which is not used in Kamailiorecvmsg()
holds data to cleverly handle ICMP or ICMPv6 responsesPossible Solutions
I have been thinking about ways to lower MTU values only for some peers.
Using connected sockets might work, possibly as an alternative when Path MTU problems arise. It might not scale however.
Every socket could have an extra sending socket set to a lower MTU. The use of
SO_REUSEADDR
seems to allow for that.Before falling back on an extra socket, the desired MTU could be set. Alternatively, as for IPv6, an MTU of 1280 might be considered in many cases:
Additional Information
(I don't suppose it matters, this code has been around for ages. I used permalinks for stable reference).
The text was updated successfully, but these errors were encountered: