aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gb/gprs_ns2_internal.h3
-rw-r--r--src/gb/gprs_ns2_vc_fsm.c20
-rw-r--r--src/gb/gprs_ns2_vty.c11
-rw-r--r--tests/gb/gprs_ns2_vty.vty16
4 files changed, 27 insertions, 23 deletions
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 0959d2b0..93aaa992 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -271,6 +271,9 @@ struct gprs_ns2_vc {
/*! recursive anchor */
bool freed;
+ /*! if blocked by O&M/vty */
+ bool om_blocked;
+
/*! when the NSVC became alive or dead */
struct timespec ts_alive_change;
};
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 1db2a8ea..9cd83c4f 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -58,8 +58,6 @@ struct gprs_ns2_vc_priv {
bool initiator;
bool initiate_block;
bool initiate_reset;
- /* if blocked by O&M/vty */
- bool om_blocked;
/* if unitdata is forwarded to the user */
bool accept_unitdata;
@@ -268,7 +266,7 @@ static void ns2_st_unconfigured(struct osmo_fsm_inst *fi, uint32_t event, void *
struct gprs_ns2_inst *nsi = priv->nsvc->nse->nsi;
priv->initiate_reset = priv->initiate_block = priv->initiator;
- priv->om_blocked = false;
+ priv->nsvc->om_blocked = false;
switch (event) {
case GPRS_NS2_EV_REQ_START:
@@ -345,7 +343,7 @@ static void ns2_st_blocked_onenter(struct osmo_fsm_inst *fi, uint32_t old_state)
}
ns2_nse_notify_unblocked(priv->nsvc, false);
- if (priv->om_blocked) {
+ if (priv->nsvc->om_blocked) {
/* we are already blocked after a RESET */
if (old_state == GPRS_NS2_ST_RESET) {
osmo_timer_del(&fi->timer);
@@ -363,7 +361,7 @@ static void ns2_st_blocked(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct gprs_ns2_vc_priv *priv = fi->priv;
- if (priv->om_blocked) {
+ if (priv->nsvc->om_blocked) {
switch (event) {
case GPRS_NS2_EV_RX_BLOCK_ACK:
priv->accept_unitdata = false;
@@ -563,7 +561,7 @@ static int ns2_vc_fsm_timer_cb(struct osmo_fsm_inst *fi)
case GPRS_NS2_ST_BLOCKED:
if (priv->initiate_block) {
priv->N++;
- if (priv->om_blocked) {
+ if (priv->nsvc->om_blocked) {
if (priv->N <= nsi->timeout[NS_TOUT_TNS_BLOCK_RETRIES]) {
osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED, nsi->timeout[NS_TOUT_TNS_BLOCK], 0);
} else {
@@ -717,14 +715,14 @@ static void ns2_vc_fsm_allstate_action(struct osmo_fsm_inst *fi,
case GPRS_NS2_EV_REQ_OM_BLOCK:
/* vty cmd: block */
priv->initiate_block = true;
- priv->om_blocked = true;
+ priv->nsvc->om_blocked = true;
osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED, nsi->timeout[NS_TOUT_TNS_BLOCK], 0);
break;
case GPRS_NS2_EV_REQ_OM_UNBLOCK:
/* vty cmd: unblock*/
- if (!priv->om_blocked)
+ if (!priv->nsvc->om_blocked)
return;
- priv->om_blocked = false;
+ priv->nsvc->om_blocked = false;
if (fi->state == GPRS_NS2_ST_BLOCKED)
osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED, nsi->timeout[NS_TOUT_TNS_BLOCK], 0);
break;
@@ -834,7 +832,7 @@ int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc)
int ns2_vc_block(struct gprs_ns2_vc *nsvc)
{
struct gprs_ns2_vc_priv *priv = nsvc->fi->priv;
- if (priv->om_blocked)
+ if (priv->nsvc->om_blocked)
return -EALREADY;
return osmo_fsm_inst_dispatch(nsvc->fi, GPRS_NS2_EV_REQ_OM_BLOCK, NULL);
@@ -846,7 +844,7 @@ int ns2_vc_block(struct gprs_ns2_vc *nsvc)
int ns2_vc_unblock(struct gprs_ns2_vc *nsvc)
{
struct gprs_ns2_vc_priv *priv = nsvc->fi->priv;
- if (!priv->om_blocked)
+ if (!priv->nsvc->om_blocked)
return -EALREADY;
return osmo_fsm_inst_dispatch(nsvc->fi, GPRS_NS2_EV_REQ_OM_UNBLOCK, NULL);
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 016199da..3046fffd 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -1875,18 +1875,21 @@ DEFUN(cfg_no_ns_nse_ip_sns_bind, cfg_no_ns_nse_ip_sns_bind_cmd,
void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats)
{
if (nsvc->nsvci_is_valid)
- vty_out(vty, " NSVCI %05u: %s %s %s %s since ", nsvc->nsvci,
+ vty_out(vty, " NSVCI %05u: %s %s %s %s %ssince ", nsvc->nsvci,
osmo_fsm_inst_state_name(nsvc->fi),
nsvc->persistent ? "PERSIST" : "DYNAMIC",
gprs_ns2_ll_str(nsvc),
- ns2_vc_is_unblocked(nsvc) ? "ALIVE" : "DEAD");
+ ns2_vc_is_unblocked(nsvc) ? "ALIVE" : "DEAD",
+ nsvc->om_blocked ? "(blocked by O&M/vty) " :
+ !ns2_vc_is_unblocked(nsvc) ? "(cause: remote) " : "");
else
- vty_out(vty, " %s %s sig_weight=%u data_weight=%u %s %s since ",
+ vty_out(vty, " %s %s sig_weight=%u data_weight=%u %s %s %ssince ",
osmo_fsm_inst_state_name(nsvc->fi),
nsvc->persistent ? "PERSIST" : "DYNAMIC",
nsvc->sig_weight, nsvc->data_weight,
gprs_ns2_ll_str(nsvc),
- ns2_vc_is_unblocked(nsvc) ? "ALIVE" : "DEAD");
+ ns2_vc_is_unblocked(nsvc) ? "ALIVE" : "DEAD",
+ !ns2_vc_is_unblocked(nsvc) ? "(cause: remote) " : "");
vty_out_uptime(vty, &nsvc->ts_alive_change);
vty_out_newline(vty);
diff --git a/tests/gb/gprs_ns2_vty.vty b/tests/gb/gprs_ns2_vty.vty
index 4be10d55..8db5fb50 100644
--- a/tests/gb/gprs_ns2_vty.vty
+++ b/tests/gb/gprs_ns2_vty.vty
@@ -40,11 +40,11 @@ OsmoNSdummy(config-ns-nse)# end
OsmoNSdummy# show ns
NSEI 01234: UDP, DEAD since 0d 0h 0m 0s
1 NS-VC:
- RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496 DEAD since 0d 0h 0m 0s
+ RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496 DEAD (cause: remote) since 0d 0h 0m 0s
UDP bind: 127.0.0.14:42999 DSCP: 0 Priority: 0
IP-SNS signalling weight: 1 data weight: 1
1 NS-VC:
- RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496 DEAD since 0d 0h 0m 0s
+ RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496 DEAD (cause: remote) since 0d 0h 0m 0s
OsmoNSdummy# configure terminal
OsmoNSdummy(config)# ns
OsmoNSdummy(config-ns)# nse 1234
@@ -54,15 +54,15 @@ OsmoNSdummy(config-ns-nse)# end
OsmoNSdummy# show ns
NSEI 01234: UDP, DEAD since 0d 0h 0m 0s
3 NS-VC:
- RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496 DEAD since 0d 0h 0m 0s
- RECOVERING PERSIST sig_weight=0 data_weight=9 udp)[127.0.0.14]:42999<>[127.0.0.16]:9496 DEAD since 0d 0h 0m 0s
- RECOVERING PERSIST sig_weight=0 data_weight=0 udp)[127.0.0.14]:42999<>[127.0.0.17]:9496 DEAD since 0d 0h 0m 0s
+ RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496 DEAD (cause: remote) since 0d 0h 0m 0s
+ RECOVERING PERSIST sig_weight=0 data_weight=9 udp)[127.0.0.14]:42999<>[127.0.0.16]:9496 DEAD (cause: remote) since 0d 0h 0m 0s
+ RECOVERING PERSIST sig_weight=0 data_weight=0 udp)[127.0.0.14]:42999<>[127.0.0.17]:9496 DEAD (cause: remote) since 0d 0h 0m 0s
UDP bind: 127.0.0.14:42999 DSCP: 0 Priority: 0
IP-SNS signalling weight: 1 data weight: 1
3 NS-VC:
- RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496 DEAD since 0d 0h 0m 0s
- RECOVERING PERSIST sig_weight=0 data_weight=9 udp)[127.0.0.14]:42999<>[127.0.0.16]:9496 DEAD since 0d 0h 0m 0s
- RECOVERING PERSIST sig_weight=0 data_weight=0 udp)[127.0.0.14]:42999<>[127.0.0.17]:9496 DEAD since 0d 0h 0m 0s
+ RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496 DEAD (cause: remote) since 0d 0h 0m 0s
+ RECOVERING PERSIST sig_weight=0 data_weight=9 udp)[127.0.0.14]:42999<>[127.0.0.16]:9496 DEAD (cause: remote) since 0d 0h 0m 0s
+ RECOVERING PERSIST sig_weight=0 data_weight=0 udp)[127.0.0.14]:42999<>[127.0.0.17]:9496 DEAD (cause: remote) since 0d 0h 0m 0s
OsmoNSdummy# configure terminal
OsmoNSdummy(config)# ns
OsmoNSdummy(config-ns)# nse 1234