[svn-commits] kpfleming: trunk r44957 - in /trunk: ./ channels/
include/asterisk/ main/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Thu Oct 12 11:43:52 MST 2006
Author: kpfleming
Date: Thu Oct 12 13:43:52 2006
New Revision: 44957
URL: http://svn.digium.com/view/asterisk?rev=44957&view=rev
Log:
Merged revisions 44956 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r44956 | kpfleming | 2006-10-12 13:38:51 -0500 (Thu, 12 Oct 2006) | 10 lines
Merged revisions 44955 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r44955 | kpfleming | 2006-10-12 13:31:26 -0500 (Thu, 12 Oct 2006) | 2 lines
ensure that IAX2 and SIP sockets allow UDP fragmentation when running on Linux (thanks to Brian Candler on the asterisk-dev list for the tip)
........
................
Modified:
trunk/ (props changed)
trunk/channels/chan_sip.c
trunk/include/asterisk/utils.h
trunk/main/netsock.c
trunk/main/utils.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=44957&r1=44956&r2=44957&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Oct 12 13:43:52 2006
@@ -16041,9 +16041,12 @@
} else {
/* Allow SIP clients on the same host to access us: */
const int reuseFlag = 1;
+
setsockopt(sipsock, SOL_SOCKET, SO_REUSEADDR,
(const char*)&reuseFlag,
sizeof reuseFlag);
+
+ ast_enable_packet_fragmentation(sipsock);
if (bind(sipsock, (struct sockaddr *)&bindaddr, sizeof(bindaddr)) < 0) {
ast_log(LOG_WARNING, "Failed to bind to %s:%d: %s\n",
Modified: trunk/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/utils.h?rev=44957&r1=44956&r2=44957&view=diff
==============================================================================
--- trunk/include/asterisk/utils.h (original)
+++ trunk/include/asterisk/utils.h Thu Oct 12 13:43:52 2006
@@ -515,4 +515,19 @@
}))
#endif
+/*!
+ \brief Disable PMTU discovery on a socket
+ \param sock The socket to manipulate
+ \return Nothing
+
+ On Linux, UDP sockets default to sending packets with the Dont Fragment (DF)
+ bit set. This is supposedly done to allow the application to do PMTU
+ discovery, but Asterisk does not do this.
+
+ Because of this, UDP packets sent by Asterisk that are larger than the MTU
+ of any hop in the path will be lost. This function can be called on a socket
+ to ensure that the DF bit will not be set.
+ */
+void ast_enable_packet_fragmentation(int sock);
+
#endif /* _ASTERISK_UTILS_H */
Modified: trunk/main/netsock.c
URL: http://svn.digium.com/view/asterisk/trunk/main/netsock.c?rev=44957&r1=44956&r2=44957&view=diff
==============================================================================
--- trunk/main/netsock.c (original)
+++ trunk/main/netsock.c Thu Oct 12 13:43:52 2006
@@ -144,6 +144,8 @@
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;
Modified: trunk/main/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/main/utils.c?rev=44957&r1=44956&r2=44957&view=diff
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Thu Oct 12 13:43:52 2006
@@ -984,3 +984,13 @@
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
+}
More information about the svn-commits
mailing list