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
217217 typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
218218 u32 timeout, u32 flags);
219219
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+
220229 /* Set type, variant-specific part */
221230 struct ip_set_type_variant {
222231 /* Kernelspace: test/add/del entries
@@ -224,7 +233,7 @@ struct ip_set_type_variant { · 1 unmodified line
224233 * zero for no match/success to add/delete
225234 * positive for matching element */
226235 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);
228237
229238 /* Userspace: test/add/del entries
230239 * 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
314323 extern void ip_set_nfnl_put(ip_set_id_t index);
315324
316325 /* API for iptables set match, and SET target */
326+
317327 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);
319329 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);
321331 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);
323333
324334 /* Utility functions */
325335 extern 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
586586
587587 static int
588588 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);
590590 static int
591591 type_pf_uadt(struct ip_set *set, struct nlattr *tb[],
592592 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
2222
2323 #define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT)
2424
25+#define opt_timeout(opt, map) \
26+ (with_timeout((opt)->timeout) ? (opt)->timeout : (map)->timeout)
27+
2528 static inline unsigned int
2629 ip_set_timeout_uget(struct nlattr *tb)
2730 {
include/linux/netfilter/xt_set.h+12−3
@@ -35,7 +35,7 @@ struct xt_set_info_target_v0 { · 34 unmodified lines
3535 struct xt_set_info_v0 del_set;
3636 };
3737
38−/* Revision 1: current interface to netfilter/iptables */
38+/* Revision 1 match and target */
3939
4040 struct xt_set_info {
4141 ip_set_id_t index;
@@ -44,13 +44,22 @@ struct xt_set_info { · 2 unmodified lines
4444 };
4545
4646 /* match and target infos */
47−struct xt_set_info_match {
47+struct xt_set_info_match_v1 {
4848 struct xt_set_info match_set;
4949 };
5050
51−struct xt_set_info_target {
51+struct xt_set_info_target_v1 {
5252 struct xt_set_info add_set;
5353 struct xt_set_info del_set;
5454 };
5555
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+
5665 #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