aboutsummaryrefslogtreecommitdiffstats
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-02-01 13:13:11 +0100
commit601a67e274d88a943fd791d091e80f63582873c3 (patch)
treeecb164e0c44407a224910c452448c7b42a92494e
parent1b891fd7bab5f2c3ea3f0c2a296a605305ac984d (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.
-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 ecc13ca68..16e74c82e 100644
--- a/openbsc/src/bsc_mgcp.c
+++ b/openbsc/src/bsc_mgcp.c
@@ -108,6 +108,7 @@ struct mgcp_endpoint {
struct bsc_fd local_rtcp;
struct in_addr remote;
+ struct in_addr bts;
/* in network byte order */
int rtp, rtcp;
@@ -254,13 +255,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));
}
@@ -275,7 +277,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);
}
@@ -901,7 +903,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);
@@ -1118,10 +1121,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),