pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/42130?usp=email )
Change subject: Tear down context_maps when UPF assoc goes down
......................................................................
Tear down context_maps when UPF assoc goes down
Related: SYS#7294
Change-Id: I7dcd9114861fa8f4bf855a02c286f85083ad75fe
---
M include/osmocom/hnbgw/context_map.h
M src/osmo-hnbgw/context_map.c
M src/osmo-hnbgw/context_map_sccp.c
M src/osmo-hnbgw/hnbgw_pfcp.c
4 files changed, 37 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/30/42130/1
diff --git a/include/osmocom/hnbgw/context_map.h
b/include/osmocom/hnbgw/context_map.h
index ea12462..5ebf3bd 100644
--- a/include/osmocom/hnbgw/context_map.h
+++ b/include/osmocom/hnbgw/context_map.h
@@ -94,6 +94,9 @@
/* The MGCP link can no longer work, for example it received an
unexpected answer from the MGW.
* Parameter: no parameter, NULL. */
MAP_SCCP_EV_MGCP_LINK_LOST,
+ /* The PFCP link can no longer work, for example it received an
unexpected answer from the UPF.
+ * Parameter: no parameter, NULL. */
+ MAP_SCCP_EV_PFCP_LINK_LOST,
};
/* For context_map_get_state(), to combine the RUA and SCCP states, for VTY
reporting only. */
@@ -247,6 +250,7 @@
bool map_sccp_is_active(struct hnbgw_context_map *map);
void context_map_cnlink_lost(struct hnbgw_context_map *map);
void context_map_mgcp_link_lost(struct hnbgw_context_map *map);
+void context_map_pfcp_link_lost(struct hnbgw_context_map *map);
void context_map_free(struct hnbgw_context_map *map);
unsigned int msg_has_l2_data(const struct msgb *msg);
diff --git a/src/osmo-hnbgw/context_map.c b/src/osmo-hnbgw/context_map.c
index 59029d7..bac67a1 100644
--- a/src/osmo-hnbgw/context_map.c
+++ b/src/osmo-hnbgw/context_map.c
@@ -195,6 +195,11 @@
map_sccp_dispatch(map, MAP_SCCP_EV_MGCP_LINK_LOST, NULL);
}
+void context_map_pfcp_link_lost(struct hnbgw_context_map *map)
+{
+ map_sccp_dispatch(map, MAP_SCCP_EV_PFCP_LINK_LOST, NULL);
+}
+
void context_map_free(struct hnbgw_context_map *map)
{
/* guard against FSM termination infinitely looping back here */
diff --git a/src/osmo-hnbgw/context_map_sccp.c
b/src/osmo-hnbgw/context_map_sccp.c
index e10d313..b8cd296 100644
--- a/src/osmo-hnbgw/context_map_sccp.c
+++ b/src/osmo-hnbgw/context_map_sccp.c
@@ -51,6 +51,7 @@
OSMO_VALUE_STRING(MAP_SCCP_EV_USER_ABORT),
OSMO_VALUE_STRING(MAP_SCCP_EV_CN_LINK_LOST),
OSMO_VALUE_STRING(MAP_SCCP_EV_MGCP_LINK_LOST),
+ OSMO_VALUE_STRING(MAP_SCCP_EV_PFCP_LINK_LOST),
{}
};
@@ -217,6 +218,7 @@
case MAP_SCCP_EV_USER_ABORT:
case MAP_SCCP_EV_CN_LINK_LOST:
case MAP_SCCP_EV_MGCP_LINK_LOST:
+ case MAP_SCCP_EV_PFCP_LINK_LOST:
map_sccp_fsm_state_chg(MAP_SCCP_ST_DISCONNECTED);
return;
@@ -263,6 +265,7 @@
case MAP_SCCP_EV_USER_ABORT:
case MAP_SCCP_EV_CN_LINK_LOST:
case MAP_SCCP_EV_MGCP_LINK_LOST:
+ case MAP_SCCP_EV_PFCP_LINK_LOST:
map->please_disconnect = true;
return;
@@ -351,6 +354,7 @@
case MAP_SCCP_EV_CN_LINK_LOST:
/* The CN peer has sent a RANAP RESET, so the old link that
this map ran on is lost */
case MAP_SCCP_EV_MGCP_LINK_LOST:
+ case MAP_SCCP_EV_PFCP_LINK_LOST:
/* The MGW failed somehow, we cannot continue */
tx_sccp_rlsd(fi);
map_sccp_fsm_state_chg(MAP_SCCP_ST_DISCONNECTED);
@@ -424,6 +428,7 @@
case MAP_SCCP_EV_USER_ABORT:
case MAP_SCCP_EV_CN_LINK_LOST:
case MAP_SCCP_EV_MGCP_LINK_LOST:
+ case MAP_SCCP_EV_PFCP_LINK_LOST:
case MAP_SCCP_EV_RAN_DISC:
/* Stop waiting for RLSD, send RLSD now. */
tx_sccp_rlsd(fi);
@@ -505,6 +510,7 @@
| S(MAP_SCCP_EV_USER_ABORT)
| S(MAP_SCCP_EV_CN_LINK_LOST)
| S(MAP_SCCP_EV_MGCP_LINK_LOST)
+ | S(MAP_SCCP_EV_PFCP_LINK_LOST)
,
.out_state_mask = 0
| S(MAP_SCCP_ST_INIT)
@@ -524,6 +530,7 @@
| S(MAP_SCCP_EV_USER_ABORT)
| S(MAP_SCCP_EV_CN_LINK_LOST)
| S(MAP_SCCP_EV_MGCP_LINK_LOST)
+ | S(MAP_SCCP_EV_PFCP_LINK_LOST)
,
.out_state_mask = 0
| S(MAP_SCCP_ST_CONNECTED)
@@ -543,6 +550,7 @@
| S(MAP_SCCP_EV_USER_ABORT)
| S(MAP_SCCP_EV_CN_LINK_LOST)
| S(MAP_SCCP_EV_MGCP_LINK_LOST)
+ | S(MAP_SCCP_EV_PFCP_LINK_LOST)
,
.out_state_mask = 0
| S(MAP_SCCP_ST_WAIT_RLSD)
@@ -563,6 +571,7 @@
| S(MAP_SCCP_EV_USER_ABORT)
| S(MAP_SCCP_EV_CN_LINK_LOST)
| S(MAP_SCCP_EV_MGCP_LINK_LOST)
+ | S(MAP_SCCP_EV_PFCP_LINK_LOST)
,
.out_state_mask = 0
| S(MAP_SCCP_ST_DISCONNECTED)
@@ -579,6 +588,7 @@
| S(MAP_SCCP_EV_USER_ABORT)
| S(MAP_SCCP_EV_CN_LINK_LOST)
| S(MAP_SCCP_EV_MGCP_LINK_LOST)
+ | S(MAP_SCCP_EV_PFCP_LINK_LOST)
,
.onenter = map_sccp_disconnected_onenter,
.action = map_sccp_disconnected_action,
diff --git a/src/osmo-hnbgw/hnbgw_pfcp.c b/src/osmo-hnbgw/hnbgw_pfcp.c
index feabae1..9e1c11b 100644
--- a/src/osmo-hnbgw/hnbgw_pfcp.c
+++ b/src/osmo-hnbgw/hnbgw_pfcp.c
@@ -77,6 +77,19 @@
}
}
+static void tear_down_all_ps_context_map(void)
+{
+ struct hnbgw_cnlink *cnlink;
+
+ LOGP(DLPFCP, LOGL_INFO, "Tearing down all PS context maps\n");
+
+ llist_for_each_entry(cnlink, &g_hnbgw->sccp.cnpool_iups->cnlinks,
entry) {
+ struct hnbgw_context_map *map, *map2;
+ llist_for_each_entry_safe(map, map2, &cnlink->map_list,
hnbgw_cnlink_entry)
+ context_map_pfcp_link_lost(map);
+ }
+}
+
static void pfcp_cp_peer_assoc_cb(struct osmo_pfcp_cp_peer *cp_peer, bool
associated)
{
struct hnbgw_upf *upf = osmo_pfcp_cp_peer_get_priv(cp_peer);
@@ -84,6 +97,11 @@
LOGUPF(upf, DLPFCP, LOGL_NOTICE, "PFCP Peer associated: %s\n",
associated ? "true" : "false");
HNBGW_UPF_STAT_SET(HNBGW_UPF_STAT_ASSOCIATED, associated ? 1 : 0);
+ if (associated == 1)
+ return;
+
+ /* Tear down all related context_maps: */
+ tear_down_all_ps_context_map();
}
struct hnbgw_upf *hnbgw_upf_alloc(struct osmo_pfcp_endpoint *ep, const struct
osmo_sockaddr *upf_addr)
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/42130?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I7dcd9114861fa8f4bf855a02c286f85083ad75fe
Gerrit-Change-Number: 42130
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>