History

netfilter: ipset: options and flags support added to the kernel API

The support makes possible to specify the timeout value for the SET target and a flag to reset the timeout for already existing entries.

Jozsef Kadlecsik committed 15 years ago

Commit ac8cc921 parent 483e9ea16 files · +206 −134Browse files

Unified · Split

16 files
  1. include/linux/netfilter/ipset/ip_set.h +14 −4
  2. include/linux/netfilter/ipset/ip_set_ahash.h +1 −1
  3. include/linux/netfilter/ipset/ip_set_timeout.h +3 −0
  4. include/linux/netfilter/xt_set.h +12 −3
  5. net/netfilter/ipset/ip_set_bitmap_ip.c +3 −3
  6. net/netfilter/ipset/ip_set_bitmap_ipmac.c +4 −4
  7. net/netfilter/ipset/ip_set_bitmap_port.c +4 −3
  8. net/netfilter/ipset/ip_set_core.c +13 −13
  9. net/netfilter/ipset/ip_set_hash_ip.c +6 −6
  10. net/netfilter/ipset/ip_set_hash_ipport.c +8 −8
  11. net/netfilter/ipset/ip_set_hash_ipportip.c +10 −10
  12. net/netfilter/ipset/ip_set_hash_ipportnet.c +10 −10
  13. net/netfilter/ipset/ip_set_hash_net.c +6 −6
  14. net/netfilter/ipset/ip_set_hash_netport.c +8 −8
  15. net/netfilter/ipset/ip_set_list_set.c +4 −4
  16. net/netfilter/xt_set.c +100 −51
