The support makes possible to specify the timeout value for the SET target and a flag to reset the timeout for already existing entries.
Showing the changes to include/linux/netfilter (4 of 16 files). Show all
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*/ |