From fe76216194cd4f69206f71e8ca823c40787ac3f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Mon, 12 May 2014 19:40:08 -0400 Subject: [PATCH] agent: Use 1280 instead of 65536 buffer size to send STUN Message RFC 5389 says: All STUN messages sent over UDP SHOULD be less than the path MTU, if known. If the path MTU is unknown, messages SHOULD be the smaller of 576 bytes and the first-hop MTU for IPv4 [RFC1122] and 1280 bytes for IPv6 [RFC2460]. So sending 65536 bytes is always wrong --- agent/component.h | 2 +- agent/conncheck.c | 2 +- agent/conncheck.h | 2 +- agent/discovery.h | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/agent/component.h b/agent/component.h index 207fdcb..6a0819a 100644 --- a/agent/component.h +++ b/agent/component.h @@ -74,7 +74,7 @@ struct _CandidatePairKeepalive guint stream_id; guint component_id; StunTimer timer; - uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE]; + uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE_IPV6]; StunMessage stun_message; }; diff --git a/agent/conncheck.c b/agent/conncheck.c index e697cb6..cde50c3 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -666,7 +666,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) NiceAddress stun_server; if (nice_address_set_from_string (&stun_server, agent->stun_server_ip)) { StunAgent stun_agent; - uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE]; + uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE_IPV6]; StunMessage stun_message; size_t buffer_len = 0; diff --git a/agent/conncheck.h b/agent/conncheck.h index 9703e1f..8c8096d 100644 --- a/agent/conncheck.h +++ b/agent/conncheck.h @@ -77,7 +77,7 @@ struct _CandidateCheckPair guint64 priority; GTimeVal next_tick; /* next tick timestamp */ StunTimer timer; - uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE]; + uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE_IPV6]; StunMessage stun_message; }; diff --git a/agent/discovery.h b/agent/discovery.h index f6d3bdd..8f0b4fd 100644 --- a/agent/discovery.h +++ b/agent/discovery.h @@ -58,7 +58,7 @@ typedef struct TurnServer *turn; StunAgent stun_agent; StunTimer timer; - uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE]; + uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE_IPV6]; StunMessage stun_message; uint8_t stun_resp_buffer[STUN_MAX_MESSAGE_SIZE]; StunMessage stun_resp_msg; @@ -76,7 +76,7 @@ typedef struct GSource *timer_source; GSource *tick_source; StunTimer timer; - uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE]; + uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE_IPV6]; StunMessage stun_message; uint8_t stun_resp_buffer[STUN_MAX_MESSAGE_SIZE]; StunMessage stun_resp_msg; -- 2.7.4