From 9d16b14345fa3f20161586fa54659187be0d37e5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 26 Jun 2020 15:55:21 +0200 Subject: Send a BVC-RESET to all persistent Gb interfaces at start-up 3GPP TS 48.018 Section 8.4: > After any failure affecting the NSE, the party (BSS or SGSN) where > the failure resided shall reset the signalling BVC. After sending or > receiving a BVC-RESET PDU for the signalling BVC, the BSS shall stop all > traffic and initiate the BVC-RESET procedure for all BVCs corresponding > to PTP functional entities of the underlying network service entity. The > BSS must complete the BVC-RESET procedure for signalling BVC before > starting PTP BVC-RESET procedures. TODO: We should not just trigger a single outbound BVC-RESET message, but we should re-transmit them until we get a response. This would likely entail adding FSMs to libosmogb, which we will leave for a later point - it's anticipated that the NS + BSSGP code is undergoing quite some changes in the coming months anyway, so leave it for then. Change-Id: I0b46035b40709c38bb9ab9493c11031a577e3ee0 Closes: OS#4629 Depends: libosmocore.git I353adc1aa72377f7d4b3336d2ff47791fb73d62c --- src/sgsn/sgsn_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/sgsn/sgsn_main.c b/src/sgsn/sgsn_main.c index 3b18b051c..5b538155a 100644 --- a/src/sgsn/sgsn_main.c +++ b/src/sgsn/sgsn_main.c @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -199,6 +200,23 @@ int sgsn_vty_go_parent(struct vty *vty) #endif } +static void bvc_reset_persistent_nsvcs(void) +{ + /* Send BVC-RESET on all persistent NSVCs */ + struct gprs_nsvc *nsvc; + + llist_for_each_entry(nsvc, &sgsn_nsi->gprs_nsvcs, list) { + struct bssgp_bvc_ctx bctx = { + .nsei = nsvc->nsei, + }; + if (!nsvc->persistent) + continue; + /* if it is not marked ALIVE, we cannot send any data over it. */ + nsvc->state |= NSE_S_ALIVE; + bssgp_tx_bvc_reset2(&bctx, BVCI_SIGNALLING, BSSGP_CAUSE_EQUIP_FAIL, false); + } +} + static struct vty_app_info vty_info = { .name = "OsmoSGSN", .version = PACKAGE_VERSION, @@ -522,6 +540,8 @@ int main(int argc, char **argv) ranap_iu_init(tall_sgsn_ctx, DRANAP, "OsmoSGSN-IuPS", sccp, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_iu_event); #endif + bvc_reset_persistent_nsvcs(); + if (daemonize) { rc = osmo_daemonize(); if (rc < 0) { -- cgit v1.2.3