Add skbinfo extension kernel support for the list set type. Introduce the new revision of the list set type.
Unified · Split
| @@ -17,7 +17,8 @@ · 16 unmodified lines | |||
| 17 | 17 | ||
| 18 | #define IPSET_TYPE_REV_MIN 0 | 18 | #define IPSET_TYPE_REV_MIN 0 |
| 19 | /* 1 Counters support added */ | 19 | /* 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 */ | ||
| 21 | 22 | ||
| 22 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
| 23 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 24 | 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 | |||
| 73 | ip_set_update_counter(ext_counter(e, set), | 74 | ip_set_update_counter(ext_counter(e, set), |
| 74 | ext, &opt->ext, | 75 | ext, &opt->ext, |
| 75 | cmdflags); | 76 | cmdflags); |
| 77 | if (SET_WITH_SKBINFO(set)) | ||
| 78 | ip_set_get_skbinfo(ext_skbinfo(e, set), | ||
| 79 | ext, &opt->ext, | ||
| 80 | cmdflags); | ||
| 76 | return ret; | 81 | return ret; |
| 77 | } | 82 | } |
| 78 | } | 83 | } |
| @@ -197,6 +202,8 @@ list_set_add(struct ip_set *set, u32 i, struct set_adt_elem *d, · 118 unmodified lines | |||
| 197 | ip_set_init_counter(ext_counter(e, set), ext); | 202 | ip_set_init_counter(ext_counter(e, set), ext); |
| 198 | if (SET_WITH_COMMENT(set)) | 203 | if (SET_WITH_COMMENT(set)) |
| 199 | ip_set_init_comment(ext_comment(e, set), ext); | 204 | 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); | ||
| 200 | return 0; | 207 | return 0; |
| 201 | } | 208 | } |
| 202 | 209 | ||
| @@ -307,6 +314,8 @@ list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext, · 104 unmodified lines | |||
| 307 | ip_set_init_counter(ext_counter(e, set), ext); | 314 | ip_set_init_counter(ext_counter(e, set), ext); |
| 308 | if (SET_WITH_COMMENT(set)) | 315 | if (SET_WITH_COMMENT(set)) |
| 309 | ip_set_init_comment(ext_comment(e, set), ext); | 316 | 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); | ||
| 310 | /* Set is already added to the list */ | 319 | /* Set is already added to the list */ |
| 311 | ip_set_put_byindex(map->net, d->id); | 320 | ip_set_put_byindex(map->net, d->id); |
| 312 | return 0; | 321 | return 0; |
| @@ -378,7 +387,10 @@ list_set_uadt(struct ip_set *set, struct nlattr *tb[], · 65 unmodified lines | |||
| 378 | !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) || | 387 | !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) || |
| 379 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS) || | 388 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS) || |
| 380 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PACKETS) || | 389 | !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))) | ||
| 382 | return -IPSET_ERR_PROTOCOL; | 394 | return -IPSET_ERR_PROTOCOL; |
| 383 | 395 | ||
| 384 | if (tb[IPSET_ATTR_LINENO]) | 396 | if (tb[IPSET_ATTR_LINENO]) |
| @@ -667,6 +679,9 @@ static struct ip_set_type list_set_type __read_mostly = { · 282 unmodified lines | |||
| 667 | [IPSET_ATTR_BYTES] = { .type = NLA_U64 }, | 679 | [IPSET_ATTR_BYTES] = { .type = NLA_U64 }, |
| 668 | [IPSET_ATTR_PACKETS] = { .type = NLA_U64 }, | 680 | [IPSET_ATTR_PACKETS] = { .type = NLA_U64 }, |
| 669 | [IPSET_ATTR_COMMENT] = { .type = NLA_NUL_STRING }, | 681 | [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 }, | ||
| 670 | }, | 685 | }, |
| 671 | .me = THIS_MODULE, | 686 | .me = THIS_MODULE, |
| 672 | }; | 687 | }; |