nat: Allocate the endpoint status dynamically

Allocate the status for an endpoint dynamically. We will support
BSCs with different amount of multiplexes and need to have this
flexibility in the future. Add the proper null checks to the
current users of this code.
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index 532e790..01bee74 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -172,15 +172,21 @@
 	int i;
 
 	llist_for_each_entry(con, &_nat->bsc_connections, list_entry) {
+		int endpoints;
 		if (!con->cfg)
 			continue;
 		if (con->cfg->nr != nr)
 			continue;
 
+		/* this bsc has no audio endpoints yet */
+		if (!con->_endpoint_status)
+			continue;
+
 		vty_out(vty, "MGCP Status for %d%s", con->cfg->nr, VTY_NEWLINE);
-		for (i = 1; i < ARRAY_SIZE(con->endpoint_status); ++i)
+		endpoints = 31 * con->cfg->number_multiplexes;
+		for (i = 1; i <= endpoints; ++i)
 			vty_out(vty, " Endpoint 0x%x %s%s", i,
-				con->endpoint_status[i] == 0 ? "free" : "allocated",
+				con->_endpoint_status[i] == 0 ? "free" : "allocated",
 				VTY_NEWLINE);
 		break;
 	}