[PATCH] osmo-iuh[master]: make point codes configurable by SCCP address book

2017-08-09 Thread Neels Hofmeyr
Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/3394

to look at the new patch set (#3).

make point codes configurable by SCCP address book

In the vty config, use the SCCP address book to configure the local and remote
SCCP addresses. Add VTY commands to set the remote SCCP addresses by name,
derive the ss7 instance from these addresses:

  cs7 instance 1
   point-code 0.23.0
   sccp-address msc
point-code 0.0.1
   sccp-address sgsn
point-code 0.0.2
  hnbgw
   iucs
remote-addr msc
   iups
remote-addr sgsn

Enforce that both IuCS and IuPS use the same ss7 instance. In the future, we
may add the feature to use two separate instances.

Depends: libosmo-sccp I75c67d289693f1c2a049ac61cf2b2097d6e5687d,
 Ie1aedd7894acd69ddc887cd65a8a0df4b38c,
 I85b46269dbe7909e52873ace3f720f6292a4516c

Change-Id: I33a7ba11eb7c2d9a5dc74d10fb0cf04bf664477b
---
M include/osmocom/iuh/hnbgw.h
M include/osmocom/iuh/hnbgw_cn.h
M src/hnbgw.c
M src/hnbgw_cn.c
M src/hnbgw_rua.c
M src/hnbgw_vty.c
6 files changed, 120 insertions(+), 100 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/94/3394/3

diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index db22d97..58bdab4 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -116,10 +116,8 @@
/*! The UDP port where we receive multiplexed CS user
 * plane traffic from HNBs */
uint16_t iuh_cs_mux_port;
-   const char *iucs_remote_ip;
-   uint16_t iucs_remote_port;
-   const char *iups_remote_ip;
-   uint16_t iups_remote_port;
+   const char *iucs_remote_addr_name;
+   const char *iups_remote_addr_name;
uint16_t rnc_id;
bool hnbap_allow_tmsi;
} config;
@@ -134,11 +132,11 @@
 
/* currently active CN links for CS and PS */
struct {
-   struct osmo_sccp_instance *instance;
+   struct osmo_sccp_instance *client;
struct hnbgw_cnlink *cnlink;
struct osmo_sccp_addr local_addr;
-   struct osmo_sccp_addr remote_addr_cs;
-   struct osmo_sccp_addr remote_addr_ps;
+   struct osmo_sccp_addr iucs_remote_addr;
+   struct osmo_sccp_addr iups_remote_addr;
} sccp;
 };
 
diff --git a/include/osmocom/iuh/hnbgw_cn.h b/include/osmocom/iuh/hnbgw_cn.h
index 93123f2..2e61d82 100644
--- a/include/osmocom/iuh/hnbgw_cn.h
+++ b/include/osmocom/iuh/hnbgw_cn.h
@@ -2,5 +2,4 @@
 
 #include 
 
-int hnbgw_cnlink_init(struct hnb_gw *gw, const char *stp_host, uint16_t 
stp_port,
- const char *local_ip, uint32_t local_pc);
+int hnbgw_cnlink_init(struct hnb_gw *gw, const char *stp_host, uint16_t 
stp_port, const char *local_ip);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 5d9f87b..c9fdd53 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -79,14 +79,6 @@
gw->config.iuh_local_ip = talloc_strdup(gw, HNBGW_LOCAL_IP_DEFAULT);
gw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
 
-   gw->config.iucs_remote_ip = talloc_strdup(gw,
-   HNBGW_IUCS_REMOTE_IP_DEFAULT);
-   gw->config.iucs_remote_port = M3UA_PORT;
-
-   gw->config.iups_remote_ip = talloc_strdup(gw,
-   HNBGW_IUPS_REMOTE_IP_DEFAULT);
-   gw->config.iups_remote_port = M3UA_PORT;
-
gw->next_ue_ctx_id = 23;
INIT_LLIST_HEAD(>hnb_list);
INIT_LLIST_HEAD(>ue_list);
@@ -465,6 +457,7 @@
vty_info.copyright = osmo_hnbgw_copyright;
vty_init(_info);
 
