neels submitted this change.
pfcp up_function_features: allow shorter lengths
eUPF sends a short CP Function Features bitmap, which is easy to solve
by just zero padding to the minimum length specified in PFCP (3GPP TS
29.244)
Related: SYS#6590
Change-Id: I40e255fd0b4770e578aea7a10ba88f5eeba087f4
---
M src/libosmo-pfcp/pfcp_ies_custom.c
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/libosmo-pfcp/pfcp_ies_custom.c b/src/libosmo-pfcp/pfcp_ies_custom.c
index e2e9f02..d3ecda5 100644
--- a/src/libosmo-pfcp/pfcp_ies_custom.c
+++ b/src/libosmo-pfcp/pfcp_ies_custom.c
@@ -431,8 +431,10 @@
int osmo_pfcp_dec_up_function_features(void *decoded_struct, void *decode_to, const struct osmo_gtlv_load *tlv)
{
struct osmo_pfcp_ie_up_function_features *up_function_features = decode_to;
- ENSURE_LENGTH_IS_AT_LEAST(6);
- memcpy(up_function_features->bits, tlv->val, 6);
+ /* 3GPP TS 29.244 version 16.6.0 Release 16 8.2.25 UP Function Features defines at least 6 octets of bits, but
+ * if the peer sends less octets, make do with what we get. */
+ memset(up_function_features->bits, 0, sizeof(up_function_features->bits));
+ memcpy(up_function_features->bits, tlv->val, OSMO_MIN(sizeof(up_function_features->bits), tlv->len));
return 0;
}
To view, visit change 36347. To unsubscribe, or for help writing mail filters, visit settings.