[nat] Make create_sccp_src_ref return the SCCP Connection.
Right now it was not possible to just find a connection, by returning
the connection that is created we will have direct access to it. It
will be used by the local connection handling.
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index ca9fbd4..6ad9870 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -273,10 +273,10 @@
/* test conn tracking once */
static void test_contrack()
{
- int rc;
struct bsc_nat *nat;
struct bsc_connection *con;
struct sccp_connections *con_found;
+ struct sccp_connections *rc_con;
struct bsc_nat_parsed *parsed;
struct msgb *msg;
@@ -294,8 +294,8 @@
fprintf(stderr, "Con should not exist %p\n", con_found);
abort();
}
- rc = create_sccp_src_ref(con, parsed);
- if (rc != 0) {
+ rc_con = create_sccp_src_ref(con, parsed);
+ if (!rc_con) {
fprintf(stderr, "Failed to create a ref\n");
abort();
}
@@ -304,6 +304,10 @@
fprintf(stderr, "Failed to find the con: %p\n", con_found);
abort();
}
+ if (con_found != rc_con) {
+ fprintf(stderr, "Failed to find the right connection.\n");
+ abort();
+ }
if (memcmp(msg->data, bsc_cr_patched, sizeof(bsc_cr_patched)) != 0) {
fprintf(stderr, "Failed to patch the BSC CR msg.\n");
abort();