summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@fingolfin.org>2022-10-22 23:25:41 +0000
committerRobert Mustacchi <rm@fingolfin.org>2022-11-05 19:01:59 +0000
commit0accf5554adfa8ff02c02d58042253bfa597bfa2 (patch)
tree2337b4b1c2347ea834e3c3364f034035e6c53933
parentb18d44ce328fbdf8d8c82ef1763d30b8a46edfde (diff)
downloadillumos-joyent-0accf5554adfa8ff02c02d58042253bfa597bfa2.tar.gz
15114 IP_DONTFRAG more like IP please frag
Reviewed by: Dan McDonald <danmcd@mnx.io> Reviewed by: Ryan Zezeski <ryan@oxide.computer> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/uts/common/inet/ip/ip.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr/src/uts/common/inet/ip/ip.c b/usr/src/uts/common/inet/ip/ip.c
index 0f6ac91ce6..6063fa01d2 100644
--- a/usr/src/uts/common/inet/ip/ip.c
+++ b/usr/src/uts/common/inet/ip/ip.c
@@ -26,6 +26,7 @@
* Copyright (c) 2016 by Delphix. All rights reserved.
* Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
* Copyright 2021 Joyent, Inc.
+ * Copyright 2022 Oxide Computer Company
*/
#include <sys/types.h>
@@ -3750,10 +3751,17 @@ ip_get_pmtu(ip_xmit_attr_t *ixa)
pmtu = IP_MAXPACKET;
/*
- * Decide whether whether IPv4 sets DF
- * For IPv6 "no DF" means to use the 1280 mtu
- */
- if (ixa->ixa_flags & IXAF_PMTU_DISCOVERY) {
+ * We need to determine if it is acceptable to set DF for IPv4 or not
+ * and for IPv6 if we need to use the minimum MTU. If a connection has
+ * opted into path MTU discovery, then we can use 'DF' in IPv4 and do
+ * not have to constrain ourselves to the IPv6 minimum MTU. There is a
+ * second consideration here: IXAF_DONTFRAG. This is set as a result of
+ * someone setting the IP_DONTFRAG or IPV6_DONTFRAG socket option. In
+ * such a case, it is acceptable to set DF for IPv4 and to use a larger
+ * MTU. Note, the actual MTU is constrained by the ill_t later on in
+ * this function.
+ */
+ if (ixa->ixa_flags & (IXAF_PMTU_DISCOVERY | IXAF_DONTFRAG)) {
ixa->ixa_flags |= IXAF_PMTU_IPV4_DF;
} else {
ixa->ixa_flags &= ~IXAF_PMTU_IPV4_DF;