summaryrefslogtreecommitdiffstats
path: root/openbsc/src/mgcp/mgcp_network.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-08-05 10:53:26 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-05 19:35:44 +0800
commitea97fbf1a197b5ba8c37bca2add2d77dab1ae78f (patch)
treeed71e83dd76ecae57b0d548caf52549f74f16b1f /openbsc/src/mgcp/mgcp_network.c
parentb97c50db0af26f9b047aaf0e74c55b64a62633f6 (diff)
mgcp: Be more strict on the source addr/source port of the bts
Once we have discovered the bts we will not accept data from anything else. The call will drop if the BTS is changing the ip address of the nat anyway.
Diffstat (limited to 'openbsc/src/mgcp/mgcp_network.c')
-rw-r--r--openbsc/src/mgcp/mgcp_network.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c
index f298ebbfc..a52e13573 100644
--- a/openbsc/src/mgcp/mgcp_network.c
+++ b/openbsc/src/mgcp/mgcp_network.c
@@ -285,6 +285,21 @@ static int rtp_data_bts(struct bsc_fd *fd, unsigned int what)
inet_ntoa(addr.sin_addr));
}
+ if (memcmp(&endp->bts_end.addr, &addr.sin_addr, sizeof(addr.sin_addr)) != 0) {
+ LOGP(DMGCP, LOGL_ERROR,
+ "Data from wrong bts %s on 0x%x\n",
+ inet_ntoa(addr.sin_addr), ENDPOINT_NUMBER(endp));
+ return -1;
+ }
+
+ if (endp->bts_end.rtp_port != addr.sin_port &&
+ endp->bts_end.rtcp_port != addr.sin_port) {
+ LOGP(DMGCP, LOGL_ERROR,
+ "Data from wrong bts source port %d on 0x%x\n",
+ ntohs(addr.sin_port), ENDPOINT_NUMBER(endp));
+ return -1;
+ }
+
/* throw away the dummy message */
if (rc == 1 && buf[0] == DUMMY_LOAD) {
LOGP(DMGCP, LOGL_NOTICE, "Filtered dummy from bts on 0x%x\n",