The support makes possible to specify the timeout value for the SET target and a flag to reset the timeout for already existing entries.
Unified · Split
| @@ -217,6 +217,15 @@ struct ip_set; · 216 unmodified lines | ||
| 217 | 217 | typedef int (*ipset_adtfn)(struct ip_set *set, void *value, |
| 218 | 218 | u32 timeout, u32 flags); |
| 219 | 219 | |
| 220 | +/* Kernel API function options */ | |
| 221 | +struct ip_set_adt_opt { | |
| 222 | + u8 family; /* Actual protocol family */ | |
| 223 | + u8 dim; /* Dimension of match/target */ | |
| 224 | + u8 flags; /* Direction and negation flags */ | |
| 225 | + u32 cmdflags; /* Command-like flags */ | |
| 226 | + u32 timeout; /* Timeout value */ | |
| 227 | +}; | |
| 228 | + | |
| 220 | 229 | /* Set type, variant-specific part */ |
| 221 | 230 | struct ip_set_type_variant { |
| 222 | 231 | /* Kernelspace: test/add/del entries |
| @@ -224,7 +233,7 @@ struct ip_set_type_variant { · 1 unmodified line | ||
| 224 | 233 | * zero for no match/success to add/delete |
| 225 | 234 | * positive for matching element */ |
| 226 | 235 | int (*kadt)(struct ip_set *set, const struct sk_buff * skb, |
| 227 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags); | |
| 236 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt); | |
| 228 | 237 | |
| 229 | 238 | /* Userspace: test/add/del entries |
| 230 | 239 | * returns negative error code, |
| @@ -314,12 +323,13 @@ extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index); · 83 unmodified lines | ||
| 314 | 323 | extern void ip_set_nfnl_put(ip_set_id_t index); |
| 315 | 324 | |
| 316 | 325 | /* API for iptables set match, and SET target */ |
| 326 | + | |
| 317 | 327 | extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb, |
| 318 | − u8 family, u8 dim, u8 flags); | |
| 328 | + const struct ip_set_adt_opt *opt); | |
| 319 | 329 | extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb, |
| 320 | − u8 family, u8 dim, u8 flags); | |
| 330 | + const struct ip_set_adt_opt *opt); | |
| 321 | 331 | extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb, |
| 322 | − u8 family, u8 dim, u8 flags); | |
| 332 | + const struct ip_set_adt_opt *opt); | |
| 323 | 333 | |
| 324 | 334 | /* Utility functions */ |
| 325 | 335 | extern void * ip_set_alloc(size_t size); |
| @@ -586,7 +586,7 @@ nla_put_failure: · 585 unmodified lines | ||
| 586 | 586 | |
| 587 | 587 | static int |
| 588 | 588 | type_pf_kadt(struct ip_set *set, const struct sk_buff * skb, |
| 589 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags); | |
| 589 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt); | |
| 590 | 590 | static int |
| 591 | 591 | type_pf_uadt(struct ip_set *set, struct nlattr *tb[], |
| 592 | 592 | enum ipset_adt adt, u32 *lineno, u32 flags); |
| @@ -22,6 +22,9 @@ · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | #define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT) |
| 24 | 24 | |
| 25 | +#define opt_timeout(opt, map) \ | |
| 26 | + (with_timeout((opt)->timeout) ? (opt)->timeout : (map)->timeout) | |
| 27 | + | |
| 25 | 28 | static inline unsigned int |
| 26 | 29 | ip_set_timeout_uget(struct nlattr *tb) |
| 27 | 30 | { |
| @@ -35,7 +35,7 @@ struct xt_set_info_target_v0 { · 34 unmodified lines | ||
| 35 | 35 | struct xt_set_info_v0 del_set; |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | −/* Revision 1: current interface to netfilter/iptables */ | |
| 38 | +/* Revision 1 match and target */ | |
| 39 | 39 | |
| 40 | 40 | struct xt_set_info { |
| 41 | 41 | ip_set_id_t index; |
| @@ -44,13 +44,22 @@ struct xt_set_info { · 2 unmodified lines | ||
| 44 | 44 | }; |
| 45 | 45 | |
| 46 | 46 | /* match and target infos */ |
| 47 | −struct xt_set_info_match { | |
| 47 | +struct xt_set_info_match_v1 { | |
| 48 | 48 | struct xt_set_info match_set; |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | −struct xt_set_info_target { | |
| 51 | +struct xt_set_info_target_v1 { | |
| 52 | 52 | struct xt_set_info add_set; |
| 53 | 53 | struct xt_set_info del_set; |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | +/* Revision 2 target */ | |
| 57 | + | |
| 58 | +struct xt_set_info_target_v2 { | |
| 59 | + struct xt_set_info add_set; | |
| 60 | + struct xt_set_info del_set; | |
| 61 | + u32 flags; | |
| 62 | + u32 timeout; | |
| 63 | +}; | |
| 64 | + | |
| 56 | 65 | #endif /*_XT_SET_H*/ |
| @@ -219,19 +219,19 @@ nla_put_failure: · 218 unmodified lines | ||
| 219 | 219 | |
| 220 | 220 | static int |
| 221 | 221 | bitmap_ip_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 222 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 222 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 223 | 223 | { |
| 224 | 224 | struct bitmap_ip *map = set->data; |
| 225 | 225 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 226 | 226 | u32 ip; |
| 227 | 227 | |
| 228 | − ip = ntohl(ip4addr(skb, flags & IPSET_DIM_ONE_SRC)); | |
| 228 | + ip = ntohl(ip4addr(skb, opt->flags & IPSET_DIM_ONE_SRC)); | |
| 229 | 229 | if (ip < map->first_ip || ip > map->last_ip) |
| 230 | 230 | return -IPSET_ERR_BITMAP_RANGE; |
| 231 | 231 | |
| 232 | 232 | ip = ip_to_id(map, ip); |
| 233 | 233 | |
| 234 | − return adtfn(set, &ip, map->timeout, flags); | |
| 234 | + return adtfn(set, &ip, opt_timeout(opt, map), opt->cmdflags); | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | static int |
| @@ -338,17 +338,17 @@ nla_put_failure: · 337 unmodified lines | ||
| 338 | 338 | |
| 339 | 339 | static int |
| 340 | 340 | bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 341 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 341 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 342 | 342 | { |
| 343 | 343 | struct bitmap_ipmac *map = set->data; |
| 344 | 344 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 345 | 345 | struct ipmac data; |
| 346 | 346 | |
| 347 | 347 | /* MAC can be src only */ |
| 348 | − if (!(flags & IPSET_DIM_TWO_SRC)) | |
| 348 | + if (!(opt->flags & IPSET_DIM_TWO_SRC)) | |
| 349 | 349 | return 0; |
| 350 | 350 | |
| 351 | − data.id = ntohl(ip4addr(skb, flags & IPSET_DIM_ONE_SRC)); | |
| 351 | + data.id = ntohl(ip4addr(skb, opt->flags & IPSET_DIM_ONE_SRC)); | |
| 352 | 352 | if (data.id < map->first_ip || data.id > map->last_ip) |
| 353 | 353 | return -IPSET_ERR_BITMAP_RANGE; |
| 354 | 354 | |
| @@ -360,7 +360,7 @@ bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb, · 5 unmodified lines | ||
| 360 | 360 | data.id -= map->first_ip; |
| 361 | 361 | data.ether = eth_hdr(skb)->h_source; |
| 362 | 362 | |
| 363 | − return adtfn(set, &data, map->timeout, flags); | |
| 363 | + return adtfn(set, &data, opt_timeout(opt, map), opt->cmdflags); | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | static int |
| @@ -208,14 +208,15 @@ nla_put_failure: · 207 unmodified lines | ||
| 208 | 208 | |
| 209 | 209 | static int |
| 210 | 210 | bitmap_port_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 211 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 211 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 212 | 212 | { |
| 213 | 213 | struct bitmap_port *map = set->data; |
| 214 | 214 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 215 | 215 | __be16 __port; |
| 216 | 216 | u16 port = 0; |
| 217 | 217 | |
| 218 | − if (!ip_set_get_ip_port(skb, pf, flags & IPSET_DIM_ONE_SRC, &__port)) | |
| 218 | + if (!ip_set_get_ip_port(skb, opt->family, | |
| 219 | + opt->flags & IPSET_DIM_ONE_SRC, &__port)) | |
| 219 | 220 | return -EINVAL; |
| 220 | 221 | |
| 221 | 222 | port = ntohs(__port); |
| @@ -225,7 +226,7 @@ bitmap_port_kadt(struct ip_set *set, const struct sk_buff *skb, · 3 unmodified lines | ||
| 225 | 226 | |
| 226 | 227 | port -= map->first_port; |
| 227 | 228 | |
| 228 | − return adtfn(set, &port, map->timeout, flags); | |
| 229 | + return adtfn(set, &port, opt_timeout(opt, map), opt->cmdflags); | |
| 229 | 230 | } |
| 230 | 231 | |
| 231 | 232 | static int |
| @@ -325,7 +325,7 @@ __ip_set_put(ip_set_id_t index) · 324 unmodified lines | ||
| 325 | 325 | |
| 326 | 326 | int |
| 327 | 327 | ip_set_test(ip_set_id_t index, const struct sk_buff *skb, |
| 328 | − u8 family, u8 dim, u8 flags) | |
| 328 | + const struct ip_set_adt_opt *opt) | |
| 329 | 329 | { |
| 330 | 330 | struct ip_set *set = ip_set_list[index]; |
| 331 | 331 | int ret = 0; |
| @@ -333,19 +333,19 @@ ip_set_test(ip_set_id_t index, const struct sk_buff *skb, · 1 unmodified line | ||
| 333 | 333 | BUG_ON(set == NULL); |
| 334 | 334 | pr_debug("set %s, index %u\n", set->name, index); |
| 335 | 335 | |
| 336 | − if (dim < set->type->dimension || | |
| 337 | − !(family == set->family || set->family == AF_UNSPEC)) | |
| 336 | + if (opt->dim < set->type->dimension || | |
| 337 | + !(opt->family == set->family || set->family == AF_UNSPEC)) | |
| 338 | 338 | return 0; |
| 339 | 339 | |
| 340 | 340 | read_lock_bh(&set->lock); |
| 341 | − ret = set->variant->kadt(set, skb, IPSET_TEST, family, dim, flags); | |
| 341 | + ret = set->variant->kadt(set, skb, IPSET_TEST, opt); | |
| 342 | 342 | read_unlock_bh(&set->lock); |
| 343 | 343 | |
| 344 | 344 | if (ret == -EAGAIN) { |
| 345 | 345 | /* Type requests element to be completed */ |
| 346 | 346 | pr_debug("element must be competed, ADD is triggered\n"); |
| 347 | 347 | write_lock_bh(&set->lock); |
| 348 | − set->variant->kadt(set, skb, IPSET_ADD, family, dim, flags); | |
| 348 | + set->variant->kadt(set, skb, IPSET_ADD, opt); | |
| 349 | 349 | write_unlock_bh(&set->lock); |
| 350 | 350 | ret = 1; |
| 351 | 351 | } |
| @@ -357,7 +357,7 @@ EXPORT_SYMBOL_GPL(ip_set_test); · 5 unmodified lines | ||
| 357 | 357 | |
| 358 | 358 | int |
| 359 | 359 | ip_set_add(ip_set_id_t index, const struct sk_buff *skb, |
| 360 | − u8 family, u8 dim, u8 flags) | |
| 360 | + const struct ip_set_adt_opt *opt) | |
| 361 | 361 | { |
| 362 | 362 | struct ip_set *set = ip_set_list[index]; |
| 363 | 363 | int ret; |
| @@ -365,12 +365,12 @@ ip_set_add(ip_set_id_t index, const struct sk_buff *skb, · 1 unmodified line | ||
| 365 | 365 | BUG_ON(set == NULL); |
| 366 | 366 | pr_debug("set %s, index %u\n", set->name, index); |
| 367 | 367 | |
| 368 | − if (dim < set->type->dimension || | |
| 369 | − !(family == set->family || set->family == AF_UNSPEC)) | |
| 368 | + if (opt->dim < set->type->dimension || | |
| 369 | + !(opt->family == set->family || set->family == AF_UNSPEC)) | |
| 370 | 370 | return 0; |
| 371 | 371 | |
| 372 | 372 | write_lock_bh(&set->lock); |
| 373 | − ret = set->variant->kadt(set, skb, IPSET_ADD, family, dim, flags); | |
| 373 | + ret = set->variant->kadt(set, skb, IPSET_ADD, opt); | |
| 374 | 374 | write_unlock_bh(&set->lock); |
| 375 | 375 | |
| 376 | 376 | return ret; |
| @@ -379,7 +379,7 @@ EXPORT_SYMBOL_GPL(ip_set_add); · 2 unmodified lines | ||
| 379 | 379 | |
| 380 | 380 | int |
| 381 | 381 | ip_set_del(ip_set_id_t index, const struct sk_buff *skb, |
| 382 | − u8 family, u8 dim, u8 flags) | |
| 382 | + const struct ip_set_adt_opt *opt) | |
| 383 | 383 | { |
| 384 | 384 | struct ip_set *set = ip_set_list[index]; |
| 385 | 385 | int ret = 0; |
| @@ -387,12 +387,12 @@ ip_set_del(ip_set_id_t index, const struct sk_buff *skb, · 1 unmodified line | ||
| 387 | 387 | BUG_ON(set == NULL); |
| 388 | 388 | pr_debug("set %s, index %u\n", set->name, index); |
| 389 | 389 | |
| 390 | − if (dim < set->type->dimension || | |
| 391 | − !(family == set->family || set->family == AF_UNSPEC)) | |
| 390 | + if (opt->dim < set->type->dimension || | |
| 391 | + !(opt->family == set->family || set->family == AF_UNSPEC)) | |
| 392 | 392 | return 0; |
| 393 | 393 | |
| 394 | 394 | write_lock_bh(&set->lock); |
| 395 | − ret = set->variant->kadt(set, skb, IPSET_DEL, family, dim, flags); | |
| 395 | + ret = set->variant->kadt(set, skb, IPSET_DEL, opt); | |
| 396 | 396 | write_unlock_bh(&set->lock); |
| 397 | 397 | |
| 398 | 398 | return ret; |
| @@ -110,18 +110,18 @@ nla_put_failure: · 109 unmodified lines | ||
| 110 | 110 | |
| 111 | 111 | static int |
| 112 | 112 | hash_ip4_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 113 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 113 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 114 | 114 | { |
| 115 | 115 | const struct ip_set_hash *h = set->data; |
| 116 | 116 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 117 | 117 | __be32 ip; |
| 118 | 118 | |
| 119 | − ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &ip); | |
| 119 | + ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &ip); | |
| 120 | 120 | ip &= ip_set_netmask(h->netmask); |
| 121 | 121 | if (ip == 0) |
| 122 | 122 | return -EINVAL; |
| 123 | 123 | |
| 124 | − return adtfn(set, &ip, h->timeout, flags); | |
| 124 | + return adtfn(set, &ip, opt_timeout(opt, h), opt->cmdflags); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | static int |
| @@ -283,18 +283,18 @@ nla_put_failure: · 155 unmodified lines | ||
| 283 | 283 | |
| 284 | 284 | static int |
| 285 | 285 | hash_ip6_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 286 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 286 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 287 | 287 | { |
| 288 | 288 | const struct ip_set_hash *h = set->data; |
| 289 | 289 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 290 | 290 | union nf_inet_addr ip; |
| 291 | 291 | |
| 292 | − ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &ip.in6); | |
| 292 | + ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &ip.in6); | |
| 293 | 293 | ip6_netmask(&ip, h->netmask); |
| 294 | 294 | if (ipv6_addr_any(&ip.in6)) |
| 295 | 295 | return -EINVAL; |
| 296 | 296 | |
| 297 | − return adtfn(set, &ip, h->timeout, flags); | |
| 297 | + return adtfn(set, &ip, opt_timeout(opt, h), opt->cmdflags); | |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | static const struct nla_policy hash_ip6_adt_policy[IPSET_ATTR_ADT_MAX + 1] = { |
| @@ -126,19 +126,19 @@ nla_put_failure: · 125 unmodified lines | ||
| 126 | 126 | |
| 127 | 127 | static int |
| 128 | 128 | hash_ipport4_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 129 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 129 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 130 | 130 | { |
| 131 | 131 | const struct ip_set_hash *h = set->data; |
| 132 | 132 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 133 | 133 | struct hash_ipport4_elem data = { }; |
| 134 | 134 | |
| 135 | − if (!ip_set_get_ip4_port(skb, flags & IPSET_DIM_TWO_SRC, | |
| 135 | + if (!ip_set_get_ip4_port(skb, opt->flags & IPSET_DIM_TWO_SRC, | |
| 136 | 136 | &data.port, &data.proto)) |
| 137 | 137 | return -EINVAL; |
| 138 | 138 | |
| 139 | − ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 139 | + ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 140 | 140 | |
| 141 | − return adtfn(set, &data, h->timeout, flags); | |
| 141 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | static int |
| @@ -330,19 +330,19 @@ nla_put_failure: · 185 unmodified lines | ||
| 330 | 330 | |
| 331 | 331 | static int |
| 332 | 332 | hash_ipport6_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 333 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 333 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 334 | 334 | { |
| 335 | 335 | const struct ip_set_hash *h = set->data; |
| 336 | 336 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 337 | 337 | struct hash_ipport6_elem data = { }; |
| 338 | 338 | |
| 339 | − if (!ip_set_get_ip6_port(skb, flags & IPSET_DIM_TWO_SRC, | |
| 339 | + if (!ip_set_get_ip6_port(skb, opt->flags & IPSET_DIM_TWO_SRC, | |
| 340 | 340 | &data.port, &data.proto)) |
| 341 | 341 | return -EINVAL; |
| 342 | 342 | |
| 343 | − ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 343 | + ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 344 | 344 | |
| 345 | − return adtfn(set, &data, h->timeout, flags); | |
| 345 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | static int |
| @@ -129,20 +129,20 @@ nla_put_failure: · 128 unmodified lines | ||
| 129 | 129 | |
| 130 | 130 | static int |
| 131 | 131 | hash_ipportip4_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 132 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 132 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 133 | 133 | { |
| 134 | 134 | const struct ip_set_hash *h = set->data; |
| 135 | 135 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 136 | 136 | struct hash_ipportip4_elem data = { }; |
| 137 | 137 | |
| 138 | − if (!ip_set_get_ip4_port(skb, flags & IPSET_DIM_TWO_SRC, | |
| 138 | + if (!ip_set_get_ip4_port(skb, opt->flags & IPSET_DIM_TWO_SRC, | |
| 139 | 139 | &data.port, &data.proto)) |
| 140 | 140 | return -EINVAL; |
| 141 | 141 | |
| 142 | − ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 143 | − ip4addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2); | |
| 142 | + ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 143 | + ip4addrptr(skb, opt->flags & IPSET_DIM_THREE_SRC, &data.ip2); | |
| 144 | 144 | |
| 145 | − return adtfn(set, &data, h->timeout, flags); | |
| 145 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | static int |
| @@ -343,20 +343,20 @@ nla_put_failure: · 194 unmodified lines | ||
| 343 | 343 | |
| 344 | 344 | static int |
| 345 | 345 | hash_ipportip6_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 346 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 346 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 347 | 347 | { |
| 348 | 348 | const struct ip_set_hash *h = set->data; |
| 349 | 349 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 350 | 350 | struct hash_ipportip6_elem data = { }; |
| 351 | 351 | |
| 352 | − if (!ip_set_get_ip6_port(skb, flags & IPSET_DIM_TWO_SRC, | |
| 352 | + if (!ip_set_get_ip6_port(skb, opt->flags & IPSET_DIM_TWO_SRC, | |
| 353 | 353 | &data.port, &data.proto)) |
| 354 | 354 | return -EINVAL; |
| 355 | 355 | |
| 356 | − ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 357 | − ip6addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2.in6); | |
| 356 | + ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 357 | + ip6addrptr(skb, opt->flags & IPSET_DIM_THREE_SRC, &data.ip2.in6); | |
| 358 | 358 | |
| 359 | − return adtfn(set, &data, h->timeout, flags); | |
| 359 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | static int |
| @@ -142,7 +142,7 @@ nla_put_failure: · 141 unmodified lines | ||
| 142 | 142 | |
| 143 | 143 | static int |
| 144 | 144 | hash_ipportnet4_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 145 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 145 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 146 | 146 | { |
| 147 | 147 | const struct ip_set_hash *h = set->data; |
| 148 | 148 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| @@ -154,15 +154,15 @@ hash_ipportnet4_kadt(struct ip_set *set, const struct sk_buff *skb, · 5 unmodified lines | ||
| 154 | 154 | if (adt == IPSET_TEST) |
| 155 | 155 | data.cidr = HOST_MASK; |
| 156 | 156 | |
| 157 | − if (!ip_set_get_ip4_port(skb, flags & IPSET_DIM_TWO_SRC, | |
| 157 | + if (!ip_set_get_ip4_port(skb, opt->flags & IPSET_DIM_TWO_SRC, | |
| 158 | 158 | &data.port, &data.proto)) |
| 159 | 159 | return -EINVAL; |
| 160 | 160 | |
| 161 | − ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 162 | − ip4addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2); | |
| 161 | + ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 162 | + ip4addrptr(skb, opt->flags & IPSET_DIM_THREE_SRC, &data.ip2); | |
| 163 | 163 | data.ip2 &= ip_set_netmask(data.cidr); |
| 164 | 164 | |
| 165 | − return adtfn(set, &data, h->timeout, flags); | |
| 165 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | static int |
| @@ -390,7 +390,7 @@ nla_put_failure: · 221 unmodified lines | ||
| 390 | 390 | |
| 391 | 391 | static int |
| 392 | 392 | hash_ipportnet6_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 393 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 393 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 394 | 394 | { |
| 395 | 395 | const struct ip_set_hash *h = set->data; |
| 396 | 396 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| @@ -402,15 +402,15 @@ hash_ipportnet6_kadt(struct ip_set *set, const struct sk_buff *skb, · 5 unmodified lines | ||
| 402 | 402 | if (adt == IPSET_TEST) |
| 403 | 403 | data.cidr = HOST_MASK; |
| 404 | 404 | |
| 405 | − if (!ip_set_get_ip6_port(skb, flags & IPSET_DIM_TWO_SRC, | |
| 405 | + if (!ip_set_get_ip6_port(skb, opt->flags & IPSET_DIM_TWO_SRC, | |
| 406 | 406 | &data.port, &data.proto)) |
| 407 | 407 | return -EINVAL; |
| 408 | 408 | |
| 409 | − ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 410 | − ip6addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2.in6); | |
| 409 | + ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 410 | + ip6addrptr(skb, opt->flags & IPSET_DIM_THREE_SRC, &data.ip2.in6); | |
| 411 | 411 | ip6_netmask(&data.ip2, data.cidr); |
| 412 | 412 | |
| 413 | − return adtfn(set, &data, h->timeout, flags); | |
| 413 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | static int |
| @@ -127,7 +127,7 @@ nla_put_failure: · 126 unmodified lines | ||
| 127 | 127 | |
| 128 | 128 | static int |
| 129 | 129 | hash_net4_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 130 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 130 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 131 | 131 | { |
| 132 | 132 | const struct ip_set_hash *h = set->data; |
| 133 | 133 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| @@ -138,10 +138,10 @@ hash_net4_kadt(struct ip_set *set, const struct sk_buff *skb, · 4 unmodified lines | ||
| 138 | 138 | if (adt == IPSET_TEST) |
| 139 | 139 | data.cidr = HOST_MASK; |
| 140 | 140 | |
| 141 | − ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 141 | + ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 142 | 142 | data.ip &= ip_set_netmask(data.cidr); |
| 143 | 143 | |
| 144 | − return adtfn(set, &data, h->timeout, flags); | |
| 144 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | static int |
| @@ -292,7 +292,7 @@ nla_put_failure: · 144 unmodified lines | ||
| 292 | 292 | |
| 293 | 293 | static int |
| 294 | 294 | hash_net6_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 295 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 295 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 296 | 296 | { |
| 297 | 297 | const struct ip_set_hash *h = set->data; |
| 298 | 298 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| @@ -303,10 +303,10 @@ hash_net6_kadt(struct ip_set *set, const struct sk_buff *skb, · 4 unmodified lines | ||
| 303 | 303 | if (adt == IPSET_TEST) |
| 304 | 304 | data.cidr = HOST_MASK; |
| 305 | 305 | |
| 306 | − ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 306 | + ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 307 | 307 | ip6_netmask(&data.ip, data.cidr); |
| 308 | 308 | |
| 309 | − return adtfn(set, &data, h->timeout, flags); | |
| 309 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | static int |
| @@ -139,7 +139,7 @@ nla_put_failure: · 138 unmodified lines | ||
| 139 | 139 | |
| 140 | 140 | static int |
| 141 | 141 | hash_netport4_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 142 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 142 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 143 | 143 | { |
| 144 | 144 | const struct ip_set_hash *h = set->data; |
| 145 | 145 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| @@ -151,14 +151,14 @@ hash_netport4_kadt(struct ip_set *set, const struct sk_buff *skb, · 5 unmodified lines | ||
| 151 | 151 | if (adt == IPSET_TEST) |
| 152 | 152 | data.cidr = HOST_MASK; |
| 153 | 153 | |
| 154 | − if (!ip_set_get_ip4_port(skb, flags & IPSET_DIM_TWO_SRC, | |
| 154 | + if (!ip_set_get_ip4_port(skb, opt->flags & IPSET_DIM_TWO_SRC, | |
| 155 | 155 | &data.port, &data.proto)) |
| 156 | 156 | return -EINVAL; |
| 157 | 157 | |
| 158 | − ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 158 | + ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip); | |
| 159 | 159 | data.ip &= ip_set_netmask(data.cidr); |
| 160 | 160 | |
| 161 | − return adtfn(set, &data, h->timeout, flags); | |
| 161 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | static int |
| @@ -352,7 +352,7 @@ nla_put_failure: · 187 unmodified lines | ||
| 352 | 352 | |
| 353 | 353 | static int |
| 354 | 354 | hash_netport6_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 355 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 355 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 356 | 356 | { |
| 357 | 357 | const struct ip_set_hash *h = set->data; |
| 358 | 358 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| @@ -364,14 +364,14 @@ hash_netport6_kadt(struct ip_set *set, const struct sk_buff *skb, · 5 unmodified lines | ||
| 364 | 364 | if (adt == IPSET_TEST) |
| 365 | 365 | data.cidr = HOST_MASK; |
| 366 | 366 | |
| 367 | − if (!ip_set_get_ip6_port(skb, flags & IPSET_DIM_TWO_SRC, | |
| 367 | + if (!ip_set_get_ip6_port(skb, opt->flags & IPSET_DIM_TWO_SRC, | |
| 368 | 368 | &data.port, &data.proto)) |
| 369 | 369 | return -EINVAL; |
| 370 | 370 | |
| 371 | − ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 371 | + ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip.in6); | |
| 372 | 372 | ip6_netmask(&data.ip, data.cidr); |
| 373 | 373 | |
| 374 | − return adtfn(set, &data, h->timeout, flags); | |
| 374 | + return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags); | |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | static int |
| @@ -72,7 +72,7 @@ list_set_expired(const struct list_set *map, u32 id) · 71 unmodified lines | ||
| 72 | 72 | |
| 73 | 73 | static int |
| 74 | 74 | list_set_kadt(struct ip_set *set, const struct sk_buff *skb, |
| 75 | − enum ipset_adt adt, u8 pf, u8 dim, u8 flags) | |
| 75 | + enum ipset_adt adt, const struct ip_set_adt_opt *opt) | |
| 76 | 76 | { |
| 77 | 77 | struct list_set *map = set->data; |
| 78 | 78 | struct set_elem *elem; |
| @@ -87,17 +87,17 @@ list_set_kadt(struct ip_set *set, const struct sk_buff *skb, · 8 unmodified lines | ||
| 87 | 87 | continue; |
| 88 | 88 | switch (adt) { |
| 89 | 89 | case IPSET_TEST: |
| 90 | − ret = ip_set_test(elem->id, skb, pf, dim, flags); | |
| 90 | + ret = ip_set_test(elem->id, skb, opt); | |
| 91 | 91 | if (ret > 0) |
| 92 | 92 | return ret; |
| 93 | 93 | break; |
| 94 | 94 | case IPSET_ADD: |
| 95 | − ret = ip_set_add(elem->id, skb, pf, dim, flags); | |
| 95 | + ret = ip_set_add(elem->id, skb, opt); | |
| 96 | 96 | if (ret == 0) |
| 97 | 97 | return ret; |
| 98 | 98 | break; |
| 99 | 99 | case IPSET_DEL: |
| 100 | − ret = ip_set_del(elem->id, skb, pf, dim, flags); | |
| 100 | + ret = ip_set_del(elem->id, skb, opt); | |
| 101 | 101 | if (ret == 0) |
| 102 | 102 | return ret; |
| 103 | 103 | break; |
| @@ -29,23 +29,32 @@ MODULE_ALIAS("ip6t_SET"); · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | static inline int |
| 31 | 31 | match_set(ip_set_id_t index, const struct sk_buff *skb, |
| 32 | − u8 pf, u8 dim, u8 flags, int inv) | |
| 32 | + const struct ip_set_adt_opt *opt, int inv) | |
| 33 | 33 | { |
| 34 | − if (ip_set_test(index, skb, pf, dim, flags)) | |
| 34 | + if (ip_set_test(index, skb, opt)) | |
| 35 | 35 | inv = !inv; |
| 36 | 36 | return inv; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | +#define ADT_OPT(n, f, d, fs, cfs, t) \ | |
| 40 | +const struct ip_set_adt_opt n = { \ | |
| 41 | + .family = f, \ | |
| 42 | + .dim = d, \ | |
| 43 | + .flags = fs, \ | |
| 44 | + .cmdflags = cfs, \ | |
| 45 | + .timeout = t, \ | |
| 46 | +} | |
| 47 | + | |
| 39 | 48 | /* Revision 0 interface: backward compatible with netfilter/iptables */ |
| 40 | 49 | |
| 41 | 50 | static bool |
| 42 | 51 | set_match_v0(const struct sk_buff *skb, struct xt_action_param *par) |
| 43 | 52 | { |
| 44 | 53 | const struct xt_set_info_match_v0 *info = par->matchinfo; |
| 54 | + ADT_OPT(opt, par->family, info->match_set.u.compat.dim, | |
| 55 | + info->match_set.u.compat.flags, 0, UINT_MAX); | |
| 45 | 56 | |
| 46 | − return match_set(info->match_set.index, skb, par->family, | |
| 47 | − info->match_set.u.compat.dim, | |
| 48 | − info->match_set.u.compat.flags, | |
| 57 | + return match_set(info->match_set.index, skb, &opt, | |
| 49 | 58 | info->match_set.u.compat.flags & IPSET_INV_MATCH); |
| 50 | 59 | } |
| 51 | 60 | |
| @@ -103,15 +112,15 @@ static unsigned int · 51 unmodified lines | ||
| 103 | 112 | set_target_v0(struct sk_buff *skb, const struct xt_action_param *par) |
| 104 | 113 | { |
| 105 | 114 | const struct xt_set_info_target_v0 *info = par->targinfo; |
| 115 | + ADT_OPT(add_opt, par->family, info->add_set.u.compat.dim, | |
| 116 | + info->add_set.u.compat.flags, 0, UINT_MAX); | |
| 117 | + ADT_OPT(del_opt, par->family, info->del_set.u.compat.dim, | |
| 118 | + info->del_set.u.compat.flags, 0, UINT_MAX); | |
| 106 | 119 | |
| 107 | 120 | if (info->add_set.index != IPSET_INVALID_ID) |
| 108 | − ip_set_add(info->add_set.index, skb, par->family, | |
| 109 | − info->add_set.u.compat.dim, | |
| 110 | − info->add_set.u.compat.flags); | |
| 121 | + ip_set_add(info->add_set.index, skb, &add_opt); | |
| 111 | 122 | if (info->del_set.index != IPSET_INVALID_ID) |
| 112 | − ip_set_del(info->del_set.index, skb, par->family, | |
| 113 | − info->del_set.u.compat.dim, | |
| 114 | − info->del_set.u.compat.flags); | |
| 123 | + ip_set_del(info->del_set.index, skb, &del_opt); | |
| 115 | 124 | |
| 116 | 125 | return XT_CONTINUE; |
| 117 | 126 | } |
| @@ -170,23 +179,23 @@ set_target_v0_destroy(const struct xt_tgdtor_param *par) · 52 unmodified lines | ||
| 170 | 179 | ip_set_nfnl_put(info->del_set.index); |
| 171 | 180 | } |
| 172 | 181 | |
| 173 | −/* Revision 1: current interface to netfilter/iptables */ | |
| 182 | +/* Revision 1 match and target */ | |
| 174 | 183 | |
| 175 | 184 | static bool |
| 176 | −set_match(const struct sk_buff *skb, struct xt_action_param *par) | |
| 185 | +set_match_v1(const struct sk_buff *skb, struct xt_action_param *par) | |
| 177 | 186 | { |
| 178 | − const struct xt_set_info_match *info = par->matchinfo; | |
| 187 | + const struct xt_set_info_match_v1 *info = par->matchinfo; | |
| 188 | + ADT_OPT(opt, par->family, info->match_set.dim, | |
| 189 | + info->match_set.flags, 0, UINT_MAX); | |
| 179 | 190 | |
| 180 | − return match_set(info->match_set.index, skb, par->family, | |
| 181 | − info->match_set.dim, | |
| 182 | − info->match_set.flags, | |
| 191 | + return match_set(info->match_set.index, skb, &opt, | |
| 183 | 192 | info->match_set.flags & IPSET_INV_MATCH); |
| 184 | 193 | } |
| 185 | 194 | |
| 186 | 195 | static int |
| 187 | −set_match_checkentry(const struct xt_mtchk_param *par) | |
| 196 | +set_match_v1_checkentry(const struct xt_mtchk_param *par) | |
| 188 | 197 | { |
| 189 | − struct xt_set_info_match *info = par->matchinfo; | |
| 198 | + struct xt_set_info_match_v1 *info = par->matchinfo; | |
| 190 | 199 | ip_set_id_t index; |
| 191 | 200 | |
| 192 | 201 | index = ip_set_nfnl_get_byindex(info->match_set.index); |
| @@ -207,36 +216,34 @@ set_match_checkentry(const struct xt_mtchk_param *par) · 14 unmodified lines | ||
| 207 | 216 | } |
| 208 | 217 | |
| 209 | 218 | static void |
| 210 | −set_match_destroy(const struct xt_mtdtor_param *par) | |
| 219 | +set_match_v1_destroy(const struct xt_mtdtor_param *par) | |
| 211 | 220 | { |
| 212 | − struct xt_set_info_match *info = par->matchinfo; | |
| 221 | + struct xt_set_info_match_v1 *info = par->matchinfo; | |
| 213 | 222 | |
| 214 | 223 | ip_set_nfnl_put(info->match_set.index); |
| 215 | 224 | } |
| 216 | 225 | |
| 217 | 226 | static unsigned int |
| 218 | −set_target(struct sk_buff *skb, const struct xt_action_param *par) | |
| 227 | +set_target_v1(struct sk_buff *skb, const struct xt_action_param *par) | |
| 219 | 228 | { |
| 220 | − const struct xt_set_info_target *info = par->targinfo; | |
| 229 | + const struct xt_set_info_target_v1 *info = par->targinfo; | |
| 230 | + ADT_OPT(add_opt, par->family, info->add_set.dim, | |
| 231 | + info->add_set.flags, 0, UINT_MAX); | |
| 232 | + ADT_OPT(del_opt, par->family, info->del_set.dim, | |
| 233 | + info->del_set.flags, 0, UINT_MAX); | |
| 221 | 234 | |
| 222 | 235 | if (info->add_set.index != IPSET_INVALID_ID) |
| 223 | − ip_set_add(info->add_set.index, | |
| 224 | − skb, par->family, | |
| 225 | − info->add_set.dim, | |
| 226 | − info->add_set.flags); | |
| 236 | + ip_set_add(info->add_set.index, skb, &add_opt); | |
| 227 | 237 | if (info->del_set.index != IPSET_INVALID_ID) |
| 228 | − ip_set_del(info->del_set.index, | |
| 229 | − skb, par->family, | |
| 230 | − info->del_set.dim, | |
| 231 | − info->del_set.flags); | |
| 238 | + ip_set_del(info->del_set.index, skb, &del_opt); | |
| 232 | 239 | |
| 233 | 240 | return XT_CONTINUE; |
| 234 | 241 | } |
| 235 | 242 | |
| 236 | 243 | static int |
| 237 | −set_target_checkentry(const struct xt_tgchk_param *par) | |
| 244 | +set_target_v1_checkentry(const struct xt_tgchk_param *par) | |
| 238 | 245 | { |
| 239 | − const struct xt_set_info_target *info = par->targinfo; | |
| 246 | + const struct xt_set_info_target_v1 *info = par->targinfo; | |
| 240 | 247 | ip_set_id_t index; |
| 241 | 248 | |
| 242 | 249 | if (info->add_set.index != IPSET_INVALID_ID) { |
| @@ -273,9 +280,9 @@ set_target_checkentry(const struct xt_tgchk_param *par) · 30 unmodified lines | ||
| 273 | 280 | } |
| 274 | 281 | |
| 275 | 282 | static void |
| 276 | −set_target_destroy(const struct xt_tgdtor_param *par) | |
| 283 | +set_target_v1_destroy(const struct xt_tgdtor_param *par) | |
| 277 | 284 | { |
| 278 | − const struct xt_set_info_target *info = par->targinfo; | |
| 285 | + const struct xt_set_info_target_v1 *info = par->targinfo; | |
| 279 | 286 | |
| 280 | 287 | if (info->add_set.index != IPSET_INVALID_ID) |
| 281 | 288 | ip_set_nfnl_put(info->add_set.index); |
| @@ -283,6 +290,28 @@ set_target_destroy(const struct xt_tgdtor_param *par) · 1 unmodified line | ||
| 283 | 290 | ip_set_nfnl_put(info->del_set.index); |
| 284 | 291 | } |
| 285 | 292 | |
| 293 | +/* Revision 2 target */ | |
| 294 | + | |
| 295 | +static unsigned int | |
| 296 | +set_target_v2(struct sk_buff *skb, const struct xt_action_param *par) | |
| 297 | +{ | |
| 298 | + const struct xt_set_info_target_v2 *info = par->targinfo; | |
| 299 | + ADT_OPT(add_opt, par->family, info->add_set.dim, | |
| 300 | + info->add_set.flags, info->flags, info->timeout); | |
| 301 | + ADT_OPT(del_opt, par->family, info->del_set.dim, | |
| 302 | + info->del_set.flags, 0, UINT_MAX); | |
| 303 | + | |
| 304 | + if (info->add_set.index != IPSET_INVALID_ID) | |
| 305 | + ip_set_add(info->add_set.index, skb, &add_opt); | |
| 306 | + if (info->del_set.index != IPSET_INVALID_ID) | |
| 307 | + ip_set_del(info->del_set.index, skb, &del_opt); | |
| 308 | + | |
| 309 | + return XT_CONTINUE; | |
| 310 | +} | |
| 311 | + | |
| 312 | +#define set_target_v2_checkentry set_target_v1_checkentry | |
| 313 | +#define set_target_v2_destroy set_target_v1_destroy | |
| 314 | + | |
| 286 | 315 | static struct xt_match set_matches[] __read_mostly = { |
| 287 | 316 | { |
| 288 | 317 | .name = "set", |
| @@ -298,20 +327,20 @@ static struct xt_match set_matches[] __read_mostly = { · 9 unmodified lines | ||
| 298 | 327 | .name = "set", |
| 299 | 328 | .family = NFPROTO_IPV4, |
| 300 | 329 | .revision = 1, |
| 301 | − .match = set_match, | |
| 302 | − .matchsize = sizeof(struct xt_set_info_match), | |
| 303 | − .checkentry = set_match_checkentry, | |
| 304 | − .destroy = set_match_destroy, | |
| 330 | + .match = set_match_v1, | |
| 331 | + .matchsize = sizeof(struct xt_set_info_match_v1), | |
| 332 | + .checkentry = set_match_v1_checkentry, | |
| 333 | + .destroy = set_match_v1_destroy, | |
| 305 | 334 | .me = THIS_MODULE |
| 306 | 335 | }, |
| 307 | 336 | { |
| 308 | 337 | .name = "set", |
| 309 | 338 | .family = NFPROTO_IPV6, |
| 310 | 339 | .revision = 1, |
| 311 | − .match = set_match, | |
| 312 | − .matchsize = sizeof(struct xt_set_info_match), | |
| 313 | − .checkentry = set_match_checkentry, | |
| 314 | − .destroy = set_match_destroy, | |
| 340 | + .match = set_match_v1, | |
| 341 | + .matchsize = sizeof(struct xt_set_info_match_v1), | |
| 342 | + .checkentry = set_match_v1_checkentry, | |
| 343 | + .destroy = set_match_v1_destroy, | |
| 315 | 344 | .me = THIS_MODULE |
| 316 | 345 | }, |
| 317 | 346 | }; |
| @@ -331,20 +360,40 @@ static struct xt_target set_targets[] __read_mostly = { · 13 unmodified lines | ||
| 331 | 360 | .name = "SET", |
| 332 | 361 | .revision = 1, |
| 333 | 362 | .family = NFPROTO_IPV4, |
| 334 | − .target = set_target, | |
| 335 | − .targetsize = sizeof(struct xt_set_info_target), | |
| 336 | − .checkentry = set_target_checkentry, | |
| 337 | − .destroy = set_target_destroy, | |
| 363 | + .target = set_target_v1, | |
| 364 | + .targetsize = sizeof(struct xt_set_info_target_v1), | |
| 365 | + .checkentry = set_target_v1_checkentry, | |
| 366 | + .destroy = set_target_v1_destroy, | |
| 338 | 367 | .me = THIS_MODULE |
| 339 | 368 | }, |
| 340 | 369 | { |
| 341 | 370 | .name = "SET", |
| 342 | 371 | .revision = 1, |
| 343 | 372 | .family = NFPROTO_IPV6, |
| 344 | − .target = set_target, | |
| 345 | − .targetsize = sizeof(struct xt_set_info_target), | |
| 346 | − .checkentry = set_target_checkentry, | |
| 347 | − .destroy = set_target_destroy, | |
| 373 | + .target = set_target_v1, | |
| 374 | + .targetsize = sizeof(struct xt_set_info_target_v1), | |
| 375 | + .checkentry = set_target_v1_checkentry, | |
| 376 | + .destroy = set_target_v1_destroy, | |
| 377 | + .me = THIS_MODULE | |
| 378 | + }, | |
| 379 | + { | |
| 380 | + .name = "SET", | |
| 381 | + .revision = 2, | |
| 382 | + .family = NFPROTO_IPV4, | |
| 383 | + .target = set_target_v2, | |
| 384 | + .targetsize = sizeof(struct xt_set_info_target_v2), | |
| 385 | + .checkentry = set_target_v2_checkentry, | |
| 386 | + .destroy = set_target_v2_destroy, | |
| 387 | + .me = THIS_MODULE | |
| 388 | + }, | |
| 389 | + { | |
| 390 | + .name = "SET", | |
| 391 | + .revision = 2, | |
| 392 | + .family = NFPROTO_IPV6, | |
| 393 | + .target = set_target_v2, | |
| 394 | + .targetsize = sizeof(struct xt_set_info_target_v2), | |
| 395 | + .checkentry = set_target_v2_checkentry, | |
| 396 | + .destroy = set_target_v2_destroy, | |
| 348 | 397 | .me = THIS_MODULE |
| 349 | 398 | }, |
| 350 | 399 | }; |