History

netfilter: ipset: Add skbinfo extension kernel support for the list set type.

Add skbinfo extension kernel support for the list set type. Introduce the new revision of the list set type.

Anton Danilov committed 12 years ago

Commit cbee93d1 parent af331411 file · +17 −2Browse files

Unified · Split

net/netfilter/ipset/ip_set_list_set.c+17−2
@@ -17,7 +17,8 @@ · 16 unmodified lines
1717
1818 #define IPSET_TYPE_REV_MIN 0
1919 /* 1 Counters support added */
20−#define IPSET_TYPE_REV_MAX 2 /* Comments support added */
20+/* 2 Comments support added */
21+#define IPSET_TYPE_REV_MAX 3 /* skbinfo support added */
2122
2223 MODULE_LICENSE("GPL");
2324 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");
@@ -73,6 +74,10 @@ list_set_ktest(struct ip_set *set, const struct sk_buff *skb, · 49 unmodified lines
7374 ip_set_update_counter(ext_counter(e, set),
7475 ext, &opt->ext,
7576 cmdflags);
77+ if (SET_WITH_SKBINFO(set))
78+ ip_set_get_skbinfo(ext_skbinfo(e, set),
79+ ext, &opt->ext,
80+ cmdflags);
7681 return ret;
7782 }
7883 }
@@ -197,6 +202,8 @@ list_set_add(struct ip_set *set, u32 i, struct set_adt_elem *d, · 118 unmodified lines
197202 ip_set_init_counter(ext_counter(e, set), ext);
198203 if (SET_WITH_COMMENT(set))
199204 ip_set_init_comment(ext_comment(e, set), ext);
205+ if (SET_WITH_SKBINFO(set))
206+ ip_set_init_skbinfo(ext_skbinfo(e, set), ext);
200207 return 0;
201208 }
202209
@@ -307,6 +314,8 @@ list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext, · 104 unmodified lines
307314 ip_set_init_counter(ext_counter(e, set), ext);
308315 if (SET_WITH_COMMENT(set))
309316 ip_set_init_comment(ext_comment(e, set), ext);
317+ if (SET_WITH_SKBINFO(set))
318+ ip_set_init_skbinfo(ext_skbinfo(e, set), ext);
310319 /* Set is already added to the list */
311320 ip_set_put_byindex(map->net, d->id);
312321 return 0;
@@ -378,7 +387,10 @@ list_set_uadt(struct ip_set *set, struct nlattr *tb[], · 65 unmodified lines
378387 !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) ||
379388 !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS) ||
380389 !ip_set_optattr_netorder(tb, IPSET_ATTR_PACKETS) ||
381− !ip_set_optattr_netorder(tb, IPSET_ATTR_BYTES)))
390+ !ip_set_optattr_netorder(tb, IPSET_ATTR_BYTES) ||
391+ !ip_set_optattr_netorder(tb, IPSET_ATTR_SKBMARK) ||
392+ !ip_set_optattr_netorder(tb, IPSET_ATTR_SKBPRIO) ||
393+ !ip_set_optattr_netorder(tb, IPSET_ATTR_SKBQUEUE)))
382394 return -IPSET_ERR_PROTOCOL;
383395
384396 if (tb[IPSET_ATTR_LINENO])
@@ -667,6 +679,9 @@ static struct ip_set_type list_set_type __read_mostly = { · 282 unmodified lines
667679 [IPSET_ATTR_BYTES] = { .type = NLA_U64 },
668680 [IPSET_ATTR_PACKETS] = { .type = NLA_U64 },
669681 [IPSET_ATTR_COMMENT] = { .type = NLA_NUL_STRING },
682+ [IPSET_ATTR_SKBMARK] = { .type = NLA_U64 },
683+ [IPSET_ATTR_SKBPRIO] = { .type = NLA_U32 },
684+ [IPSET_ATTR_SKBQUEUE] = { .type = NLA_U16 },
670685 },
671686 .me = THIS_MODULE,
672687 };