summaryrefslogtreecommitdiffstats
path: root/src/expr/data_reg.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2025-10-16 01:30:20 +0200
committerPhil Sutter <phil@nwl.cc>2026-01-27 22:59:15 +0100
commit6077bf5cadd980038c223841c886aa8bc1d5abec (patch)
treed6ca2a1cca3bf6ba7f2589e2e9d72562d95e73e5 /src/expr/data_reg.c
parentcb5f02ae63923fd129efd1ccef91ba87c66e9cc0 (diff)
data_reg: Introduce struct nftnl_data_reg::sizes array
This will hold the actual size of each component in concatenated data. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/expr/data_reg.c')
-rw-r--r--src/expr/data_reg.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
index 45f2d94..d1aadcc 100644
--- a/src/expr/data_reg.c
+++ b/src/expr/data_reg.c
@@ -202,7 +202,7 @@ int nftnl_parse_data(union nftnl_data_reg *data, struct nlattr *attr, int *type)
}
int nftnl_data_cpy(union nftnl_data_reg *dreg, const void *src,
- uint32_t len, uint32_t byteorder)
+ uint32_t len, uint32_t byteorder, uint8_t *sizes)
{
int ret = 0;
@@ -214,5 +214,9 @@ int nftnl_data_cpy(union nftnl_data_reg *dreg, const void *src,
memcpy(dreg->val, src, len);
dreg->len = len;
dreg->byteorder = byteorder;
+ if (sizes)
+ memcpy(dreg->sizes, sizes, sizeof(dreg->sizes));
+ else
+ memset(dreg->sizes, 0, sizeof(dreg->sizes));
return ret;
}