summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/netsock.c2
-rw-r--r--main/utils.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/main/netsock.c b/main/netsock.c
index e19433bbb..46b306074 100644
--- a/main/netsock.c
+++ b/main/netsock.c
@@ -144,6 +144,8 @@ struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct i
if (setsockopt(netsocket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)))
ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos);
+ ast_enable_packet_fragmentation(netsocket);
+
if (!(ns = ast_calloc(1, sizeof(struct ast_netsock)))) {
close(netsocket);
return NULL;
diff --git a/main/utils.c b/main/utils.c
index 6ba136ed6..9ff2fd48a 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -984,3 +984,13 @@ int ast_dynamic_str_thread_build_va(struct ast_dynamic_str **buf, size_t max_len
return res;
}
+
+void ast_enable_packet_fragmentation(int sock)
+{
+#ifdef __linux__
+ int val = IP_PMTUDISC_DONT;
+
+ if (setsockopt(sock, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val)))
+ ast_log(LOG_WARNING, "Unable to disable PMTU discovery. Large UDP packets may fail to be delivered when sent from this socket.\n");
+#endif
+}