osmo-gsm-manuals[master]: Add Osmo-GSM-Tester manual

2017-04-14 Thread Harald Welte

Patch Set 2: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2325
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8a9c0bfbce0072359c5094b940f225082d6847a7
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] libosmo-netif[master]: ipa.h: Don't redefine what libosmocore already defines

2017-04-14 Thread Harald Welte

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

ipa.h: Don't redefine what libosmocore already defines

Change-Id: Ibd81efc1dc61b8c2019d55a8fa6e3bb99b5acb20
---
M include/osmocom/netif/ipa.h
1 file changed, 5 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/26/2326/1

diff --git a/include/osmocom/netif/ipa.h b/include/osmocom/netif/ipa.h
index 4e28e1a..8d221e3 100644
--- a/include/osmocom/netif/ipa.h
+++ b/include/osmocom/netif/ipa.h
@@ -1,49 +1,21 @@
 #ifndef _OSMO_NETIF_IPA_H_
 #define _OSMO_NETIF_IPA_H_
 
+#include 
+
+/* This is like 'struct ipaccess_head' in libosmocore, but 'ipa_head' is
+ * actually the more apropriate name, so rather than making more code
+ * use the wrong name, let's keep the duplicate header definitions below */
 struct ipa_head {
uint16_t len;   /* network byte order */
uint8_t proto;
uint8_t data[0];
 } __attribute__ ((packed));
 
-/* IPA protocols. */
-#define IPAC_PROTO_RSL 0x00
-#define IPAC_PROTO_IPACCESS0xfe
-#define IPAC_PROTO_SCCP0xfd
-#define IPAC_PROTO_OML 0xff
-#define IPAC_PROTO_OSMO0xee/* OpenBSC extension. */
-#define IPAC_PROTO_MGCP_OLD0xfc/* OpenBSC extension. */
-
 struct ipa_head_ext {
uint8_t proto;
uint8_t data[0];
 } __attribute__ ((packed));
-
-/* Protocol extensions. */
-#define IPAC_PROTO_EXT_CTRL0x00
-#define IPAC_PROTO_EXT_MGCP0x01
-#define IPAC_PROTO_EXT_LAC 0x02
-
-/* Message types. */
-#define IPAC_MSGT_PING 0x00
-#define IPAC_MSGT_PONG 0x01
-#define IPAC_MSGT_ID_GET   0x04
-#define IPAC_MSGT_ID_RESP  0x05
-#define IPAC_MSGT_ID_ACK   0x06
-#define IPAC_MSGT_SCCP_OLD 0xff/* OpenBSC extension */
-
-enum ipaccess_id_tags {
-   IPAC_IDTAG_SERNR= 0x00,
-   IPAC_IDTAG_UNITNAME = 0x01,
-   IPAC_IDTAG_LOCATION1= 0x02,
-   IPAC_IDTAG_LOCATION2= 0x03,
-   IPAC_IDTAG_EQUIPVERS= 0x04,
-   IPAC_IDTAG_SWVERSION= 0x05,
-   IPAC_IDTAG_IPADDR   = 0x06,
-   IPAC_IDTAG_MACADDR  = 0x07,
-   IPAC_IDTAG_UNIT = 0x08,
-};
 
 struct msgb *osmo_ipa_msg_alloc(int headroom);
 void osmo_ipa_msg_push_header(struct msgb *msg, uint8_t proto);

-- 
To view, visit https://gerrit.osmocom.org/2326
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd81efc1dc61b8c2019d55a8fa6e3bb99b5acb20
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-netif[master]: osmo_stream_srv_fd_cb(): don't leak socket FDs on errors

2017-04-14 Thread Harald Welte
Hello Neels Hofmeyr, Jenkins Builder,

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

https://gerrit.osmocom.org/1320

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

osmo_stream_srv_fd_cb(): don't leak socket FDs on errors

So far we seem to assume that the accept_cb does all handling of socket
fd cleanup. However, there are cases where there is no accept_cb set,
the accept_cb returns error, or an earlier sctp_sock_activate_events()
or the activation of non-blocking mode fails.

For those cases, close the socket and return an error code.

Fixes: CID#57915
Change-Id: I3a3ce9194ab7ca5c1921fc79c2a1c9e10a552cf0
---
M src/stream.c
1 file changed, 23 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/20/1320/2

diff --git a/src/stream.c b/src/stream.c
index 591cd06..653f26b 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -529,6 +529,7 @@
 static int osmo_stream_srv_fd_cb(struct osmo_fd *ofd, unsigned int what)
 {
int ret;
+   int sock_fd;
struct sockaddr_in sa;
socklen_t sa_len = sizeof(sa);
struct osmo_stream_srv_link *link = ofd->data;
@@ -541,17 +542,33 @@
}
LOGP(DLINP, LOGL_DEBUG, "accept()ed new link from %s to port %u\n",
inet_ntoa(sa.sin_addr), link->port);
+   sock_fd = ret;
 
-   if (link->proto == IPPROTO_SCTP)
-   sctp_sock_activate_events(ret);
+   if (link->proto == IPPROTO_SCTP) {
+   ret = sctp_sock_activate_events(sock_fd);
+   if (ret < 0)
+   goto error_close_socket;
+   }
 
-   if (link->flags & OSMO_STREAM_SRV_F_NODELAY)
-   setsockopt_nodelay(ret, link->proto, 1);
+   if (link->flags & OSMO_STREAM_SRV_F_NODELAY) {
+   ret = setsockopt_nodelay(ret, link->proto, 1);
+   if (ret < 0)
+   goto error_close_socket;
+   }
 
-   if (link->accept_cb)
-   link->accept_cb(link, ret);
+   if (!link->accept_cb) {
+   ret = -ENOTSUP;
+   goto error_close_socket;
+   }
 
+   ret = link->accept_cb(link, sock_fd);
+   if (ret)
+   goto error_close_socket;
return 0;
+
+error_close_socket:
+   close(sock_fd);
+   return ret;
 }
 
 /*! \brief Create an Osmocom Stream Server Link

-- 
To view, visit https://gerrit.osmocom.org/1320
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3a3ce9194ab7ca5c1921fc79c2a1c9e10a552cf0
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 


libosmo-netif[master]: osmo_stream_srv_fd_cb(): don't leak socket FDs on errors

2017-04-14 Thread Harald Welte
Harald Welte has restored this change.

Change subject: osmo_stream_srv_fd_cb(): don't leak socket FDs on errors
..


Restored

-- 
To view, visit https://gerrit.osmocom.org/1320
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: restore
Gerrit-Change-Id: I3a3ce9194ab7ca5c1921fc79c2a1c9e10a552cf0
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 


libosmo-netif[master]: ipa.h: Don't redefine what libosmocore already defines

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2326
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibd81efc1dc61b8c2019d55a8fa6e3bb99b5acb20
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-netif[master]: ipa.h: Don't redefine what libosmocore already defines

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: ipa.h: Don't redefine what libosmocore already defines
..


ipa.h: Don't redefine what libosmocore already defines

Change-Id: Ibd81efc1dc61b8c2019d55a8fa6e3bb99b5acb20
---
M include/osmocom/netif/ipa.h
1 file changed, 5 insertions(+), 33 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/netif/ipa.h b/include/osmocom/netif/ipa.h
index 4e28e1a..8d221e3 100644
--- a/include/osmocom/netif/ipa.h
+++ b/include/osmocom/netif/ipa.h
@@ -1,49 +1,21 @@
 #ifndef _OSMO_NETIF_IPA_H_
 #define _OSMO_NETIF_IPA_H_
 
+#include 
+
+/* This is like 'struct ipaccess_head' in libosmocore, but 'ipa_head' is
+ * actually the more apropriate name, so rather than making more code
+ * use the wrong name, let's keep the duplicate header definitions below */
 struct ipa_head {
uint16_t len;   /* network byte order */
uint8_t proto;
uint8_t data[0];
 } __attribute__ ((packed));
 
-/* IPA protocols. */
-#define IPAC_PROTO_RSL 0x00
-#define IPAC_PROTO_IPACCESS0xfe
-#define IPAC_PROTO_SCCP0xfd
-#define IPAC_PROTO_OML 0xff
-#define IPAC_PROTO_OSMO0xee/* OpenBSC extension. */
-#define IPAC_PROTO_MGCP_OLD0xfc/* OpenBSC extension. */
-
 struct ipa_head_ext {
uint8_t proto;
uint8_t data[0];
 } __attribute__ ((packed));
-
-/* Protocol extensions. */
-#define IPAC_PROTO_EXT_CTRL0x00
-#define IPAC_PROTO_EXT_MGCP0x01
-#define IPAC_PROTO_EXT_LAC 0x02
-
-/* Message types. */
-#define IPAC_MSGT_PING 0x00
-#define IPAC_MSGT_PONG 0x01
-#define IPAC_MSGT_ID_GET   0x04
-#define IPAC_MSGT_ID_RESP  0x05
-#define IPAC_MSGT_ID_ACK   0x06
-#define IPAC_MSGT_SCCP_OLD 0xff/* OpenBSC extension */
-
-enum ipaccess_id_tags {
-   IPAC_IDTAG_SERNR= 0x00,
-   IPAC_IDTAG_UNITNAME = 0x01,
-   IPAC_IDTAG_LOCATION1= 0x02,
-   IPAC_IDTAG_LOCATION2= 0x03,
-   IPAC_IDTAG_EQUIPVERS= 0x04,
-   IPAC_IDTAG_SWVERSION= 0x05,
-   IPAC_IDTAG_IPADDR   = 0x06,
-   IPAC_IDTAG_MACADDR  = 0x07,
-   IPAC_IDTAG_UNIT = 0x08,
-};
 
 struct msgb *osmo_ipa_msg_alloc(int headroom);
 void osmo_ipa_msg_push_header(struct msgb *msg, uint8_t proto);

-- 
To view, visit https://gerrit.osmocom.org/2326
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibd81efc1dc61b8c2019d55a8fa6e3bb99b5acb20
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-bts[master]: octphy: set tx/rx antenne IDs via VTY

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: octphy: set tx/rx antenne IDs via VTY
..


octphy: set tx/rx antenne IDs via VTY

add support for the TX/RX antenna-id feature that has been
introduced with release OCTSDR-2G-02.07.00-B1314-BETA. The
user can now set individual ID numbers for the TX and for
the RX antenna.

