ns2: Don't start sending NS-RESET until FR DLC is available
There's no point in sending NS-RESET (or any other) messages to the
underlying FR layer if the FR DLC has not been marked as
available/active yet.
Change-Id: Id4e7565ba166ca1d12f8800c643d9f2bc4d66873
Closes: OS#4999
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index b5ddf7e..fc6a5c4 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -179,6 +179,17 @@
talloc_free(priv);
}
+static void fr_dlci_status_cb(struct osmo_fr_dlc *dlc, void *cb_data, bool active)
+{
+ struct gprs_ns2_vc *nsvc = cb_data;
+
+ if (active) {
+ ns2_vc_fsm_start(nsvc);
+ } else {
+ ns2_vc_force_unconfigured(nsvc);
+ }
+}
+
static struct priv_vc *fr_alloc_vc(struct gprs_ns2_vc_bind *bind,
struct gprs_ns2_vc *nsvc,
uint16_t dlci)
@@ -200,6 +211,7 @@
priv->dlc->cb_data = nsvc;
priv->dlc->rx_cb = fr_dlci_rx_cb;
+ priv->dlc->status_cb = fr_dlci_status_cb;
return priv;
}
@@ -899,8 +911,6 @@
nsvc->nsvci = nsvci;
nsvc->nsvci_is_valid = true;
- ns2_vc_fsm_start(nsvc);
-
return nsvc;
err: