mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-upf.git
synced 2025-10-23 08:12:03 +00:00
osmo-pfcp-tool: avoid stale pointers on msg copy
Upon copying a PFCP msg struct for the 'retrans' command, make sure the copy has no pointers that may go stale. Change-Id: I4278d1c6b6da48a10d72955d9b070790d631c664
This commit is contained in:
@@ -159,13 +159,22 @@ void pfcp_tool_rx_msg(struct osmo_pfcp_endpoint *ep, struct osmo_pfcp_msg *m, st
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_msg(struct osmo_pfcp_msg *dst, const struct osmo_pfcp_msg *m)
|
||||
{
|
||||
*dst = *m;
|
||||
dst->encoded = NULL;
|
||||
dst->ctx.peer_use_token = NULL;
|
||||
dst->ctx.session_use_token = NULL;
|
||||
dst->ctx.resp_cb = NULL;
|
||||
}
|
||||
|
||||
int peer_tx(struct pfcp_tool_peer *peer, struct osmo_pfcp_msg *m)
|
||||
{
|
||||
int rc;
|
||||
if (m->is_response)
|
||||
peer->last_resp = *m;
|
||||
copy_msg(&peer->last_resp, m);
|
||||
else
|
||||
peer->last_req = *m;
|
||||
copy_msg(&peer->last_req, m);
|
||||
rc = osmo_pfcp_endpoint_tx(g_pfcp_tool->ep, m);
|
||||
return rc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user