#### Pre-Submission Checklist
- [X] Commit message has the format required by CONTRIBUTING guide
- [X] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [X] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [X] Small bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [ ] PR should be backported to stable branches (no, it is a requirement to use UDP/IPv6 with everyone)
- [X] Tested changes locally (same results as before with the Kamailio test framework)
- [ ] Related to issue #3119
#### Description
The IPv6 support for Path MTU discovery is absent, but IPv6 has no DF flag to allow downstream fragmentation. See Issue #3119 for my discovery / learning path. In short, unconnected UDP sockets do not learn Path MTU problems, so a message dropped once will be dropped again on resend. Using `IPV6_PMTUDISC_WANT`, any knowledge in the kernel can be used to fragment the message at sending time, as intended for IPv6.
These patches actually correct two IPv6-related things in the `core/udp_server.c`,
1. Benefit from any kernel knowledge about Path MTU for IPv6
2. The same option to learn from UDP_ERRORS is now available for IPv6
Do note that the last has not been implemented for IPv4 or IPv6. It is more useful for IPv6, allowing instant "tm" resends for Path MTU, but not "sl" I think. I cannot do that work, but this brings IPv6 to the same level as IPv4.
```
commit 0f90cff05c1a448eb2f85f83b4c087ab32ede11
Author: Rick van Rein <rick(a)openfortress.nl>
Date: Sat Jun 11 10:57:32 2022 +0000
core: Issue 3119. Handling ICMPv6 Packet too Big
- This was only defined for IPv4 under flag UDP_ERRORS
- IPv6 has no toggle DF to clear for en-route fragmentation
- Kamailio currently does not collect with recvmsg(...,MSG_ERRQUEUE)
- The benefits of adding that can be instant resends for "tm" messages
- Note that "sl" messages will have been forgotten at this point
commit 6b404b5f9807174177bee36eaf3543be0794f55e
Author: Rick van Rein <rick(a)openfortress.nl>
Date: Sat Jun 11 10:44:27 2022 +0000
core: Issue #3119. Path MTU kernel info for 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
```
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3141
-- Commit Summary --
* core: Issue #3119. Path MTU kernel info for IPv6
* core: Issue 3119. Handling ICMPv6 Packet too Big
-- File Changes --
M doc/misc/NEWS (2)
M src/core/udp_server.c (44)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3141.patchhttps://github.com/kamailio/kamailio/pull/3141.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3141
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3141(a)github.com>
Module: kamailio
Branch: master
Commit: a022dbd6b30d8301053950756cd30a2b478433e0
URL: https://github.com/kamailio/kamailio/commit/a022dbd6b30d8301053950756cd30a2…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2022-08-21T12:38:16Z
core: add pmtu_discovery=2 for IPv4 and IPv6 - set IP_PMTUDISC_WANT/IPV6_PMTUDISC_WANT (GH #3141)
- add pmtu_discovery=2 for IPv4 and IPv6 - set IP_PMTUDISC_WANT/IPV6_PMTUDISC_WANT
- related to GH #3141
- for IPv4: will fragment a datagram if needed according to the path MTU,
or will set the don't-fragment flag otherwise
- for IPv6: will fragment a datagram if needed according to the path MTU for IPv6
---
Modified: src/core/udp_server.c
---
Diff: https://github.com/kamailio/kamailio/commit/a022dbd6b30d8301053950756cd30a2…
Patch: https://github.com/kamailio/kamailio/commit/a022dbd6b30d8301053950756cd30a2…
---
diff --git a/src/core/udp_server.c b/src/core/udp_server.c
index 7c501f0dab..3edf485199 100644
--- a/src/core/udp_server.c
+++ b/src/core/udp_server.c
@@ -349,9 +349,19 @@ int udp_init(struct socket_info* sock_info)
#endif
#if defined (__OS_linux)
if (addr->s.sa_family==AF_INET){
- /* If pmtu_discovery=1 then set DF bit and do Path MTU discovery
- * disabled by default. Specific to IPv4. */
- optval= (pmtu_discovery) ? IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
+ /* If pmtu_discovery=1 then set DF bit and do Path MTU discovery,
+ * disabled by default. Specific to IPv4. If pmtu_discovery=2
+ * then the datagram will be fragmented if needed according to
+ * path MTU, or will set the don't-fragment flag otherwise */
+ switch (pmtu_discovery) {
+ case 1: optval=IP_PMTUDISC_DO;
+ break;
+ case 2: optval=IP_PMTUDISC_WANT;
+ break;
+ case 0:
+ default: optval=IP_PMTUDISC_DONT;
+ break;
+ }
if(setsockopt(sock_info->socket, IPPROTO_IP, IP_MTU_DISCOVER,
(void*)&optval, sizeof(optval)) ==-1){
LM_ERR("IPv4 setsockopt: %s\n", strerror(errno));
@@ -359,9 +369,19 @@ int udp_init(struct socket_info* sock_info)
}
} else if (addr->s.sa_family==AF_INET6){
/* IPv6 never fragments but sends ICMPv6 Packet too Big,
- * If pmtu_discovery=1 then set DF bit and do Path MTU discovery
- * disabled by default. Specific to IPv6. */
- optval= (pmtu_discovery) ? IPV6_PMTUDISC_DO : IPV6_PMTUDISC_DONT;
+ * If pmtu_discovery=1 then set DF bit and do Path MTU discovery,
+ * disabled by default. Specific to IPv6. If pmtu_discovery=2
+ * then the datagram will be fragmented if needed according to
+ * path MTU */
+ switch (pmtu_discovery) {
+ case 1: optval=IPV6_PMTUDISC_DO;
+ break;
+ case 2: optval=IPV6_PMTUDISC_WANT;
+ break;
+ case 0:
+ default: optval=IPV6_PMTUDISC_DONT;
+ break;
+ }
if(setsockopt(sock_info->socket, IPPROTO_IPV6,
IPV6_MTU_DISCOVER,
(void*)&optval, sizeof(optval)) ==-1){
Module: kamailio
Branch: master
Commit: 24cfce96a1e9e970ab7661a4e188dab2b3542fd0
URL: https://github.com/kamailio/kamailio/commit/24cfce96a1e9e970ab7661a4e188dab…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2022-08-19T14:02:16Z
tm: improve comment related to dns failover, add debug output in this case
---
Modified: src/modules/tm/timer.c
---
Diff: https://github.com/kamailio/kamailio/commit/24cfce96a1e9e970ab7661a4e188dab…
Patch: https://github.com/kamailio/kamailio/commit/24cfce96a1e9e970ab7661a4e188dab…
---
diff --git a/src/modules/tm/timer.c b/src/modules/tm/timer.c
index 4c821ba871..8437b4ed40 100644
--- a/src/modules/tm/timer.c
+++ b/src/modules/tm/timer.c
@@ -442,12 +442,14 @@ inline static void final_response_handler(
BLST_ERR_TIMEOUT, &r_buf->dst, r_buf->my_T->uas.request);
#endif
#ifdef USE_DNS_FAILOVER
- /* if this is an invite, the destination resolves to more ips, and
- * it still hasn't passed more than fr_inv_timeout since we
- * started, add another branch/uac */
+ /* if this is an request, the destination resolves to more IPs, and
+ * it still hasn't passed more than max_inv_lifetime or
+ * max_noninv_lifetimesince we started, add another branch/uac */
if(cfg_get(core, core_cfg, use_dns_failover)) {
now = get_ticks_raw();
if((s_ticks_t)(t->end_of_life - now) > 0) {
+ LM_DBG("send on branch %d failed, adding another branch\n",
+ r_buf->branch);
branch_ret = add_uac_dns_fallback(
t, t->uas.request, &t->uac[r_buf->branch], 0);
prev_branch = -1;
Module: kamailio
Branch: master
Commit: d6b1c20d3ad94d9136cf247e67b7fc0d32b18d3b
URL: https://github.com/kamailio/kamailio/commit/d6b1c20d3ad94d9136cf247e67b7fc0…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2022-08-09T14:11:59Z
tm: restore X/AVP values from initial transaction in DNS failover processing
- restore X/AVP values from initial transaction in DNS failover processing
- the X/AVP context gets lost, so we need to re-create it from the transaction
- otherwise modules that depends on the X/AVPs, e.g. topology hiding will not work
- tested with one load-balancer and two proxy servers
---
Modified: src/modules/tm/t_fwd.c
---
Diff: https://github.com/kamailio/kamailio/commit/d6b1c20d3ad94d9136cf247e67b7fc0…
Patch: https://github.com/kamailio/kamailio/commit/d6b1c20d3ad94d9136cf247e67b7fc0…
---
diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
index fbcf1b3e02..6b26f28f6a 100644
--- a/src/modules/tm/t_fwd.c
+++ b/src/modules/tm/t_fwd.c
@@ -1042,6 +1042,8 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
t->uac[t->nr_of_outgoings].on_branch_failure = old_uac->on_branch_failure;
/* copy branch flags */
t->uac[t->nr_of_outgoings].branch_flags = old_uac->branch_flags;
+ /* restore X/AVP values from initial transaction */
+ tm_xdata_swap(t, 0, 0);
if (cfg_get(tm, tm_cfg, reparse_on_dns_failover)){
/* Reuse the old buffer and only replace the via header.