From 9c641885afea6f46b62f591ed9b0e3006fb23701 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Sun, 12 Apr 2015 21:10:42 +0100 Subject: netlink: pad constant concat sub-expressions Pad all but the last sub-expressions of a concat expressions. Signed-off-by: Patrick McHardy --- src/datatype.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/datatype.c') diff --git a/src/datatype.c b/src/datatype.c index f93337b1..a06a58e2 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -943,7 +944,7 @@ const struct datatype *concat_type_alloc(uint32_t type) strncat(desc, i->desc, sizeof(desc) - strlen(desc) - 1); strncat(name, i->name, sizeof(name) - strlen(name) - 1); - size += i->size; + size += netlink_padded_len(i->size); subtypes++; } strncat(desc, ")", sizeof(desc) - strlen(desc) - 1); -- cgit v1.2.3 From a93bc1795b272174a10d90961a248f2c620bfa2c Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Sun, 12 Apr 2015 21:10:42 +0100 Subject: netlink: handle concat expressions in set data Reconstruct the concat expressions in set data by splicing off the subtype values based on the keytype of the set. Signed-off-by: Patrick McHardy --- src/datatype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/datatype.c') diff --git a/src/datatype.c b/src/datatype.c index a06a58e2..ca834263 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -932,7 +932,7 @@ const struct datatype *concat_type_alloc(uint32_t type) unsigned int size = 0, subtypes = 0, n; n = div_round_up(fls(type), TYPE_BITS); - while (concat_subtype_id(type, --n)) { + while (n > 0 && concat_subtype_id(type, --n)) { i = concat_subtype_lookup(type, n); if (i == NULL) return NULL; -- cgit v1.2.3