aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-03-30 09:17:53 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-03-30 09:17:53 +0200
commit957bc93244224124a1fa5576c94953ae09bc984d (patch)
tree53e6eff664feab00fa32afc24e687166d1ee4da7 /openbsc/tests
parent18bbe2e8a012be195069fad7224121ab64953fec (diff)
nat: Return the SCCP connection, change order of patching and updating
* Return the SCCP connection. This will be needed to store the assigned timeslot in there. * Update code to work with this change * This uncovered a bug in the CC handling, at the time the BSC was passed it was still a null pointer and the code would have failed.
Diffstat (limited to 'openbsc/tests')
-rw-r--r--openbsc/tests/bsc-nat/bsc_nat_test.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index 196f187d8..3a1096001 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -189,7 +189,7 @@ static void copy_to_msg(struct msgb *msg, const u_int8_t *data, unsigned int len
}
#define VERIFY(con_found, con, msg, ver, str) \
- if (con_found != con) { \
+ if (!con_found || con_found->bsc != con) { \
fprintf(stderr, "Failed to find the con: %p\n", con_found); \
abort(); \
} \
@@ -203,7 +203,8 @@ static void test_contrack()
{
int rc;
struct bsc_nat *nat;
- struct bsc_connection *con, *con_found;
+ struct bsc_connection *con;
+ struct sccp_connections *con_found;
struct bsc_nat_parsed *parsed;
struct msgb *msg;
@@ -226,7 +227,7 @@ static void test_contrack()
abort();
}
con_found = patch_sccp_src_ref_to_msc(msg, parsed, nat);
- if (con_found != con) {
+ if (!con_found || con_found->bsc != con) {
fprintf(stderr, "Failed to find the con: %p\n", con_found);
abort();
}
@@ -239,12 +240,12 @@ static void test_contrack()
/* 2.) get the cc */
copy_to_msg(msg, msc_cc, sizeof(msc_cc));
parsed = bsc_nat_parse(msg);
- if (update_sccp_src_ref(con, msg, parsed) != 0) {
+ con_found = patch_sccp_src_ref_to_bsc(msg, parsed, nat);
+ VERIFY(con_found, con, msg, msc_cc_patched, "MSC CC");
+ if (update_sccp_src_ref(con_found, parsed) != 0) {
fprintf(stderr, "Failed to update the SCCP con.\n");
abort();
}
- con_found = patch_sccp_src_ref_to_bsc(msg, parsed, nat);
- VERIFY(con_found, con, msg, msc_cc_patched, "MSC CC");
/* 3.) send some data */
copy_to_msg(msg, bsc_dtap, sizeof(bsc_dtap));
@@ -268,7 +269,7 @@ static void test_contrack()
copy_to_msg(msg, bsc_rlc, sizeof(bsc_rlc));
parsed = bsc_nat_parse(msg);
con_found = patch_sccp_src_ref_to_msc(msg, parsed, nat);
- if (con_found != con) {
+ if (!con_found || con_found->bsc != con) {
fprintf(stderr, "Failed to find the con: %p\n", con_found);
abort();
}