This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
neels gerrit-no-reply at lists.osmocom.orgneels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/20630 ) Change subject: LCS: disable Lb interface by default, add vty 'smlc' / 'enable' ...................................................................... LCS: disable Lb interface by default, add vty 'smlc' / 'enable' To not modify previous SCCP behavior of OsmoBSC, keep the Lb interface disabled by default. The following configuration enables the Lb interface: smlc enable Change-Id: I01314a29a2cad6f325d9f4687a9dedca6b90a3ce --- M include/osmocom/bsc/lb.h M src/osmo-bsc/lb.c M src/osmo-bsc/osmo_bsc_main.c 3 files changed, 108 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/30/20630/1 diff --git a/include/osmocom/bsc/lb.h b/include/osmocom/bsc/lb.h index 0649986..db191ba 100644 --- a/include/osmocom/bsc/lb.h +++ b/include/osmocom/bsc/lb.h @@ -35,6 +35,8 @@ }; struct smlc_config { + bool enable; + uint32_t cs7_instance; bool cs7_instance_valid; struct osmo_sccp_instance *sccp; @@ -56,5 +58,6 @@ extern const struct rate_ctr_group_desc smlc_ctrg_desc; int lb_init(); +int lb_start_or_stop(); int lb_send(struct gsm_subscriber_connection *conn, const struct bssap_le_pdu *bssap_le); void lb_close_conn(struct gsm_subscriber_connection *conn); diff --git a/src/osmo-bsc/lb.c b/src/osmo-bsc/lb.c index 6ab131f..f70a930 100644 --- a/src/osmo-bsc/lb.c +++ b/src/osmo-bsc/lb.c @@ -357,8 +357,14 @@ #define DEFAULT_ASP_LOCAL_IP "localhost" #define DEFAULT_ASP_REMOTE_IP "localhost" -/* Initialize Lb interface to SMLC */ -int lb_init() +void lb_cancel_all() +{ + struct gsm_subscriber_connection *conn; + llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) + lcs_loc_req_reset(conn); +}; + +static int lb_start() { uint32_t default_pc; struct osmo_ss7_instance *cs7_inst = NULL; @@ -367,11 +373,11 @@ char inst_name[32]; const char *smlc_name = "smlc"; - if (!bsc_gsmnet->smlc) { - bsc_gsmnet->smlc = talloc_zero(bsc_gsmnet, struct smlc_config); - bsc_gsmnet->smlc->ctrs = rate_ctr_group_alloc(bsc_gsmnet, &smlc_ctrg_desc, 0); - } - OSMO_ASSERT(bsc_gsmnet->smlc); + /* Already set up? */ + if (bsc_gsmnet->smlc->sccp_user) + return -EAGAIN; + + LOGP(DLCS, LOGL_INFO, "Starting Lb link\n"); if (!bsc_gsmnet->smlc->cs7_instance_valid) { bsc_gsmnet->smlc->cs7_instance = 0; @@ -436,6 +442,60 @@ return 0; } +static int lb_stop() +{ + /* Not set up? */ + if (!bsc_gsmnet->smlc->sccp_user) + return -EAGAIN; + + LOGP(DLCS, LOGL_INFO, "Shutting down Lb link\n"); + + lb_cancel_all(); + osmo_sccp_user_unbind(bsc_gsmnet->smlc->sccp_user); + bsc_gsmnet->smlc->sccp_user = NULL; + return 0; +} + +int lb_start_or_stop() +{ + int rc; + if (bsc_gsmnet->smlc->enable) { + rc = lb_start(); + switch (rc) { + case -EAGAIN: + /* no need to log about anything */ + break; + default: + LOGP(DLCS, LOGL_ERROR, "Failed to start Lb interface"); + break; + } + } else { + rc = lb_stop(); + switch (rc) { + case -EAGAIN: + /* no need to log about anything */ + break; + default: + LOGP(DLCS, LOGL_ERROR, "Failed to stop Lb interface"); + break; + } + } + return rc; +} + +static void smlc_vty_init(void); + +int lb_init() +{ + OSMO_ASSERT(!bsc_gsmnet->smlc); + bsc_gsmnet->smlc = talloc_zero(bsc_gsmnet, struct smlc_config); + OSMO_ASSERT(bsc_gsmnet->smlc); + bsc_gsmnet->smlc->ctrs = rate_ctr_group_alloc(bsc_gsmnet, &smlc_ctrg_desc, 0); + + smlc_vty_init(); + return 0; +} + /********************************************************************************* * VTY Interface (Configuration + Introspection) *********************************************************************************/ @@ -453,6 +513,30 @@ 1, }; +DEFUN(cfg_smlc_enable, cfg_smlc_enable_cmd, + "enable", + "Start up Lb interface connection to the remote SMLC\n") +{ + bsc_gsmnet->smlc->enable = true; + if (vty->type != VTY_FILE) { + if (lb_start_or_stop()) + vty_out(vty, "%% Error: failed to enable Lb interface%s", VTY_NEWLINE); + } + return CMD_SUCCESS; +} + +DEFUN(cfg_smlc_no_enable, cfg_smlc_no_enable_cmd, + "no enable", + NO_STR "Stop Lb interface connection to the remote SMLC\n") +{ + bsc_gsmnet->smlc->enable = false; + if (vty->type != VTY_FILE) { + if (lb_start_or_stop()) + vty_out(vty, "%% Error: failed to disable Lb interface%s", VTY_NEWLINE); + } + return CMD_SUCCESS; +} + static void enforce_ssn(struct vty *vty, struct osmo_sccp_addr *addr, enum osmo_sccp_ssn want_ssn) { if (addr->presence & OSMO_SCCP_ADDR_T_SSN) { @@ -529,7 +613,17 @@ static int config_write_smlc(struct vty *vty) { + /* Nothing to write? */ + if (!(bsc_gsmnet->smlc->enable + || bsc_gsmnet->smlc->bsc_addr_name + || bsc_gsmnet->smlc->smlc_addr_name)) + return 0; + vty_out(vty, "smlc%s", VTY_NEWLINE); + + if (bsc_gsmnet->smlc->enable) + vty_out(vty, " enable%s", VTY_NEWLINE); + if (bsc_gsmnet->smlc->bsc_addr_name) { vty_out(vty, " bsc-addr %s%s", bsc_gsmnet->smlc->bsc_addr_name, VTY_NEWLINE); @@ -556,6 +650,8 @@ install_element(CONFIG_NODE, &cfg_smlc_cmd); install_node(&smlc_node, config_write_smlc); + install_element(SMLC_NODE, &cfg_smlc_enable_cmd); + install_element(SMLC_NODE, &cfg_smlc_no_enable_cmd); install_element(SMLC_NODE, &cfg_smlc_cs7_bsc_addr_cmd); install_element(SMLC_NODE, &cfg_smlc_cs7_smlc_addr_cmd); } diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c index 35ddbbf..7eaa18f 100644 --- a/src/osmo-bsc/osmo_bsc_main.c +++ b/src/osmo-bsc/osmo_bsc_main.c @@ -888,6 +888,7 @@ bsc_subscr_conn_fsm_init(); assignment_fsm_init(); handover_fsm_init(); + lb_init(); /* Read the config */ rc = bsc_network_configure(config_file); @@ -957,7 +958,7 @@ handover_decision_1_init(); hodec2_init(bsc_gsmnet); bsc_cbc_link_restart(); - lb_init(); + lb_start_or_stop(); signal(SIGINT, &signal_handler); signal(SIGTERM, &signal_handler); -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/20630 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I01314a29a2cad6f325d9f4687a9dedca6b90a3ce Gerrit-Change-Number: 20630 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201012/37793862/attachment.htm>