diff options
author | Patrick McHardy <kaber@trash.net> | 2014-01-09 13:42:37 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-01-09 14:17:15 -0500 |
commit | 2a37d755b885995443f11cdcaf1f9d4b5f246eab (patch) | |
tree | 8ae3cefff2147663baae9336c555930260f335d8 | |
parent | 93b0806f006b8b3ecb7a6183fcad21e88f39904f (diff) |
netfilter: nf_tables: constify chain type definitions and pointers
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | include/net/netfilter/nf_tables.h | 6 | ||||
-rw-r--r-- | net/bridge/netfilter/nf_tables_bridge.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_tables_arp.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_tables_ipv4.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/nft_chain_nat_ipv4.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/nft_chain_route_ipv4.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_tables_ipv6.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/nft_chain_nat_ipv6.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/nft_chain_route_ipv6.c | 2 | ||||
-rw-r--r-- | net/netfilter/nf_tables_api.c | 14 | ||||
-rw-r--r-- | net/netfilter/nf_tables_inet.c | 2 |
11 files changed, 19 insertions, 19 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index e9b97862bf52..d3f70530a59a 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -436,7 +436,7 @@ struct nft_stats { | |||
436 | */ | 436 | */ |
437 | struct nft_base_chain { | 437 | struct nft_base_chain { |
438 | struct nf_hook_ops ops[NFT_HOOK_OPS_MAX]; | 438 | struct nf_hook_ops ops[NFT_HOOK_OPS_MAX]; |
439 | struct nf_chain_type *type; | 439 | const struct nf_chain_type *type; |
440 | u8 policy; | 440 | u8 policy; |
441 | struct nft_stats __percpu *stats; | 441 | struct nft_stats __percpu *stats; |
442 | struct nft_chain chain; | 442 | struct nft_chain chain; |
@@ -507,8 +507,8 @@ struct nf_chain_type { | |||
507 | int family; | 507 | int family; |
508 | }; | 508 | }; |
509 | 509 | ||
510 | int nft_register_chain_type(struct nf_chain_type *); | 510 | int nft_register_chain_type(const struct nf_chain_type *); |
511 | void nft_unregister_chain_type(struct nf_chain_type *); | 511 | void nft_unregister_chain_type(const struct nf_chain_type *); |
512 | 512 | ||
513 | int nft_register_expr(struct nft_expr_type *); | 513 | int nft_register_expr(struct nft_expr_type *); |
514 | void nft_unregister_expr(struct nft_expr_type *); | 514 | void nft_unregister_expr(struct nft_expr_type *); |
diff --git a/net/bridge/netfilter/nf_tables_bridge.c b/net/bridge/netfilter/nf_tables_bridge.c index f97222eb8235..283658d21825 100644 --- a/net/bridge/netfilter/nf_tables_bridge.c +++ b/net/bridge/netfilter/nf_tables_bridge.c | |||
@@ -68,7 +68,7 @@ static struct pernet_operations nf_tables_bridge_net_ops = { | |||
68 | .exit = nf_tables_bridge_exit_net, | 68 | .exit = nf_tables_bridge_exit_net, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static struct nf_chain_type filter_bridge = { | 71 | static const struct nf_chain_type filter_bridge = { |
72 | .family = NFPROTO_BRIDGE, | 72 | .family = NFPROTO_BRIDGE, |
73 | .name = "filter", | 73 | .name = "filter", |
74 | .type = NFT_CHAIN_T_DEFAULT, | 74 | .type = NFT_CHAIN_T_DEFAULT, |
diff --git a/net/ipv4/netfilter/nf_tables_arp.c b/net/ipv4/netfilter/nf_tables_arp.c index 228df003f3cc..8af01a5e8f98 100644 --- a/net/ipv4/netfilter/nf_tables_arp.c +++ b/net/ipv4/netfilter/nf_tables_arp.c | |||
@@ -68,7 +68,7 @@ static struct pernet_operations nf_tables_arp_net_ops = { | |||
68 | .exit = nf_tables_arp_exit_net, | 68 | .exit = nf_tables_arp_exit_net, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static struct nf_chain_type filter_arp = { | 71 | static const struct nf_chain_type filter_arp = { |
72 | .family = NFPROTO_ARP, | 72 | .family = NFPROTO_ARP, |
73 | .name = "filter", | 73 | .name = "filter", |
74 | .type = NFT_CHAIN_T_DEFAULT, | 74 | .type = NFT_CHAIN_T_DEFAULT, |
diff --git a/net/ipv4/netfilter/nf_tables_ipv4.c b/net/ipv4/netfilter/nf_tables_ipv4.c index d6fc1b4ace4e..cec7805de3e3 100644 --- a/net/ipv4/netfilter/nf_tables_ipv4.c +++ b/net/ipv4/netfilter/nf_tables_ipv4.c | |||
@@ -91,7 +91,7 @@ static struct pernet_operations nf_tables_ipv4_net_ops = { | |||
91 | .exit = nf_tables_ipv4_exit_net, | 91 | .exit = nf_tables_ipv4_exit_net, |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static struct nf_chain_type filter_ipv4 = { | 94 | static const struct nf_chain_type filter_ipv4 = { |
95 | .family = NFPROTO_IPV4, | 95 | .family = NFPROTO_IPV4, |
96 | .name = "filter", | 96 | .name = "filter", |
97 | .type = NFT_CHAIN_T_DEFAULT, | 97 | .type = NFT_CHAIN_T_DEFAULT, |
diff --git a/net/ipv4/netfilter/nft_chain_nat_ipv4.c b/net/ipv4/netfilter/nft_chain_nat_ipv4.c index cf2c792cd971..9e535c2c2cd2 100644 --- a/net/ipv4/netfilter/nft_chain_nat_ipv4.c +++ b/net/ipv4/netfilter/nft_chain_nat_ipv4.c | |||
@@ -164,7 +164,7 @@ static unsigned int nf_nat_output(const struct nf_hook_ops *ops, | |||
164 | return ret; | 164 | return ret; |
165 | } | 165 | } |
166 | 166 | ||
167 | static struct nf_chain_type nft_chain_nat_ipv4 = { | 167 | static const struct nf_chain_type nft_chain_nat_ipv4 = { |
168 | .family = NFPROTO_IPV4, | 168 | .family = NFPROTO_IPV4, |
169 | .name = "nat", | 169 | .name = "nat", |
170 | .type = NFT_CHAIN_T_NAT, | 170 | .type = NFT_CHAIN_T_NAT, |
diff --git a/net/ipv4/netfilter/nft_chain_route_ipv4.c b/net/ipv4/netfilter/nft_chain_route_ipv4.c index 4e6bf9a3d7aa..2dd2eeaad15f 100644 --- a/net/ipv4/netfilter/nft_chain_route_ipv4.c +++ b/net/ipv4/netfilter/nft_chain_route_ipv4.c | |||
@@ -61,7 +61,7 @@ static unsigned int nf_route_table_hook(const struct nf_hook_ops *ops, | |||
61 | return ret; | 61 | return ret; |
62 | } | 62 | } |
63 | 63 | ||
64 | static struct nf_chain_type nft_chain_route_ipv4 = { | 64 | static const struct nf_chain_type nft_chain_route_ipv4 = { |
65 | .family = NFPROTO_IPV4, | 65 | .family = NFPROTO_IPV4, |
66 | .name = "route", | 66 | .name = "route", |
67 | .type = NFT_CHAIN_T_ROUTE, | 67 | .type = NFT_CHAIN_T_ROUTE, |
diff --git a/net/ipv6/netfilter/nf_tables_ipv6.c b/net/ipv6/netfilter/nf_tables_ipv6.c index a34027687ecd..758a32b0e2ff 100644 --- a/net/ipv6/netfilter/nf_tables_ipv6.c +++ b/net/ipv6/netfilter/nf_tables_ipv6.c | |||
@@ -90,7 +90,7 @@ static struct pernet_operations nf_tables_ipv6_net_ops = { | |||
90 | .exit = nf_tables_ipv6_exit_net, | 90 | .exit = nf_tables_ipv6_exit_net, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static struct nf_chain_type filter_ipv6 = { | 93 | static const struct nf_chain_type filter_ipv6 = { |
94 | .family = NFPROTO_IPV6, | 94 | .family = NFPROTO_IPV6, |
95 | .name = "filter", | 95 | .name = "filter", |
96 | .type = NFT_CHAIN_T_DEFAULT, | 96 | .type = NFT_CHAIN_T_DEFAULT, |
diff --git a/net/ipv6/netfilter/nft_chain_nat_ipv6.c b/net/ipv6/netfilter/nft_chain_nat_ipv6.c index e86dcd70dc76..efd1d57a610a 100644 --- a/net/ipv6/netfilter/nft_chain_nat_ipv6.c +++ b/net/ipv6/netfilter/nft_chain_nat_ipv6.c | |||
@@ -170,7 +170,7 @@ static unsigned int nf_nat_ipv6_output(const struct nf_hook_ops *ops, | |||
170 | return ret; | 170 | return ret; |
171 | } | 171 | } |
172 | 172 | ||
173 | static struct nf_chain_type nft_chain_nat_ipv6 = { | 173 | static const struct nf_chain_type nft_chain_nat_ipv6 = { |
174 | .family = NFPROTO_IPV6, | 174 | .family = NFPROTO_IPV6, |
175 | .name = "nat", | 175 | .name = "nat", |
176 | .type = NFT_CHAIN_T_NAT, | 176 | .type = NFT_CHAIN_T_NAT, |
diff --git a/net/ipv6/netfilter/nft_chain_route_ipv6.c b/net/ipv6/netfilter/nft_chain_route_ipv6.c index 3fe40f0456ad..3620f8851eba 100644 --- a/net/ipv6/netfilter/nft_chain_route_ipv6.c +++ b/net/ipv6/netfilter/nft_chain_route_ipv6.c | |||
@@ -59,7 +59,7 @@ static unsigned int nf_route_table_hook(const struct nf_hook_ops *ops, | |||
59 | return ret; | 59 | return ret; |
60 | } | 60 | } |
61 | 61 | ||
62 | static struct nf_chain_type nft_chain_route_ipv6 = { | 62 | static const struct nf_chain_type nft_chain_route_ipv6 = { |
63 | .family = NFPROTO_IPV6, | 63 | .family = NFPROTO_IPV6, |
64 | .name = "route", | 64 | .name = "route", |
65 | .type = NFT_CHAIN_T_ROUTE, | 65 | .type = NFT_CHAIN_T_ROUTE, |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 7d6a2264ae0a..acdd9d68d52f 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -124,9 +124,9 @@ static inline u64 nf_tables_alloc_handle(struct nft_table *table) | |||
124 | return ++table->hgenerator; | 124 | return ++table->hgenerator; |
125 | } | 125 | } |
126 | 126 | ||
127 | static struct nf_chain_type *chain_type[AF_MAX][NFT_CHAIN_T_MAX]; | 127 | static const struct nf_chain_type *chain_type[AF_MAX][NFT_CHAIN_T_MAX]; |
128 | 128 | ||
129 | static struct nf_chain_type * | 129 | static const struct nf_chain_type * |
130 | __nf_tables_chain_type_lookup(int family, const struct nlattr *nla) | 130 | __nf_tables_chain_type_lookup(int family, const struct nlattr *nla) |
131 | { | 131 | { |
132 | int i; | 132 | int i; |
@@ -139,12 +139,12 @@ __nf_tables_chain_type_lookup(int family, const struct nlattr *nla) | |||
139 | return NULL; | 139 | return NULL; |
140 | } | 140 | } |
141 | 141 | ||
142 | static struct nf_chain_type * | 142 | static const struct nf_chain_type * |
143 | nf_tables_chain_type_lookup(const struct nft_af_info *afi, | 143 | nf_tables_chain_type_lookup(const struct nft_af_info *afi, |
144 | const struct nlattr *nla, | 144 | const struct nlattr *nla, |
145 | bool autoload) | 145 | bool autoload) |
146 | { | 146 | { |
147 | struct nf_chain_type *type; | 147 | const struct nf_chain_type *type; |
148 | 148 | ||
149 | type = __nf_tables_chain_type_lookup(afi->family, nla); | 149 | type = __nf_tables_chain_type_lookup(afi->family, nla); |
150 | if (type != NULL) | 150 | if (type != NULL) |
@@ -475,7 +475,7 @@ static int nf_tables_deltable(struct sock *nlsk, struct sk_buff *skb, | |||
475 | return 0; | 475 | return 0; |
476 | } | 476 | } |
477 | 477 | ||
478 | int nft_register_chain_type(struct nf_chain_type *ctype) | 478 | int nft_register_chain_type(const struct nf_chain_type *ctype) |
479 | { | 479 | { |
480 | int err = 0; | 480 | int err = 0; |
481 | 481 | ||
@@ -491,7 +491,7 @@ out: | |||
491 | } | 491 | } |
492 | EXPORT_SYMBOL_GPL(nft_register_chain_type); | 492 | EXPORT_SYMBOL_GPL(nft_register_chain_type); |
493 | 493 | ||
494 | void nft_unregister_chain_type(struct nf_chain_type *ctype) | 494 | void nft_unregister_chain_type(const struct nf_chain_type *ctype) |
495 | { | 495 | { |
496 | nfnl_lock(NFNL_SUBSYS_NFTABLES); | 496 | nfnl_lock(NFNL_SUBSYS_NFTABLES); |
497 | chain_type[ctype->family][ctype->type] = NULL; | 497 | chain_type[ctype->family][ctype->type] = NULL; |
@@ -900,7 +900,7 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, | |||
900 | return -EOVERFLOW; | 900 | return -EOVERFLOW; |
901 | 901 | ||
902 | if (nla[NFTA_CHAIN_HOOK]) { | 902 | if (nla[NFTA_CHAIN_HOOK]) { |
903 | struct nf_chain_type *type; | 903 | const struct nf_chain_type *type; |
904 | struct nf_hook_ops *ops; | 904 | struct nf_hook_ops *ops; |
905 | nf_hookfn *hookfn; | 905 | nf_hookfn *hookfn; |
906 | u32 hooknum, priority; | 906 | u32 hooknum, priority; |
diff --git a/net/netfilter/nf_tables_inet.c b/net/netfilter/nf_tables_inet.c index 280d3a2d5abc..ee29ba2829d0 100644 --- a/net/netfilter/nf_tables_inet.c +++ b/net/netfilter/nf_tables_inet.c | |||
@@ -66,7 +66,7 @@ static struct pernet_operations nf_tables_inet_net_ops = { | |||
66 | .exit = nf_tables_inet_exit_net, | 66 | .exit = nf_tables_inet_exit_net, |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static struct nf_chain_type filter_inet = { | 69 | static const struct nf_chain_type filter_inet = { |
70 | .family = NFPROTO_INET, | 70 | .family = NFPROTO_INET, |
71 | .name = "filter", | 71 | .name = "filter", |
72 | .type = NFT_CHAIN_T_DEFAULT, | 72 | .type = NFT_CHAIN_T_DEFAULT, |