aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc_msc.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 18:52:38 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:20 +0800
commitca999a989d972ba79902251cbb74956732e91bf9 (patch)
treef3821fbcd0e1a07cc7dc1c8711cd6e3db43c3e91 /openbsc/src/bsc_msc.c
parentb71c23bb0aba550f7f6907476ef5ca43cd578433 (diff)
msc: Add msc ip-tos NR option for the BSC
Allow to set the TOS field via the VTY interface. The SO_PRIORITY was not used as it has no effect on the packets being sent (in contrast to the documentation).
Diffstat (limited to 'openbsc/src/bsc_msc.c')
-rw-r--r--openbsc/src/bsc_msc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/openbsc/src/bsc_msc.c b/openbsc/src/bsc_msc.c
index 5ee267a2f..42b4c20f8 100644
--- a/openbsc/src/bsc_msc.c
+++ b/openbsc/src/bsc_msc.c
@@ -163,6 +163,13 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
/* make it non blocking */
setnonblocking(fd);
+ /* set the socket priority */
+ ret = setsockopt(fd->fd, IPPROTO_IP, IP_TOS,
+ &con->prio, sizeof(con->prio));
+ if (ret != 0)
+ LOGP(DMSC, LOGL_ERROR, "Failed to set prio to %d. %s\n",
+ con->prio, strerror(errno));
+
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(con->port);
@@ -200,7 +207,7 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
return ret;
}
-struct bsc_msc_connection *bsc_msc_create(const char *ip, int port)
+struct bsc_msc_connection *bsc_msc_create(const char *ip, int port, int prio)
{
struct bsc_msc_connection *con;
@@ -212,6 +219,7 @@ struct bsc_msc_connection *bsc_msc_create(const char *ip, int port)
con->ip = ip;
con->port = port;
+ con->prio = prio;
write_queue_init(&con->write_queue, 100);
con->write_queue.except_cb = bsc_msc_except;
return con;