Handle padding attribute properly in userspace.
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 19 Sep 2017 19:43:29 +0000 (21:43 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sat, 23 Sep 2017 11:03:55 +0000 (13:03 +0200)
lib/debug.c
lib/session.c

index 6f831ecccf55e9b9d0f73e4e94a184935e6d0874..44d0f0402cc359706cc6af668718e7e000e300e2 100644 (file)
@@ -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",
index 1bdaaa7045f6165341d384bfd66dcd8afdda3fef..403ed232ccf5626bba565de693932b1e44bd2ed8 100644 (file)
@@ -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] = {};