aboutsummaryrefslogtreecommitdiff
path: root/src/openvpn/socket.c
diff options
context:
space:
mode:
authorArne Schwabe2022-01-01 17:25:22 +0100
committerGert Doering2022-02-02 14:26:24 +0100
commita63a727b020ef42c475bd861b960200686359b2d (patch)
tree810405bc0b3031f09d36bc271e9c53aca5aa01fe /src/openvpn/socket.c
parent65a21eb14f4afd80864e88ff425f5d9ef8d8fdec (diff)
downloadopenvpn-a63a727b020ef42c475bd861b960200686359b2d.zip
openvpn-a63a727b020ef42c475bd861b960200686359b2d.tar.gz
Fix datagram_overhead and assorted functions
This function is supposed to calculate the overhead of the protocol header (IP/IPv6 + TCP/UDP). But at some point the index that used to index the array proto_overhead and the associated PROTO_N went completely out of sync. This fixed the function and related caller to again calculate the overhead as intended. Note that IPv6 mapped IPv4 addresses still have the wrong overhead calculated as they treated are as IPv6 addresses (0:0:0:0:0:ffff::/96) Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Frank Lichtenheld <frank@lichtenheld.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20220101162532.2251835-5-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23504.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/socket.c')
-rw-r--r--src/openvpn/socket.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index ab0f547..45541c1 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -44,17 +44,6 @@
#include "memdbg.h"
-const int proto_overhead[] = { /* indexed by PROTO_x */
- 0,
- IPv4_UDP_HEADER_SIZE, /* IPv4 */
- IPv4_TCP_HEADER_SIZE,
- IPv4_TCP_HEADER_SIZE,
- IPv6_UDP_HEADER_SIZE, /* IPv6 */
- IPv6_TCP_HEADER_SIZE,
- IPv6_TCP_HEADER_SIZE,
- IPv6_TCP_HEADER_SIZE,
-};
-
/*
* Convert sockflags/getaddr_flags into getaddr_flags
*/
@@ -1660,9 +1649,10 @@ socket_frame_init(const struct frame *frame, struct link_socket *sock)
* to us by the OS.
*/
void
-frame_adjust_path_mtu(struct frame *frame, int pmtu, int proto)
+frame_adjust_path_mtu(struct frame *frame, int pmtu, sa_family_t af, int proto)
{
- frame_set_mtu_dynamic(frame, pmtu - datagram_overhead(proto), SET_MTU_UPPER_BOUND);
+ frame_set_mtu_dynamic(frame, pmtu - datagram_overhead(af, proto),
+ SET_MTU_UPPER_BOUND);
}
static void