From 6728c0b2c9c372cc821c3f03736c0ad89a44ef50 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 19 Sep 2017 21:43:29 +0200 Subject: Handle padding attribute properly in userspace. --- lib/debug.c | 3 +++ lib/session.c | 6 ++++++ 2 files changed, 9 insertions(+) (limited to 'lib') diff --git a/lib/debug.c b/lib/debug.c index 6f831ec..44d0f04 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -87,6 +87,9 @@ debug_cadt_attrs(int max, const struct ipset_attr_policy *policy, if (!nla[i]) continue; switch (policy[i].type) { + case MNL_TYPE_UNSPEC: + fprintf(stderr,"\t\tpadding\n"); + break; case MNL_TYPE_U8: v = *(uint8_t *) mnl_attr_get_payload(nla[i]); fprintf(stderr, "\t\t%s: %u\n", diff --git a/lib/session.c b/lib/session.c index 1bdaaa7..403ed23 100644 --- a/lib/session.c +++ b/lib/session.c @@ -514,6 +514,10 @@ static const struct ipset_attr_policy adt_attrs[] = { .type = MNL_TYPE_U16, .opt = IPSET_OPT_SKBQUEUE, }, + [IPSET_ATTR_PAD] = { + .type = MNL_TYPE_UNSPEC, + .len = 0, + }, }; static const struct ipset_attr_policy ipaddr_attrs[] = { @@ -593,6 +597,8 @@ attr2data(struct ipset_session *session, struct nlattr *nla[], attr = &attrs[type]; d = mnl_attr_get_payload(nla[type]); + if (attr->type == MNL_TYPE_UNSPEC) + return 0; if (attr->type == MNL_TYPE_NESTED && attr->opt) { /* IP addresses */ struct nlattr *ipattr[IPSET_ATTR_IPADDR_MAX+1] = {}; -- cgit v1.2.3