[Openvpn-devel,2/2] Log a note if someone wants to set a MTU below 1280 on IPv6

Message ID 20200629190930.1360-2-cschenk@mail.uni-paderborn.de
State Accepted
Headers show
Series [Openvpn-devel,1/2] Unified success messages for setting mtu | expand

Commit Message

Christopher Schenk June 29, 2020, 9:09 a.m. UTC
---
 src/openvpn/tun.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Gert Doering June 29, 2020, 9:33 p.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Stared-at-code, looks good. Test build on ubuntu/mingw, passes.

I have not actually tested that it prints the warnings when expected, 
but the code looks good and the change is simple enough :-)

Your patch has been applied to the master branch.

commit 93439307e597007e0d60b904c0f3d9d85de26b49
Author: Christopher Schenk
Date:   Mon Jun 29 21:09:30 2020 +0200

     Log a note if someone wants to set a MTU below 1280 on IPv6

     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20200629190930.1360-2-cschenk@mail.uni-paderborn.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20161.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 3ef79b2f..67d7664e 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -238,6 +238,10 @@  do_set_mtu_service(const struct tuntap *tt, const short family, const int mtu)
         .family = family
     };
     strncpynt(mtu_msg.iface.name, tt->actual_name, sizeof(mtu_msg.iface.name));
+    if (family == AF_INET6 && mtu < 1280)
+    {
+        msg(M_INFO, "NOTE: IPv6 interface MTU < 1280 conflicts with IETF standards and might not work");
+    }
 
     if (!send_msg_iservice(pipe, &mtu_msg, sizeof(mtu_msg), &ack, "Set_mtu"))
     {
@@ -5498,6 +5502,11 @@  windows_set_mtu(const int iface_index, const short family,
     const char *family_name = (family == AF_INET6) ? "IPv6" : "IPv4";
     ipiface.Family = family;
     ipiface.InterfaceIndex = iface_index;
+    if (family == AF_INET6 && mtu < 1280)
+    {
+        msg(M_INFO, "NOTE: IPv6 interface MTU < 1280 conflicts with IETF standards and might not work");
+    }
+
     err = GetIpInterfaceEntry(&ipiface);
     if (err == NO_ERROR)
     {