iproute2: update to 5.0.0
[openwrt/openwrt.git] / package / network / utils / iproute2 / patches / 135-sync-iptables-header.patch
1 Description: Sync header from iptables
2 The current versions in several suites have the same content:
3 - 1.6.1-2 (unstable)
4 Bug: https://bugs.debian.org/868059
5 Forwarded: not-needed
6 Author: Cyril Brulebois <cyril@debamax.com>
7 Last-Update: 2017-11-22
8 --- a/include/xtables.h
9 +++ b/include/xtables.h
10 @@ -206,9 +206,24 @@ enum xtables_ext_flags {
11 XTABLES_EXT_ALIAS = 1 << 0,
12 };
13
14 +struct xt_xlate;
15 +
16 +struct xt_xlate_mt_params {
17 + const void *ip;
18 + const struct xt_entry_match *match;
19 + int numeric;
20 + bool escape_quotes;
21 +};
22 +
23 +struct xt_xlate_tg_params {
24 + const void *ip;
25 + const struct xt_entry_target *target;
26 + int numeric;
27 + bool escape_quotes;
28 +};
29 +
30 /* Include file for additions: new matches and targets. */
31 -struct xtables_match
32 -{
33 +struct xtables_match {
34 /*
35 * ABI/API version this module requires. Must be first member,
36 * as the rest of this struct may be subject to ABI changes.
37 @@ -270,6 +285,10 @@ struct xtables_match
38 void (*x6_fcheck)(struct xt_fcheck_call *);
39 const struct xt_option_entry *x6_options;
40
41 + /* Translate iptables to nft */
42 + int (*xlate)(struct xt_xlate *xl,
43 + const struct xt_xlate_mt_params *params);
44 +
45 /* Size of per-extension instance extra "global" scratch space */
46 size_t udata_size;
47
48 @@ -281,8 +300,7 @@ struct xtables_match
49 unsigned int loaded; /* simulate loading so options are merged properly */
50 };
51
52 -struct xtables_target
53 -{
54 +struct xtables_target {
55 /*
56 * ABI/API version this module requires. Must be first member,
57 * as the rest of this struct may be subject to ABI changes.
58 @@ -347,6 +365,10 @@ struct xtables_target
59 void (*x6_fcheck)(struct xt_fcheck_call *);
60 const struct xt_option_entry *x6_options;
61
62 + /* Translate iptables to nft */
63 + int (*xlate)(struct xt_xlate *xl,
64 + const struct xt_xlate_tg_params *params);
65 +
66 size_t udata_size;
67
68 /* Ignore these men behind the curtain: */
69 @@ -407,6 +429,17 @@ struct xtables_globals
70
71 #define XT_GETOPT_TABLEEND {.name = NULL, .has_arg = false}
72
73 +/*
74 + * enum op-
75 + *
76 + * For writing clean nftables translations code
77 + */
78 +enum xt_op {
79 + XT_OP_EQ,
80 + XT_OP_NEQ,
81 + XT_OP_MAX,
82 +};
83 +
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87 @@ -549,6 +582,14 @@ extern void xtables_lmap_free(struct xta
88 extern int xtables_lmap_name2id(const struct xtables_lmap *, const char *);
89 extern const char *xtables_lmap_id2name(const struct xtables_lmap *, int);
90
91 +/* xlate infrastructure */
92 +struct xt_xlate *xt_xlate_alloc(int size);
93 +void xt_xlate_free(struct xt_xlate *xl);
94 +void xt_xlate_add(struct xt_xlate *xl, const char *fmt, ...);
95 +void xt_xlate_add_comment(struct xt_xlate *xl, const char *comment);
96 +const char *xt_xlate_get_comment(struct xt_xlate *xl);
97 +const char *xt_xlate_get(struct xt_xlate *xl);
98 +
99 #ifdef XTABLES_INTERNAL
100
101 /* Shipped modules rely on this... */