+   osmo_ss7_vty_init_asp(tall_hnb_ctx);
hnbgw_vty_init(g_hnb_gw, tall_hnb_ctx);
logging_vty_add_cmds(_log_info);
 
@@ -501,23 +494,12 @@
 
ranap_set_log_area(DRANAP);
 
-   OSMO_ASSERT(g_hnb_gw->config.iucs_remote_ip);
rc = hnbgw_cnlink_init(g_hnb_gw,
-  g_hnb_gw->config.iucs_remote_ip,
-  g_hnb_gw->config.iucs_remote_port,
-  "127.0.0.5" /* FIXME: configurable */,
-  23 /* FIXME: configurable */);
+  "127.0.0.1", M3UA_PORT, "127.0.0.5" /* FIXME: 
configurable */);
if (rc < 0) {
LOGP(DMAIN, LOGL_ERROR, "Failed to initialize SCCP link to 
CN\n");
exit(1);
}
-
-   osmo_sccp_make_addr_pc_ssn(_hnb_gw->sccp.remote_addr_cs,
-  1 /* FIXME: configurable */,
-  OSMO_SCCP_SSN_RANAP);
-   osmo_sccp_make_addr_pc_ssn(_hnb_gw->sccp.remote_addr_ps,
-  2 /* FIXME: configurable */,
-  OSMO_SCCP_SSN_RANAP);
 
OSMO_ASSERT(g_hnb_gw->config.iuh_local_ip);

[PATCH] osmo-iuh[master]: make point codes configurable by SCCP address book

2017-08-07 Thread Neels Hofmeyr
Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/3394

to look at the new patch set (#2).

make point codes configurable by SCCP address book

In the vty config, use the SCCP address book to configure the local and remote
SCCP addresses. Add VTY commands to set the remote SCCP addresses by name,
derive the ss7 instance from these addresses:

  cs7 instance 1
   point-code 0.23.0
   sccp-address msc
point-code 0.0.1
   sccp-address sgsn
point-code 0.0.2
  hnbgw
   iucs
remote-addr msc
   iups
remote-addr sgsn

Enforce that both IuCS and IuPS use the same ss7 instance. In the future, we
may add the feature to use two separate instances.

Depends: libosmo-sccp I75c67d289693f1c2a049ac61cf2b2097d6e5687d,
 Ie1aedd7894acd69ddc887cd65a8a0df4b38c,
 I85b46269dbe7909e52873ace3f720f6292a4516c

Change-Id: I33a7ba11eb7c2d9a5dc74d10fb0cf04bf664477b
---
M include/osmocom/iuh/hnbgw.h
M include/osmocom/iuh/hnbgw_cn.h
M src/hnbgw.c
M src/hnbgw_cn.c
M src/hnbgw_rua.c
M src/hnbgw_vty.c
6 files changed, 120 insertions(+), 100 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/94/3394/2

diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index db22d97..58bdab4 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -116,10 +116,8 @@
/*! The UDP port where we receive multiplexed CS user
 * plane traffic from HNBs */
uint16_t iuh_cs_mux_port;
-   const char *iucs_remote_ip;
-   uint16_t iucs_remote_port;
-   const char *iups_remote_ip;
-   uint16_t iups_remote_port;
+   const char *iucs_remote_addr_name;
+   const char *iups_remote_addr_name;
uint16_t rnc_id;
bool hnbap_allow_tmsi;
} config;
@@ -134,11 +132,11 @@
 
/* currently active CN links for CS and PS */
struct {
-   struct osmo_sccp_instance *instance;
+   struct osmo_sccp_instance *client;
struct hnbgw_cnlink *cnlink;
struct osmo_sccp_addr local_addr;
-   struct osmo_sccp_addr remote_addr_cs;
-   struct osmo_sccp_addr remote_addr_ps;
+   struct osmo_sccp_addr iucs_remote_addr;
+   struct osmo_sccp_addr iups_remote_addr;
} sccp;
 };
 
diff --git a/include/osmocom/iuh/hnbgw_cn.h b/include/osmocom/iuh/hnbgw_cn.h
index 93123f2..2e61d82 100644
--- a/include/osmocom/iuh/hnbgw_cn.h
+++ b/include/osmocom/iuh/hnbgw_cn.h
@@ -2,5 +2,4 @@
 
 #include 
 
