nat: Add a command to close a given BSC Connection
This can be used to clear stale connections for a given BSC
or to force a reconnect of the BSC.
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 0462f9d..16ffa0a 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -59,7 +59,6 @@
static struct bsc_nat *nat;
static void bsc_send_data(struct bsc_connection *bsc, const u_int8_t *data, unsigned int length, int);
-static void remove_bsc_connection(struct bsc_connection *connection);
static void msc_send_reset(struct bsc_msc_connection *con);
struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num)
@@ -344,7 +343,7 @@
LOGP(DMSC, LOGL_ERROR, "Closing all connections downstream.\n");
llist_for_each_entry_safe(bsc, tmp, &nat->bsc_connections, list_entry)
- remove_bsc_connection(bsc);
+ bsc_close_connection(bsc);
nat->first_contact = 0;
bsc_mgcp_free_endpoints(nat);
@@ -432,7 +431,7 @@
* remove it from the patching of SCCP header lists
* as well. Maybe in the future even close connection..
*/
-static void remove_bsc_connection(struct bsc_connection *connection)
+void bsc_close_connection(struct bsc_connection *connection)
{
struct sccp_connections *sccp_patch, *tmp;
@@ -470,7 +469,7 @@
getpeername(conn->write_queue.bfd.fd, (struct sockaddr *) &sock, &len);
LOGP(DNAT, LOGL_ERROR, "BSC on %s didn't respond to identity request. Closing.\n",
inet_ntoa(sock.sin_addr));
- remove_bsc_connection(conn);
+ bsc_close_connection(conn);
}
static void ipaccess_auth_bsc(struct tlv_parsed *tvp, struct bsc_connection *bsc)
@@ -605,7 +604,7 @@
else
LOGP(DNAT, LOGL_ERROR, "Failed to parse ip access message: %d\n", error);
- remove_bsc_connection(bsc);
+ bsc_close_connection(bsc);
return -1;
}