summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-05-05 18:58:13 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-05-05 18:59:54 +0800
commitebd57da87d6499506aabf65b76d43904490b9eaa (patch)
tree18499fff0dbef5436c6308012ce0eaa4d5b322b5
parentb0ee082bb0f465c32bc303f045606c91f4adcd0b (diff)
nat: Use TCP_NODELAY for the connection to the BSC.
We do not want to use NAGLE for the BSC connection.
-rw-r--r--openbsc/src/nat/bsc_nat.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 9fe444ce0..6b0baf7e1 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -23,6 +23,7 @@
*/
#include <sys/socket.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <errno.h>
@@ -716,7 +717,7 @@ static int ipaccess_bsc_write_cb(struct bsc_fd *bfd, struct msgb *msg)
static int ipaccess_listen_bsc_cb(struct bsc_fd *bfd, unsigned int what)
{
struct bsc_connection *bsc;
- int ret;
+ int ret, on;
struct sockaddr_in sa;
socklen_t sa_len = sizeof(sa);
@@ -741,6 +742,11 @@ static int ipaccess_listen_bsc_cb(struct bsc_fd *bfd, unsigned int what)
return 0;
}
+ on = 1;
+ ret = setsockopt(bfd->fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
+ if (ret != 0)
+ LOGP(DNAT, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno));
+
/* todo... do something with the connection */
/* todo... use GNUtls to see if we want to trust this as a BTS */