aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc_msc.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-05-18 03:31:16 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-05-18 03:31:16 +0800
commit35e56453d2cb11847fe6b65752e1641987419773 (patch)
tree204dedf7090c0df7206a165d326deb27b7a0a90d /openbsc/src/bsc_msc.c
parent4fcf80a59a58f920862eb6db5135e8d01e9b5e12 (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 3ecd13170..362450fa5 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);
@@ -201,7 +208,7 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
}
-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;
@@ -213,6 +220,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;