aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-01-13 16:37:32 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-01-13 16:38:18 +0100
commitd4c29c1574435041f59f9e101f9285b8b335fc11 (patch)
tree96a9ae7d07e1abf185292d6f71167b1dc0eae1b3 /openbsc/src
parent3d947e6d678e87377fec684a90c08fdcfde5f69b (diff)
[mgcp] Make it possible to not specify a bts ip
This way the mgcp will allow anyone to be the BTS.. in the future we might need to communicate things properly between BSC and MGCP.
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/bsc_mgcp.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/openbsc/src/bsc_mgcp.c b/openbsc/src/bsc_mgcp.c
index d5e53c565..760d8c912 100644
--- a/openbsc/src/bsc_mgcp.c
+++ b/openbsc/src/bsc_mgcp.c
@@ -109,6 +109,7 @@ struct mgcp_endpoint {
struct bsc_fd local_rtcp;
struct in_addr remote;
+ struct in_addr bts;
/* in network byte order */
int rtp, rtcp;
@@ -255,13 +256,14 @@ static int rtp_data_cb(struct bsc_fd *fd, unsigned int what)
/* We have no idea who called us, maybe it is the BTS. */
if (dest == DEST_NETWORK && endp->bts_rtp == 0) {
/* it was the BTS... */
- if (memcmp(&addr.sin_addr, &bts_in, sizeof(bts_in)) == 0) {
+ if (!bts_ip || memcmp(&addr.sin_addr, &bts_in, sizeof(bts_in)) == 0) {
if (fd == &endp->local_rtp) {
endp->bts_rtp = addr.sin_port;
} else {
endp->bts_rtcp = addr.sin_port;
}
+ endp->bts = addr.sin_addr;
DEBUGP(DMGCP, "Found BTS for endpoint: 0x%x on port: %d/%d\n",
ENDPOINT_NUMBER(endp), ntohs(endp->bts_rtp), ntohs(endp->bts_rtcp));
}
@@ -276,7 +278,7 @@ static int rtp_data_cb(struct bsc_fd *fd, unsigned int what)
proto == PROTO_RTP ? endp->rtp : endp->rtcp,
buf, rc);
} else {
- return _send(fd->fd, &bts_in,
+ return _send(fd->fd, &endp->bts,
proto == PROTO_RTP ? endp->bts_rtp : endp->bts_rtcp,
buf, rc);
}
@@ -902,7 +904,8 @@ static int config_write_mgcp(struct vty *vty)
vty_out(vty, "mgcp%s", VTY_NEWLINE);
if (local_ip)
vty_out(vty, " local ip %s%s", local_ip, VTY_NEWLINE);
- vty_out(vty, " bts ip %s%s", bts_ip, VTY_NEWLINE);
+ if (bts_ip)
+ vty_out(vty, " bts ip %s%s", bts_ip, VTY_NEWLINE);
vty_out(vty, " bind ip %s%s", source_addr, VTY_NEWLINE);
vty_out(vty, " bind port %u%s", source_port, VTY_NEWLINE);
vty_out(vty, " bind early %u%s", !!early_bind, VTY_NEWLINE);
@@ -1112,10 +1115,8 @@ int main(int argc, char** argv)
}
- if (!bts_ip) {
- fprintf(stderr, "Need to specify the BTS ip address for RTP handling.\n");
- return -1;
- }
+ if (!bts_ip)
+ fprintf(stderr, "No BTS ip address specified. This will allow everyone to connect.\n");
endpoints = _talloc_zero_array(tall_bsc_ctx,
sizeof(struct mgcp_endpoint),