pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/34613?usp=email )

Change subject: xua_server: asp: Support removing local addresses
......................................................................

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
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7_vty.c
M src/osmo_ss7_xua_srv.c
3 files changed, 43 insertions(+), 0 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve




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 @@
 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 @@
        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 @@
        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 @@
        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(): */

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/34613?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I942edff7695efeea7753f22e31c2098c201290ff
Gerrit-Change-Number: 34613
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to