include/linux/netfilter/ipset/ip_set.h+14−4
@@ -217,6 +217,15 @@ struct ip_set; · 216 unmodified lines
217typedef int (*ipset_adtfn)(struct ip_set *set, void *value,217typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
218 u32 timeout, u32 flags);218 u32 timeout, u32 flags);
219 219
220/* Kernel API function options */
221struct 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/* Set type, variant-specific part */229/* Set type, variant-specific part */
221struct ip_set_type_variant {230struct ip_set_type_variant {
222 /* Kernelspace: test/add/del entries231 /* Kernelspace: test/add/del entries
@@ -224,7 +233,7 @@ struct ip_set_type_variant { · 1 unmodified line
224 * zero for no match/success to add/delete233 * zero for no match/success to add/delete
225 * positive for matching element */234 * positive for matching element */
226 int (*kadt)(struct ip_set *set, const struct sk_buff * skb,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 /* Userspace: test/add/del entries238 /* Userspace: test/add/del entries
230 * returns negative error code,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
314extern void ip_set_nfnl_put(ip_set_id_t index);323extern void ip_set_nfnl_put(ip_set_id_t index);
315 324
316/* API for iptables set match, and SET target */325/* API for iptables set match, and SET target */
326
317extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb,327extern 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);
319extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb,329extern 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);
321extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb,331extern 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/* Utility functions */334/* Utility functions */
325extern void * ip_set_alloc(size_t size);335extern void * ip_set_alloc(size_t size);
include/linux/netfilter/ipset/ip_set_ahash.h+1−1
@@ -586,7 +586,7 @@ nla_put_failure: · 585 unmodified lines
586 586
587static int587static int
588type_pf_kadt(struct ip_set *set, const struct sk_buff * skb,588type_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);
590static int590static int
591type_pf_uadt(struct ip_set *set, struct nlattr *tb[],591type_pf_uadt(struct ip_set *set, struct nlattr *tb[],
592 enum ipset_adt adt, u32 *lineno, u32 flags);592 enum ipset_adt adt, u32 *lineno, u32 flags);
include/linux/netfilter/ipset/ip_set_timeout.h+3−0
@@ -22,6 +22,9 @@ · 21 unmodified lines
22 22
23#define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT)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
25static inline unsigned int28static inline unsigned int
26ip_set_timeout_uget(struct nlattr *tb)29ip_set_timeout_uget(struct nlattr *tb)
27{30{
include/linux/netfilter/xt_set.h+12−3
@@ -35,7 +35,7 @@ struct xt_set_info_target_v0 { · 34 unmodified lines
35 struct xt_set_info_v0 del_set;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
40struct xt_set_info {40struct xt_set_info {
41 ip_set_id_t index;41 ip_set_id_t index;
@@ -44,13 +44,22 @@ struct xt_set_info { · 2 unmodified lines
44};44};
45 45
46/* match and target infos */46/* match and target infos */
47struct xt_set_info_match {47struct xt_set_info_match_v1 {
48 struct xt_set_info match_set;48 struct xt_set_info match_set;
49};49};
50 50
51struct xt_set_info_target {51struct xt_set_info_target_v1 {
52 struct xt_set_info add_set;52 struct xt_set_info add_set;
53 struct xt_set_info del_set;53 struct xt_set_info del_set;
54};54};
55 55
56/* Revision 2 target */
57
58struct 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#endif /*_XT_SET_H*/65#endif /*_XT_SET_H*/
net/netfilter/ipset/ip_set_bitmap_ip.c+3−3
@@ -219,19 +219,19 @@ nla_put_failure: · 218 unmodified lines
219 219
220static int220static int
221bitmap_ip_kadt(struct ip_set *set, const struct sk_buff *skb,221bitmap_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 struct bitmap_ip *map = set->data;224 struct bitmap_ip *map = set->data;
225 ipset_adtfn adtfn = set->variant->adt[adt];225 ipset_adtfn adtfn = set->variant->adt[adt];
226 u32 ip;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 if (ip < map->first_ip || ip > map->last_ip)229 if (ip < map->first_ip || ip > map->last_ip)
230 return -IPSET_ERR_BITMAP_RANGE;230 return -IPSET_ERR_BITMAP_RANGE;
231 231
232 ip = ip_to_id(map, ip);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
237static int237static int
net/netfilter/ipset/ip_set_bitmap_ipmac.c+4−4
@@ -338,17 +338,17 @@ nla_put_failure: · 337 unmodified lines
338 338
339static int339static int
340bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb,340bitmap_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 struct bitmap_ipmac *map = set->data;343 struct bitmap_ipmac *map = set->data;
344 ipset_adtfn adtfn = set->variant->adt[adt];344 ipset_adtfn adtfn = set->variant->adt[adt];
345 struct ipmac data;345 struct ipmac data;
346 346
347 /* MAC can be src only */347 /* MAC can be src only */
348 if (!(flags & IPSET_DIM_TWO_SRC))348 if (!(opt->flags & IPSET_DIM_TWO_SRC))
349 return 0;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 if (data.id < map->first_ip || data.id > map->last_ip)352 if (data.id < map->first_ip || data.id > map->last_ip)
353 return -IPSET_ERR_BITMAP_RANGE;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 data.id -= map->first_ip;360 data.id -= map->first_ip;
361 data.ether = eth_hdr(skb)->h_source;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
366static int366static int
net/netfilter/ipset/ip_set_bitmap_port.c+4−3
@@ -208,14 +208,15 @@ nla_put_failure: · 207 unmodified lines
208 208
209static int209static int
210bitmap_port_kadt(struct ip_set *set, const struct sk_buff *skb,210bitmap_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 struct bitmap_port *map = set->data;213 struct bitmap_port *map = set->data;
214 ipset_adtfn adtfn = set->variant->adt[adt];214 ipset_adtfn adtfn = set->variant->adt[adt];
215 __be16 __port;215 __be16 __port;
216 u16 port = 0;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 return -EINVAL;220 return -EINVAL;
220 221
221 port = ntohs(__port);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 port -= map->first_port;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
231static int232static int
net/netfilter/ipset/ip_set_core.c+13−13
@@ -325,7 +325,7 @@ __ip_set_put(ip_set_id_t index) · 324 unmodified lines
325 325
326int326int
327ip_set_test(ip_set_id_t index, const struct sk_buff *skb,327ip_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 struct ip_set *set = ip_set_list[index];330 struct ip_set *set = ip_set_list[index];
331 int ret = 0;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 BUG_ON(set == NULL);333 BUG_ON(set == NULL);
334 pr_debug("set %s, index %u\n", set->name, index);334 pr_debug("set %s, index %u\n", set->name, index);
335 335
336 if (dim < set->type->dimension ||336 if (opt->dim < set->type->dimension ||
337 !(family == set->family || set->family == AF_UNSPEC))337 !(opt->family == set->family || set->family == AF_UNSPEC))
338 return 0;338 return 0;
339 339
340 read_lock_bh(&set->lock);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 read_unlock_bh(&set->lock);342 read_unlock_bh(&set->lock);
343 343
344 if (ret == -EAGAIN) {344 if (ret == -EAGAIN) {
345 /* Type requests element to be completed */345 /* Type requests element to be completed */
346 pr_debug("element must be competed, ADD is triggered\n");346 pr_debug("element must be competed, ADD is triggered\n");
347 write_lock_bh(&set->lock);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 write_unlock_bh(&set->lock);349 write_unlock_bh(&set->lock);
350 ret = 1;350 ret = 1;
351 }351 }
@@ -357,7 +357,7 @@ EXPORT_SYMBOL_GPL(ip_set_test); · 5 unmodified lines
357 357
358int358int
359ip_set_add(ip_set_id_t index, const struct sk_buff *skb,359ip_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 struct ip_set *set = ip_set_list[index];362 struct ip_set *set = ip_set_list[index];
363 int ret;363 int ret;
@@ -365,12 +365,12 @@ ip_set_add(ip_set_id_t index, const struct sk_buff *skb, · 1 unmodified line
365 BUG_ON(set == NULL);365 BUG_ON(set == NULL);
366 pr_debug("set %s, index %u\n", set->name, index);366 pr_debug("set %s, index %u\n", set->name, index);
367 367
368 if (dim < set->type->dimension ||368 if (opt->dim < set->type->dimension ||
369 !(family == set->family || set->family == AF_UNSPEC))369 !(opt->family == set->family || set->family == AF_UNSPEC))
370 return 0;370 return 0;
371 371
372 write_lock_bh(&set->lock);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 write_unlock_bh(&set->lock);374 write_unlock_bh(&set->lock);
375 375
376 return ret;376 return ret;
@@ -379,7 +379,7 @@ EXPORT_SYMBOL_GPL(ip_set_add); · 2 unmodified lines
379 379
380int380int
381ip_set_del(ip_set_id_t index, const struct sk_buff *skb,381ip_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 struct ip_set *set = ip_set_list[index];384 struct ip_set *set = ip_set_list[index];
385 int ret = 0;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 BUG_ON(set == NULL);387 BUG_ON(set == NULL);
388 pr_debug("set %s, index %u\n", set->name, index);388 pr_debug("set %s, index %u\n", set->name, index);
389 389
390 if (dim < set->type->dimension ||390 if (opt->dim < set->type->dimension ||
391 !(family == set->family || set->family == AF_UNSPEC))391 !(opt->family == set->family || set->family == AF_UNSPEC))
392 return 0;392 return 0;
393 393
394 write_lock_bh(&set->lock);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 write_unlock_bh(&set->lock);396 write_unlock_bh(&set->lock);
397 397
398 return ret;398 return ret;
net/netfilter/ipset/ip_set_hash_ip.c+6−6
@@ -110,18 +110,18 @@ nla_put_failure: · 109 unmodified lines
110 110
111static int111static int
112hash_ip4_kadt(struct ip_set *set, const struct sk_buff *skb,112hash_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 const struct ip_set_hash *h = set->data;115 const struct ip_set_hash *h = set->data;
116 ipset_adtfn adtfn = set->variant->adt[adt];116 ipset_adtfn adtfn = set->variant->adt[adt];
117 __be32 ip;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 ip &= ip_set_netmask(h->netmask);120 ip &= ip_set_netmask(h->netmask);
121 if (ip == 0)121 if (ip == 0)
122 return -EINVAL;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
127static int127static int
@@ -283,18 +283,18 @@ nla_put_failure: · 155 unmodified lines
283 283
284static int284static int
285hash_ip6_kadt(struct ip_set *set, const struct sk_buff *skb,285hash_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 const struct ip_set_hash *h = set->data;288 const struct ip_set_hash *h = set->data;
289 ipset_adtfn adtfn = set->variant->adt[adt];289 ipset_adtfn adtfn = set->variant->adt[adt];
290 union nf_inet_addr ip;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 ip6_netmask(&ip, h->netmask);293 ip6_netmask(&ip, h->netmask);
294 if (ipv6_addr_any(&ip.in6))294 if (ipv6_addr_any(&ip.in6))
295 return -EINVAL;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
300static const struct nla_policy hash_ip6_adt_policy[IPSET_ATTR_ADT_MAX + 1] = {300static const struct nla_policy hash_ip6_adt_policy[IPSET_ATTR_ADT_MAX + 1] = {
net/netfilter/ipset/ip_set_hash_ipport.c+8−8
@@ -126,19 +126,19 @@ nla_put_failure: · 125 unmodified lines
126 126
127static int127static int
128hash_ipport4_kadt(struct ip_set *set, const struct sk_buff *skb,128hash_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 const struct ip_set_hash *h = set->data;131 const struct ip_set_hash *h = set->data;
132 ipset_adtfn adtfn = set->variant->adt[adt];132 ipset_adtfn adtfn = set->variant->adt[adt];
133 struct hash_ipport4_elem data = { };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 &data.port, &data.proto))136 &data.port, &data.proto))
137 return -EINVAL;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
144static int144static int
@@ -330,19 +330,19 @@ nla_put_failure: · 185 unmodified lines
330 330
331static int331static int
332hash_ipport6_kadt(struct ip_set *set, const struct sk_buff *skb,332hash_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 const struct ip_set_hash *h = set->data;335 const struct ip_set_hash *h = set->data;
336 ipset_adtfn adtfn = set->variant->adt[adt];336 ipset_adtfn adtfn = set->variant->adt[adt];
337 struct hash_ipport6_elem data = { };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 &data.port, &data.proto))340 &data.port, &data.proto))
341 return -EINVAL;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
348static int348static int
net/netfilter/ipset/ip_set_hash_ipportip.c+10−10
@@ -129,20 +129,20 @@ nla_put_failure: · 128 unmodified lines
129 129
130static int130static int
131hash_ipportip4_kadt(struct ip_set *set, const struct sk_buff *skb,131hash_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 const struct ip_set_hash *h = set->data;134 const struct ip_set_hash *h = set->data;
135 ipset_adtfn adtfn = set->variant->adt[adt];135 ipset_adtfn adtfn = set->variant->adt[adt];
136 struct hash_ipportip4_elem data = { };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 &data.port, &data.proto))139 &data.port, &data.proto))
140 return -EINVAL;140 return -EINVAL;
141 141
142 ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip);142 ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip);
143 ip4addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2);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
148static int148static int
@@ -343,20 +343,20 @@ nla_put_failure: · 194 unmodified lines
343 343
344static int344static int
345hash_ipportip6_kadt(struct ip_set *set, const struct sk_buff *skb,345hash_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 const struct ip_set_hash *h = set->data;348 const struct ip_set_hash *h = set->data;
349 ipset_adtfn adtfn = set->variant->adt[adt];349 ipset_adtfn adtfn = set->variant->adt[adt];
350 struct hash_ipportip6_elem data = { };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 &data.port, &data.proto))353 &data.port, &data.proto))
354 return -EINVAL;354 return -EINVAL;
355 355
356 ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6);356 ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip.in6);
357 ip6addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2.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
362static int362static int
net/netfilter/ipset/ip_set_hash_ipportnet.c+10−10
@@ -142,7 +142,7 @@ nla_put_failure: · 141 unmodified lines
142 142
143static int143static int
144hash_ipportnet4_kadt(struct ip_set *set, const struct sk_buff *skb,144hash_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 const struct ip_set_hash *h = set->data;147 const struct ip_set_hash *h = set->data;
148 ipset_adtfn adtfn = set->variant->adt[adt];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 if (adt == IPSET_TEST)154 if (adt == IPSET_TEST)
155 data.cidr = HOST_MASK;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 &data.port, &data.proto))158 &data.port, &data.proto))
159 return -EINVAL;159 return -EINVAL;
160 160
161 ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip);161 ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip);
162 ip4addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2);162 ip4addrptr(skb, opt->flags & IPSET_DIM_THREE_SRC, &data.ip2);
163 data.ip2 &= ip_set_netmask(data.cidr);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
168static int168static int
@@ -390,7 +390,7 @@ nla_put_failure: · 221 unmodified lines
390 390
391static int391static int
392hash_ipportnet6_kadt(struct ip_set *set, const struct sk_buff *skb,392hash_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 const struct ip_set_hash *h = set->data;395 const struct ip_set_hash *h = set->data;
396 ipset_adtfn adtfn = set->variant->adt[adt];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 if (adt == IPSET_TEST)402 if (adt == IPSET_TEST)
403 data.cidr = HOST_MASK;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 &data.port, &data.proto))406 &data.port, &data.proto))
407 return -EINVAL;407 return -EINVAL;
408 408
409 ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6);409 ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip.in6);
410 ip6addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2.in6);410 ip6addrptr(skb, opt->flags & IPSET_DIM_THREE_SRC, &data.ip2.in6);
411 ip6_netmask(&data.ip2, data.cidr);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
416static int416static int
net/netfilter/ipset/ip_set_hash_net.c+6−6
@@ -127,7 +127,7 @@ nla_put_failure: · 126 unmodified lines
127 127
128static int128static int
129hash_net4_kadt(struct ip_set *set, const struct sk_buff *skb,129hash_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 const struct ip_set_hash *h = set->data;132 const struct ip_set_hash *h = set->data;
133 ipset_adtfn adtfn = set->variant->adt[adt];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 if (adt == IPSET_TEST)138 if (adt == IPSET_TEST)
139 data.cidr = HOST_MASK;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 data.ip &= ip_set_netmask(data.cidr);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
147static int147static int
@@ -292,7 +292,7 @@ nla_put_failure: · 144 unmodified lines
292 292
293static int293static int
294hash_net6_kadt(struct ip_set *set, const struct sk_buff *skb,294hash_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 const struct ip_set_hash *h = set->data;297 const struct ip_set_hash *h = set->data;
298 ipset_adtfn adtfn = set->variant->adt[adt];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 if (adt == IPSET_TEST)303 if (adt == IPSET_TEST)
304 data.cidr = HOST_MASK;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 ip6_netmask(&data.ip, data.cidr);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
312static int312static int
net/netfilter/ipset/ip_set_hash_netport.c+8−8
@@ -139,7 +139,7 @@ nla_put_failure: · 138 unmodified lines
139 139
140static int140static int
141hash_netport4_kadt(struct ip_set *set, const struct sk_buff *skb,141hash_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 const struct ip_set_hash *h = set->data;144 const struct ip_set_hash *h = set->data;
145 ipset_adtfn adtfn = set->variant->adt[adt];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 if (adt == IPSET_TEST)151 if (adt == IPSET_TEST)
152 data.cidr = HOST_MASK;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 &data.port, &data.proto))155 &data.port, &data.proto))
156 return -EINVAL;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 data.ip &= ip_set_netmask(data.cidr);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
164static int164static int
@@ -352,7 +352,7 @@ nla_put_failure: · 187 unmodified lines
352 352
353static int353static int
354hash_netport6_kadt(struct ip_set *set, const struct sk_buff *skb,354hash_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 const struct ip_set_hash *h = set->data;357 const struct ip_set_hash *h = set->data;
358 ipset_adtfn adtfn = set->variant->adt[adt];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 if (adt == IPSET_TEST)364 if (adt == IPSET_TEST)
365 data.cidr = HOST_MASK;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 &data.port, &data.proto))368 &data.port, &data.proto))
369 return -EINVAL;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 ip6_netmask(&data.ip, data.cidr);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
377static int377static int
net/netfilter/ipset/ip_set_list_set.c+4−4
@@ -72,7 +72,7 @@ list_set_expired(const struct list_set *map, u32 id) · 71 unmodified lines
72 72
73static int73static int
74list_set_kadt(struct ip_set *set, const struct sk_buff *skb,74list_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 struct list_set *map = set->data;77 struct list_set *map = set->data;
78 struct set_elem *elem;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 continue;87 continue;
88 switch (adt) {88 switch (adt) {
89 case IPSET_TEST: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 if (ret > 0)91 if (ret > 0)
92 return ret;92 return ret;
93 break;93 break;
94 case IPSET_ADD: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 if (ret == 0)96 if (ret == 0)
97 return ret;97 return ret;
98 break;98 break;
99 case IPSET_DEL: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 if (ret == 0)101 if (ret == 0)
102 return ret;102 return ret;
103 break;103 break;
net/netfilter/xt_set.c+100−51
@@ -29,23 +29,32 @@ MODULE_ALIAS("ip6t_SET"); · 28 unmodified lines
29 29
30static inline int30static inline int
31match_set(ip_set_id_t index, const struct sk_buff *skb,31match_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 inv = !inv;35 inv = !inv;
36 return inv;36 return inv;
37}37}
38 38
39#define ADT_OPT(n, f, d, fs, cfs, t) \
40const struct ip_set_adt_opt n = { \
41 .family = f, \
42 .dim = d, \
43 .flags = fs, \
44 .cmdflags = cfs, \
45 .timeout = t, \
46}
47
39/* Revision 0 interface: backward compatible with netfilter/iptables */48/* Revision 0 interface: backward compatible with netfilter/iptables */
40 49
41static bool50static bool
42set_match_v0(const struct sk_buff *skb, struct xt_action_param *par)51set_match_v0(const struct sk_buff *skb, struct xt_action_param *par)
43{52{
44 const struct xt_set_info_match_v0 *info = par->matchinfo;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,57 return match_set(info->match_set.index, skb, &opt,
47 info->match_set.u.compat.dim,
48 info->match_set.u.compat.flags,
49 info->match_set.u.compat.flags & IPSET_INV_MATCH);58 info->match_set.u.compat.flags & IPSET_INV_MATCH);
50}59}
51 60
@@ -103,15 +112,15 @@ static unsigned int · 51 unmodified lines
103set_target_v0(struct sk_buff *skb, const struct xt_action_param *par)112set_target_v0(struct sk_buff *skb, const struct xt_action_param *par)
104{113{
105 const struct xt_set_info_target_v0 *info = par->targinfo;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 if (info->add_set.index != IPSET_INVALID_ID)120 if (info->add_set.index != IPSET_INVALID_ID)
108 ip_set_add(info->add_set.index, skb, par->family,121 ip_set_add(info->add_set.index, skb, &add_opt);
109 info->add_set.u.compat.dim,
110 info->add_set.u.compat.flags);
111 if (info->del_set.index != IPSET_INVALID_ID)122 if (info->del_set.index != IPSET_INVALID_ID)
112 ip_set_del(info->del_set.index, skb, par->family,123 ip_set_del(info->del_set.index, skb, &del_opt);
113 info->del_set.u.compat.dim,
114 info->del_set.u.compat.flags);
115 124
116 return XT_CONTINUE;125 return XT_CONTINUE;
117}126}
@@ -170,23 +179,23 @@ set_target_v0_destroy(const struct xt_tgdtor_param *par) · 52 unmodified lines
170 ip_set_nfnl_put(info->del_set.index);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
175static bool184static bool
176set_match(const struct sk_buff *skb, struct xt_action_param *par)185set_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,191 return match_set(info->match_set.index, skb, &opt,
181 info->match_set.dim,
182 info->match_set.flags,
183 info->match_set.flags & IPSET_INV_MATCH);192 info->match_set.flags & IPSET_INV_MATCH);
184}193}
185 194
186static int195static int
187set_match_checkentry(const struct xt_mtchk_param *par)196set_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 ip_set_id_t index;199 ip_set_id_t index;
191 200
192 index = ip_set_nfnl_get_byindex(info->match_set.index);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
209static void218static void
210set_match_destroy(const struct xt_mtdtor_param *par)219set_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 ip_set_nfnl_put(info->match_set.index);223 ip_set_nfnl_put(info->match_set.index);
215}224}
216 225
217static unsigned int226static unsigned int
218set_target(struct sk_buff *skb, const struct xt_action_param *par)227set_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 if (info->add_set.index != IPSET_INVALID_ID)235 if (info->add_set.index != IPSET_INVALID_ID)
223 ip_set_add(info->add_set.index,236 ip_set_add(info->add_set.index, skb, &add_opt);
224 skb, par->family,
225 info->add_set.dim,
226 info->add_set.flags);
227 if (info->del_set.index != IPSET_INVALID_ID)237 if (info->del_set.index != IPSET_INVALID_ID)
228 ip_set_del(info->del_set.index,238 ip_set_del(info->del_set.index, skb, &del_opt);
229 skb, par->family,
230 info->del_set.dim,
231 info->del_set.flags);
232 239
233 return XT_CONTINUE;240 return XT_CONTINUE;
234}241}
235 242
236static int243static int
237set_target_checkentry(const struct xt_tgchk_param *par)244set_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 ip_set_id_t index;247 ip_set_id_t index;
241 248
242 if (info->add_set.index != IPSET_INVALID_ID) {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
275static void282static void
276set_target_destroy(const struct xt_tgdtor_param *par)283set_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 if (info->add_set.index != IPSET_INVALID_ID)287 if (info->add_set.index != IPSET_INVALID_ID)
281 ip_set_nfnl_put(info->add_set.index);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 ip_set_nfnl_put(info->del_set.index);290 ip_set_nfnl_put(info->del_set.index);
284}291}
285 292
293/* Revision 2 target */
294
295static unsigned int
296set_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
286static struct xt_match set_matches[] __read_mostly = {315static struct xt_match set_matches[] __read_mostly = {
287 {316 {
288 .name = "set",317 .name = "set",
@@ -298,20 +327,20 @@ static struct xt_match set_matches[] __read_mostly = { · 9 unmodified lines
298 .name = "set",327 .name = "set",
299 .family = NFPROTO_IPV4,328 .family = NFPROTO_IPV4,
300 .revision = 1,329 .revision = 1,
301 .match = set_match,330 .match = set_match_v1,
302 .matchsize = sizeof(struct xt_set_info_match),331 .matchsize = sizeof(struct xt_set_info_match_v1),
303 .checkentry = set_match_checkentry,332 .checkentry = set_match_v1_checkentry,
304 .destroy = set_match_destroy,333 .destroy = set_match_v1_destroy,
305 .me = THIS_MODULE334 .me = THIS_MODULE
306 },335 },
307 {336 {
308 .name = "set",337 .name = "set",
309 .family = NFPROTO_IPV6,338 .family = NFPROTO_IPV6,
310 .revision = 1,339 .revision = 1,
311 .match = set_match,340 .match = set_match_v1,
312 .matchsize = sizeof(struct xt_set_info_match),341 .matchsize = sizeof(struct xt_set_info_match_v1),
313 .checkentry = set_match_checkentry,342 .checkentry = set_match_v1_checkentry,
314 .destroy = set_match_destroy,343 .destroy = set_match_v1_destroy,
315 .me = THIS_MODULE344 .me = THIS_MODULE
316 },345 },
317};346};
@@ -331,20 +360,40 @@ static struct xt_target set_targets[] __read_mostly = { · 13 unmodified lines
331 .name = "SET",360 .name = "SET",
332 .revision = 1,361 .revision = 1,
333 .family = NFPROTO_IPV4,362 .family = NFPROTO_IPV4,
334 .target = set_target,363 .target = set_target_v1,
335 .targetsize = sizeof(struct xt_set_info_target),364 .targetsize = sizeof(struct xt_set_info_target_v1),
336 .checkentry = set_target_checkentry,365 .checkentry = set_target_v1_checkentry,
337 .destroy = set_target_destroy,366 .destroy = set_target_v1_destroy,
338 .me = THIS_MODULE367 .me = THIS_MODULE
339 },368 },
340 {369 {
341 .name = "SET",370 .name = "SET",
342 .revision = 1,371 .revision = 1,
343 .family = NFPROTO_IPV6,372 .family = NFPROTO_IPV6,
344 .target = set_target,373 .target = set_target_v1,
345 .targetsize = sizeof(struct xt_set_info_target),374 .targetsize = sizeof(struct xt_set_info_target_v1),
346 .checkentry = set_target_checkentry,375 .checkentry = set_target_v1_checkentry,
347 .destroy = set_target_destroy,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 .me = THIS_MODULE397 .me = THIS_MODULE
349 },398 },
350};399};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t