aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-10-02 19:41:06 +0200
committerpespin <pespin@sysmocom.de>2023-10-04 11:21:05 +0000
commit08001775c6a475025ec782e79d70eb6dae1ce541 (patch)
tree84eee25de1097e456a4a91f6876c420f2948ed66
parentc5a4b772b103d441d0be714145269e17b5228621 (diff)
xua_server: asp: Support removing local addresses
The socket is reconfigured (and hence reopened) upon VTY node exit if changes were stored in the address list of the xua_server (osmo_stream_srv_link). Related: OS#4607 Change-Id: I942edff7695efeea7753f22e31c2098c201290ff
-rw-r--r--include/osmocom/sigtran/osmo_ss7.h1
-rw-r--r--src/osmo_ss7_vty.c17
-rw-r--r--src/osmo_ss7_xua_srv.c11
3 files changed, 29 insertions, 0 deletions
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 841c12b..a8a624f 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -562,6 +562,7 @@ osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local
int
osmo_ss7_xua_server_set_local_hosts(struct osmo_xua_server *xs, const char **local_hosts, size_t local_host_cnt);
int osmo_ss7_xua_server_add_local_host(struct osmo_xua_server *xs, const char *local_host);
+int osmo_ss7_xua_server_del_local_host(struct osmo_xua_server *xs, const char *local_host);
void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs);
struct osmo_sccp_instance *
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 172893e..ff27cf3 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -511,6 +511,22 @@ DEFUN_ATTR(xua_local_ip, xua_local_ip_cmd,
return CMD_SUCCESS;
}
+DEFUN_ATTR(xua_no_local_ip, xua_no_local_ip_cmd,
+ "no local-ip " VTY_IPV46_CMD,
+ NO_STR "Configure the Local IP Address for xUA\n"
+ "IPv4 Address to use for XUA\n"
+ "IPv6 Address to use for XUA\n",
+ CMD_ATTR_NODE_EXIT)
+{
+ struct osmo_xua_server *xs = vty->index;
+
+ if (osmo_ss7_xua_server_del_local_host(xs, argv[0]) != 0) {
+ vty_out(vty, "%% Failed deleting local address '%s' from set%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ return CMD_SUCCESS;
+}
+
DEFUN_ATTR(xua_accept_dyn_asp, xua_accept_dyn_asp_cmd,
"accept-asp-connections (pre-configured|dynamic-permitted)",
"Define what kind of ASP connections to accept\n"
@@ -2476,6 +2492,7 @@ void osmo_ss7_vty_init_sg(void *ctx)
install_lib_element(L_CS7_NODE, &cs7_xua_cmd);
install_lib_element(L_CS7_NODE, &no_cs7_xua_cmd);
install_lib_element(L_CS7_XUA_NODE, &xua_local_ip_cmd);
+ install_lib_element(L_CS7_XUA_NODE, &xua_no_local_ip_cmd);
install_lib_element(L_CS7_XUA_NODE, &xua_accept_dyn_asp_cmd);
install_lib_element(L_CS7_XUA_NODE, &xua_sctp_param_init_cmd);
install_lib_element(L_CS7_XUA_NODE, &xua_no_sctp_param_init_cmd);
diff --git a/src/osmo_ss7_xua_srv.c b/src/osmo_ss7_xua_srv.c
index dc27c83..32266ff 100644
--- a/src/osmo_ss7_xua_srv.c
+++ b/src/osmo_ss7_xua_srv.c
@@ -284,6 +284,17 @@ osmo_ss7_xua_server_add_local_host(struct osmo_xua_server *xs, const char *local
return osmo_stream_srv_link_set_addrs(xs->server, (const char **)xs->cfg.local.host, xs->cfg.local.host_cnt);
}
+int
+osmo_ss7_xua_server_del_local_host(struct osmo_xua_server *xs, const char *local_host)
+{
+ int rc;
+
+ rc = osmo_ss7_asp_peer_del_host(&xs->cfg.local, local_host);
+ if (rc < 0)
+ return rc;
+ return osmo_stream_srv_link_set_addrs(xs->server, (const char **)xs->cfg.local.host, xs->cfg.local.host_cnt);
+}
+
bool ss7_xua_server_set_default_local_hosts(struct osmo_xua_server *oxs)
{
/* If no local addr was set, or erased after _create(): */