summaryrefslogtreecommitdiffstats
path: root/openbsc/src/mgcp/mgcp_network.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-05-31 10:22:00 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-17 14:34:30 +0800
commit75492e6e5451e691f3eea9e5dc91f87dab0552f0 (patch)
tree31ffdb68d2cd8371fd50d523ecca27cff9f081e5 /openbsc/src/mgcp/mgcp_network.c
parenta19bdabf22bf748b917794628a1e49e6c232756a (diff)
[mgcp] Set the IP_TOS/DSCP on RTP/RTCP IP packets.
Diffstat (limited to 'openbsc/src/mgcp/mgcp_network.c')
-rw-r--r--openbsc/src/mgcp/mgcp_network.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c
index ceeadb168..911bb2602 100644
--- a/openbsc/src/mgcp/mgcp_network.c
+++ b/openbsc/src/mgcp/mgcp_network.c
@@ -231,6 +231,14 @@ static int create_bind(const char *source_addr, struct bsc_fd *fd, int port)
return 0;
}
+static int set_ip_tos(int fd, int tos)
+{
+ int ret;
+ ret = setsockopt(fd, IPPROTO_IP, IP_TOS,
+ &tos, sizeof(tos));
+ return ret != 0;
+}
+
static int bind_rtp(struct mgcp_endpoint *endp)
{
struct mgcp_config *cfg = endp->cfg;
@@ -247,6 +255,9 @@ static int bind_rtp(struct mgcp_endpoint *endp)
goto cleanup1;
}
+ set_ip_tos(endp->local_rtp.fd, cfg->endp_tos);
+ set_ip_tos(endp->local_rtcp.fd, cfg->endp_tos);
+
endp->local_rtp.cb = rtp_data_cb;
endp->local_rtp.data = endp;
endp->local_rtp.when = BSC_FD_READ;