Change-Id: I872fe3c4d7b593358a4ce2f02cf0726611b9f3aa
---
M configure.ac
M include/osmo-bts/phy_link.h
M src/osmo-bts-octphy/l1_oml.c
M src/osmo-bts-octphy/octphy_vty.c
4 files changed, 64 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/configure.ac b/configure.ac
index cbfbf12..a03b2dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,13 @@
[],
[#include ])
 
+   AC_CHECK_MEMBER([tOCTVC1_GSM_RF_CONFIG.ulTxAntennaId],
+   AC_DEFINE([OCTPHY_USE_ANTENNA_ID],
+   [1],
+   [Define to 1 if your octphy header files support 
antenna ids in tOCTVC1_GSM_RF_CONFIG]),
+   [],
+   [#include ])
+
CPPFLAGS=$oldCPPFLAGS
 fi
 
diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index e644a91..e8fd7eb 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -53,6 +53,10 @@
 
/* configuration */
uint32_t rf_port_index;
+#if OCTPHY_USE_ANTENNA_ID == 1
+   uint32_t rx_ant_id;
+   uint32_t tx_ant_id;
+#endif
uint32_t rx_gain_db;
bool tx_atten_flag;
uint32_t tx_atten_db;
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 0cd25f2..c70b45f 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1394,6 +1394,11 @@
oc->RfConfig.ulTxAttndB = (trx->max_power_red) << 2;
}
 
+#if OCTPHY_USE_ANTENNA_ID == 1
+   oc->RfConfig.ulTxAntennaId = plink->u.octphy.tx_ant_id;
+   oc->RfConfig.ulRxAntennaId = plink->u.octphy.rx_ant_id;
+#endif
+
 #if OCTPHY_MULTI_TRX == 1
LOGP(DL1C, LOGL_INFO, "Tx TRX-OPEN.req(trx=%u, rf_port=%u, arfcn=%u, "
"center=%u, tsc=%u, rx_gain=%u, tx_atten=%u)\n",
diff --git a/src/osmo-bts-octphy/octphy_vty.c b/src/osmo-bts-octphy/octphy_vty.c
index 370aff6..fb36493 100644
--- a/src/osmo-bts-octphy/octphy_vty.c
+++ b/src/osmo-bts-octphy/octphy_vty.c
@@ -117,6 +117,42 @@
return CMD_SUCCESS;
 }
 
+#if OCTPHY_USE_ANTENNA_ID == 1
+DEFUN(cfg_phy_rx_ant_id, cfg_phy_rx_ant_id_cmd,
+  "octphy rx-ant-id <0-1>",
+  OCT_STR "Configure the RX Antenna for this TRX\n" "RX Antenna Id\n")
+{
+   struct phy_link *plink = vty->index;
+
+   if (plink->state != PHY_LINK_SHUTDOWN) {
+   vty_out(vty, "Can only reconfigure a PHY link that is down%s",
+   VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
+   plink->u.octphy.rx_ant_id = atoi(argv[0]);
+
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_phy_tx_ant_id, cfg_phy_tx_ant_id_cmd,
+  "octphy tx-ant-id <0-1>",
+  OCT_STR "Configure the TX Antenna for this TRX\n" "TX Antenna Id\n")
+{
+   struct phy_link *plink = vty->index;
+
+   if (plink->state != PHY_LINK_SHUTDOWN) {
+   vty_out(vty, "Can only reconfigure a PHY link that is down%s",
+   VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
+   plink->u.octphy.tx_ant_id = atoi(argv[0]);
+
+   return CMD_SUCCESS;
+}
+#endif
+
 DEFUN(cfg_phy_rx_gain_db, cfg_phy_rx_gain_db_cmd,
"octphy rx-gain <0-73>",
OCT_STR "Configure the Rx Gain in dB\n"
@@ -300,6 +336,14 @@
 
vty_out(vty, " octphy rf-port-index %u%s", 
plink->u.octphy.rf_port_index,
VTY_NEWLINE);
+
+#if OCTPHY_USE_ANTENNA_ID == 1
+   vty_out(vty, " octphy tx-ant-id %u%s", plink->u.octphy.tx_ant_id,
+   VTY_NEWLINE);
+
+   vty_out(vty, " octphy rx-ant-id %u%s", plink->u.octphy.rx_ant_id,
+   VTY_NEWLINE);
+#endif
 }
 
 void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance 
*pinst)
@@ -347,6 +391,10 @@
install_element(PHY_NODE, &cfg_phy_hwaddr_cmd);
install_element(PHY_NODE, &cfg_phy_netdev_cmd);
install_element(PHY_NODE, &cfg_phy_rf_port_idx_cmd);
+#if OCTPHY_USE_ANTENNA_ID == 1
+   install_element(PHY_NODE, &cfg_phy_rx_ant_id_cmd);
+   install_element(PHY_NODE, &cfg_phy_tx_ant_id_cmd);
+#endif
install_element(PHY_NODE, &cfg_phy_rx_gain_db_cmd);
install_element(PHY_NODE, &cfg_phy_tx_atten_db_cmd);
 

-- 
To view, visit https://gerrit.osmocom.org/1976
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I872fe3c4d

[MERGED] osmo-bts[master]: octphy: fix usage of wrong define constant

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: octphy: fix usage of wrong define constant
..


octphy: fix usage of wrong define constant

octphy_hw_get_rf_ant_tx_config() uses define constant
cOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_RX_CONFIG_CID instead of
cOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_CID. This commit
replaces exchanges the wrong constant with the correct one.

Change-Id: Ie4de23daf79bb07ca0c0b818eefe350d18d27e4d
---
M src/osmo-bts-octphy/octphy_hw_api.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-octphy/octphy_hw_api.c 
b/src/osmo-bts-octphy/octphy_hw_api.c
index f77..0d6fabd 100644
--- a/src/osmo-bts-octphy/octphy_hw_api.c
+++ b/src/osmo-bts-octphy/octphy_hw_api.c
@@ -237,7 +237,7 @@
msgb_put(msg, sizeof(*psc));
 
l1if_fill_msg_hdr(&psc->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND,
- cOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_RX_CONFIG_CID);
+ cOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_CID);
 
psc->ulPortIndex = port_idx;
psc->ulAntennaIndex = ant_idx;

-- 
To view, visit https://gerrit.osmocom.org/1966
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie4de23daf79bb07ca0c0b818eefe350d18d27e4d
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-bts[master]: octphy: add CBCH support

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: octphy: add CBCH support
..


octphy: add CBCH support

add Support for CBCH channels in osmo-bts-octphy

Change-Id: Ic5c8363b4dd8ba78ab22bd5527c08d1162331540
---
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-octphy/l1_oml.c
2 files changed, 19 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index 0fc51fc..b42fb3a 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "l1_if.h"
 #include "l1_oml.h"
@@ -340,9 +341,11 @@
cbits = 0x02 + subCh;
break;
case GSM_PCHAN_CCCH_SDCCH4:
+   case GSM_PCHAN_CCCH_SDCCH4_CBCH:
cbits = 0x04 + subCh;
break;
case GSM_PCHAN_SDCCH8_SACCH8C:
+   case GSM_PCHAN_SDCCH8_SACCH8C_CBCH:
cbits = 0x08 + subCh;
break;
default:
@@ -353,9 +356,11 @@
case cOCTVC1_GSM_SAPI_ENUM_SDCCH:
switch (pchan) {
case GSM_PCHAN_CCCH_SDCCH4:
+   case GSM_PCHAN_CCCH_SDCCH4_CBCH:
cbits = 0x04 + subCh;
break;
case GSM_PCHAN_SDCCH8_SACCH8C:
+   case GSM_PCHAN_SDCCH8_SACCH8C_CBCH:
cbits = 0x08 + subCh;
break;
default:
@@ -918,6 +923,10 @@
(g_time.t1 << 7) | (g_time.t2 << 2) | (t3p >> 1);
data_req->Data.abyDataContent[3] = (t3p & 1);
break;
+   case cOCTVC1_GSM_SAPI_ENUM_CBCH:
+   rc = bts_cbch_get(bts, data_req->Data.abyDataContent, &g_time);
+   data_req->Data.ulDataLength = 23;   /* GSM MAX BLK SIZE */
+   break;
case cOCTVC1_GSM_SAPI_ENUM_PRACH:
 #if 0
/* in case we decide to send an empty frame... */
@@ -1101,7 +1110,8 @@
l1sap->u.rach_ind.acc_delay = acc_delay;
l1sap->u.rach_ind.fn = fn;
if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
-   lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4)
+   lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
+   lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
l1sap->u.rach_ind.chan_nr = 0x88;
else
l1sap->u.rach_ind.chan_nr = gsm_lchan2chan_nr(lchan);
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index a68169e..6857a5d 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -64,6 +64,12 @@
// TODO - watch out below two!!!
[GSM_PCHAN_PDCH]= 
cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_PDTCHF_PACCHF_PTCCHF,
[GSM_PCHAN_TCH_F_PDCH]  = 
cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_PDTCHF_PACCHF_PTCCHF,
+#ifdef 
cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_FCCH_SCH_BCCH_CCCH_SDCCH4_CBCH_SACCHC4
+   [GSM_PCHAN_CCCH_SDCCH4_CBCH]= 
cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_FCCH_SCH_BCCH_CCCH_SDCCH4_CBCH_SACCHC4,
+#endif
+#ifdef cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_SDCCH8_CBCH_SACCHC8
+   [GSM_PCHAN_SDCCH8_SACCH8C_CBCH] = 
cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_SDCCH8_CBCH_SACCHC8,
+#endif
[GSM_PCHAN_UNKNOWN] = 
cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_EMPTY
 };
 
@@ -202,11 +208,13 @@
 {
switch (lchan->ts->pchan) {
case GSM_PCHAN_CCCH_SDCCH4:
+   case GSM_PCHAN_CCCH_SDCCH4_CBCH:
if (lchan->type == GSM_LCHAN_CCCH)
return cOCTVC1_GSM_ID_SUB_CHANNEL_NB_ENUM_ALL;
/* fall-through */
case GSM_PCHAN_TCH_H:
case GSM_PCHAN_SDCCH8_SACCH8C:
+   case GSM_PCHAN_SDCCH8_SACCH8C_CBCH:
return (tOCTVC1_GSM_ID_SUB_CHANNEL_NB_ENUM) lchan->nr;
case GSM_PCHAN_NONE:
case GSM_PCHAN_CCCH:

-- 
To view, visit https://gerrit.osmocom.org/1979
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic5c8363b4dd8ba78ab22bd5527c08d1162331540
Gerrit-PatchSet: 5
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-bts[master]: octphy: print log message for multi-trx support

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: octphy: print log message for multi-trx support
..


octphy: print log message for multi-trx support

Some header file versions support multi-trx and some do not. After
to compiling it is very difficult to find out if the binary is
multi-trx capable por not. This patch adds a log line that should
rule out any doubts.

Change-Id: I257c0a5e7c5ff5df2f0a603d1ede6db5679382e0
---
M src/osmo-bts-octphy/l1_oml.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 6857a5d..0cd25f2 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1187,6 +1187,12 @@
LOGP(DL1C, LOGL_INFO, "Rx APP-INFO-SYSTEM.resp (platform='%s', 
version='%s')\n",
aisr->szPlatform, aisr->szVersion);
 
+#if OCTPHY_MULTI_TRX == 1
+   LOGP(DL1C, LOGL_INFO, "Note: compiled with multi-trx support.\n");
+#else
+   LOGP(DL1C, LOGL_INFO, "Note: compiled without multi-trx support.\n");
+#endif
+
talloc_replace(fl1h->info.system.platform, fl1h, aisr->szPlatform);
talloc_replace(fl1h->info.system.version, fl1h, aisr->szVersion);
 

-- 
To view, visit https://gerrit.osmocom.org/2315
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I257c0a5e7c5ff5df2f0a603d1ede6db5679382e0
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-bts[master]: octphy: display hint in case of wrongly configured transceiv...

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: octphy: display hint in case of wrongly configured transceiver 
number
..


octphy: display hint in case of wrongly configured transceiver number

Making use of the multi-trx feature requires to tell osmo-bts that
more than one transceiver are available. Otherwise it will complain
that not enough transceivers are available. This can be quite
confusing, even a correct config file will fail to parse if it
specifies more transcrivers than available.

This patch adds a hint to the error message so that the user knows
that he should check the -t commandline option

Change-Id: Ifbeacd9d43f7c6cd74a1e1b33288e66828fe843f
---
M src/common/vty.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/vty.c b/src/common/vty.c
index a48f809..44c742c 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -224,6 +224,8 @@
if (!trx) {
vty_out(vty, "Unknown TRX %u. Available TRX are: 0..%u%s",
trx_nr, bts->num_trx - 1, VTY_NEWLINE);
+   vty_out(vty, "Hint: Check if commandline option -t matches the"
+   "number of available transceivers!%s", VTY_NEWLINE);
return CMD_WARNING;
}
 

-- 
To view, visit https://gerrit.osmocom.org/2316
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifbeacd9d43f7c6cd74a1e1b33288e66828fe843f
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-bts[master]: l1sap: improve log output

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: l1sap: improve log output
..


l1sap: improve log output

Print toa and ra value with the "RACH for packet access" log
message.

Change-Id: I3a2dde95947438aa8348a0a9fc8566cbc177aa2d
---
M src/common/l1sap.c
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 19b38af..3592096 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1029,7 +1029,9 @@
if ((trx == bts->c0 && L1SAP_IS_PACKET_RACH(rach_ind->ra)) ||
(trx == bts->c0 && rach_ind->is_11bit)) {
 
-   LOGP(DL1P, LOGL_INFO, "RACH for packet access\n");
+   LOGP(DL1P, LOGL_INFO, "RACH for packet access (toa=%d, 
ra=%d)\n",
+   rach_ind->acc_delay, rach_ind->ra);
+
pcu_tx_rach_ind(bts, rach_ind->acc_delay << 2,
rach_ind->ra, rach_ind->fn,
rach_ind->is_11bit, rach_ind->burst_type);

-- 
To view, visit https://gerrit.osmocom.org/1967
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3a2dde95947438aa8348a0a9fc8566cbc177aa2d
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


[MERGED] osmo-bts[master]: octphy: add conditional compilation to support latest octasi...

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: octphy: add conditional compilation to support latest octasic 
header release
..


octphy: add conditional compilation to support latest octasic header release

With octasics latest release (octsdr-2g-02.07.01-B1351-beta), some struct
members are moved or renamed. This patch adds ifdef-logic and configure
checks to restore compatibilty.

Change-Id: I73287983e8bed8bf64b2ab87e6b810c2c59ea6fd
---
M configure.ac
M src/osmo-bts-octphy/octphy_hw_api.c
M src/osmo-bts-octphy/octphy_vty.c
3 files changed, 74 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/configure.ac b/configure.ac
index 001e10e..cbfbf12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,10 +72,46 @@
 if test "$enable_octphy" = "yes" ; then
oldCPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$OCTSDR2G_INCDIR -I$srcdir/include 
$LIBOSMOCORE_CFLAGS"
+
AC_CHECK_HEADER([octphy/octvc1/gsm/octvc1_gsm_default.h],[],
[AC_MSG_ERROR([octphy/octvc1/gsm/octvc1_gsm_default.h 
can not be found in $octsdr2g_incdir])],
[#include ])
-   AC_CHECK_MEMBER([tOCTVC1_GSM_TRX_CONFIG.usCentreArfcn], 
AC_DEFINE([OCTPHY_MULTI_TRX], [1], [Define to 1 if your octphy header files 
support multi-trx]), [], [#include ])
+
+   AC_CHECK_MEMBER([tOCTVC1_GSM_TRX_CONFIG.usCentreArfcn],
+   AC_DEFINE([OCTPHY_MULTI_TRX],
+   [1],
+   [Define to 1 if your octphy header files support 
multi-trx]),
+   [],
+   [#include ])
+
+   AC_CHECK_MEMBER([tOCTVC1_HW_RF_PORT_RX_STATS.Frequency],
+   AC_DEFINE([OCTPHY_USE_FREQUENCY],
+   [1],
+   [Define to 1 if your octphy header files support 
tOCTVC1_RADIO_FREQUENCY_VALUE type]),
+   [],
+   [#include ])
+
+   AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulSyncLossCnt],
+   AC_DEFINE([OCTPHY_USE_SYNC_LOSS_CNT],
+   [1],
+   [Define to 1 if your octphy header files renamed 
ulSyncLosseCnt to ulSyncLossCnt]),
+   [],
+   [#include ])
+
+   
AC_CHECK_MEMBER([tOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_RSP.TxConfig],
+   AC_DEFINE([OCTPHY_USE_TX_CONFIG],
+   [1],
+   [Define to 1 if your octphy header files support 
tOCTVC1_HW_RF_PORT_ANTENNA_TX_CONFIG type]),
+   [],
+   [#include ])
+
+   
AC_CHECK_MEMBER([tOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_RX_CONFIG_RSP.RxConfig],
+   AC_DEFINE([OCTPHY_USE_RX_CONFIG],
+   [1],
+   [Define to 1 if your octphy header files support 
tOCTVC1_HW_RF_PORT_ANTENNA_RX_CONFIG type]),
+   [],
+   [#include ])
+
CPPFLAGS=$oldCPPFLAGS
 fi
 
diff --git a/src/osmo-bts-octphy/octphy_hw_api.c 
b/src/osmo-bts-octphy/octphy_hw_api.c
index 0d6fabd..7b988fe 100644
--- a/src/osmo-bts-octphy/octphy_hw_api.c
+++ b/src/osmo-bts-octphy/octphy_hw_api.c
@@ -125,11 +125,19 @@
psr->RxStats.ulRxByteCnt, psr->RxStats.ulRxOverflowCnt,
psr->RxStats.ulRxAverageBytePerSecond,
psr->RxStats.ulRxAveragePeriodUs,
+#if OCTPHY_USE_FREQUENCY == 1
+   psr->RxStats.Frequency.ulValue,
+#else
psr->RxStats.ulFrequencyKhz,
+#endif
psr->TxStats.ulTxByteCnt, psr->TxStats.ulTxUnderflowCnt,
psr->TxStats.ulTxAverageBytePerSecond,
psr->TxStats.ulTxAveragePeriodUs,
+#if OCTPHY_USE_FREQUENCY == 1
+   psr->TxStats.Frequency.ulValue);
+#else
psr->TxStats.ulFrequencyKhz);
+#endif
 
get_cb_data = (struct octphy_hw_get_cb_data*) data;
get_cb_data->cb(resp,get_cb_data->data);
@@ -177,10 +185,15 @@
LOGP(DL1C, LOGL_INFO, "ANT-RX-CONFIG.resp(Port=%u, Ant=%u): %s, "
"Gain %d dB, GainCtrlMode=%s\n",
arc->ulPortIndex,  arc->ulAntennaIndex,
+#ifdef OCTPHY_USE_RX_CONFIG
+   arc->RxConfig.ulEnableFlag ? "Enabled" : "Disabled",
+   arc->RxConfig.lRxGaindB/512,
+   get_value_string(rx_gain_mode_vals, 
arc->RxConfig.ulRxGainMode));
+#else
arc->ulEnableFlag ? "Enabled" : "Disabled",
arc->lRxGaindB/512,
get_value_string(rx_gain_mode_vals, arc->ulRxGainMode));
-
+#endif
msgb_free(resp);
return 0;
 }
@@ -219,9 +232,14 @@
LOGP(DL1C, LOGL_INFO, "ANT-TX-CONFIG.resp(Port=%u, Ant=%u): %s, "
"Gain %d dB\n",
atc->ulPortIndex, atc->ulAnten

libosmo-netif[master]: osmo_stream_srv_fd_cb(): don't leak socket FDs on errors

2017-04-14 Thread Harald Welte

Patch Set 2: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/1320
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I3a3ce9194ab7ca5c1921fc79c2a1c9e10a552cf0
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


[MERGED] libosmo-netif[master]: osmo_stream_srv_fd_cb(): don't leak socket FDs on errors

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo_stream_srv_fd_cb(): don't leak socket FDs on errors
..


osmo_stream_srv_fd_cb(): don't leak socket FDs on errors

So far we seem to assume that the accept_cb does all handling of socket
fd cleanup. However, there are cases where there is no accept_cb set,
the accept_cb returns error, or an earlier sctp_sock_activate_events()
or the activation of non-blocking mode fails.

For those cases, close the socket and return an error code.

Fixes: CID#57915
Change-Id: I3a3ce9194ab7ca5c1921fc79c2a1c9e10a552cf0
---
M src/stream.c
1 file changed, 23 insertions(+), 6 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/stream.c b/src/stream.c
index 591cd06..653f26b 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -529,6 +529,7 @@
 static int osmo_stream_srv_fd_cb(struct osmo_fd *ofd, unsigned int what)
 {
int ret;
+   int sock_fd;
struct sockaddr_in sa;
socklen_t sa_len = sizeof(sa);
struct osmo_stream_srv_link *link = ofd->data;
@@ -541,17 +542,33 @@
}
LOGP(DLINP, LOGL_DEBUG, "accept()ed new link from %s to port %u\n",
inet_ntoa(sa.sin_addr), link->port);
+   sock_fd = ret;
 
-   if (link->proto == IPPROTO_SCTP)
-   sctp_sock_activate_events(ret);
+   if (link->proto == IPPROTO_SCTP) {
+   ret = sctp_sock_activate_events(sock_fd);
+   if (ret < 0)
+   goto error_close_socket;
+   }
 
-   if (link->flags & OSMO_STREAM_SRV_F_NODELAY)
-   setsockopt_nodelay(ret, link->proto, 1);
+   if (link->flags & OSMO_STREAM_SRV_F_NODELAY) {
+   ret = setsockopt_nodelay(ret, link->proto, 1);
+   if (ret < 0)
+   goto error_close_socket;
+   }
 
-   if (link->accept_cb)
-   link->accept_cb(link, ret);
+   if (!link->accept_cb) {
+   ret = -ENOTSUP;
+   goto error_close_socket;
+   }
 
+   ret = link->accept_cb(link, sock_fd);
+   if (ret)
+   goto error_close_socket;
return 0;
+
+error_close_socket:
+   close(sock_fd);
+   return ret;
 }
 
 /*! \brief Create an Osmocom Stream Server Link

-- 
To view, visit https://gerrit.osmocom.org/1320
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3a3ce9194ab7ca5c1921fc79c2a1c9e10a552cf0
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 


[PATCH] libosmocore[master]: vty/command.h: Introduce VTY nodes for libosmo-sigtran

2017-04-14 Thread Harald Welte

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

vty/command.h: Introduce VTY nodes for libosmo-sigtran

This adds several VTY nodes required by the libosmo-sigtran VTY
interface.

Change-Id: I184a7e3187b48c15c71bf773f86e188fe1daad15
---
M include/osmocom/vty/command.h
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/2327/1

diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h
index 135ef2f..b39bbf7 100644
--- a/include/osmocom/vty/command.h
+++ b/include/osmocom/vty/command.h
@@ -85,6 +85,14 @@
L_BSSGP_NODE,   /*!< \brief BSSGP node in libosmo-gb. */
L_CTRL_NODE,/*!< \brief Control interface node. */
 
+   L_CS7_NODE, /*!< \brief SS7 root node */
+   L_CS7_AS_NODE,  /*!< \brief SS7 Application Server */
+   L_CS7_ASP_NODE, /*!< \brief SS7 Application Server Process */
+   L_CS7_XUA_NODE, /*!< \brief SS7 xUA Listener */
+   L_CS7_RTABLE_NODE,  /*!< \brief SS7 Routing Table */
+   L_CS7_LINK_NODE,/*!< \brief SS7 Link */
+   L_CS7_LINKSET_NODE, /*!< \brief SS7 Linkset */
+
/*
 * When adding new nodes to the libosmocore project, these nodes can be
 * used to avoid ABI changes for unrelated projects.

-- 
To view, visit https://gerrit.osmocom.org/2327
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I184a7e3187b48c15c71bf773f86e188fe1daad15
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[MERGED] libosmocore[master]: vty/command.h: Introduce VTY nodes for libosmo-sigtran

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: vty/command.h: Introduce VTY nodes for libosmo-sigtran
..


vty/command.h: Introduce VTY nodes for libosmo-sigtran

This adds several VTY nodes required by the libosmo-sigtran VTY
interface.

Change-Id: I184a7e3187b48c15c71bf773f86e188fe1daad15
---
M include/osmocom/vty/command.h
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h
index 135ef2f..b39bbf7 100644
--- a/include/osmocom/vty/command.h
+++ b/include/osmocom/vty/command.h
@@ -85,6 +85,14 @@
L_BSSGP_NODE,   /*!< \brief BSSGP node in libosmo-gb. */
L_CTRL_NODE,/*!< \brief Control interface node. */
 
+   L_CS7_NODE, /*!< \brief SS7 root node */
+   L_CS7_AS_NODE,  /*!< \brief SS7 Application Server */
+   L_CS7_ASP_NODE, /*!< \brief SS7 Application Server Process */
+   L_CS7_XUA_NODE, /*!< \brief SS7 xUA Listener */
+   L_CS7_RTABLE_NODE,  /*!< \brief SS7 Routing Table */
+   L_CS7_LINK_NODE,/*!< \brief SS7 Link */
+   L_CS7_LINKSET_NODE, /*!< \brief SS7 Linkset */
+
/*
 * When adding new nodes to the libosmocore project, these nodes can be
 * used to avoid ABI changes for unrelated projects.

-- 
To view, visit https://gerrit.osmocom.org/2327
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I184a7e3187b48c15c71bf773f86e188fe1daad15
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: vty/command.h: Introduce VTY nodes for libosmo-sigtran

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2327
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I184a7e3187b48c15c71bf773f86e188fe1daad15
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Merge the SUA and M3UA VTY nodes

2017-04-14 Thread Harald Welte

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

osmo_ss7_vty: Merge the SUA and M3UA VTY nodes

The xUA servers have pretty much everything in common, there's no point
in introducing a separate VTY note for each xUA flavor.

Change-Id: I5b842b7f10d94957398cf0c0406c440c495a0bdc
---
M stp/internal.h
M stp/osmo_ss7_vty.c
2 files changed, 41 insertions(+), 106 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/29/2329/1

diff --git a/stp/internal.h b/stp/internal.h
index 31d95ba..cbd6bac 100644
--- a/stp/internal.h
+++ b/stp/internal.h
@@ -6,8 +6,7 @@
L_CS7_NODE = _LAST_OSMOVTY_NODE + 1,
L_CS7_AS_NODE,
L_CS7_ASP_NODE,
-   L_CS7_SUA_NODE,
-   L_CS7_M3UA_NODE,
+   L_CS7_XUA_NODE,
L_CS7_RTABLE_NODE,
 };
 
diff --git a/stp/osmo_ss7_vty.c b/stp/osmo_ss7_vty.c
index 29693a8..fe7bc41 100644
--- a/stp/osmo_ss7_vty.c
+++ b/stp/osmo_ss7_vty.c
@@ -328,58 +328,67 @@
 }
 
 /***
- * SUA Configuration (SG)
+ * xUA Listener Configuration (SG)
  ***/
 
-static struct cmd_node sua_node = {
-   L_CS7_SUA_NODE,
-   "%s(config-cs7-sua)# ",
+static enum osmo_ss7_asp_protocol parse_asp_proto(const char *protocol)
+{
+   return get_string_value(osmo_ss7_asp_protocol_vals, protocol);
+}
+
+static struct cmd_node xua_node = {
+   L_CS7_XUA_NODE,
+   "%s(config-cs7-listen)# ",
1,
 };
 
-DEFUN(cs7_sua, cs7_sua_cmd,
-   "sua <0-65534>",
-   "Configure/Enable SUA\n"
-   "SCTP Port number for SUA\n")
+#define XUA_STR"SCCP User Adaptation\n" "MTP3 User Adaptation\n"
+
+DEFUN(cs7_xua, cs7_xua_cmd,
+   "listen (sua|m3ua) <0-65534>",
+   "Configure/Enable xUA Listener\n"
+   XUA_STR "SCTP Port number\n")
 {
struct osmo_ss7_instance *inst = vty->index;
struct osmo_xua_server *xs;
-   uint16_t port = atoi(argv[0]);
+   enum osmo_ss7_asp_protocol proto = parse_asp_proto(argv[0]);
+   uint16_t port = atoi(argv[1]);
 
-   xs = osmo_ss7_xua_server_find(inst, OSMO_SS7_ASP_PROT_SUA, port);
+   xs = osmo_ss7_xua_server_find(inst, proto, port);
if (!xs) {
-   xs = osmo_ss7_xua_server_create(inst, OSMO_SS7_ASP_PROT_SUA, 
port, NULL);
+   xs = osmo_ss7_xua_server_create(inst, proto, port, NULL);
if (!xs)
return CMD_SUCCESS;
}
 
-   vty->node = L_CS7_SUA_NODE;
+   vty->node = L_CS7_XUA_NODE;
vty->index = xs;
return CMD_SUCCESS;
 }
 
-DEFUN(no_cs7_sua, no_cs7_sua_cmd,
-   "no sua <0-65534>",
-   NO_STR "Disable SUA on given SCTP Port\n"
-   "SCTP Port number for SUA\n")
+DEFUN(no_cs7_xua, no_cs7_xua_cmd,
+   "no listen (sua|m3ua) <0-65534>",
+   NO_STR "Disable xUA Listener on given SCTP Port\n"
+   XUA_STR "SCTP Port number\n")
 {
struct osmo_ss7_instance *inst = vty->index;
struct osmo_xua_server *xs;
-   uint16_t port = atoi(argv[0]);
+   enum osmo_ss7_asp_protocol proto = parse_asp_proto(argv[0]);
+   uint16_t port = atoi(argv[1]);
 
-   xs = osmo_ss7_xua_server_find(inst, OSMO_SS7_ASP_PROT_SUA, port);
+   xs = osmo_ss7_xua_server_find(inst, proto, port);
if (!xs) {
-   vty_out(vty, "No SUA server for port %u found%s", port, 
VTY_NEWLINE);
+   vty_out(vty, "No xUA server for port %u found%s", port, 
VTY_NEWLINE);
return CMD_WARNING;
}
osmo_ss7_xua_server_destroy(xs);
return CMD_SUCCESS;
 }
 
-DEFUN(sua_local_ip, sua_local_ip_cmd,
+DEFUN(xua_local_ip, xua_local_ip_cmd,
"local-ip A.B.C.D",
-   "Configure the Local IP Address for SUA\n"
-   "IP Address to use for SUA\n")
+   "Configure the Local IP Address for xUA\n"
+   "IP Address to use for XUA\n")
 {
struct osmo_xua_server *xs = vty->index;
 
@@ -387,12 +396,7 @@
return CMD_SUCCESS;
 }
 
-enum osmo_ss7_asp_protocol parse_asp_proto(const char *protocol)
-{
-   return get_string_value(osmo_ss7_asp_protocol_vals, protocol);
-}
-
-static void write_one_sua(struct vty *vty, struct osmo_xua_server *xs)
+static void write_one_xua(struct vty *vty, struct osmo_xua_server *xs)
 {
vty_out(vty, " %s %u%s",
get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto),
@@ -400,66 +404,6 @@
vty_out(vty, "  local-ip %s%s", xs->cfg.local.host, VTY_NEWLINE);
 }
 
-
-/***
- * M3UA Configuration (SG)
- ***/
-
-static struct cmd_node m3ua_node = {
-   L_CS7_M3UA_NODE,
-   "%s(config-cs7-m3ua)# ",
-   1,
-};
-
-DEFUN(cs7_m3ua, cs7_m3ua_cmd,
-   "m3ua <0-65534>",
-   "Configure/Enable M3UA\n"
-   "SCTP Port number for M3UA\n")
-{
-   struct osmo_ss7_instance *i

[PATCH] libosmo-sccp[master]: sua: Reject DATA messages on SCTP stream 0

2017-04-14 Thread Harald Welte

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

sua: Reject DATA messages on SCTP stream 0

RFC3868 states clearly that DATA messages MUST be sent o a stream other
than stream '0'.  So at the receiver side, we should validate that (just
like we do in M3UA.

Change-Id: I0784e221ef791557a69be04f7d246de059ea84c8
---
M src/sua.c
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/31/2331/1

diff --git a/src/sua.c b/src/sua.c
index 881191e..3bff855 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -630,15 +630,22 @@
goto out;
}
 
-   /* TODO: check for SCTP Strema ID */
/* TODO: check if any AS configured in ASP */
/* TODO: check for valid routing context */
 
switch (xua->hdr.msg_class) {
case SUA_MSGC_CL:
+   if (msgb_sctp_stream(msg) == 0) {
+   rc = SUA_ERR_INVAL_STREAM_ID;
+   break;
+   }
rc = sua_rx_cl(asp, xua);
break;
case SUA_MSGC_CO:
+   if (msgb_sctp_stream(msg) == 0) {
+   rc = SUA_ERR_INVAL_STREAM_ID;
+   break;
+   }
rc = sua_rx_co(asp, xua);
break;
case SUA_MSGC_ASPSM:

-- 
To view, visit https://gerrit.osmocom.org/2331
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0784e221ef791557a69be04f7d246de059ea84c8
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: move osmo_ss7_vty.c [back] into libosmo-sigtran

2017-04-14 Thread Harald Welte

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

move osmo_ss7_vty.c [back] into libosmo-sigtran

Now that the VTY has no static dependencies like a global ss7_instance
anymore, we can move it back to libosmo-sigtran and make use of it in
other programs outside osmo-stp.

This requires Change-Id I184a7e3187b48c15c71bf773f86e188fe1daad15 in
libosmocore

Change-Id: I2e549f1eadbfb28dde79f620b130cbf022312c42
---
M include/osmocom/sigtran/osmo_ss7.h
M src/Makefile.am
R src/osmo_ss7_vty.c
M stp/Makefile.am
D stp/internal.h
M stp/stp_main.c
6 files changed, 11 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/30/2330/1

diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index 1d82669..24f83e9 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -437,3 +437,11 @@
 
 enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in);
 int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod);
+
+/* VTY related */
+struct vty;
+void osmo_ss7_set_vty_alloc_ctx(void *ctx);
+void osmo_ss7_vty_init_asp(void);
+void osmo_ss7_vty_init_sg(void);
+int osmo_ss7_vty_go_parent(struct vty *vty);
+int osmo_ss7_is_config_node(struct vty *vty, int node);
diff --git a/src/Makefile.am b/src/Makefile.am
index f9b87b0..8e52792 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,6 +29,7 @@
 libosmo_sigtran_la_SOURCES = sccp_sap.c sua.c m3ua.c xua_msg.c sccp_helpers.c \
 sccp2sua.c sccp_scrc.c sccp_sclc.c sccp_scoc.c \
 sccp_user.c xua_rkm.c xua_default_lm_fsm.c \
-osmo_ss7.c osmo_ss7_hmrt.c xua_asp_fsm.c 
xua_as_fsm.c
+osmo_ss7.c osmo_ss7_hmrt.c xua_asp_fsm.c 
xua_as_fsm.c \
+osmo_ss7_vty.c
 libosmo_sigtran_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined 
-export-symbols-regex '^osmo_'
 libosmo_sigtran_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMONETIF_LIBS) 
$(LIBSCTP_LIBS)
diff --git a/stp/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
similarity index 99%
rename from stp/osmo_ss7_vty.c
rename to src/osmo_ss7_vty.c
index fe7bc41..59c4008 100644
--- a/stp/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -35,8 +35,6 @@
 #include 
 #include 
 
-#include "internal.h"
-
 #define CS7_STR"ITU-T Signaling System 7\n"
 #define PC_STR "Point Code\n"
 
diff --git a/stp/Makefile.am b/stp/Makefile.am
index 81aa11c..ae37487 100644
--- a/stp/Makefile.am
+++ b/stp/Makefile.am
@@ -2,10 +2,8 @@
 AM_CFLAGS=-Wall -g $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) 
$(LIBOSMONETIF_CFLAGS) $(COVERAGE_FLAGS)
 AM_LDFLAGS=$(COVERAGE_LDFLAGS)
 
-EXTRA_DIST = internal.h
-
 bin_PROGRAMS = osmo-stp
 
-osmo_stp_SOURCES = stp_main.c osmo_ss7_vty.c
+osmo_stp_SOURCES = stp_main.c
 osmo_stp_LDADD = $(top_builddir)/src/libosmo-sigtran.la \
   $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS)
diff --git a/stp/internal.h b/stp/internal.h
deleted file mode 100644
index cbd6bac..000
--- a/stp/internal.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once
-
-#include 
-
-enum stp_vty_node {
-   L_CS7_NODE = _LAST_OSMOVTY_NODE + 1,
-   L_CS7_AS_NODE,
-   L_CS7_ASP_NODE,
-   L_CS7_XUA_NODE,
-   L_CS7_RTABLE_NODE,
-};
-
-void osmo_ss7_set_vty_alloc_ctx(void *ctx);
-void osmo_ss7_vty_init_asp(void);
-void osmo_ss7_vty_init_sg(void);
-int osmo_ss7_vty_go_parent(struct vty *vty);
-int osmo_ss7_is_config_node(struct vty *vty, int node);
diff --git a/stp/stp_main.c b/stp/stp_main.c
index 24e2230..267806b 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -38,8 +38,6 @@
 #include 
 #include 
 
-#include "internal.h"
-
 static const struct log_info_cat log_info_cat[] = {
 };
 

-- 
To view, visit https://gerrit.osmocom.org/2330
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e549f1eadbfb28dde79f620b130cbf022312c42
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: STP: re-structure VTY interface; introduce 'cs7 instance' node

2017-04-14 Thread Harald Welte

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

STP: re-structure VTY interface; introduce 'cs7 instance' node

This properly integrates the concept of multiple SS7 instances (each
with their own point code format, address indicator, ...) into the VTY.
At the same time, this also removes the stp-global "g_s7i" instance
that existed so far, moving the VTY code more into the direction of also
being able to be used outside the STP - which is underlined by splitting
the vty commands between those generally useful, and those useful only
for a STP or only for a simpla ASP (client).

Change-Id: I30966fbf2e143318cd9127eb8c17cccb24407106
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
M stp/internal.h
M stp/osmo_ss7_vty.c
M stp/stp_main.c
5 files changed, 257 insertions(+), 203 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/28/2328/1

diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index 49a8ca5..1d82669 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -9,6 +9,7 @@
 #include 
 #include 
 
+extern struct llist_head osmo_ss7_instances;
 extern struct llist_head osmo_ss7_xua_servers;
 
 struct osmo_ss7_instance;
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index d864916..27e56af 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -52,7 +52,7 @@
 
 static bool ss7_initialized = false;
 
-static LLIST_HEAD(ss7_instances);
+LLIST_HEAD(osmo_ss7_instances);
 LLIST_HEAD(osmo_ss7_xua_servers);
 static int32_t next_rctx = 1;
 static int32_t next_l_rk_id = 1;
@@ -296,7 +296,7 @@
OSMO_ASSERT(ss7_initialized);
 
struct osmo_ss7_instance *inst;
-   llist_for_each_entry(inst, &ss7_instances, list) {
+   llist_for_each_entry(inst, &osmo_ss7_instances, list) {
if (inst->cfg.id == id)
return inst;
}
@@ -335,7 +335,7 @@
inst->cfg.pc_fmt.component_len[1] = 8;
inst->cfg.pc_fmt.component_len[2] = 3;
 
-   llist_add(&inst->list, &ss7_instances);
+   llist_add(&inst->list, &osmo_ss7_instances);
 
return inst;
 }
@@ -993,7 +993,7 @@
 
/* check all instances for any ASP definition matching the
 * address combination of local/remote ip/port */
-   llist_for_each_entry(inst, &ss7_instances, list) {
+   llist_for_each_entry(inst, &osmo_ss7_instances, list) {
struct osmo_ss7_asp *asp;
llist_for_each_entry(asp, &inst->asp_list, list) {
if (asp->cfg.local.port == local_port &&
diff --git a/stp/internal.h b/stp/internal.h
index 0a434cc..31d95ba 100644
--- a/stp/internal.h
+++ b/stp/internal.h
@@ -3,16 +3,16 @@
 #include 
 
 enum stp_vty_node {
-   L_CS7_AS_NODE = _LAST_OSMOVTY_NODE + 1,
+   L_CS7_NODE = _LAST_OSMOVTY_NODE + 1,
+   L_CS7_AS_NODE,
L_CS7_ASP_NODE,
L_CS7_SUA_NODE,
L_CS7_M3UA_NODE,
L_CS7_RTABLE_NODE,
 };
 
-int osmo_ss7_vty_init(void);
+void osmo_ss7_set_vty_alloc_ctx(void *ctx);
+void osmo_ss7_vty_init_asp(void);
+void osmo_ss7_vty_init_sg(void);
 int osmo_ss7_vty_go_parent(struct vty *vty);
 int osmo_ss7_is_config_node(struct vty *vty, int node);
-
-extern struct osmo_ss7_instance *g_s7i;
-
diff --git a/stp/osmo_ss7_vty.c b/stp/osmo_ss7_vty.c
index 014fa03..29693a8 100644
--- a/stp/osmo_ss7_vty.c
+++ b/stp/osmo_ss7_vty.c
@@ -44,6 +44,35 @@
  * Core CS7 Configuration
  ***/
 
+static void *g_ctx;
+
+static struct cmd_node cs7_node = {
+   L_CS7_NODE,
+   "%s(config-cs7)# ",
+   1,
+};
+
+DEFUN(cs7_instance, cs7_instance_cmd,
+   "cs7 instance <0-15>",
+   CS7_STR "Configure a SS7 Instance\n"
+   "Number of the instance\n")
+{
+   int id = atoi(argv[0]);
+   struct osmo_ss7_instance *inst;
+
+   inst = osmo_ss7_instance_find_or_create(g_ctx, id);
+   if (!inst) {
+   vty_out(vty, "Unable to create SS7 Instance %d%s", id, 
VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
+   vty->node = L_CS7_NODE;
+   vty->index = inst;
+   vty->index_sub = &inst->cfg.description;
+
+   return CMD_SUCCESS;
+}
+
 static const struct value_string ss7_network_indicator_vals[] = {
{ 0,"international" },
{ 1,"spare" },
@@ -54,14 +83,14 @@
 
 /* cs7 network-indicator */
 DEFUN(cs7_net_ind, cs7_net_ind_cmd,
-   "cs7 network-indicator (international | national | reserved | spare)",
-   CS7_STR "Configure the Network Indicator\n"
+   "network-indicator (international | national | reserved | spare)",
+   "Configure the Network Indicator\n"
"International Network\n"
"National Network\n"
"Reserved Network\n"
"Spare Network\n")
 {
-   struct osmo_ss7_instance *inst = g_s7i;
+   struct osmo_ss7_instance *inst = vty->index;
int ni = get_string_value(ss7_network_indicator_vals, argv[0]);
 
 

libosmo-sccp[master]: move osmo_ss7_vty.c [back] into libosmo-sigtran

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2330
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2e549f1eadbfb28dde79f620b130cbf022312c42
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: STP: re-structure VTY interface; introduce 'cs7 instance' node

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2 Verified+1

this doesn't build anymore with recent libosmocore, it's expected.

-- 
To view, visit https://gerrit.osmocom.org/2328
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I30966fbf2e143318cd9127eb8c17cccb24407106
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-sccp[master]: STP: re-structure VTY interface; introduce 'cs7 instance' node

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: STP: re-structure VTY interface; introduce 'cs7 instance' node
..


STP: re-structure VTY interface; introduce 'cs7 instance' node

This properly integrates the concept of multiple SS7 instances (each
with their own point code format, address indicator, ...) into the VTY.
At the same time, this also removes the stp-global "g_s7i" instance
that existed so far, moving the VTY code more into the direction of also
being able to be used outside the STP - which is underlined by splitting
the vty commands between those generally useful, and those useful only
for a STP or only for a simpla ASP (client).

Change-Id: I30966fbf2e143318cd9127eb8c17cccb24407106
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
M stp/internal.h
M stp/osmo_ss7_vty.c
M stp/stp_main.c
5 files changed, 257 insertions(+), 203 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved; Verified



diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index 49a8ca5..1d82669 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -9,6 +9,7 @@
 #include 
 #include 
 
+extern struct llist_head osmo_ss7_instances;
 extern struct llist_head osmo_ss7_xua_servers;
 
 struct osmo_ss7_instance;
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index d864916..27e56af 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -52,7 +52,7 @@
 
 static bool ss7_initialized = false;
 
-static LLIST_HEAD(ss7_instances);
+LLIST_HEAD(osmo_ss7_instances);
 LLIST_HEAD(osmo_ss7_xua_servers);
 static int32_t next_rctx = 1;
 static int32_t next_l_rk_id = 1;
@@ -296,7 +296,7 @@
OSMO_ASSERT(ss7_initialized);
 
struct osmo_ss7_instance *inst;
-   llist_for_each_entry(inst, &ss7_instances, list) {
+   llist_for_each_entry(inst, &osmo_ss7_instances, list) {
if (inst->cfg.id == id)
return inst;
}
@@ -335,7 +335,7 @@
inst->cfg.pc_fmt.component_len[1] = 8;
inst->cfg.pc_fmt.component_len[2] = 3;
 
-   llist_add(&inst->list, &ss7_instances);
+   llist_add(&inst->list, &osmo_ss7_instances);
 
return inst;
 }
@@ -993,7 +993,7 @@
 
/* check all instances for any ASP definition matching the
 * address combination of local/remote ip/port */
-   llist_for_each_entry(inst, &ss7_instances, list) {
+   llist_for_each_entry(inst, &osmo_ss7_instances, list) {
struct osmo_ss7_asp *asp;
llist_for_each_entry(asp, &inst->asp_list, list) {
if (asp->cfg.local.port == local_port &&
diff --git a/stp/internal.h b/stp/internal.h
index 0a434cc..31d95ba 100644
--- a/stp/internal.h
+++ b/stp/internal.h
@@ -3,16 +3,16 @@
 #include 
 
 enum stp_vty_node {
-   L_CS7_AS_NODE = _LAST_OSMOVTY_NODE + 1,
+   L_CS7_NODE = _LAST_OSMOVTY_NODE + 1,
+   L_CS7_AS_NODE,
L_CS7_ASP_NODE,
L_CS7_SUA_NODE,
L_CS7_M3UA_NODE,
L_CS7_RTABLE_NODE,
 };
 
-int osmo_ss7_vty_init(void);
+void osmo_ss7_set_vty_alloc_ctx(void *ctx);
+void osmo_ss7_vty_init_asp(void);
+void osmo_ss7_vty_init_sg(void);
 int osmo_ss7_vty_go_parent(struct vty *vty);
 int osmo_ss7_is_config_node(struct vty *vty, int node);
-
-extern struct osmo_ss7_instance *g_s7i;
-
diff --git a/stp/osmo_ss7_vty.c b/stp/osmo_ss7_vty.c
index 014fa03..29693a8 100644
--- a/stp/osmo_ss7_vty.c
+++ b/stp/osmo_ss7_vty.c
@@ -44,6 +44,35 @@
  * Core CS7 Configuration
  ***/
 
+static void *g_ctx;
+
+static struct cmd_node cs7_node = {
+   L_CS7_NODE,
+   "%s(config-cs7)# ",
+   1,
+};
+
+DEFUN(cs7_instance, cs7_instance_cmd,
+   "cs7 instance <0-15>",
+   CS7_STR "Configure a SS7 Instance\n"
+   "Number of the instance\n")
+{
+   int id = atoi(argv[0]);
+   struct osmo_ss7_instance *inst;
+
+   inst = osmo_ss7_instance_find_or_create(g_ctx, id);
+   if (!inst) {
+   vty_out(vty, "Unable to create SS7 Instance %d%s", id, 
VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
+   vty->node = L_CS7_NODE;
+   vty->index = inst;
+   vty->index_sub = &inst->cfg.description;
+
+   return CMD_SUCCESS;
+}
+
 static const struct value_string ss7_network_indicator_vals[] = {
{ 0,"international" },
{ 1,"spare" },
@@ -54,14 +83,14 @@
 
 /* cs7 network-indicator */
 DEFUN(cs7_net_ind, cs7_net_ind_cmd,
-   "cs7 network-indicator (international | national | reserved | spare)",
-   CS7_STR "Configure the Network Indicator\n"
+   "network-indicator (international | national | reserved | spare)",
+   "Configure the Network Indicator\n"
"International Network\n"
"National Network\n"
"Reserved Network\n"
"Spare Network\n")
 {
-   struct osmo_ss7

libosmo-sccp[master]: osmo_ss7_vty: Merge the SUA and M3UA VTY nodes

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2 Verified+1

-- 
To view, visit https://gerrit.osmocom.org/2329
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I5b842b7f10d94957398cf0c0406c440c495a0bdc
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-sccp[master]: sua: Reject DATA messages on SCTP stream 0

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: sua: Reject DATA messages on SCTP stream 0
..


sua: Reject DATA messages on SCTP stream 0

RFC3868 states clearly that DATA messages MUST be sent o a stream other
than stream '0'.  So at the receiver side, we should validate that (just
like we do in M3UA.

Change-Id: I0784e221ef791557a69be04f7d246de059ea84c8
---
M src/sua.c
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/sua.c b/src/sua.c
index 881191e..3bff855 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -630,15 +630,22 @@
goto out;
}
 
-   /* TODO: check for SCTP Strema ID */
/* TODO: check if any AS configured in ASP */
/* TODO: check for valid routing context */
 
switch (xua->hdr.msg_class) {
case SUA_MSGC_CL:
+   if (msgb_sctp_stream(msg) == 0) {
+   rc = SUA_ERR_INVAL_STREAM_ID;
+   break;
+   }
rc = sua_rx_cl(asp, xua);
break;
case SUA_MSGC_CO:
+   if (msgb_sctp_stream(msg) == 0) {
+   rc = SUA_ERR_INVAL_STREAM_ID;
+   break;
+   }
rc = sua_rx_co(asp, xua);
break;
case SUA_MSGC_ASPSM:

-- 
To view, visit https://gerrit.osmocom.org/2331
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0784e221ef791557a69be04f7d246de059ea84c8
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmo-sccp[master]: move osmo_ss7_vty.c [back] into libosmo-sigtran

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: move osmo_ss7_vty.c [back] into libosmo-sigtran
..


move osmo_ss7_vty.c [back] into libosmo-sigtran

Now that the VTY has no static dependencies like a global ss7_instance
anymore, we can move it back to libosmo-sigtran and make use of it in
other programs outside osmo-stp.

This requires Change-Id I184a7e3187b48c15c71bf773f86e188fe1daad15 in
libosmocore

Change-Id: I2e549f1eadbfb28dde79f620b130cbf022312c42
---
M include/osmocom/sigtran/osmo_ss7.h
M src/Makefile.am
R src/osmo_ss7_vty.c
M stp/Makefile.am
D stp/internal.h
M stp/stp_main.c
6 files changed, 11 insertions(+), 25 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index 1d82669..24f83e9 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -437,3 +437,11 @@
 
 enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in);
 int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod);
+
+/* VTY related */
+struct vty;
+void osmo_ss7_set_vty_alloc_ctx(void *ctx);
+void osmo_ss7_vty_init_asp(void);
+void osmo_ss7_vty_init_sg(void);
+int osmo_ss7_vty_go_parent(struct vty *vty);
+int osmo_ss7_is_config_node(struct vty *vty, int node);
diff --git a/src/Makefile.am b/src/Makefile.am
index f9b87b0..8e52792 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,6 +29,7 @@
 libosmo_sigtran_la_SOURCES = sccp_sap.c sua.c m3ua.c xua_msg.c sccp_helpers.c \
 sccp2sua.c sccp_scrc.c sccp_sclc.c sccp_scoc.c \
 sccp_user.c xua_rkm.c xua_default_lm_fsm.c \
-osmo_ss7.c osmo_ss7_hmrt.c xua_asp_fsm.c 
xua_as_fsm.c
+osmo_ss7.c osmo_ss7_hmrt.c xua_asp_fsm.c 
xua_as_fsm.c \
+osmo_ss7_vty.c
 libosmo_sigtran_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined 
-export-symbols-regex '^osmo_'
 libosmo_sigtran_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMONETIF_LIBS) 
$(LIBSCTP_LIBS)
diff --git a/stp/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
similarity index 99%
rename from stp/osmo_ss7_vty.c
rename to src/osmo_ss7_vty.c
index fe7bc41..59c4008 100644
--- a/stp/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -35,8 +35,6 @@
 #include 
 #include 
 
-#include "internal.h"
-
 #define CS7_STR"ITU-T Signaling System 7\n"
 #define PC_STR "Point Code\n"
 
diff --git a/stp/Makefile.am b/stp/Makefile.am
index 81aa11c..ae37487 100644
--- a/stp/Makefile.am
+++ b/stp/Makefile.am
@@ -2,10 +2,8 @@
 AM_CFLAGS=-Wall -g $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) 
$(LIBOSMONETIF_CFLAGS) $(COVERAGE_FLAGS)
 AM_LDFLAGS=$(COVERAGE_LDFLAGS)
 
-EXTRA_DIST = internal.h
-
 bin_PROGRAMS = osmo-stp
 
-osmo_stp_SOURCES = stp_main.c osmo_ss7_vty.c
+osmo_stp_SOURCES = stp_main.c
 osmo_stp_LDADD = $(top_builddir)/src/libosmo-sigtran.la \
   $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS)
diff --git a/stp/internal.h b/stp/internal.h
deleted file mode 100644
index cbd6bac..000
--- a/stp/internal.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once
-
-#include 
-
-enum stp_vty_node {
-   L_CS7_NODE = _LAST_OSMOVTY_NODE + 1,
-   L_CS7_AS_NODE,
-   L_CS7_ASP_NODE,
-   L_CS7_XUA_NODE,
-   L_CS7_RTABLE_NODE,
-};
-
-void osmo_ss7_set_vty_alloc_ctx(void *ctx);
-void osmo_ss7_vty_init_asp(void);
-void osmo_ss7_vty_init_sg(void);
-int osmo_ss7_vty_go_parent(struct vty *vty);
-int osmo_ss7_is_config_node(struct vty *vty, int node);
diff --git a/stp/stp_main.c b/stp/stp_main.c
index 24e2230..267806b 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -38,8 +38,6 @@
 #include 
 #include 
 
-#include "internal.h"
-
 static const struct log_info_cat log_info_cat[] = {
 };
 

-- 
To view, visit https://gerrit.osmocom.org/2330
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2e549f1eadbfb28dde79f620b130cbf022312c42
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmo-sccp[master]: sua: Reject DATA messages on SCTP stream 0

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2331
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I0784e221ef791557a69be04f7d246de059ea84c8
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-sccp[master]: osmo_ss7_vty: Merge the SUA and M3UA VTY nodes

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo_ss7_vty: Merge the SUA and M3UA VTY nodes
..


osmo_ss7_vty: Merge the SUA and M3UA VTY nodes

The xUA servers have pretty much everything in common, there's no point
in introducing a separate VTY note for each xUA flavor.

Change-Id: I5b842b7f10d94957398cf0c0406c440c495a0bdc
---
M stp/internal.h
M stp/osmo_ss7_vty.c
2 files changed, 41 insertions(+), 106 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved; Verified



diff --git a/stp/internal.h b/stp/internal.h
index 31d95ba..cbd6bac 100644
--- a/stp/internal.h
+++ b/stp/internal.h
@@ -6,8 +6,7 @@
L_CS7_NODE = _LAST_OSMOVTY_NODE + 1,
L_CS7_AS_NODE,
L_CS7_ASP_NODE,
-   L_CS7_SUA_NODE,
-   L_CS7_M3UA_NODE,
+   L_CS7_XUA_NODE,
L_CS7_RTABLE_NODE,
 };
 
diff --git a/stp/osmo_ss7_vty.c b/stp/osmo_ss7_vty.c
index 29693a8..fe7bc41 100644
--- a/stp/osmo_ss7_vty.c
+++ b/stp/osmo_ss7_vty.c
@@ -328,58 +328,67 @@
 }
 
 /***
- * SUA Configuration (SG)
+ * xUA Listener Configuration (SG)
  ***/
 
-static struct cmd_node sua_node = {
-   L_CS7_SUA_NODE,
-   "%s(config-cs7-sua)# ",
+static enum osmo_ss7_asp_protocol parse_asp_proto(const char *protocol)
+{
+   return get_string_value(osmo_ss7_asp_protocol_vals, protocol);
+}
+
+static struct cmd_node xua_node = {
+   L_CS7_XUA_NODE,
+   "%s(config-cs7-listen)# ",
1,
 };
 
-DEFUN(cs7_sua, cs7_sua_cmd,
-   "sua <0-65534>",
-   "Configure/Enable SUA\n"
-   "SCTP Port number for SUA\n")
+#define XUA_STR"SCCP User Adaptation\n" "MTP3 User Adaptation\n"
+
+DEFUN(cs7_xua, cs7_xua_cmd,
+   "listen (sua|m3ua) <0-65534>",
+   "Configure/Enable xUA Listener\n"
+   XUA_STR "SCTP Port number\n")
 {
struct osmo_ss7_instance *inst = vty->index;
struct osmo_xua_server *xs;
-   uint16_t port = atoi(argv[0]);
+   enum osmo_ss7_asp_protocol proto = parse_asp_proto(argv[0]);
+   uint16_t port = atoi(argv[1]);
 
-   xs = osmo_ss7_xua_server_find(inst, OSMO_SS7_ASP_PROT_SUA, port);
+   xs = osmo_ss7_xua_server_find(inst, proto, port);
if (!xs) {
-   xs = osmo_ss7_xua_server_create(inst, OSMO_SS7_ASP_PROT_SUA, 
port, NULL);
+   xs = osmo_ss7_xua_server_create(inst, proto, port, NULL);
if (!xs)
return CMD_SUCCESS;
}
 
-   vty->node = L_CS7_SUA_NODE;
+   vty->node = L_CS7_XUA_NODE;
vty->index = xs;
return CMD_SUCCESS;
 }
 
-DEFUN(no_cs7_sua, no_cs7_sua_cmd,
-   "no sua <0-65534>",
-   NO_STR "Disable SUA on given SCTP Port\n"
-   "SCTP Port number for SUA\n")
+DEFUN(no_cs7_xua, no_cs7_xua_cmd,
+   "no listen (sua|m3ua) <0-65534>",
+   NO_STR "Disable xUA Listener on given SCTP Port\n"
+   XUA_STR "SCTP Port number\n")
 {
struct osmo_ss7_instance *inst = vty->index;
struct osmo_xua_server *xs;
-   uint16_t port = atoi(argv[0]);
+   enum osmo_ss7_asp_protocol proto = parse_asp_proto(argv[0]);
+   uint16_t port = atoi(argv[1]);
 
-   xs = osmo_ss7_xua_server_find(inst, OSMO_SS7_ASP_PROT_SUA, port);
+   xs = osmo_ss7_xua_server_find(inst, proto, port);
if (!xs) {
-   vty_out(vty, "No SUA server for port %u found%s", port, 
VTY_NEWLINE);
+   vty_out(vty, "No xUA server for port %u found%s", port, 
VTY_NEWLINE);
return CMD_WARNING;
}
osmo_ss7_xua_server_destroy(xs);
return CMD_SUCCESS;
 }
 
-DEFUN(sua_local_ip, sua_local_ip_cmd,
+DEFUN(xua_local_ip, xua_local_ip_cmd,
"local-ip A.B.C.D",
-   "Configure the Local IP Address for SUA\n"
-   "IP Address to use for SUA\n")
+   "Configure the Local IP Address for xUA\n"
+   "IP Address to use for XUA\n")
 {
struct osmo_xua_server *xs = vty->index;
 
@@ -387,12 +396,7 @@
return CMD_SUCCESS;
 }
 
-enum osmo_ss7_asp_protocol parse_asp_proto(const char *protocol)
-{
-   return get_string_value(osmo_ss7_asp_protocol_vals, protocol);
-}
-
-static void write_one_sua(struct vty *vty, struct osmo_xua_server *xs)
+static void write_one_xua(struct vty *vty, struct osmo_xua_server *xs)
 {
vty_out(vty, " %s %u%s",
get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto),
@@ -400,66 +404,6 @@
vty_out(vty, "  local-ip %s%s", xs->cfg.local.host, VTY_NEWLINE);
 }
 
-
-/***
- * M3UA Configuration (SG)
- ***/
-
-static struct cmd_node m3ua_node = {
-   L_CS7_M3UA_NODE,
-   "%s(config-cs7-m3ua)# ",
-   1,
-};
-
-DEFUN(cs7_m3ua, cs7_m3ua_cmd,

[PATCH] libosmo-sccp[master]: Don't overwrite existing data in osmo_ss7_instance_find_or_c...

2017-04-14 Thread Harald Welte

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

Don't overwrite existing data in osmo_ss7_instance_find_or_create()

If we actually found an instance for the specified ID, return it fast
and don't (re)initialize all linked list heads, etc.

Change-Id: I91b6aabdb873ed8dd103918ee5e40b7ad3946735
---
M src/osmo_ss7.c
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/36/2336/1

diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 27e56af..9b2377b 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -315,8 +315,10 @@
OSMO_ASSERT(ss7_initialized);
 
inst = osmo_ss7_instance_find(id);
-   if (!inst)
-   inst = talloc_zero(ctx, struct osmo_ss7_instance);
+   if (inst)
+   return inst;
+
+   inst = talloc_zero(ctx, struct osmo_ss7_instance);
if (!inst)
return NULL;
 

-- 
To view, visit https://gerrit.osmocom.org/2336
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I91b6aabdb873ed8dd103918ee5e40b7ad3946735
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: stp: Add copyright notice

2017-04-14 Thread Harald Welte

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

stp: Add copyright notice

Change-Id: I4e074f570eac2e6a0a761f9f5f9c35fa4afa0315
---
M stp/stp_main.c
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/40/2340/1

diff --git a/stp/stp_main.c b/stp/stp_main.c
index 267806b..6fbc634 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -58,8 +58,17 @@
log_set_category_filter(osmo_stderr_target, log_cats[i], 1, 
LOGL_DEBUG);
 }
 
+static const char stp_copyright[] =
+   "Copyright (C) 2015-2017 by Harald Welte \r\n"
+   "Contributions by Holger Freyther, Neels Hofmeyr\r\n"
+   "License GPLv2+: GNU GPL Version 2 or later 
\r\n"
+   "This is free software: you are free ot change and redistribute it.\r\n"
+   "There is NO WARRANTY, to the extent permitted by law.\r\n\r\n"
+   "Free Software lives by contribution.  If you use this, please 
contribute!\r\n";
+
 static struct vty_app_info vty_info = {
.name   = "osmo-stp",
+   .copyright = stp_copyright,
.version = PACKAGE_VERSION,
.go_parent_cb = osmo_ss7_vty_go_parent,
.is_config_node = osmo_ss7_is_config_node,
@@ -70,6 +79,9 @@
char *config_file = "osmo-stp.cfg";
int rc;
 
+   fputs(stp_copyright, stdout);
+   fputs("\n", stdout);
+
init_logging();
osmo_ss7_init();
osmo_fsm_log_addr(false);

-- 
To view, visit https://gerrit.osmocom.org/2340
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e074f570eac2e6a0a761f9f5f9c35fa4afa0315
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Add 'description' command for SS7 instances

2017-04-14 Thread Harald Welte

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

osmo_ss7_vty: Add 'description' command for SS7 instances

This allows the user to add some description to each SS7 instance

Change-Id: Ia5d22f2f70ec12dd13151f949bb45b5fdab42fc5
---
M src/osmo_ss7_vty.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/35/2335/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 6c19188..5dfa465 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -844,6 +844,8 @@
struct osmo_xua_server *oxs;
 
vty_out(vty, "cs7 instance %u%s", inst->cfg.id, VTY_NEWLINE);
+   if (inst->cfg.description)
+   vty_out(vty, " description %s%s", inst->cfg.description, 
VTY_NEWLINE);
if (inst->cfg.network_indicator)
vty_out(vty, " network-indicator %s%s",
get_value_string(ss7_network_indicator_vals,
@@ -950,6 +952,7 @@
 
install_node(&cs7_node, config_write_cs7);
vty_install_default(L_CS7_NODE);
+   install_element(L_CS7_NODE, &cfg_description_cmd);
install_element(L_CS7_NODE, &cs7_net_ind_cmd);
install_element(L_CS7_NODE, &cs7_point_code_cmd);
install_element(L_CS7_NODE, &cs7_pc_format_cmd);

-- 
To view, visit https://gerrit.osmocom.org/2335
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia5d22f2f70ec12dd13151f949bb45b5fdab42fc5
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: Add exampel osmo-stp configuration file

2017-04-14 Thread Harald Welte

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

Add exampel osmo-stp configuration file

Change-Id: I45a04dc808e5a419bf5d68eb28c48cbec352b318
---
M Makefile.am
A doc/examples/osmo-stp.cfg
2 files changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/39/2339/1

diff --git a/Makefile.am b/Makefile.am
index ededdac..9bb711c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,7 @@
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libosmo-sccp.pc libosmo-mtp.pc libosmo-sigtran.pc 
libosmo-xua.pc
 
-EXTRA_DIST = .version
+EXTRA_DIST = .version doc/examples/osmo-stp.cfg
 
 BUILT_SOURCES = $(top_srcdir)/.version
 $(top_srcdir)/.version:
diff --git a/doc/examples/osmo-stp.cfg b/doc/examples/osmo-stp.cfg
new file mode 100644
index 000..45a822b
--- /dev/null
+++ b/doc/examples/osmo-stp.cfg
@@ -0,0 +1,11 @@
+!
+! osmo-stp (0.0.6.3.179-b248) configuration saved from vty
+!!
+!
+line vty
+ no login
+!
+cs7 instance 0
+ xua rkm routing-key-allocation dynamic-permitted
+ listen m3ua 2905
+  accept-asp-connections dynamic-permitted

-- 
To view, visit https://gerrit.osmocom.org/2339
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I45a04dc808e5a419bf5d68eb28c48cbec352b318
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Add Command to permit (or disallow) dynamc rou...

2017-04-14 Thread Harald Welte

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

osmo_ss7_vty: Add Command to permit (or disallow) dynamc routing key allocation

This feature has been introduced in
8dec5a8ec554bbd56f4d3f45b6e1025d4c1ffb45, but so far hasn't been exposed
to the VTY yet.

Change-Id: I7355522bacbad1072feb5484b865dfd1be50a64d
---
M src/osmo_ss7_vty.c
1 file changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/34/2334/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 40f99b1..6c19188 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -163,8 +163,25 @@
inst->cfg.primary_pc = pc;
return CMD_SUCCESS;
 }
+
 /* TODO: cs7 secondary-pc */
 /* TODO: cs7 capability-pc */
+
+DEFUN(cs7_permit_dyn_rkm, cs7_permit_dyn_rkm_cmd,
+   "xua rkm routing-key-allocation (static-only|dynamic-permitted)",
+   "SIGTRAN xxxUA related\n" "Routing Key Management Allocation Policy\n"
+   "Only static (pre-confgured) Routing Keys permitted\n"
+   "Dynamically allocate Routing Keys for what ASPs request\n")
+{
+   struct osmo_ss7_instance *inst = vty->index;
+
+   if (!strcmp(argv[0], "dynamic-permitted"))
+   inst->cfg.permit_dyn_rkm_alloc = true;
+   else
+   inst->cfg.permit_dyn_rkm_alloc = false;
+
+   return CMD_SUCCESS;
+}
 
 static void write_one_cs7(struct vty *vty, struct osmo_ss7_instance *inst);
 
@@ -853,6 +870,9 @@
osmo_ss7_pointcode_print(inst, inst->cfg.primary_pc),
VTY_NEWLINE);
 
+   if (inst->cfg.permit_dyn_rkm_alloc)
+   vty_out(vty, " xua rkm routing-key-allocation 
dynamic-permitted%s", VTY_NEWLINE);
+
/* first dump ASPs, as ASs reference them */
llist_for_each_entry(asp, &inst->asp_list, list)
write_one_asp(vty, asp);
@@ -935,6 +955,7 @@
install_element(L_CS7_NODE, &cs7_pc_format_cmd);
install_element(L_CS7_NODE, &cs7_pc_format_def_cmd);
install_element(L_CS7_NODE, &cs7_pc_delimiter_cmd);
+   install_element(L_CS7_NODE, &cs7_permit_dyn_rkm_cmd);
 
install_node(&asp_node, NULL);
vty_install_default(L_CS7_ASP_NODE);

-- 
To view, visit https://gerrit.osmocom.org/2334
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7355522bacbad1072feb5484b865dfd1be50a64d
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Introduce xUA listener accept-asp-connections ...

2017-04-14 Thread Harald Welte

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

osmo_ss7_vty: Introduce xUA listener accept-asp-connections command

Using this command one can specify if ASP connections should be refused
if there's no matching configuration, or whether ASPs should simply be
create on-demand.

Change-Id: Ic93b99047fb566cdb25a2f4139ebef54849dece9
---
M src/osmo_ss7_vty.c
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/37/2337/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 5dfa465..e661623 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -436,12 +436,30 @@
return CMD_SUCCESS;
 }
 
+DEFUN(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"
+   "Accept only pre-confiugred ASPs (source IP/prt)\n"
+   "Accept any connection and dynamically create an ASP definition\n")
+{
+   struct osmo_xua_server *xs = vty->index;
+
+   if (!strcmp(argv[0], "dynamic-permitted"))
+   xs->cfg.accept_dyn_reg = true;
+   else
+   xs->cfg.accept_dyn_reg = false;
+
+   return CMD_SUCCESS;
+}
+
 static void write_one_xua(struct vty *vty, struct osmo_xua_server *xs)
 {
vty_out(vty, " %s %u%s",
get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto),
xs->cfg.local.port, VTY_NEWLINE);
vty_out(vty, "  local-ip %s%s", xs->cfg.local.host, VTY_NEWLINE);
+   if (xs->cfg.accept_dyn_reg)
+   vty_out(vty, "  accept-asp-connections dynamic-permitted%s", 
VTY_NEWLINE);
 }
 
 
@@ -1007,6 +1025,7 @@
install_element(L_CS7_NODE, &cs7_xua_cmd);
install_element(L_CS7_NODE, &no_cs7_xua_cmd);
install_element(L_CS7_XUA_NODE, &xua_local_ip_cmd);
+   install_element(L_CS7_XUA_NODE, &xua_accept_dyn_asp_cmd);
 }
 
 void osmo_ss7_set_vty_alloc_ctx(void *ctx)

-- 
To view, visit https://gerrit.osmocom.org/2337
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic93b99047fb566cdb25a2f4139ebef54849dece9
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo-stp: Add command line options and daemonize functionality

2017-04-14 Thread Harald Welte

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

osmo-stp: Add command line options and daemonize functionality

Change-Id: I267fbe2e5c774960f0b63cfdd9f60df121b4934d
---
M stp/stp_main.c
1 file changed, 75 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/42/2342/1

diff --git a/stp/stp_main.c b/stp/stp_main.c
index 5412223..3110ec4 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -29,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -64,25 +66,82 @@
.is_config_node = osmo_ss7_is_config_node,
 };
 
+static struct {
+   bool daemonize;
+   const char *config_file;
+} cmdline_config = {
+   .daemonize = false,
+   .config_file = "osmo-stp.cfg",
+};
+
+static void print_help(void)
+{
+   printf("  -h --help This text.\n");
+   printf("  -D --daemonizeFork teh process into a 
background daemon\n");
+   printf("  -c --config-file filename The config file to use. 
Default: ./osmo-stp.cfg\n");
+   printf("  -V --version  Print the version of 
OsmoSTP\n");
+}
+
+static void handle_options(int argc, char **argv)
+{
+   while (1) {
+   int option_index = 0, c;
+   static const struct option long_options[] = {
+   { "help", 0, 0, 'h' },
+   { "daemonize", 0, 0, 'D' },
+   { "config-file", 1, 0, 'c' },
+   { "version", 0, 0, 'V' },
+   { NULL, 0, 0, 0 }
+   };
+
+   c = getopt_long(argc, argv, "hDc:V", long_options, 
&option_index);
+   if (c == -1)
+   break;
+
+   switch (c) {
+   case 'h':
+   print_help();
+   exit(0);
+   break;
+   case 'D':
+   cmdline_config.daemonize = true;
+   break;
+   case 'c':
+   cmdline_config.config_file = optarg;
+   break;
+   case 'V':
+   print_version(1);
+   exit(0);
+   break;
+   default:
+   fprintf(stderr, "Error in command line options. 
Exiting\n");
+   exit(1);
+   break;
+   }
+   }
+}
+
 int main(int argc, char **argv)
 {
-   char *config_file = "osmo-stp.cfg";
int rc;
+
+   osmo_init_logging(&log_info);
+   vty_init(&vty_info);
+
+   handle_options(argc, argv);
 
fputs(stp_copyright, stdout);
fputs("\n", stdout);
 
-   osmo_init_logging(&log_info);
osmo_ss7_init();
osmo_fsm_log_addr(false);
-   vty_init(&vty_info);
logging_vty_add_cmds(&log_info);
osmo_ss7_vty_init_sg();
 
-   rc = vty_read_config_file(config_file, NULL);
+   rc = vty_read_config_file(cmdline_config.config_file, NULL);
if (rc < 0) {
fprintf(stderr, "Failed to parse the config file '%s'\n",
-   config_file);
+   cmdline_config.config_file);
exit(1);
}
 
@@ -92,7 +151,17 @@
exit(1);
}
 
+   if (cmdline_config.daemonize) {
+   rc = osmo_daemonize();
+   if (rc < 0) {
+   perror("Error during daemonize");
+   exit(1);
+   }
+   }
+
while (1) {
-   osmo_select_main(0);
+   rc = osmo_select_main(0);
+   if (rc < 0)
+   exit(3);
}
 }

-- 
To view, visit https://gerrit.osmocom.org/2342
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I267fbe2e5c774960f0b63cfdd9f60df121b4934d
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Make 'instance <0-15>' mandatory of all show c...

2017-04-14 Thread Harald Welte

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

osmo_ss7_vty: Make 'instance <0-15>' mandatory of all show commands

This way it is systematic and doesn't clash with other optional
arguments we may introduce sooner or later at the end of the commands

Change-Id: I5c1050b0564791b5684619d3737d1cb6c4539d63
---
M src/osmo_ss7_vty.c
1 file changed, 12 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/32/2332/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 59c4008..d97610d 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -37,6 +37,7 @@
 
 #define CS7_STR"ITU-T Signaling System 7\n"
 #define PC_STR "Point Code\n"
+#define INST_STR "An instance of the SS7 stack\n"
 
 /***
  * Core CS7 Configuration
@@ -52,7 +53,7 @@
 
 DEFUN(cs7_instance, cs7_instance_cmd,
"cs7 instance <0-15>",
-   CS7_STR "Configure a SS7 Instance\n"
+   CS7_STR "Configure a SS7 Instance\n" INST_STR
"Number of the instance\n")
 {
int id = atoi(argv[0]);
@@ -307,14 +308,12 @@
 }
 
 DEFUN(show_cs7_route, show_cs7_route_cmd,
-   "show cs7 route [instance <0-15>]",
-   SHOW_STR CS7_STR "Routing Table\n")
+   "show cs7 instance <0-15> route",
+   SHOW_STR CS7_STR INST_STR INST_STR "Routing Table\n")
 {
-   int id = 0;
+   int id = atoi(argv[0]);
struct osmo_ss7_instance *inst;
 
-   if (argc > 0)
-   id = atoi(argv[0]);
inst = osmo_ss7_instance_find(id);
if (!inst) {
vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
@@ -504,15 +503,13 @@
 }
 
 DEFUN(show_cs7_asp, show_cs7_asp_cmd,
-   "show cs7 asp [instance <0-15>]",
-   SHOW_STR CS7_STR "Application Server Process (ASP)\n")
+   "show cs7 instance <0-15> asp",
+   SHOW_STR CS7_STR INST_STR INST_STR "Application Server Process (ASP)\n")
 {
struct osmo_ss7_instance *inst;
struct osmo_ss7_asp *asp;
-   int id = 0;
+   int id = atoi(argv[0]);
 
-   if (argc > 0)
-   id = atoi(argv[0]);
inst = osmo_ss7_instance_find(id);
if (!inst) {
vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
@@ -760,8 +757,8 @@
 }
 
 DEFUN(show_cs7_as, show_cs7_as_cmd,
-   "show cs7 as (active|all|m3ua|sua) [instance <0-15>]",
-   SHOW_STR CS7_STR "Application Server (AS)\n"
+   "show cs7 instance <0-15> as (active|all|m3ua|sua)",
+   SHOW_STR CS7_STR INST_STR INST_STR "Application Server (AS)\n"
"Display all active ASs\n"
"Display all ASs (default)\n"
"Display all m3ua ASs\n"
@@ -769,14 +766,9 @@
 {
struct osmo_ss7_instance *inst;
struct osmo_ss7_as *as;
-   const char *filter = NULL;
-   int id = 0;
+   const char *filter = argv[1];
+   int id = atoi(argv[0]);
 
-   if (argc)
-   filter = argv[0];
-
-   if (argc > 1)
-   id = atoi(argv[1]);
inst = osmo_ss7_instance_find(id);
if (!inst) {
vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);

-- 
To view, visit https://gerrit.osmocom.org/2332
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c1050b0564791b5684619d3737d1cb6c4539d63
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Fix config file writing for xUA listeners

2017-04-14 Thread Harald Welte

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

osmo_ss7_vty: Fix config file writing for xUA listeners

We so far generated un-parseable config files..

Change-Id: Iff6940ef6f52739b6f30a152487038cb0220da43
---
M src/osmo_ss7_vty.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/38/2338/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index e661623..08229dc 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -454,7 +454,7 @@
 
 static void write_one_xua(struct vty *vty, struct osmo_xua_server *xs)
 {
-   vty_out(vty, " %s %u%s",
+   vty_out(vty, " listen %s %u%s",
get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto),
xs->cfg.local.port, VTY_NEWLINE);
vty_out(vty, "  local-ip %s%s", xs->cfg.local.host, VTY_NEWLINE);

-- 
To view, visit https://gerrit.osmocom.org/2338
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff6940ef6f52739b6f30a152487038cb0220da43
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Add 'show cs7 instance <0-15> users' command

2017-04-14 Thread Harald Welte

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

osmo_ss7_vty: Add 'show cs7 instance <0-15> users' command

This will list which Service Indicators have bound local users (like SCCP)

Change-Id: Ibb21810e2ebe520e07cfdda3a0c62172b152015e
---
M src/osmo_ss7_vty.c
1 file changed, 28 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/33/2333/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index d97610d..40f99b1 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -178,6 +178,32 @@
return 0;
 }
 
+DEFUN(show_cs7_user, show_cs7_user_cmd,
+   "show cs7 instance <0-15> users",
+   SHOW_STR CS7_STR INST_STR INST_STR "User Table\n")
+{
+   int id = atoi(argv[0]);
+   struct osmo_ss7_instance *inst;
+   unsigned int i;
+
+   inst = osmo_ss7_instance_find(id);
+   if (!inst) {
+   vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
+   for (i = 0; i < ARRAY_SIZE(inst->user); i++) {
+   const struct osmo_ss7_user *user = inst->user[i];
+   if (!user)
+   continue;
+   vty_out(vty, "SI %u: %s%s", i, user->name, VTY_NEWLINE);
+   }
+
+   return CMD_SUCCESS;
+}
+
+/* TODO: Links + Linksets */
+
 /***
  * Routing Table Configuration
  ***/
@@ -897,6 +923,8 @@
 
 static void vty_init_shared(void)
 {
+   install_element_ve(&show_cs7_user_cmd);
+
/* the mother of all VTY config nodes */
install_element(CONFIG_NODE, &cs7_instance_cmd);
 

-- 
To view, visit https://gerrit.osmocom.org/2333
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb21810e2ebe520e07cfdda3a0c62172b152015e
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo-stp: Remove hack to always enable debug logging

2017-04-14 Thread Harald Welte

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

osmo-stp: Remove hack to always enable debug logging

... and rather use the config file based logging configuration, like
other osmocom programs, too.

Change-Id: I7e0fb869bd778d8c276dc8afd16ecd7f1965b74a
---
M doc/examples/osmo-stp.cfg
M stp/stp_main.c
2 files changed, 13 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/41/2341/1

diff --git a/doc/examples/osmo-stp.cfg b/doc/examples/osmo-stp.cfg
index 45a822b..960bf33 100644
--- a/doc/examples/osmo-stp.cfg
+++ b/doc/examples/osmo-stp.cfg
@@ -2,6 +2,15 @@
 ! osmo-stp (0.0.6.3.179-b248) configuration saved from vty
 !!
 !
+log stderr
+  logging filter all 1
+  logging color 1
+  logging print category 1
+  logging timestamp 0
+  logging level lss7 debug
+  logging level lsccp debug
+  logging level lsua debug
+  logging level lm3ua debug
 line vty
  no login
 !
diff --git a/stp/stp_main.c b/stp/stp_main.c
index 6fbc634..5412223 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -38,6 +39,7 @@
 #include 
 #include 
 
+/* we only use logging sub-systems of the various libraries so far */
 static const struct log_info_cat log_info_cat[] = {
 };
 
@@ -45,18 +47,6 @@
.cat = log_info_cat,
.num_cat = ARRAY_SIZE(log_info_cat),
 };
-
-/* Hack to enable debug logging for all relevant (used?) subsystems */
-static void init_logging(void)
-{
-   const int log_cats[] = { DLSS7, DLSUA, DLM3UA, DLSCCP, DLINP };
-   unsigned int i;
-
-   osmo_init_logging(&log_info);
-
-   for (i = 0; i < ARRAY_SIZE(log_cats); i++)
-   log_set_category_filter(osmo_stderr_target, log_cats[i], 1, 
LOGL_DEBUG);
-}
 
 static const char stp_copyright[] =
"Copyright (C) 2015-2017 by Harald Welte \r\n"
@@ -82,10 +72,11 @@
fputs(stp_copyright, stdout);
fputs("\n", stdout);
 
-   init_logging();
+   osmo_init_logging(&log_info);
osmo_ss7_init();
osmo_fsm_log_addr(false);
vty_init(&vty_info);
+   logging_vty_add_cmds(&log_info);
osmo_ss7_vty_init_sg();
 
rc = vty_read_config_file(config_file, NULL);

-- 
To view, visit https://gerrit.osmocom.org/2341
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e0fb869bd778d8c276dc8afd16ecd7f1965b74a
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


libosmo-sccp[master]: osmo_ss7_vty: Make 'instance <0-15>' mandatory of all show c...

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2332
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I5c1050b0564791b5684619d3737d1cb6c4539d63
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: osmo_ss7_vty: Add 'show cs7 instance <0-15> users' command

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2333
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibb21810e2ebe520e07cfdda3a0c62172b152015e
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: osmo_ss7_vty: Add Command to permit (or disallow) dynamc rou...

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2334
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7355522bacbad1072feb5484b865dfd1be50a64d
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-sccp[master]: osmo_ss7_vty: Add Command to permit (or disallow) dynamc rou...

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo_ss7_vty: Add Command to permit (or disallow) dynamc 
routing key allocation
..


osmo_ss7_vty: Add Command to permit (or disallow) dynamc routing key allocation

This feature has been introduced in
8dec5a8ec554bbd56f4d3f45b6e1025d4c1ffb45, but so far hasn't been exposed
to the VTY yet.

Change-Id: I7355522bacbad1072feb5484b865dfd1be50a64d
---
M src/osmo_ss7_vty.c
1 file changed, 21 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 40f99b1..6c19188 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -163,8 +163,25 @@
inst->cfg.primary_pc = pc;
return CMD_SUCCESS;
 }
+
 /* TODO: cs7 secondary-pc */
 /* TODO: cs7 capability-pc */
+
+DEFUN(cs7_permit_dyn_rkm, cs7_permit_dyn_rkm_cmd,
+   "xua rkm routing-key-allocation (static-only|dynamic-permitted)",
+   "SIGTRAN xxxUA related\n" "Routing Key Management Allocation Policy\n"
+   "Only static (pre-confgured) Routing Keys permitted\n"
+   "Dynamically allocate Routing Keys for what ASPs request\n")
+{
+   struct osmo_ss7_instance *inst = vty->index;
+
+   if (!strcmp(argv[0], "dynamic-permitted"))
+   inst->cfg.permit_dyn_rkm_alloc = true;
+   else
+   inst->cfg.permit_dyn_rkm_alloc = false;
+
+   return CMD_SUCCESS;
+}
 
 static void write_one_cs7(struct vty *vty, struct osmo_ss7_instance *inst);
 
@@ -853,6 +870,9 @@
osmo_ss7_pointcode_print(inst, inst->cfg.primary_pc),
VTY_NEWLINE);
 
+   if (inst->cfg.permit_dyn_rkm_alloc)
+   vty_out(vty, " xua rkm routing-key-allocation 
dynamic-permitted%s", VTY_NEWLINE);
+
/* first dump ASPs, as ASs reference them */
llist_for_each_entry(asp, &inst->asp_list, list)
write_one_asp(vty, asp);
@@ -935,6 +955,7 @@
install_element(L_CS7_NODE, &cs7_pc_format_cmd);
install_element(L_CS7_NODE, &cs7_pc_format_def_cmd);
install_element(L_CS7_NODE, &cs7_pc_delimiter_cmd);
+   install_element(L_CS7_NODE, &cs7_permit_dyn_rkm_cmd);
 
install_node(&asp_node, NULL);
vty_install_default(L_CS7_ASP_NODE);

-- 
To view, visit https://gerrit.osmocom.org/2334
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7355522bacbad1072feb5484b865dfd1be50a64d
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmo-sccp[master]: osmo_ss7_vty: Add 'show cs7 instance <0-15> users' command

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo_ss7_vty: Add 'show cs7 instance <0-15> users' command
..


osmo_ss7_vty: Add 'show cs7 instance <0-15> users' command

This will list which Service Indicators have bound local users (like SCCP)

Change-Id: Ibb21810e2ebe520e07cfdda3a0c62172b152015e
---
M src/osmo_ss7_vty.c
1 file changed, 28 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index d97610d..40f99b1 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -178,6 +178,32 @@
return 0;
 }
 
+DEFUN(show_cs7_user, show_cs7_user_cmd,
+   "show cs7 instance <0-15> users",
+   SHOW_STR CS7_STR INST_STR INST_STR "User Table\n")
+{
+   int id = atoi(argv[0]);
+   struct osmo_ss7_instance *inst;
+   unsigned int i;
+
+   inst = osmo_ss7_instance_find(id);
+   if (!inst) {
+   vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
+   for (i = 0; i < ARRAY_SIZE(inst->user); i++) {
+   const struct osmo_ss7_user *user = inst->user[i];
+   if (!user)
+   continue;
+   vty_out(vty, "SI %u: %s%s", i, user->name, VTY_NEWLINE);
+   }
+
+   return CMD_SUCCESS;
+}
+
+/* TODO: Links + Linksets */
+
 /***
  * Routing Table Configuration
  ***/
@@ -897,6 +923,8 @@
 
 static void vty_init_shared(void)
 {
+   install_element_ve(&show_cs7_user_cmd);
+
/* the mother of all VTY config nodes */
install_element(CONFIG_NODE, &cs7_instance_cmd);
 

-- 
To view, visit https://gerrit.osmocom.org/2333
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibb21810e2ebe520e07cfdda3a0c62172b152015e
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmo-sccp[master]: osmo_ss7_vty: Make 'instance <0-15>' mandatory of all show c...

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo_ss7_vty: Make 'instance <0-15>' mandatory of all show 
commands
..


osmo_ss7_vty: Make 'instance <0-15>' mandatory of all show commands

This way it is systematic and doesn't clash with other optional
arguments we may introduce sooner or later at the end of the commands

Change-Id: I5c1050b0564791b5684619d3737d1cb6c4539d63
---
M src/osmo_ss7_vty.c
1 file changed, 12 insertions(+), 20 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 59c4008..d97610d 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -37,6 +37,7 @@
 
 #define CS7_STR"ITU-T Signaling System 7\n"
 #define PC_STR "Point Code\n"
+#define INST_STR "An instance of the SS7 stack\n"
 
 /***
  * Core CS7 Configuration
@@ -52,7 +53,7 @@
 
 DEFUN(cs7_instance, cs7_instance_cmd,
"cs7 instance <0-15>",
-   CS7_STR "Configure a SS7 Instance\n"
+   CS7_STR "Configure a SS7 Instance\n" INST_STR
"Number of the instance\n")
 {
int id = atoi(argv[0]);
@@ -307,14 +308,12 @@
 }
 
 DEFUN(show_cs7_route, show_cs7_route_cmd,
-   "show cs7 route [instance <0-15>]",
-   SHOW_STR CS7_STR "Routing Table\n")
+   "show cs7 instance <0-15> route",
+   SHOW_STR CS7_STR INST_STR INST_STR "Routing Table\n")
 {
-   int id = 0;
+   int id = atoi(argv[0]);
struct osmo_ss7_instance *inst;
 
-   if (argc > 0)
-   id = atoi(argv[0]);
inst = osmo_ss7_instance_find(id);
if (!inst) {
vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
@@ -504,15 +503,13 @@
 }
 
 DEFUN(show_cs7_asp, show_cs7_asp_cmd,
-   "show cs7 asp [instance <0-15>]",
-   SHOW_STR CS7_STR "Application Server Process (ASP)\n")
+   "show cs7 instance <0-15> asp",
+   SHOW_STR CS7_STR INST_STR INST_STR "Application Server Process (ASP)\n")
 {
struct osmo_ss7_instance *inst;
struct osmo_ss7_asp *asp;
-   int id = 0;
+   int id = atoi(argv[0]);
 
-   if (argc > 0)
-   id = atoi(argv[0]);
inst = osmo_ss7_instance_find(id);
if (!inst) {
vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
@@ -760,8 +757,8 @@
 }
 
 DEFUN(show_cs7_as, show_cs7_as_cmd,
-   "show cs7 as (active|all|m3ua|sua) [instance <0-15>]",
-   SHOW_STR CS7_STR "Application Server (AS)\n"
+   "show cs7 instance <0-15> as (active|all|m3ua|sua)",
+   SHOW_STR CS7_STR INST_STR INST_STR "Application Server (AS)\n"
"Display all active ASs\n"
"Display all ASs (default)\n"
"Display all m3ua ASs\n"
@@ -769,14 +766,9 @@
 {
struct osmo_ss7_instance *inst;
struct osmo_ss7_as *as;
-   const char *filter = NULL;
-   int id = 0;
+   const char *filter = argv[1];
+   int id = atoi(argv[0]);
 
-   if (argc)
-   filter = argv[0];
-
-   if (argc > 1)
-   id = atoi(argv[1]);
inst = osmo_ss7_instance_find(id);
if (!inst) {
vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);

-- 
To view, visit https://gerrit.osmocom.org/2332
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5c1050b0564791b5684619d3737d1cb6c4539d63
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmo-sccp[master]: osmo_ss7_vty: Add 'description' command for SS7 instances

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo_ss7_vty: Add 'description' command for SS7 instances
..


osmo_ss7_vty: Add 'description' command for SS7 instances

This allows the user to add some description to each SS7 instance

Change-Id: Ia5d22f2f70ec12dd13151f949bb45b5fdab42fc5
---
M src/osmo_ss7_vty.c
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 6c19188..5dfa465 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -844,6 +844,8 @@
struct osmo_xua_server *oxs;
 
vty_out(vty, "cs7 instance %u%s", inst->cfg.id, VTY_NEWLINE);
+   if (inst->cfg.description)
+   vty_out(vty, " description %s%s", inst->cfg.description, 
VTY_NEWLINE);
if (inst->cfg.network_indicator)
vty_out(vty, " network-indicator %s%s",
get_value_string(ss7_network_indicator_vals,
@@ -950,6 +952,7 @@
 
install_node(&cs7_node, config_write_cs7);
vty_install_default(L_CS7_NODE);
+   install_element(L_CS7_NODE, &cfg_description_cmd);
install_element(L_CS7_NODE, &cs7_net_ind_cmd);
install_element(L_CS7_NODE, &cs7_point_code_cmd);
install_element(L_CS7_NODE, &cs7_pc_format_cmd);

-- 
To view, visit https://gerrit.osmocom.org/2335
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5d22f2f70ec12dd13151f949bb45b5fdab42fc5
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmo-sccp[master]: osmo_ss7_vty: Add 'description' command for SS7 instances

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2335
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5d22f2f70ec12dd13151f949bb45b5fdab42fc5
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: osmo-stp: Remove hack to always enable debug logging

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2341
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7e0fb869bd778d8c276dc8afd16ecd7f1965b74a
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-sccp[master]: osmo-stp: Remove hack to always enable debug logging

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo-stp: Remove hack to always enable debug logging
..


osmo-stp: Remove hack to always enable debug logging

... and rather use the config file based logging configuration, like
other osmocom programs, too.

Change-Id: I7e0fb869bd778d8c276dc8afd16ecd7f1965b74a
---
M doc/examples/osmo-stp.cfg
M stp/stp_main.c
2 files changed, 13 insertions(+), 13 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/doc/examples/osmo-stp.cfg b/doc/examples/osmo-stp.cfg
index 45a822b..960bf33 100644
--- a/doc/examples/osmo-stp.cfg
+++ b/doc/examples/osmo-stp.cfg
@@ -2,6 +2,15 @@
 ! osmo-stp (0.0.6.3.179-b248) configuration saved from vty
 !!
 !
+log stderr
+  logging filter all 1
+  logging color 1
+  logging print category 1
+  logging timestamp 0
+  logging level lss7 debug
+  logging level lsccp debug
+  logging level lsua debug
+  logging level lm3ua debug
 line vty
  no login
 !
diff --git a/stp/stp_main.c b/stp/stp_main.c
index 6fbc634..5412223 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -38,6 +39,7 @@
 #include 
 #include 
 
+/* we only use logging sub-systems of the various libraries so far */
 static const struct log_info_cat log_info_cat[] = {
 };
 
@@ -45,18 +47,6 @@
.cat = log_info_cat,
.num_cat = ARRAY_SIZE(log_info_cat),
 };
-
-/* Hack to enable debug logging for all relevant (used?) subsystems */
-static void init_logging(void)
-{
-   const int log_cats[] = { DLSS7, DLSUA, DLM3UA, DLSCCP, DLINP };
-   unsigned int i;
-
-   osmo_init_logging(&log_info);
-
-   for (i = 0; i < ARRAY_SIZE(log_cats); i++)
-   log_set_category_filter(osmo_stderr_target, log_cats[i], 1, 
LOGL_DEBUG);
-}
 
 static const char stp_copyright[] =
"Copyright (C) 2015-2017 by Harald Welte \r\n"
@@ -82,10 +72,11 @@
fputs(stp_copyright, stdout);
fputs("\n", stdout);
 
-   init_logging();
+   osmo_init_logging(&log_info);
osmo_ss7_init();
osmo_fsm_log_addr(false);
vty_init(&vty_info);
+   logging_vty_add_cmds(&log_info);
osmo_ss7_vty_init_sg();
 
rc = vty_read_config_file(config_file, NULL);

-- 
To view, visit https://gerrit.osmocom.org/2341
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7e0fb869bd778d8c276dc8afd16ecd7f1965b74a
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmo-sccp[master]: osmo_ss7_vty: Fix config file writing for xUA listeners

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2338
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Iff6940ef6f52739b6f30a152487038cb0220da43
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: Add exampel osmo-stp configuration file

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2339
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I45a04dc808e5a419bf5d68eb28c48cbec352b318
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: stp: Add copyright notice

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2340
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4e074f570eac2e6a0a761f9f5f9c35fa4afa0315
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: Don't overwrite existing data in osmo_ss7_instance_find_or_c...

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2336
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I91b6aabdb873ed8dd103918ee5e40b7ad3946735
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-sccp[master]: Add exampel osmo-stp configuration file

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Add exampel osmo-stp configuration file
..


Add exampel osmo-stp configuration file

Change-Id: I45a04dc808e5a419bf5d68eb28c48cbec352b318
---
M Makefile.am
A doc/examples/osmo-stp.cfg
2 files changed, 12 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Makefile.am b/Makefile.am
index ededdac..9bb711c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,7 @@
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libosmo-sccp.pc libosmo-mtp.pc libosmo-sigtran.pc 
libosmo-xua.pc
 
-EXTRA_DIST = .version
+EXTRA_DIST = .version doc/examples/osmo-stp.cfg
 
 BUILT_SOURCES = $(top_srcdir)/.version
 $(top_srcdir)/.version:
diff --git a/doc/examples/osmo-stp.cfg b/doc/examples/osmo-stp.cfg
new file mode 100644
index 000..45a822b
--- /dev/null
+++ b/doc/examples/osmo-stp.cfg
@@ -0,0 +1,11 @@
+!
+! osmo-stp (0.0.6.3.179-b248) configuration saved from vty
+!!
+!
+line vty
+ no login
+!
+cs7 instance 0
+ xua rkm routing-key-allocation dynamic-permitted
+ listen m3ua 2905
+  accept-asp-connections dynamic-permitted

-- 
To view, visit https://gerrit.osmocom.org/2339
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I45a04dc808e5a419bf5d68eb28c48cbec352b318
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmo-sccp[master]: osmo-stp: Add command line options and daemonize functionality

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2342
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I267fbe2e5c774960f0b63cfdd9f60df121b4934d
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-sccp[master]: osmo-stp: Add command line options and daemonize functionality

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo-stp: Add command line options and daemonize functionality
..


osmo-stp: Add command line options and daemonize functionality

Change-Id: I267fbe2e5c774960f0b63cfdd9f60df121b4934d
---
M stp/stp_main.c
1 file changed, 75 insertions(+), 6 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/stp/stp_main.c b/stp/stp_main.c
index 5412223..3110ec4 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -29,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -64,25 +66,82 @@
.is_config_node = osmo_ss7_is_config_node,
 };
 
+static struct {
+   bool daemonize;
+   const char *config_file;
+} cmdline_config = {
+   .daemonize = false,
+   .config_file = "osmo-stp.cfg",
+};
+
+static void print_help(void)
+{
+   printf("  -h --help This text.\n");
+   printf("  -D --daemonizeFork teh process into a 
background daemon\n");
+   printf("  -c --config-file filename The config file to use. 
Default: ./osmo-stp.cfg\n");
+   printf("  -V --version  Print the version of 
OsmoSTP\n");
+}
+
+static void handle_options(int argc, char **argv)
+{
+   while (1) {
+   int option_index = 0, c;
+   static const struct option long_options[] = {
+   { "help", 0, 0, 'h' },
+   { "daemonize", 0, 0, 'D' },
+   { "config-file", 1, 0, 'c' },
+   { "version", 0, 0, 'V' },
+   { NULL, 0, 0, 0 }
+   };
+
+   c = getopt_long(argc, argv, "hDc:V", long_options, 
&option_index);
+   if (c == -1)
+   break;
+
+   switch (c) {
+   case 'h':
+   print_help();
+   exit(0);
+   break;
+   case 'D':
+   cmdline_config.daemonize = true;
+   break;
+   case 'c':
+   cmdline_config.config_file = optarg;
+   break;
+   case 'V':
+   print_version(1);
+   exit(0);
+   break;
+   default:
+   fprintf(stderr, "Error in command line options. 
Exiting\n");
+   exit(1);
+   break;
+   }
+   }
+}
+
 int main(int argc, char **argv)
 {
-   char *config_file = "osmo-stp.cfg";
int rc;
+
+   osmo_init_logging(&log_info);
+   vty_init(&vty_info);
+
+   handle_options(argc, argv);
 
fputs(stp_copyright, stdout);
fputs("\n", stdout);
 
-   osmo_init_logging(&log_info);
osmo_ss7_init();
osmo_fsm_log_addr(false);
-   vty_init(&vty_info);
logging_vty_add_cmds(&log_info);
osmo_ss7_vty_init_sg();
 
-   rc = vty_read_config_file(config_file, NULL);
+   rc = vty_read_config_file(cmdline_config.config_file, NULL);
if (rc < 0) {
fprintf(stderr, "Failed to parse the config file '%s'\n",
-   config_file);
+   cmdline_config.config_file);
exit(1);
}
 
@@ -92,7 +151,17 @@
exit(1);
}
 
+   if (cmdline_config.daemonize) {
+   rc = osmo_daemonize();
+   if (rc < 0) {
+   perror("Error during daemonize");
+   exit(1);
+   }
+   }
+
while (1) {
-   osmo_select_main(0);
+   rc = osmo_select_main(0);
+   if (rc < 0)
+   exit(3);
}
 }

-- 
To view, visit https://gerrit.osmocom.org/2342
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I267fbe2e5c774960f0b63cfdd9f60df121b4934d
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmo-sccp[master]: osmo_ss7_vty: Fix config file writing for xUA listeners

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo_ss7_vty: Fix config file writing for xUA listeners
..


osmo_ss7_vty: Fix config file writing for xUA listeners

We so far generated un-parseable config files..

Change-Id: Iff6940ef6f52739b6f30a152487038cb0220da43
---
M src/osmo_ss7_vty.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index e661623..08229dc 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -454,7 +454,7 @@
 
 static void write_one_xua(struct vty *vty, struct osmo_xua_server *xs)
 {
-   vty_out(vty, " %s %u%s",
+   vty_out(vty, " listen %s %u%s",
get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto),
xs->cfg.local.port, VTY_NEWLINE);
vty_out(vty, "  local-ip %s%s", xs->cfg.local.host, VTY_NEWLINE);

-- 
To view, visit https://gerrit.osmocom.org/2338
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iff6940ef6f52739b6f30a152487038cb0220da43
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmo-sccp[master]: osmo_ss7_vty: Introduce xUA listener accept-asp-connections ...

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2337
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic93b99047fb566cdb25a2f4139ebef54849dece9
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-sccp[master]: osmo_ss7_vty: Introduce xUA listener accept-asp-connections ...

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo_ss7_vty: Introduce xUA listener accept-asp-connections 
command
..


osmo_ss7_vty: Introduce xUA listener accept-asp-connections command

Using this command one can specify if ASP connections should be refused
if there's no matching configuration, or whether ASPs should simply be
create on-demand.

Change-Id: Ic93b99047fb566cdb25a2f4139ebef54849dece9
---
M src/osmo_ss7_vty.c
1 file changed, 19 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 5dfa465..e661623 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -436,12 +436,30 @@
return CMD_SUCCESS;
 }
 
+DEFUN(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"
+   "Accept only pre-confiugred ASPs (source IP/prt)\n"
+   "Accept any connection and dynamically create an ASP definition\n")
+{
+   struct osmo_xua_server *xs = vty->index;
+
+   if (!strcmp(argv[0], "dynamic-permitted"))
+   xs->cfg.accept_dyn_reg = true;
+   else
+   xs->cfg.accept_dyn_reg = false;
+
+   return CMD_SUCCESS;
+}
+
 static void write_one_xua(struct vty *vty, struct osmo_xua_server *xs)
 {
vty_out(vty, " %s %u%s",
get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto),
xs->cfg.local.port, VTY_NEWLINE);
vty_out(vty, "  local-ip %s%s", xs->cfg.local.host, VTY_NEWLINE);
+   if (xs->cfg.accept_dyn_reg)
+   vty_out(vty, "  accept-asp-connections dynamic-permitted%s", 
VTY_NEWLINE);
 }
 
 
@@ -1007,6 +1025,7 @@
install_element(L_CS7_NODE, &cs7_xua_cmd);
install_element(L_CS7_NODE, &no_cs7_xua_cmd);
install_element(L_CS7_XUA_NODE, &xua_local_ip_cmd);
+   install_element(L_CS7_XUA_NODE, &xua_accept_dyn_asp_cmd);
 }
 
 void osmo_ss7_set_vty_alloc_ctx(void *ctx)

-- 
To view, visit https://gerrit.osmocom.org/2337
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic93b99047fb566cdb25a2f4139ebef54849dece9
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmo-sccp[master]: Don't overwrite existing data in osmo_ss7_instance_find_or_c...

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Don't overwrite existing data in 
osmo_ss7_instance_find_or_create()
..


Don't overwrite existing data in osmo_ss7_instance_find_or_create()

If we actually found an instance for the specified ID, return it fast
and don't (re)initialize all linked list heads, etc.

Change-Id: I91b6aabdb873ed8dd103918ee5e40b7ad3946735
---
M src/osmo_ss7.c
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 27e56af..9b2377b 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -315,8 +315,10 @@
OSMO_ASSERT(ss7_initialized);
 
inst = osmo_ss7_instance_find(id);
-   if (!inst)
-   inst = talloc_zero(ctx, struct osmo_ss7_instance);
+   if (inst)
+   return inst;
+
+   inst = talloc_zero(ctx, struct osmo_ss7_instance);
if (!inst)
return NULL;
 

-- 
To view, visit https://gerrit.osmocom.org/2336
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I91b6aabdb873ed8dd103918ee5e40b7ad3946735
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmo-sccp[master]: stp: Add copyright notice

2017-04-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: stp: Add copyright notice
..


stp: Add copyright notice

Change-Id: I4e074f570eac2e6a0a761f9f5f9c35fa4afa0315
---
M stp/stp_main.c
1 file changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/stp/stp_main.c b/stp/stp_main.c
index 267806b..6fbc634 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -58,8 +58,17 @@
log_set_category_filter(osmo_stderr_target, log_cats[i], 1, 
LOGL_DEBUG);
 }
 
+static const char stp_copyright[] =
+   "Copyright (C) 2015-2017 by Harald Welte \r\n"
+   "Contributions by Holger Freyther, Neels Hofmeyr\r\n"
+   "License GPLv2+: GNU GPL Version 2 or later 
\r\n"
+   "This is free software: you are free ot change and redistribute it.\r\n"
+   "There is NO WARRANTY, to the extent permitted by law.\r\n\r\n"
+   "Free Software lives by contribution.  If you use this, please 
contribute!\r\n";
+
 static struct vty_app_info vty_info = {
.name   = "osmo-stp",
+   .copyright = stp_copyright,
.version = PACKAGE_VERSION,
.go_parent_cb = osmo_ss7_vty_go_parent,
.is_config_node = osmo_ss7_is_config_node,
@@ -70,6 +79,9 @@
char *config_file = "osmo-stp.cfg";
int rc;
 
+   fputs(stp_copyright, stdout);
+   fputs("\n", stdout);
+
init_logging();
osmo_ss7_init();
osmo_fsm_log_addr(false);

-- 
To view, visit https://gerrit.osmocom.org/2340
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4e074f570eac2e6a0a761f9f5f9c35fa4afa0315
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Build failure of network:osmocom:nightly/osmo-stp in xUbuntu_16.10/x86_64

2017-04-14 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-stp/xUbuntu_16.10/x86_64

Package network:osmocom:nightly/osmo-stp failed to build in xUbuntu_16.10/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-stp

Last lines of build log:
[  114s]   #warning "Notify any other AS(P) for failover scenario"
[  114s]^~~
[  115s] gcc -DHAVE_CONFIG_H -I. -I..   -I../include -Wdate-time 
-D_FORTIFY_SOURCE=2 -Wall -I/usr/include/ -I/usr/include/ -I/usr/include/ 
-I/usr/include/   -DNO_UNIPORTE -g -O2 
-fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong -Wformat 
-Werror=format-security -c -o vty_interface.o vty_interface.c
[  115s] gcc -DHAVE_CONFIG_H -I. -I..   -I../include -Wdate-time 
-D_FORTIFY_SOURCE=2 -Wall -I/usr/include/ -I/usr/include/ -I/usr/include/ 
-I/usr/include/   -DNO_UNIPORTE -g -O2 
-fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong -Wformat 
-Werror=format-security -c -o sctp_m3ua_client.o sctp_m3ua_client.c
[  115s] sctp_m3ua_client.c:25:40: fatal error: osmocom/sigtran/m3ua_types.h: 
No such file or directory
[  115s]  #include 
[  115s] ^
[  115s] compilation terminated.
[  115s] Makefile:485: recipe for target 'sctp_m3ua_client.o' failed
[  115s] make[3]: *** [sctp_m3ua_client.o] Error 1
[  115s] make[3]: Leaving directory '/usr/src/packages/BUILD/src'
[  115s] Makefile:380: recipe for target 'all-recursive' failed
[  115s] make[2]: *** [all-recursive] Error 1
[  115s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[  115s] Makefile:321: recipe for target 'all' failed
[  115s] make[1]: *** [all] Error 2
[  115s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  115s] dh_auto_build: make -j1 returned exit code 2
[  115s] debian/rules:23: recipe for target 'build' failed
[  115s] make: *** [build] Error 2
[  115s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  115s] 
[  115s] lamb60 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:06:23 UTC 2017.
[  115s] 
[  115s] ### VM INTERACTION START ###
[  119s] ### VM INTERACTION END ###
[  119s] 
[  119s] lamb60 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:06:27 UTC 2017.
[  119s] 

-- 
Configure notifications at https://build.opensuse.org/user/notifications
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/osmo-stp in Debian_8.0/x86_64

2017-04-14 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-stp/Debian_8.0/x86_64

Package network:osmocom:nightly/osmo-stp failed to build in Debian_8.0/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-stp

Last lines of build log:
[  101s]   CC   vty_interface.o
[  101s]   CC   sctp_m3ua_client.o
[  102s] sctp_m3ua_client.c:25:40: fatal error: osmocom/sigtran/m3ua_types.h: 
No such file or directory
[  102s]  #include 
[  102s] ^
[  102s] compilation terminated.
[  102s] Makefile:475: recipe for target 'sctp_m3ua_client.o' failed
[  102s] make[3]: *** [sctp_m3ua_client.o] Error 1
[  102s] make[3]: Leaving directory '/usr/src/packages/BUILD/src'
[  102s] Makefile:370: recipe for target 'all-recursive' failed
[  102s] make[2]: *** [all-recursive] Error 1
[  102s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[  102s] Makefile:310: recipe for target 'all' failed
[  102s] make[1]: *** [all] Error 2
[  102s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  102s] dh_auto_build: make -j1 returned exit code 2
[  102s] debian/rules:23: recipe for target 'build' failed
[  102s] make: *** [build] Error 2
[  102s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  102s] 
[  102s] lamb15 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:06:24 UTC 2017.
[  102s] 
[  102s] ### VM INTERACTION START ###
[  103s] Powering off.
[  103s] [   90.243917] reboot: Power down
[  103s] ### VM INTERACTION END ###
[  103s] 
[  103s] lamb15 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:06:26 UTC 2017.
[  103s] 

-- 
Configure notifications at https://build.opensuse.org/user/notifications
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/osmo-stp in Debian_8.0/i586

2017-04-14 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-stp/Debian_8.0/i586

Package network:osmocom:nightly/osmo-stp failed to build in Debian_8.0/i586

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-stp

Last lines of build log:
[   97s]   CC   vty_interface.o
[   98s]   CC   sctp_m3ua_client.o
[   98s] sctp_m3ua_client.c:25:40: fatal error: osmocom/sigtran/m3ua_types.h: 
No such file or directory
[   98s]  #include 
[   98s] ^
[   98s] compilation terminated.
[   98s] Makefile:475: recipe for target 'sctp_m3ua_client.o' failed
[   98s] make[3]: *** [sctp_m3ua_client.o] Error 1
[   98s] make[3]: Leaving directory '/usr/src/packages/BUILD/src'
[   98s] Makefile:370: recipe for target 'all-recursive' failed
[   98s] make[2]: *** [all-recursive] Error 1
[   98s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[   98s] Makefile:310: recipe for target 'all' failed
[   98s] make[1]: *** [all] Error 2
[   98s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[   98s] dh_auto_build: make -j1 returned exit code 2
[   98s] debian/rules:23: recipe for target 'build' failed
[   98s] make: *** [build] Error 2
[   98s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[   98s] 
[   98s] build84 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:06:07 UTC 2017.
[   98s] 
[   98s] ### VM INTERACTION START ###
[   99s] Powering off.
[   99s] [   86.501369] reboot: Power down
[  100s] ### VM INTERACTION END ###
[  100s] 
[  100s] build84 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:06:10 UTC 2017.
[  100s] 

-- 
Configure notifications at https://build.opensuse.org/user/notifications
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/osmo-stp in xUbuntu_16.04/i586

2017-04-14 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-stp/xUbuntu_16.04/i586

Package network:osmocom:nightly/osmo-stp failed to build in xUbuntu_16.04/i586

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-stp

Last lines of build log:
[   81s] sctp_m2ua.c: In function 'm2ua_conn_destroy':
[   81s] sctp_m2ua.c:91:3: warning: #warning "Notify any other AS(P) for 
failover scenario" [-Wcpp]
[   81s]   #warning "Notify any other AS(P) for failover scenario"
[   81s]^
[   81s] gcc -DHAVE_CONFIG_H -I. -I..   -I../include -Wdate-time 
-D_FORTIFY_SOURCE=2 -Wall -I/usr/include/ -I/usr/include/ -I/usr/include/ 
-I/usr/include/   -DNO_UNIPORTE -g -O2 -fstack-protector-strong -Wformat 
-Werror=format-security -c -o vty_interface.o vty_interface.c
[   82s] gcc -DHAVE_CONFIG_H -I. -I..   -I../include -Wdate-time 
-D_FORTIFY_SOURCE=2 -Wall -I/usr/include/ -I/usr/include/ -I/usr/include/ 
-I/usr/include/   -DNO_UNIPORTE -g -O2 -fstack-protector-strong -Wformat 
-Werror=format-security -c -o sctp_m3ua_client.o sctp_m3ua_client.c
[   82s] sctp_m3ua_client.c:25:40: fatal error: osmocom/sigtran/m3ua_types.h: 
No such file or directory
[   82s] compilation terminated.
[   82s] Makefile:485: recipe for target 'sctp_m3ua_client.o' failed
[   82s] make[3]: *** [sctp_m3ua_client.o] Error 1
[   82s] make[3]: Leaving directory '/usr/src/packages/BUILD/src'
[   82s] Makefile:380: recipe for target 'all-recursive' failed
[   82s] make[2]: *** [all-recursive] Error 1
[   82s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[   82s] Makefile:321: recipe for target 'all' failed
[   82s] make[1]: *** [all] Error 2
[   82s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[   82s] dh_auto_build: make -j1 returned exit code 2
[   82s] debian/rules:23: recipe for target 'build' failed
[   82s] make: *** [build] Error 2
[   82s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[   82s] 
[   82s] build82 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:07:41 UTC 2017.
[   82s] 
[   82s] ### VM INTERACTION START ###
[   85s] ### VM INTERACTION END ###
[   85s] 
[   85s] build82 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:07:44 UTC 2017.
[   85s] 

-- 
Configure notifications at https://build.opensuse.org/user/notifications
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/osmo-stp in xUbuntu_16.10/i586

2017-04-14 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-stp/xUbuntu_16.10/i586

Package network:osmocom:nightly/osmo-stp failed to build in xUbuntu_16.10/i586

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-stp

Last lines of build log:
[  163s]^~~
[  163s] gcc -DHAVE_CONFIG_H -I. -I..   -I../include -Wdate-time 
-D_FORTIFY_SOURCE=2 -Wall -I/usr/include/ -I/usr/include/ -I/usr/include/ 
-I/usr/include/   -DNO_UNIPORTE -g -O2 
-fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong -Wformat 
-Werror=format-security -c -o vty_interface.o vty_interface.c
[  164s] gcc -DHAVE_CONFIG_H -I. -I..   -I../include -Wdate-time 
-D_FORTIFY_SOURCE=2 -Wall -I/usr/include/ -I/usr/include/ -I/usr/include/ 
-I/usr/include/   -DNO_UNIPORTE -g -O2 
-fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong -Wformat 
-Werror=format-security -c -o sctp_m3ua_client.o sctp_m3ua_client.c
[  164s] sctp_m3ua_client.c:25:40: fatal error: osmocom/sigtran/m3ua_types.h: 
No such file or directory
[  164s]  #include 
[  164s] ^
[  164s] compilation terminated.
[  164s] Makefile:485: recipe for target 'sctp_m3ua_client.o' failed
[  164s] make[3]: *** [sctp_m3ua_client.o] Error 1
[  164s] make[3]: Leaving directory '/usr/src/packages/BUILD/src'
[  164s] Makefile:380: recipe for target 'all-recursive' failed
[  164s] make[2]: *** [all-recursive] Error 1
[  164s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[  164s] Makefile:321: recipe for target 'all' failed
[  164s] make[1]: *** [all] Error 2
[  164s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  164s] dh_auto_build: make -j1 returned exit code 2
[  164s] debian/rules:23: recipe for target 'build' failed
[  164s] make: *** [build] Error 2
[  164s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  164s] 
[  164s] lamb69 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:09:08 UTC 2017.
[  164s] 
[  164s] ### VM INTERACTION START ###
[  167s] [  141.992533] reboot: Power down
[  167s] ### VM INTERACTION END ###
[  167s] 
[  167s] lamb69 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:09:12 UTC 2017.
[  167s] 

-- 
Configure notifications at https://build.opensuse.org/user/notifications
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/osmo-stp in xUbuntu_16.04/x86_64

2017-04-14 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-stp/xUbuntu_16.04/x86_64

Package network:osmocom:nightly/osmo-stp failed to build in xUbuntu_16.04/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-stp

Last lines of build log:
[  329s] sctp_m2ua.c:91:3: warning: #warning "Notify any other AS(P) for 
failover scenario" [-Wcpp]
[  329s]   #warning "Notify any other AS(P) for failover scenario"
[  329s]^
[  330s] gcc -DHAVE_CONFIG_H -I. -I..   -I../include -Wdate-time 
-D_FORTIFY_SOURCE=2 -Wall -I/usr/include/ -I/usr/include/ -I/usr/include/ 
-I/usr/include/   -DNO_UNIPORTE -g -O2 -fstack-protector-strong -Wformat 
-Werror=format-security -c -o vty_interface.o vty_interface.c
[  331s] gcc -DHAVE_CONFIG_H -I. -I..   -I../include -Wdate-time 
-D_FORTIFY_SOURCE=2 -Wall -I/usr/include/ -I/usr/include/ -I/usr/include/ 
-I/usr/include/   -DNO_UNIPORTE -g -O2 -fstack-protector-strong -Wformat 
-Werror=format-security -c -o sctp_m3ua_client.o sctp_m3ua_client.c
[  331s] sctp_m3ua_client.c:25:40: fatal error: osmocom/sigtran/m3ua_types.h: 
No such file or directory
[  331s] compilation terminated.
[  331s] Makefile:485: recipe for target 'sctp_m3ua_client.o' failed
[  331s] make[3]: *** [sctp_m3ua_client.o] Error 1
[  331s] make[3]: Leaving directory '/usr/src/packages/BUILD/src'
[  331s] Makefile:380: recipe for target 'all-recursive' failed
[  331s] make[2]: *** [all-recursive] Error 1
[  331s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[  331s] Makefile:321: recipe for target 'all' failed
[  331s] make[1]: *** [all] Error 2
[  331s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  331s] dh_auto_build: make -j1 returned exit code 2
[  331s] debian/rules:23: recipe for target 'build' failed
[  331s] make: *** [build] Error 2
[  331s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  331s] 
[  331s] cloud116 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:15:28 UTC 2017.
[  331s] 
[  331s] ### VM INTERACTION START ###
[  334s] [  302.266407] reboot: Power down
[  336s] ### VM INTERACTION END ###
[  336s] 
[  336s] cloud116 failed "build cellmgr-ng_1.4.7.20170414.dsc" at Fri Apr 14 
20:15:33 UTC 2017.
[  336s] 

-- 
Configure notifications at https://build.opensuse.org/user/notifications
openSUSE Build Service (https://build.opensuse.org/)


[PATCH] libosmo-sccp[master]: m3ua_example: Add SS7 and SCCP VTY

2017-04-14 Thread Harald Welte

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

m3ua_example: Add SS7 and SCCP VTY

Change-Id: Id03d2f94d22445ada01917356a5ec5a8e4fa3fca
---
M examples/m3ua_example.c
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/46/2346/1

diff --git a/examples/m3ua_example.c b/examples/m3ua_example.c
index d1247f5..d3c6a7c 100644
--- a/examples/m3ua_example.c
+++ b/examples/m3ua_example.c
@@ -92,6 +92,8 @@
osmo_ss7_init();
osmo_fsm_log_addr(false);
vty_init(&vty_info);
+   osmo_ss7_vty_init_asp();
+   osmo_sccp_vty_init();
 
if (argc <= 1)
client = true;

-- 
To view, visit https://gerrit.osmocom.org/2346
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id03d2f94d22445ada01917356a5ec5a8e4fa3fca
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo_ss7: Clean up all ASPs established via xua_server upon ...

2017-04-14 Thread Harald Welte

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

osmo_ss7: Clean up all ASPs established via xua_server upon destroy

When we destroy a xua_server, we would like to close and destroy any
ASPs that were established via that xua_server.   In order to do so, we
need to add a list of ASPs to the xua_server, which we can iterate.

Change-Id: Iff3ed099b817e54e563b70d9ab40f63af63cc2fb
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
2 files changed, 16 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/51/2351/1

diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index 376e399..a8c1c3c 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -339,6 +339,7 @@
 
/*! \ref osmo_xua_server over which we were established */
struct osmo_xua_server *xua_server;
+   struct llist_head siblings;
 
/*! osmo_stream / libosmo-netif handles */
struct osmo_stream_cli *client;
@@ -396,6 +397,9 @@
struct llist_head list;
struct osmo_ss7_instance *inst;
 
+   /* list of ASPs established via this server */
+   struct llist_head asp_list;
+
struct osmo_stream_srv_link *server;
 
struct {
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 771501f..57d9d39 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1050,6 +1050,8 @@
osmo_stream_cli_destroy(asp->client);
if (asp->fi)
osmo_fsm_inst_term(asp->fi, OSMO_FSM_TERM_REQUEST, NULL);
+   if (asp->xua_server)
+   llist_del(&asp->siblings);
 
/* unlink from all ASs we are part of */
llist_for_each_entry(as, &asp->inst->as_list, list) {
@@ -1481,6 +1483,7 @@
/* update the ASP reference back to the server over which the
 * connection came in */
asp->server = srv;
+   llist_add_tail(&asp->siblings, &oxs->asp_list);
/* update the ASP socket name */
if (asp->sock_name)
talloc_free(asp->sock_name);
@@ -1575,6 +1578,8 @@
LOGP(DLSS7, LOGL_INFO, "Creating XUA Server %s:%u\n",
local_host, local_port);
 
+   INIT_LLIST_HEAD(&oxs->asp_list);
+
oxs->cfg.proto = proto;
oxs->cfg.local.port = local_port;
oxs->cfg.local.host = talloc_strdup(oxs, local_host);
@@ -1614,13 +1619,17 @@
 
 void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs)
 {
+   struct osmo_ss7_asp *asp, *asp2;
+
if (xs->server) {
osmo_stream_srv_link_close(xs->server);
osmo_stream_srv_link_destroy(xs->server);
}
-   /* FIXME: add asp_list to xua_server so we can iterate it here
-* and close all connections established in relation with this
-* server */
+   /* iterate and close all connections established in relation
+* with this server */
+   llist_for_each_entry_safe(asp, asp2, &xs->asp_list, siblings)
+   osmo_ss7_asp_destroy(asp);
+
llist_del(&xs->list);
talloc_free(xs);
 }

-- 
To view, visit https://gerrit.osmocom.org/2351
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff3ed099b817e54e563b70d9ab40f63af63cc2fb
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: sccp_scoc: Memorize if a connection is incoming or outbound

2017-04-14 Thread Harald Welte

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

sccp_scoc: Memorize if a connection is incoming or outbound

This is not really needed by the state machines internally, so we have
to artificially add it to the sccp_connection.  We don't use it yet, but
upcoming code for VTY introspection of SCCP connections will be able to
use it.

Change-Id: Ic3c85152665abfb613e197b098c97392d16d16bf
---
M src/sccp_scoc.c
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/44/2344/1

diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index 4bf340d..8621e6d 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -102,6 +102,9 @@
uint32_t sccp_class;
uint32_t release_cause; /* WAIT_CONN_CONF */
 
+   /* incoming (true) or outgoing (false) */
+   bool incoming;
+
/* Osmo FSM Instance of sccp_scoc_fsm */
struct osmo_fsm_inst *fi;
 
@@ -1514,6 +1517,7 @@
/* Allocate new connection */
conn = conn_create(inst);
conn->user = scu;
+   conn->incoming = true;
} else {
uint32_t conn_id;
/* Resolve existing connection */

-- 
To view, visit https://gerrit.osmocom.org/2344
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3c85152665abfb613e197b098c97392d16d16bf
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: SUA/M3UA: Implement T(r) recovery timer of Application Serve...

2017-04-14 Thread Harald Welte

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

SUA/M3UA: Implement T(r) recovery timer of Application Server FSM

When an AS goes "down" it first entres a recovery state, in which any
to-be-transmitted messages are enqueued until the timer T(r) expires.

Once the timer expires, the messages are discarded.  If the AS goes
ACTIVE before timer expiration, queued messages are sent.

Change-Id: I22725bf35306299a00c66d7b3637f5e198c26247
---
M src/m3ua.c
M src/sua.c
M src/xua_as_fsm.c
M src/xua_as_fsm.h
4 files changed, 145 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/49/2349/1

diff --git a/src/m3ua.c b/src/m3ua.c
index 7dc2afb..a7ef06c 100644
--- a/src/m3ua.c
+++ b/src/m3ua.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 
+#include "xua_as_fsm.h"
 #include "xua_asp_fsm.h"
 #include "xua_internal.h"
 
@@ -420,16 +421,14 @@
  * Transmitting M3UA messsages to SCTP
  ***/
 
-/* transmit given xua_msg via given ASP. callee takes xua ownership */
-static int m3ua_tx_xua_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
+/* Convert M3UA from xua_msg to msgb and set PPID/stream */
+static struct msgb *m3ua_to_msg(struct xua_msg *xua)
 {
struct msgb *msg = xua_to_msg(M3UA_VERSION, xua);
 
-   OSMO_ASSERT(asp->cfg.proto == OSMO_SS7_ASP_PROT_M3UA);
-
if (!msg) {
LOGP(DLM3UA, LOGL_ERROR, "Error encoding M3UA Msg\n");
-   return -1;
+   return NULL;
}
 
if (xua->hdr.msg_class == M3UA_MSGC_XFER)
@@ -437,6 +436,20 @@
else
msgb_sctp_stream(msg) = 0;
msgb_sctp_ppid(msg) = M3UA_PPID;
+
+   return msg;
+}
+
+/* transmit given xua_msg via given ASP */
+static int m3ua_tx_xua_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
+{
+   struct msgb *msg = m3ua_to_msg(xua);
+
+   OSMO_ASSERT(asp->cfg.proto == OSMO_SS7_ASP_PROT_M3UA);
+
+   if (!msg)
+   return -1;
+
return osmo_ss7_asp_send(asp, msg);
 }
 
@@ -446,8 +459,8 @@
  *  \return 0 on success; negative on error */
 int m3ua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua)
 {
-   struct osmo_ss7_asp *asp;
-   unsigned int i;
+   struct msgb *msg;
+   int rc;
 
OSMO_ASSERT(as->cfg.proto == OSMO_SS7_ASP_PROT_M3UA);
 
@@ -455,19 +468,16 @@
if (as->cfg.routing_key.context)
xua_msg_add_u32(xua, M3UA_IEI_ROUTE_CTX, 
as->cfg.routing_key.context);
 
-   for (i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) {
-   asp = as->cfg.asps[i];
-   if (!asp)
-   continue;
-   if (asp)
-   break;
-   }
-   if (!asp) {
-   LOGP(DLM3UA, LOGL_ERROR, "No ASP entroy in AS, dropping 
message\n");
-   return -ENODEV;
-   }
+   msg = m3ua_to_msg(xua);
+   if (!msg)
+   return -1;
 
-   return m3ua_tx_xua_asp(asp, xua);
+   /* send the msg to the AS for transmission.  The AS FSM might
+* (depending on its state) enqueue it before trnsmission */
+   rc = osmo_fsm_inst_dispatch(as->fi, XUA_AS_E_TRANSFER_REQ, msg);
+   if (rc < 0)
+   msgb_free(msg);
+   return rc;
 }
 
 /***
diff --git a/src/sua.c b/src/sua.c
index 3bff855..97a0785 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 
+#include "xua_as_fsm.h"
 #include "xua_asp_fsm.h"
 #include "xua_internal.h"
 #include "sccp_internal.h"
@@ -252,18 +253,38 @@
  * Transmitting SUA messsages to SCTP
  ***/
 
-static int sua_tx_xua_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
+static struct msgb *sua_to_msg(struct xua_msg *xua)
 {
struct msgb *msg = xua_to_msg(SUA_VERSION, xua);
 
-   OSMO_ASSERT(asp->cfg.proto == OSMO_SS7_ASP_PROT_SUA);
-
if (!msg) {
-   LOGPASP(asp, DLSUA, LOGL_ERROR, "Error encoding SUA Msg\n");
-   return -1;
+   LOGP(DLSUA, LOGL_ERROR, "Error encoding SUA Msg\n");
+   return NULL;
}
 
+   switch (xua->hdr.msg_class) {
+   case SUA_MSGC_CL:
+   case SUA_MSGC_CO:
+   msgb_sctp_stream(msg) = 1;
+   break;
+   default:
+   msgb_sctp_stream(msg) = 0;
+   break;
+   }
msgb_sctp_ppid(msg) = SUA_PPID;
+
+   return msg;
+}
+
+static int sua_tx_xua_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
+{
+   struct msgb *msg = sua_to_msg(xua);
+
+   OSMO_ASSERT(asp->cfg.proto == OSMO_SS7_ASP_PROT_SUA);
+
+   if (!msg)
+   return -1;
+
return osmo_ss7_asp_send(asp, msg);
 }
 
@@ -273,25 +294,25 @@
  *  \return 0 on success; negative on error */
 int sua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua)
 {
-   struct o

[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Print AS and ASP state names during 'show'

2017-04-14 Thread Harald Welte

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

osmo_ss7_vty: Print AS and ASP state names during 'show'

Change-Id: I6a06d93d6e6c0386676742d6d19f5483a46d7fba
---
M src/osmo_ss7_vty.c
1 file changed, 10 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/48/2348/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index a05d74f..8356d16 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -579,13 +579,13 @@
return CMD_WARNING;
}
 
-   vty_out(vty, " 
Effect Primary%s", VTY_NEWLINE);
-   vty_out(vty, "ASP Name  AS Name   State Type  Rmt Port 
Remote IP Addr  SCTP%s", VTY_NEWLINE);
-   vty_out(vty, "         
--- --%s", VTY_NEWLINE);
+   vty_out(vty, "  
Effect Primary%s", VTY_NEWLINE);
+   vty_out(vty, "ASP Name  AS Name   State  Type  Rmt Port 
Remote IP Addr  SCTP%s", VTY_NEWLINE);
+   vty_out(vty, "    -     
--- --%s", VTY_NEWLINE);
 
llist_for_each_entry(asp, &inst->asp_list, list) {
-   vty_out(vty, "%-12s  %-12s  %-8s  %-4s  %-8u %-15s %-10s%s",
-   asp->cfg.name, "?", "?",
+   vty_out(vty, "%-12s  %-12s  %-13s  %-4s  %-8u %-15s %-10s%s",
+   asp->cfg.name, "?", osmo_fsm_inst_state_name(asp->fi),
get_value_string(osmo_ss7_asp_protocol_vals, 
asp->cfg.proto),
asp->cfg.remote.port, asp->cfg.remote.host, "", 
VTY_NEWLINE);
}
@@ -846,9 +846,9 @@
return CMD_WARNING;
}
 
-   vty_out(vty, "RoutingRouting Key
  Cic   Cic%s", VTY_NEWLINE);
-   vty_out(vty, "AS Name  State  ContextDpc   Si   Opc 
  Ssn Min   Max%s", VTY_NEWLINE);
-   vty_out(vty, " -- -- -  
- --- - -%s", VTY_NEWLINE);
+   vty_out(vty, "  RoutingRouting Key  
Cic   Cic%s", VTY_NEWLINE);
+   vty_out(vty, "AS Name  StateContextDpc   Si   
Opc   Ssn Min   Max%s", VTY_NEWLINE);
+   vty_out(vty, "  -- -  
- --- - -%s", VTY_NEWLINE);
 
llist_for_each_entry(as, &inst->as_list, list) {
if (filter && !strcmp(filter, "m3ua") && as->cfg.proto != 
OSMO_SS7_ASP_PROT_M3UA)
@@ -856,8 +856,8 @@
if (filter && !strcmp(filter, "sua") && as->cfg.proto != 
OSMO_SS7_ASP_PROT_SUA)
continue;
/* FIXME: active filter */
-   vty_out(vty, "%-12s %-6s %-10u %-13s %4s %13s %3s %5s %4s%s",
-   as->cfg.name, "fixme", as->cfg.routing_key.context,
+   vty_out(vty, "%-12s %-12s %-10u %-13s %4s %13s %3s %5s %4s%s",
+   as->cfg.name, osmo_fsm_inst_state_name(as->fi), 
as->cfg.routing_key.context,
osmo_ss7_pointcode_print(as->inst, 
as->cfg.routing_key.pc),
"", "", "", "", "", VTY_NEWLINE);
}

-- 
To view, visit https://gerrit.osmocom.org/2348
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a06d93d6e6c0386676742d6d19f5483a46d7fba
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: ss7_vty: don't re-define xUA dialect strings

2017-04-14 Thread Harald Welte

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

ss7_vty: don't re-define xUA dialect strings

If we add more xUA variants/protocols, we want to avoid having to touch
too many parts of the code with copy+pasted strings.

Change-Id: I085b884d98fb4c45ac15910a8ebf82b91e861fd4
---
M src/osmo_ss7_vty.c
1 file changed, 15 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/47/2347/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index c2ad25c..a05d74f 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -37,6 +37,13 @@
 
 #include "xua_internal.h"
 
+#define XUA_VAR_STR"(sua|m3ua)"
+
+#define XUA_VAR_HELP_STR   \
+   "SCCP User Adaptation\n" \
+   "MTP3 User Adaptation\n"
+
+
 /***
  * Core CS7 Configuration
  ***/
@@ -380,12 +387,10 @@
1,
 };
 
-#define XUA_STR"SCCP User Adaptation\n" "MTP3 User Adaptation\n"
-
 DEFUN(cs7_xua, cs7_xua_cmd,
-   "listen (sua|m3ua) <0-65534>",
+   "listen " XUA_VAR_STR " <0-65534>",
"Configure/Enable xUA Listener\n"
-   XUA_STR "SCTP Port number\n")
+   XUA_VAR_HELP_STR "SCTP Port number\n")
 {
struct osmo_ss7_instance *inst = vty->index;
struct osmo_xua_server *xs;
@@ -405,9 +410,9 @@
 }
 
 DEFUN(no_cs7_xua, no_cs7_xua_cmd,
-   "no listen (sua|m3ua) <0-65534>",
+   "no listen " XUA_VAR_STR " <0-65534>",
NO_STR "Disable xUA Listener on given SCTP Port\n"
-   XUA_STR "SCTP Port number\n")
+   XUA_VAR_HELP_STR "SCTP Port number\n")
 {
struct osmo_ss7_instance *inst = vty->index;
struct osmo_xua_server *xs;
@@ -472,13 +477,12 @@
 };
 
 DEFUN(cs7_asp, cs7_asp_cmd,
-   "asp NAME <0-65535> <0-65535> (m3ua|sua)",
+   "asp NAME <0-65535> <0-65535> " XUA_VAR_STR,
"Configure Application Server Process\n"
"Name of ASP\n"
"Remote SCTP port number\n"
"Local SCTP port number\n"
-   "M3UA Protocol\n"
-   "SUA Protocol\n")
+   XUA_VAR_HELP_STR)
 {
struct osmo_ss7_instance *inst = vty->index;
const char *name = argv[0];
@@ -617,11 +621,10 @@
 };
 
 DEFUN(cs7_as, cs7_as_cmd,
-   "as NAME (m3ua|sua)",
+   "as NAME " XUA_VAR_STR,
"Configure an Application Server\n"
"Name of the Application Server\n"
-   "M3UA Application Server\n"
-   "SUA Application Server\n")
+   XUA_VAR_HELP_STR)
 {
struct osmo_ss7_instance *inst = vty->index;
struct osmo_ss7_as *as;

-- 
To view, visit https://gerrit.osmocom.org/2347
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I085b884d98fb4c45ac15910a8ebf82b91e861fd4
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Don't save dynamically generated AS / ASP

2017-04-14 Thread Harald Welte

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

osmo_ss7_vty: Don't save dynamically generated AS / ASP

If RKM has dynamically generated some AS definitions on the fly, or if
we accepted auto-creation of ASPs on SCTP connect time, then we don't
wnat to save such objects during vty config file store.

Change-Id: I9d0b0b61737a30b9d6e76cecbe42ec071bcddeeb
---
M src/osmo_ss7_vty.c
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/43/2343/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 08229dc..b08a456 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -592,6 +592,11 @@
 
 static void write_one_asp(struct vty *vty, struct osmo_ss7_asp *asp)
 {
+   /* skip any dynamically created ASPs (auto-created at connect
+* time) */
+   if (asp->dyn_allocated)
+   return;
+
vty_out(vty, " asp %s %u %u %s%s",
asp->cfg.name, asp->cfg.remote.port, asp->cfg.local.port,
osmo_ss7_asp_protocol_name(asp->cfg.proto), VTY_NEWLINE);
@@ -787,6 +792,10 @@
struct osmo_ss7_routing_key *rkey;
unsigned int i;
 
+   /* skip any dynamically allocated AS definitions */
+   if (as->rkm_dyn_allocated)
+   return;
+
vty_out(vty, " as %s %s%s", as->cfg.name,
osmo_ss7_asp_protocol_name(as->cfg.proto), VTY_NEWLINE);
if (as->cfg.description)

-- 
To view, visit https://gerrit.osmocom.org/2343
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d0b0b61737a30b9d6e76cecbe42ec071bcddeeb
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: get rid of global osmo_ss7_xua_servers variable

2017-04-14 Thread Harald Welte

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

get rid of global osmo_ss7_xua_servers variable

By moving this variable into the SS7 instance, we avoid one more global
variable, and we also fix a bug where the xua servers would be saved
multiple times (once per instance).

Change-Id: Icbab59d773f23cc8514cbeb6e21e25ca35dd337f
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
M src/osmo_ss7_vty.c
3 files changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/50/2350/1

diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index 24f83e9..376e399 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -10,7 +10,6 @@
 #include 
 
 extern struct llist_head osmo_ss7_instances;
-extern struct llist_head osmo_ss7_xua_servers;
 
 struct osmo_ss7_instance;
 struct osmo_ss7_user;
@@ -70,6 +69,8 @@
struct llist_head asp_list;
/*! list of \ref osmo_ss7_route_table */
struct llist_head rtable_list;
+   /*! list of \ref osmo_xua_servers */
+   struct llist_head xua_servers;
/* array for faster lookup of user (indexed by service
 * indicator) */
const struct osmo_ss7_user *user[16];
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 9b2377b..771501f 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -53,7 +53,6 @@
 static bool ss7_initialized = false;
 
 LLIST_HEAD(osmo_ss7_instances);
-LLIST_HEAD(osmo_ss7_xua_servers);
 static int32_t next_rctx = 1;
 static int32_t next_l_rk_id = 1;
 
@@ -329,6 +328,7 @@
INIT_LLIST_HEAD(&inst->as_list);
INIT_LLIST_HEAD(&inst->asp_list);
INIT_LLIST_HEAD(&inst->rtable_list);
+   INIT_LLIST_HEAD(&inst->xua_servers);
inst->rtable_system = osmo_ss7_route_table_find_or_create(inst, 
"system");
 
/* default point code structure + formatting */
@@ -1546,7 +1546,7 @@
struct osmo_xua_server *xs;
 
OSMO_ASSERT(ss7_initialized);
-   llist_for_each_entry(xs, &osmo_ss7_xua_servers, list) {
+   llist_for_each_entry(xs, &inst->xua_servers, list) {
if (proto == xs->cfg.proto &&
local_port == xs->cfg.local.port)
return xs;
@@ -1596,7 +1596,7 @@
}
 
oxs->inst = inst;
-   llist_add_tail(&oxs->list, &osmo_ss7_xua_servers);
+   llist_add_tail(&oxs->list, &inst->xua_servers);
 
return oxs;
 }
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 8356d16..282a5a0 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -915,7 +915,7 @@
llist_for_each_entry(rtable, &inst->rtable_list, list)
write_one_rtable(vty, rtable);
 
-   llist_for_each_entry(oxs, &osmo_ss7_xua_servers, list)
+   llist_for_each_entry(oxs, &inst->xua_servers, list)
write_one_xua(vty, oxs);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/2350
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbab59d773f23cc8514cbeb6e21e25ca35dd337f
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-sccp[master]: SCCP: Add VTY interface for SCCP

2017-04-14 Thread Harald Welte

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

SCCP: Add VTY interface for SCCP

Change-Id: I100daaa947dbab6a4528c4e9fbd0d30790288f63
---
M include/osmocom/sigtran/sccp_sap.h
M src/Makefile.am
M src/osmo_ss7_vty.c
M src/sccp_internal.h
M src/sccp_scoc.c
A src/sccp_vty.c
M src/xua_internal.h
M tests/ss7/Makefile.am
M tests/xua/Makefile.am
9 files changed, 202 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/45/2345/1

diff --git a/include/osmocom/sigtran/sccp_sap.h 
b/include/osmocom/sigtran/sccp_sap.h
index fd25752..f378e5c 100644
--- a/include/osmocom/sigtran/sccp_sap.h
+++ b/include/osmocom/sigtran/sccp_sap.h
@@ -227,6 +227,8 @@
 struct osmo_sccp_instance;
 struct osmo_sccp_user;
 
+void osmo_sccp_vty_init(void);
+
 struct osmo_sccp_instance *
 osmo_sccp_instance_create(struct osmo_ss7_instance *ss7, void *priv);
 void osmo_sccp_instance_destroy(struct osmo_sccp_instance *inst);
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e52792..217f2f7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,6 +30,6 @@
 sccp2sua.c sccp_scrc.c sccp_sclc.c sccp_scoc.c \
 sccp_user.c xua_rkm.c xua_default_lm_fsm.c \
 osmo_ss7.c osmo_ss7_hmrt.c xua_asp_fsm.c 
xua_as_fsm.c \
-osmo_ss7_vty.c
+osmo_ss7_vty.c sccp_vty.c
 libosmo_sigtran_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined 
-export-symbols-regex '^osmo_'
 libosmo_sigtran_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMONETIF_LIBS) 
$(LIBSCTP_LIBS)
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index b08a456..c2ad25c 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -35,9 +35,7 @@
 #include 
 #include 
 
-#define CS7_STR"ITU-T Signaling System 7\n"
-#define PC_STR "Point Code\n"
-#define INST_STR "An instance of the SS7 stack\n"
+#include "xua_internal.h"
 
 /***
  * Core CS7 Configuration
diff --git a/src/sccp_internal.h b/src/sccp_internal.h
index c35ef4b..17dda13 100644
--- a/src/sccp_internal.h
+++ b/src/sccp_internal.h
@@ -87,3 +87,5 @@
 struct msgb *sccp_msgb_alloc(const char *name);
 
 struct osmo_fsm sccp_scoc_fsm;
+
+void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance 
*inst);
diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index 8621e6d..6d9916b 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -1649,3 +1649,42 @@
llist_for_each_entry_safe(conn, conn2, &inst->connections, list)
conn_destroy(conn);
 }
+
+#include 
+
+static void vty_show_connection(struct vty *vty, struct sccp_connection *conn)
+{
+   struct osmo_ss7_instance *s7i = conn->inst->ss7;
+   struct osmo_sccp_addr *remote_addr;
+   uint32_t local_pc;
+
+   if (conn->user->pc_valid)
+   local_pc = conn->user->pc;
+   else
+   local_pc = s7i->cfg.primary_pc;
+
+   if (conn->incoming)
+   remote_addr = &conn->calling_addr;
+   else
+   remote_addr = &conn->called_addr;
+
+   vty_out(vty, "%c %06x %3u %7s ", conn->incoming ? 'I' : 'O',
+   conn->conn_id, conn->user->ssn,
+   osmo_ss7_pointcode_print(s7i, local_pc));
+   vty_out(vty, "%16s %06x %3u %7s%s",
+   osmo_fsm_inst_state_name(conn->fi), conn->remote_ref, 
remote_addr->ssn,
+   osmo_ss7_pointcode_print(s7i, conn->remote_pc),
+   VTY_NEWLINE);
+}
+
+void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance 
*inst)
+{
+   struct sccp_connection *conn;
+
+   vty_out(vty, "I Local  Conn.Remote
%s", VTY_NEWLINE);
+   vty_out(vty, "O RefSSN PC  StateRefSSN PC 
%s", VTY_NEWLINE);
+   vty_out(vty, "- -- --- ---  -- --- 
---%s", VTY_NEWLINE);
+
+   llist_for_each_entry(conn, &inst->connections, list)
+   vty_show_connection(vty, conn);
+}
diff --git a/src/sccp_vty.c b/src/sccp_vty.c
new file mode 100644
index 000..626fefb
--- /dev/null
+++ b/src/sccp_vty.c
@@ -0,0 +1,149 @@
+/* Core SS7 Instance/Linkset/Link/AS/ASP VTY Interface */
+
+/* (C) 2015-2017 by Harald Welte 
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see 

[PATCH] libosmo-sccp[master]: SUA/M3UA: Implement T(r) recovery timer of Application Serve...

2017-04-14 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/2349

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

SUA/M3UA: Implement T(r) recovery timer of Application Server FSM

When an AS goes "down" it first entres a recovery state, in which any
to-be-transmitted messages are enqueued until the timer T(r) expires.

Once the timer expires, the messages are discarded.  If the AS goes
ACTIVE before timer expiration, queued messages are sent.

Change-Id: I22725bf35306299a00c66d7b3637f5e198c26247
---
M src/m3ua.c
M src/sua.c
M src/xua_as_fsm.c
M src/xua_as_fsm.h
M src/xua_asp_fsm.c
5 files changed, 147 insertions(+), 46 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/49/2349/2

diff --git a/src/m3ua.c b/src/m3ua.c
index 7dc2afb..a7ef06c 100644
--- a/src/m3ua.c
+++ b/src/m3ua.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 
+#include "xua_as_fsm.h"
 #include "xua_asp_fsm.h"
 #include "xua_internal.h"
 
@@ -420,16 +421,14 @@
  * Transmitting M3UA messsages to SCTP
  ***/
 
-/* transmit given xua_msg via given ASP. callee takes xua ownership */
-static int m3ua_tx_xua_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
+/* Convert M3UA from xua_msg to msgb and set PPID/stream */
+static struct msgb *m3ua_to_msg(struct xua_msg *xua)
 {
struct msgb *msg = xua_to_msg(M3UA_VERSION, xua);
 
-   OSMO_ASSERT(asp->cfg.proto == OSMO_SS7_ASP_PROT_M3UA);
-
if (!msg) {
LOGP(DLM3UA, LOGL_ERROR, "Error encoding M3UA Msg\n");
-   return -1;
+   return NULL;
}
 
if (xua->hdr.msg_class == M3UA_MSGC_XFER)
@@ -437,6 +436,20 @@
else
msgb_sctp_stream(msg) = 0;
msgb_sctp_ppid(msg) = M3UA_PPID;
+
+   return msg;
+}
+
+/* transmit given xua_msg via given ASP */
+static int m3ua_tx_xua_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
+{
+   struct msgb *msg = m3ua_to_msg(xua);
+
+   OSMO_ASSERT(asp->cfg.proto == OSMO_SS7_ASP_PROT_M3UA);
+
+   if (!msg)
+   return -1;
+
return osmo_ss7_asp_send(asp, msg);
 }
 
@@ -446,8 +459,8 @@
  *  \return 0 on success; negative on error */
 int m3ua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua)
 {
-   struct osmo_ss7_asp *asp;
-   unsigned int i;
+   struct msgb *msg;
+   int rc;
 
OSMO_ASSERT(as->cfg.proto == OSMO_SS7_ASP_PROT_M3UA);
 
@@ -455,19 +468,16 @@
if (as->cfg.routing_key.context)
xua_msg_add_u32(xua, M3UA_IEI_ROUTE_CTX, 
as->cfg.routing_key.context);
 
-   for (i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) {
-   asp = as->cfg.asps[i];
-   if (!asp)
-   continue;
-   if (asp)
-   break;
-   }
-   if (!asp) {
-   LOGP(DLM3UA, LOGL_ERROR, "No ASP entroy in AS, dropping 
message\n");
-   return -ENODEV;
-   }
+   msg = m3ua_to_msg(xua);
+   if (!msg)
+   return -1;
 
-   return m3ua_tx_xua_asp(asp, xua);
+   /* send the msg to the AS for transmission.  The AS FSM might
+* (depending on its state) enqueue it before trnsmission */
+   rc = osmo_fsm_inst_dispatch(as->fi, XUA_AS_E_TRANSFER_REQ, msg);
+   if (rc < 0)
+   msgb_free(msg);
+   return rc;
 }
 
 /***
diff --git a/src/sua.c b/src/sua.c
index 3bff855..97a0785 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 
+#include "xua_as_fsm.h"
 #include "xua_asp_fsm.h"
 #include "xua_internal.h"
 #include "sccp_internal.h"
@@ -252,18 +253,38 @@
  * Transmitting SUA messsages to SCTP
  ***/
 
-static int sua_tx_xua_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
+static struct msgb *sua_to_msg(struct xua_msg *xua)
 {
struct msgb *msg = xua_to_msg(SUA_VERSION, xua);
 
-   OSMO_ASSERT(asp->cfg.proto == OSMO_SS7_ASP_PROT_SUA);
-
if (!msg) {
-   LOGPASP(asp, DLSUA, LOGL_ERROR, "Error encoding SUA Msg\n");
-   return -1;
+   LOGP(DLSUA, LOGL_ERROR, "Error encoding SUA Msg\n");
+   return NULL;
}
 
+   switch (xua->hdr.msg_class) {
+   case SUA_MSGC_CL:
+   case SUA_MSGC_CO:
+   msgb_sctp_stream(msg) = 1;
+   break;
+   default:
+   msgb_sctp_stream(msg) = 0;
+   break;
+   }
msgb_sctp_ppid(msg) = SUA_PPID;
+
+   return msg;
+}
+
+static int sua_tx_xua_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
+{
+   struct msgb *msg = sua_to_msg(xua);
+
+   OSMO_ASSERT(asp->cfg.proto == OSMO_SS7_ASP_PROT_SUA);
+
+   if (!msg)
+   return -1;
+
return osmo_ss7_asp_send(asp, msg);
 }
 
@@ -273,25 +294,25 @@
  *  \re

libosmo-sccp[master]: osmo_ss7_vty: Don't save dynamically generated AS / ASP

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2343
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I9d0b0b61737a30b9d6e76cecbe42ec071bcddeeb
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: SCCP: Add VTY interface for SCCP

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2345
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I100daaa947dbab6a4528c4e9fbd0d30790288f63
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: ss7_vty: don't re-define xUA dialect strings

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2347
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I085b884d98fb4c45ac15910a8ebf82b91e861fd4
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: osmo_ss7_vty: Print AS and ASP state names during 'show'

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2348
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6a06d93d6e6c0386676742d6d19f5483a46d7fba
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: sccp_scoc: Memorize if a connection is incoming or outbound

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2344
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic3c85152665abfb613e197b098c97392d16d16bf
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: m3ua_example: Add SS7 and SCCP VTY

2017-04-14 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2346
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id03d2f94d22445ada01917356a5ec5a8e4fa3fca
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-sccp[master]: SUA/M3UA: Implement T(r) recovery timer of Application Serve...

2017-04-14 Thread Harald Welte

Patch Set 2: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/2349
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I22725bf35306299a00c66d7b3637f5e198c26247
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No