From f3b51061e4c6ae63417e557261adf5f0d03dcc55 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Tue, 29 Mar 2005 23:20:31 +0000 Subject: Add option to disable checksums on IAX git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5301 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax2.c | 19 +++++++++++++++++++ configs/iax.conf.sample | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index c44dc97f1..25bb7320c 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -82,6 +82,10 @@ #define IPTOS_MINCOST 0x02 #endif +#ifdef SO_NO_CHECK +static int nochecksums = 0; +#endif + /* * Uncomment to try experimental IAX bridge optimization, * designed to reduce latency when IAX calls cannot @@ -3569,6 +3573,9 @@ static struct iax2_trunk_peer *find_tpeer(struct sockaddr_in *sin, int fd) tpeer->next = tpeers; tpeer->sockfd = fd; tpeers = tpeer; +#ifdef SO_NO_CHECK + setsockopt(tpeer->sockfd, SOL_SOCKET, SO_NO_CHECK, &nochecksums, sizeof(nochecksums)); +#endif ast_log(LOG_DEBUG, "Created trunk peer for '%s:%d'\n", ast_inet_ntoa(iabuf, sizeof(iabuf), tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port)); } } @@ -8235,6 +8242,7 @@ static int set_config(char *config_file, int reload) v = ast_variable_browse(cfg, "general"); /* Reset Global Flags */ memset(&globalflags, 0, sizeof(globalflags)); + nochecksums = 0; while(v) { if (!strcasecmp(v->name, "bindport")){ @@ -8244,6 +8252,17 @@ static int set_config(char *config_file, int reload) portno = atoi(v->value); } else if (!strcasecmp(v->name, "pingtime")) ping_time = atoi(v->value); + else if (!strcasecmp(v->name, "nochecksums")) { +#ifdef SO_NO_CHECK + if (ast_true(v->value)) + nochecksums = 1; + else + nochecksums = 0; +#else + if (ast_true(v->value)) + ast_log(LOG_WARNING, "Disabling RTP checksums is not supported on this operating system!\n"); +#endif + } else if (!strcasecmp(v->name, "maxjitterbuffer")) maxjitterbuffer = atoi(v->value); else if (!strcasecmp(v->name, "jittershrinkrate")) diff --git a/configs/iax.conf.sample b/configs/iax.conf.sample index 50f1fb37e..724b71952 100755 --- a/configs/iax.conf.sample +++ b/configs/iax.conf.sample @@ -23,6 +23,12 @@ ; ;iaxcompat=yes ; +; Disable UDP checksums (if nochecksums is set, then no checkums will +; be calculated/checked on systems supporting this feature) +; +;nochecksums=no +; +; ; For increased security against brute force password attacks ; enable "delayreject" which will delay the sending of authentication ; reject for REGREQ or AUTHREP if there is a password. -- cgit v1.2.3