agent: Use 1280 instead of 65536 buffer size to send STUN Message
authorOlivier Crête <olivier.crete@collabora.com>
Mon, 12 May 2014 23:40:08 +0000 (19:40 -0400)
committerOlivier Crête <olivier.crete@collabora.com>
Mon, 12 May 2014 23:42:09 +0000 (19:42 -0400)
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
agent/conncheck.c
agent/conncheck.h
agent/discovery.h

index 207fdcb..6a0819a 100644 (file)
@@ -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;
 };
 
index e697cb6..cde50c3 100644 (file)
@@ -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;
 
index 9703e1f..8c8096d 100644 (file)
@@ -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;
 };
 
index f6d3bdd..8f0b4fd 100644 (file)
@@ -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;