aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Janosch Hofmeyr <nhofmeyr@sysmocom.de>2024-03-16 05:51:23 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2024-03-19 04:40:06 +0100
commit5d2ee7e72c62db67ee3f70805e7d40f3c154209f (patch)
treec19f9ef13dc42594f9c622cac81ffa1ad5755dc0
parent172dc5a72d9a625acd3786d6d6f8a6c31d130d2c (diff)
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
-rw-r--r--src/libosmo-pfcp/pfcp_ies_custom.c6
1 files changed, 4 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 @@ char *osmo_pfcp_bits_to_str_c(void *ctx, const uint8_t *bits, const struct value
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;
}