summaryrefslogtreecommitdiffstats
path: root/src/datatype.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2015-06-13 14:48:56 +0200
committerPatrick McHardy <kaber@trash.net>2015-06-13 14:48:56 +0200
commit077509fdea3aa009823491be7096749c84795874 (patch)
tree07287fb0971df4011b33135d25ef8b0c0848e099 /src/datatype.c
parent45cabc474e46c74c27b645582d37a55d5d076051 (diff)
parenta93bc1795b272174a10d90961a248f2c620bfa2c (diff)
Merge remote-tracking branch 'origin/next-4.1'
Diffstat (limited to 'src/datatype.c')
-rw-r--r--src/datatype.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/datatype.c b/src/datatype.c
index 82a77537..f42e3dfb 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -23,6 +23,7 @@
#include <expression.h>
#include <gmputil.h>
#include <erec.h>
+#include <netlink.h>
#include <netinet/ip_icmp.h>
#include <netinet/icmp6.h>
@@ -938,7 +939,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;
@@ -950,7 +951,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);