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

Showing the changes to include/linux/netfilter (4 of 16 files). Show all

Unified · Split

4 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
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*/

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