plaisthos has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/1708?usp=email )
Change subject: Ensure pushed tun-mtu is no lower than TUN_MTU_MIN ...................................................................... Ensure pushed tun-mtu is no lower than TUN_MTU_MIN The normal path ensure that the minimum tun mtu is set to at least TUN_MTU_MIN. However, the pushed options path does not have this restriction. Check that the tun-mtu is within the limits of min/max mtu in options.c. This ensure that the check is also correctly done on the pushed variant. Also add an extra check to keep the allowed payload for icmp6 packets to be at least 64 bytes in the the block-ipv6 code path (ipv6_send_icmp_unreachable) as extra layer of defence. Pushing a low mtu like 1 and also block-ipv6 could trigger an assertion in the ipv6_send_icmp_unreachable code path. Reported-By: Haiyang Huang <[email protected]> Change-Id: Iff8b336126a5dff9871213664b1e8585fb70d21e --- M src/openvpn/forward.c M src/openvpn/mtu.h M src/openvpn/options.c 3 files changed, 16 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/08/1708/1 diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index e43ce28..2255951 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1610,6 +1610,8 @@ */ int max_payload_size = min_int(MAX_ICMPV6LEN, c->c2.frame.tun_mtu - icmpheader_len); + /* Ensure that minimum payload size is at least 64 bytes as extra safety layer */ + max_payload_size = max_int(max_payload_size, 64); int payload_len = min_int(max_payload_size, BLEN(&inputipbuf)); pip6out.payload_len = htons(sizeof(struct openvpn_icmp6hdr) + payload_len); diff --git a/src/openvpn/mtu.h b/src/openvpn/mtu.h index d3df5b2..70ec43d 100644 --- a/src/openvpn/mtu.h +++ b/src/openvpn/mtu.h @@ -69,6 +69,11 @@ */ #define TUN_MTU_DEFAULT 1500 +/** + * Maximum MTU we accept for MTU related options + */ +#define TUN_MTU_MAX 65536 + /* * MTU Defaults for TAP devices */ diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 044aab3..ea640da 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -6552,7 +6552,15 @@ else if (streq(p[0], "tun-mtu") && p[1] && !p[3]) { VERIFY_PERMISSION(OPT_P_PUSH_MTU|OPT_P_CONNECTION); - options->ce.tun_mtu = positive_atoi(p[1]); + int mtu = positive_atoi(p[1]); + if (mtu < TUN_MTU_MIN || mtu > TUN_MTU_MAX) + { + msg(msglevel, "--mtu parm must be between %d and %d.", TUN_MTU_MIN, + TUN_MTU_MAX); + goto err; + } + + options->ce.tun_mtu = mtu; options->ce.tun_mtu_defined = true; if (p[2]) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1708?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: Iff8b336126a5dff9871213664b1e8585fb70d21e Gerrit-Change-Number: 1708 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos <[email protected]> Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
