From f76e530f907ea0357a05105b7c817b146dded420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Soares=20Silva?= Date: Wed, 28 Jan 2026 16:08:03 +0000 Subject: [PATCH 1/2] Prevent the PNF from sending P7 messages after sending a STOP.indication Upon stopping the PNF, when sending the STOP.indication to the VNF, set pnf_p7->terminate to 1. Add a check on the PNF P7 send functions to not send a message after pnf_p7->terminate is set --- nfapi/oai_integration/nfapi_pnf.c | 3 +++ nfapi/oai_integration/socket/socket_pnf.c | 4 ++++ nfapi/oai_integration/wls_integration/wls_pnf.c | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 8b07bea297..90cc275e39 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -1801,6 +1801,9 @@ int nr_stop_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfa .header.phy_id = req->header.phy_id}; nfapi_nr_stop_indication(config, &resp); has_sent_stop_ind = true; + // Upon sending the STOP.indication mark P7 PNF to terminate, to not send any further messages to the VNF + pnf_p7_t *pnf_p7 = (pnf_p7_t *)(p7_config_g); + pnf_p7->terminate = 1; #ifdef ENABLE_WLS wls_pnf_close(pnf_p5_init_and_receive_pthread); #endif diff --git a/nfapi/oai_integration/socket/socket_pnf.c b/nfapi/oai_integration/socket/socket_pnf.c index 6a96247b74..0be068fe22 100644 --- a/nfapi/oai_integration/socket/socket_pnf.c +++ b/nfapi/oai_integration/socket/socket_pnf.c @@ -78,6 +78,10 @@ static int send_p7_msg(pnf_p7_t *pnf_p7, uint8_t *msg, uint32_t len) bool pnf_nr_send_p7_message(pnf_p7_t *pnf_p7, nfapi_nr_p7_message_header_t *header, uint32_t msg_len) { + if (pnf_p7->terminate) { + //don't send any further P7 messages after terminating + return false; + } header->m_segment_sequence = NFAPI_NR_P7_SET_MSS(0, 0, pnf_p7->sequence_number); // Need to guard against different threads calling the encode function at the same time diff --git a/nfapi/oai_integration/wls_integration/wls_pnf.c b/nfapi/oai_integration/wls_integration/wls_pnf.c index e6fd609346..96bfc3fd6b 100644 --- a/nfapi/oai_integration/wls_integration/wls_pnf.c +++ b/nfapi/oai_integration/wls_integration/wls_pnf.c @@ -201,7 +201,10 @@ bool wls_pnf_nr_send_p5_message(pnf_t *pnf, nfapi_nr_p4_p5_message_header_t *msg bool wls_pnf_nr_send_p7_message(pnf_p7_t *pnf_p7, nfapi_nr_p7_message_header_t *msg, uint32_t msg_len) { UNUSED_VARIABLE(msg_len); - + if (pnf_p7->terminate) { + // don't send any further P7 messages after terminating + return false; + } if (!isFAPIMessageIDValid(msg->message_id)) { return false; } From e82e3a35fe7b58b5807d235e9e93f1d128bb56a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Soares=20Silva?= Date: Wed, 28 Jan 2026 16:08:50 +0000 Subject: [PATCH 2/2] Add a check on the VNF P7 message handler to ignore P7 messages after it received a STOP.indication from the PNF --- nfapi/open-nFAPI/vnf/src/vnf_p7.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c index 82c5ae7d1c..e1f99f6d38 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -2130,6 +2130,10 @@ void vnf_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) void vnf_nr_handle_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) { + if (vnf_p7->terminate) { + // VNF already terminated, ignore messages ( shouldn't get here, since the PNF doesn't send further messages after terminating as well ) + return; + } nfapi_nr_p7_message_header_t header; // validate the input params