aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2022-07-27 14:59:30 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2022-07-28 13:52:17 +0200
commitd6168a81031a7caf72e1d2e3db7ed52b0d8fdb69 (patch)
tree7feaef608f23756fc87c311732ebd0193979d426
parent1a9a3ad342bcd558c8e06f238f91644116d45028 (diff)
pfcp_endpoint: fix final PFCP retrans resp_cb
After the final retransmission of a sent request, still keep the message in the queue for its expiry period, so that a later response is matched to the request. The osmo_pfcp_msg.resp_cb() depends on the sent message to remain in the queue until it times out. That was not the case in an earlier stage of libosmo-pfcp development. I noticed this during ttcn3 testing, where osmo-hnbgw continuously resends PFCP Association Setup Requests, and fails to associate if ttcn3 happens to respond to the final retransmission of a request. Related: SYS#5599 Change-Id: Iaca396891921f7057015ce6e1e4528b955757809
-rw-r--r--src/libosmo-pfcp/pfcp_endpoint.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libosmo-pfcp/pfcp_endpoint.c b/src/libosmo-pfcp/pfcp_endpoint.c
index 0ee3a9a..68d0a21 100644
--- a/src/libosmo-pfcp/pfcp_endpoint.c
+++ b/src/libosmo-pfcp/pfcp_endpoint.c
@@ -181,18 +181,19 @@ static bool pfcp_queue_retrans(struct osmo_pfcp_queue_entry *qe)
struct osmo_pfcp_msg *m = qe->m;
int rc;
+ /* if no more attempts remaining, drop from queue */
+ if (!qe->n1_remaining)
+ return false;
+
/* re-transmit */
- if (qe->n1_remaining)
- qe->n1_remaining--;
- OSMO_LOG_PFCP_MSG(m, LOGL_INFO, "re-sending (%u attempts remaining)\n", qe->n1_remaining);
+ qe->n1_remaining--;
+ OSMO_LOG_PFCP_MSG(m, LOGL_INFO, "re-sending (%u attempts remaining after this)\n", qe->n1_remaining);
rc = osmo_pfcp_endpoint_tx_data_no_logging(endpoint, m);
- /* If encoding failed, it cannot ever succeed. Drop the queue entry. */
+ /* If encoding failed, it cannot ever succeed. Drop the queue entry. (Error logging already taken care of in
+ * osmo_pfcp_endpoint_tx_data_no_logging().) */
if (rc)
return false;
- /* if no more attempts remaining, drop from queue */
- if (!qe->n1_remaining)
- return false;
/* re-schedule timer, keep in queue */
osmo_timer_schedule(&qe->t1, t1_ms/1000, (t1_ms % 1000) * 1000);
return true;