aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-06 11:06:11 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-06 11:06:11 +0200
commit581e58d16645d8cd0e1a62776f4d2a570f3b2445 (patch)
tree26d169375a88a9ba3ff1c940f894c3489a28ed22
parente308bb466ab46851abd6eeeb6601e3ed3c7bfd51 (diff)
Revert "nat: Remember where the BTS is listening for things."
Remove the code to parse port as we need to discover the BTS behind the nat and most likely it will have a different port than the one advertised by the BTS. This reverts commit c6a1fe773d16eb20d4cb1d3097761419436f4537.
-rw-r--r--openbsc/include/openbsc/bsc_nat.h1
-rw-r--r--openbsc/src/nat/bsc_mgcp_utils.c17
-rw-r--r--openbsc/tests/bsc-nat/bsc_nat_test.c14
3 files changed, 1 insertions, 31 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 6de32ebc9..6cf20f2d0 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -208,6 +208,5 @@ void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg);
void bsc_mgcp_clear_endpoints_for(struct bsc_connection *bsc);
int bsc_mgcp_parse_response(const char *str, int *code, char transaction[60]);
int bsc_mgcp_extract_ci(const char *resp);
-int bsc_mgcp_extract_port(const char *resp);
#endif
diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c
index 6fc5eaca2..ffdc3ed87 100644
--- a/openbsc/src/nat/bsc_mgcp_utils.c
+++ b/openbsc/src/nat/bsc_mgcp_utils.c
@@ -186,7 +186,7 @@ void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg)
struct msgb *output;
struct bsc_endpoint *bsc_endp = NULL;
struct mgcp_endpoint *endp = NULL;
- int i, code, port;
+ int i, code;
char transaction_id[60];
/* Some assumption that our buffer is big enough.. and null terminate */
@@ -228,9 +228,6 @@ void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg)
/* make it point to our endpoint */
endp->ci = bsc_mgcp_extract_ci((const char *) msg->l2h);
- port = bsc_mgcp_extract_port((const char *) msg->l2h);
- endp->bts_rtp = htons(port);
- endp->bts_rtcp = htons(port + 1);
output = bsc_mgcp_rewrite((char * ) msg->l2h, msgb_l2len(msg),
bsc->nat->mgcp_cfg->source_addr, endp->rtp_port);
@@ -269,18 +266,6 @@ int bsc_mgcp_extract_ci(const char *str)
return ci;
}
-int bsc_mgcp_extract_port(const char *str)
-{
- int port;
- char *res = strstr(str, "m=audio ");
- if (!res)
- return 0;
-
- if (sscanf(res, "m=audio %d RTP/AVP %*d", &port) != 1)
- return 0;
- return port;
-}
-
/* we need to replace some strings... */
struct msgb *bsc_mgcp_rewrite(char *input, int length, const char *ip, int port)
{
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index a859d072d..593963291 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -505,19 +505,6 @@ static void test_mgcp_parse(void)
}
}
-static void test_mgcp_parse_port(void)
-{
- int port;
-
- fprintf(stderr, "Test MGCP port parsing.\n");
-
- port = bsc_mgcp_extract_port(mdcx_resp);
- if (port != 4002) {
- fprintf(stderr, "Could not parse port. Got: %d\n", port);
- abort();
- }
-}
-
int main(int argc, char **argv)
{
struct debug_target *stderr_target;
@@ -533,7 +520,6 @@ int main(int argc, char **argv)
test_mgcp_find();
test_mgcp_rewrite();
test_mgcp_parse();
- test_mgcp_parse_port();
return 0;
}