-int hnbgw_cnlink_init(struct hnb_gw *gw, const char *stp_host, uint16_t 
stp_port,
- const char *local_ip, uint32_t local_pc);
+int hnbgw_cnlink_init(struct hnb_gw *gw, const char *stp_host, uint16_t 
stp_port, const char *local_ip);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 5d9f87b..409110f 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -79,14 +79,6 @@
gw->config.iuh_local_ip = talloc_strdup(gw, HNBGW_LOCAL_IP_DEFAULT);
gw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
 
-   gw->config.iucs_remote_ip = talloc_strdup(gw,
-   HNBGW_IUCS_REMOTE_IP_DEFAULT);
-   gw->config.iucs_remote_port = M3UA_PORT;
-
-   gw->config.iups_remote_ip = talloc_strdup(gw,
-   HNBGW_IUPS_REMOTE_IP_DEFAULT);
-   gw->config.iups_remote_port = M3UA_PORT;
-
gw->next_ue_ctx_id = 23;
INIT_LLIST_HEAD(>hnb_list);
INIT_LLIST_HEAD(>ue_list);
@@ -465,6 +457,7 @@
vty_info.copyright = osmo_hnbgw_copyright;
vty_init(_info);
 
+   osmo_ss7_vty_init_asp();
hnbgw_vty_init(g_hnb_gw, tall_hnb_ctx);
logging_vty_add_cmds(_log_info);
 
@@ -501,23 +494,12 @@
 
ranap_set_log_area(DRANAP);
 
-   OSMO_ASSERT(g_hnb_gw->config.iucs_remote_ip);
rc = hnbgw_cnlink_init(g_hnb_gw,
-  g_hnb_gw->config.iucs_remote_ip,
-  g_hnb_gw->config.iucs_remote_port,
-  "127.0.0.5" /* FIXME: configurable */,
-  23 /* FIXME: configurable */);
+  "127.0.0.1", M3UA_PORT, "127.0.0.5" /* FIXME: 
configurable */);
if (rc < 0) {
LOGP(DMAIN, LOGL_ERROR, "Failed to initialize SCCP link to 
CN\n");
exit(1);
}
-
-   osmo_sccp_make_addr_pc_ssn(_hnb_gw->sccp.remote_addr_cs,
-  1 /* FIXME: configurable */,
-  OSMO_SCCP_SSN_RANAP);
-   osmo_sccp_make_addr_pc_ssn(_hnb_gw->sccp.remote_addr_ps,
-  2 /* FIXME: configurable */,
-  OSMO_SCCP_SSN_RANAP);
 
OSMO_ASSERT(g_hnb_gw->config.iuh_local_ip);
LOGP(DMAIN, 

[PATCH] osmo-iuh[master]: make point codes configurable by SCCP address book

2017-07-31 Thread Neels Hofmeyr

Review at  https://gerrit.osmocom.org/3394

make point codes configurable by SCCP address book

In the vty config, use the SCCP address book to configure the local and remote
SCCP addresses. Add VTY commands to set the remote SCCP addresses by name,
derive the ss7 instance from these addresses:

  cs7 instance 1
   point-code 0.23.0
   sccp-address msc
point-code 0.0.1
   sccp-address sgsn
point-code 0.0.2
  hnbgw
   iucs
remote-addr msc
   iups
remote-addr sgsn

Enforce that both IuCS and IuPS use the same ss7 instance. In the future, we
may add the feature to use two separate instances.

Depends: libosmo-sccp I75c67d289693f1c2a049ac61cf2b2097d6e5687d,
 Ie1aedd7894acd69ddc887cd65a8a0df4b38c,
 I85b46269dbe7909e52873ace3f720f6292a4516c

Change-Id: I33a7ba11eb7c2d9a5dc74d10fb0cf04bf664477b
---
M include/osmocom/iuh/hnbgw.h
M include/osmocom/iuh/hnbgw_cn.h
M src/hnbgw.c
M src/hnbgw_cn.c
M src/hnbgw_rua.c
M src/hnbgw_vty.c
6 files changed, 118 insertions(+), 98 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/94/3394/1

diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index db22d97..58bdab4 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -116,10 +116,8 @@
/*! The UDP port where we receive multiplexed CS user
 * plane traffic from HNBs */
uint16_t iuh_cs_mux_port;
-   const char *iucs_remote_ip;
-   uint16_t iucs_remote_port;
-   const char *iups_remote_ip;
-   uint16_t iups_remote_port;
+   const char *iucs_remote_addr_name;
+   const char *iups_remote_addr_name;
uint16_t rnc_id;
bool hnbap_allow_tmsi;
} config;
@@ -134,11 +132,11 @@
 
/* currently active CN links for CS and PS */
struct {
-   struct osmo_sccp_instance *instance;
+   struct osmo_sccp_instance *client;
struct hnbgw_cnlink *cnlink;
struct osmo_sccp_addr local_addr;
-   struct osmo_sccp_addr remote_addr_cs;
-   struct osmo_sccp_addr remote_addr_ps;
+   struct osmo_sccp_addr iucs_remote_addr;
+   struct osmo_sccp_addr iups_remote_addr;
} sccp;
 };
 
