[mgcp] Set the IP_TOS/DSCP on RTP/RTCP IP packets.
diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c
index ceeadb1..911bb26 100644
--- a/openbsc/src/mgcp/mgcp_network.c
+++ b/openbsc/src/mgcp/mgcp_network.c
@@ -231,6 +231,14 @@
 	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 @@
 		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;