Date: Fri, 24 Sep 2021 08:28:30 GMT From: Wojciech Macek <wma@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 4f3376951d70 - main - ipsec: Add PMTUD support for IPsec IPv4 over IPv6 tunnel Message-ID: <202109240828.18O8SU4l075240@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=4f3376951d7024d1c3446af2260cef9e4d3404a6 commit 4f3376951d7024d1c3446af2260cef9e4d3404a6 Author: Bartlomiej Grzesik <bag@semihalf.com> AuthorDate: 2021-09-24 08:17:11 +0000 Commit: Wojciech Macek <wma@FreeBSD.org> CommitDate: 2021-09-24 08:17:11 +0000 ipsec: Add PMTUD support for IPsec IPv4 over IPv6 tunnel Add support for checking PMTU for IPv4 packets encapsulated in IPv6 tunnels. Differential revision: https://reviews.freebsd.org/D31769 Sponsored by: Stormshield Obtained from: Semihalf --- sys/netipsec/ipsec_output.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 2f8cc12c526b..50bbd72f0589 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -305,7 +305,6 @@ ipsec4_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) uint32_t idx; int error; - /* Don't check PMTU if the frame won't have DF bit set. */ if (!V_ip4_ipsec_dfbit) return (0); @@ -335,15 +334,22 @@ setdf: } dst = &sav->sah->saidx.dst; - - /* Final header is not ipv4. */ - if (dst->sa.sa_family != AF_INET) { + memset(&inc, 0, sizeof(inc)); + switch (dst->sa.sa_family) { + case AF_INET: + inc.inc_faddr = satosin(&dst->sa)->sin_addr; + break; +#ifdef INET6 + case AF_INET6: + inc.inc6_faddr = satosin6(&dst->sa)->sin6_addr; + inc.inc_flags |= INC_ISIPV6; + break; +#endif + default: key_freesav(&sav); return (0); } - memset(&inc, 0, sizeof(inc)); - inc.inc_faddr = satosin(&dst->sa)->sin_addr; key_freesav(&sav); pmtu = tcp_hc_getmtu(&inc); /* No entry in hostcache. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109240828.18O8SU4l075240>