diff --git a/include/osmocom/iuh/hnbgw_cn.h b/include/osmocom/iuh/hnbgw_cn.h
index 93123f2..2e61d82 100644
--- a/include/osmocom/iuh/hnbgw_cn.h
+++ b/include/osmocom/iuh/hnbgw_cn.h
@@ -2,5 +2,4 @@
 
 #include 
 
-int hnbgw_cnlink_init(struct hnb_gw *gw, const char *stp_host, uint16_t 
stp_port,
- const char *local_ip, uint32_t local_pc);
+int hnbgw_cnlink_init(struct hnb_gw *gw, const char *stp_host, uint16_t 
stp_port, const char *local_ip);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 5d9f87b..409110f 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -79,14 +79,6 @@
gw->config.iuh_local_ip = talloc_strdup(gw, HNBGW_LOCAL_IP_DEFAULT);
gw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
 
-   gw->config.iucs_remote_ip = talloc_strdup(gw,
-   HNBGW_IUCS_REMOTE_IP_DEFAULT);
-   gw->config.iucs_remote_port = M3UA_PORT;
-
-   gw->config.iups_remote_ip = talloc_strdup(gw,
-   HNBGW_IUPS_REMOTE_IP_DEFAULT);
-   gw->config.iups_remote_port = M3UA_PORT;
-
gw->next_ue_ctx_id = 23;
INIT_LLIST_HEAD(>hnb_list);
INIT_LLIST_HEAD(>ue_list);
@@ -465,6 +457,7 @@
vty_info.copyright = osmo_hnbgw_copyright;
vty_init(_info);
 
+   osmo_ss7_vty_init_asp();
hnbgw_vty_init(g_hnb_gw, tall_hnb_ctx);
logging_vty_add_cmds(_log_info);
 
@@ -501,23 +494,12 @@
 
ranap_set_log_area(DRANAP);
 
-   OSMO_ASSERT(g_hnb_gw->config.iucs_remote_ip);
rc = hnbgw_cnlink_init(g_hnb_gw,
-  g_hnb_gw->config.iucs_remote_ip,
-  g_hnb_gw->config.iucs_remote_port,
-  "127.0.0.5" /* FIXME: configurable */,
-  23 /* FIXME: configurable */);
+  "127.0.0.1", M3UA_PORT, "127.0.0.5" /* FIXME: 
configurable */);
if (rc < 0) {
LOGP(DMAIN, LOGL_ERROR, "Failed to initialize SCCP link to 
CN\n");
exit(1);
}
-
-   osmo_sccp_make_addr_pc_ssn(_hnb_gw->sccp.remote_addr_cs,
-  1 /* FIXME: configurable */,
-  OSMO_SCCP_SSN_RANAP);
-   osmo_sccp_make_addr_pc_ssn(_hnb_gw->sccp.remote_addr_ps,
-  2 /* FIXME: configurable */,
-  OSMO_SCCP_SSN_RANAP);
 
OSMO_ASSERT(g_hnb_gw->config.iuh_local_ip);
LOGP(DMAIN, LOGL_NOTICE, "Listening for Iuh at %s %d\n",
diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c
index e967260..4bd6506 100644