nat: Attempt to assign the BSC Timeslot based on a free list
Do attempt to not reassign an endpoint immediately but go
to the next free one.
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index b7a89c5..acc5de3 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -444,7 +444,7 @@
msg = msgb_alloc(4096, "foo");
copy_to_msg(msg, ass_cmd, sizeof(ass_cmd));
parsed = bsc_nat_parse(msg);
- if (bsc_mgcp_assign(&con, msg) != 0) {
+ if (bsc_mgcp_assign_patch(&con, msg) != 0) {
fprintf(stderr, "Failed to handle assignment.\n");
abort();
}
@@ -454,14 +454,19 @@
abort();
}
- if (con.bsc_endp != 21) {
- fprintf(stderr, "Assigned timeslot should have been 21.\n");
+ if (con.bsc_endp != 1) {
+ fprintf(stderr, "Assigned timeslot should have been 1.\n");
abort();
}
+ if (con.bsc->endpoint_status[1] != 1) {
+ fprintf(stderr, "The status on the BSC is wrong.\n");
+ abort();
+ }
+
talloc_free(parsed);
bsc_mgcp_dlcx(&con);
- if (con.bsc_endp != -1 || con.msc_endp != -1) {
+ if (con.bsc_endp != -1 || con.msc_endp != -1 || con.bsc->endpoint_status[1] != 0) {
fprintf(stderr, "Clearing should remove the mapping.\n");
abort();
}