]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
netfilter: nf_tables: constify chain type definitions and pointers
authorPatrick McHardy <kaber@trash.net>
Thu, 9 Jan 2014 18:42:37 +0000 (18:42 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 9 Jan 2014 19:17:15 +0000 (20:17 +0100)
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables.h
net/bridge/netfilter/nf_tables_bridge.c
net/ipv4/netfilter/nf_tables_arp.c
net/ipv4/netfilter/nf_tables_ipv4.c
net/ipv4/netfilter/nft_chain_nat_ipv4.c
net/ipv4/netfilter/nft_chain_route_ipv4.c
net/ipv6/netfilter/nf_tables_ipv6.c
net/ipv6/netfilter/nft_chain_nat_ipv6.c
net/ipv6/netfilter/nft_chain_route_ipv6.c
net/netfilter/nf_tables_api.c
net/netfilter/nf_tables_inet.c

index e9b97862bf529087a6eaf4b14b7f16f8861742bf..d3f70530a59a3975d9b9fa4ce9bafa6e6523f5b1 100644 (file)
@@ -436,7 +436,7 @@ struct nft_stats {
  */
 struct nft_base_chain {
        struct nf_hook_ops              ops[NFT_HOOK_OPS_MAX];
-       struct nf_chain_type            *type;
+       const struct nf_chain_type      *type;
        u8                              policy;
        struct nft_stats __percpu       *stats;
        struct nft_chain                chain;
@@ -507,8 +507,8 @@ struct nf_chain_type {
        int                     family;
 };
 
-int nft_register_chain_type(struct nf_chain_type *);
-void nft_unregister_chain_type(struct nf_chain_type *);
+int nft_register_chain_type(const struct nf_chain_type *);
+void nft_unregister_chain_type(const struct nf_chain_type *);
 
 int nft_register_expr(struct nft_expr_type *);
 void nft_unregister_expr(struct nft_expr_type *);
index f97222eb8235425338d205ad2d84e2cebcbcfdae..283658d21825197d4bfefe94f0aca46cf6c5ebd1 100644 (file)
@@ -68,7 +68,7 @@ static struct pernet_operations nf_tables_bridge_net_ops = {
        .exit   = nf_tables_bridge_exit_net,
 };
 
-static struct nf_chain_type filter_bridge = {
+static const struct nf_chain_type filter_bridge = {
        .family         = NFPROTO_BRIDGE,
        .name           = "filter",
        .type           = NFT_CHAIN_T_DEFAULT,
index 228df003f3cc5f7c2e5ef1c1a8c80aa5a409afb9..8af01a5e8f98a79127d80ab3b92e0773f5bb94bc 100644 (file)
@@ -68,7 +68,7 @@ static struct pernet_operations nf_tables_arp_net_ops = {
        .exit   = nf_tables_arp_exit_net,
 };
 
-static struct nf_chain_type filter_arp = {
+static const struct nf_chain_type filter_arp = {
        .family         = NFPROTO_ARP,
        .name           = "filter",
        .type           = NFT_CHAIN_T_DEFAULT,
index d6fc1b4ace4ebcd957912d1a74cabf8452bff48b..cec7805de3e378e49eb0769a73a3fe6f12d54dcb 100644 (file)
@@ -91,7 +91,7 @@ static struct pernet_operations nf_tables_ipv4_net_ops = {
        .exit   = nf_tables_ipv4_exit_net,
 };
 
-static struct nf_chain_type filter_ipv4 = {
+static const struct nf_chain_type filter_ipv4 = {
        .family         = NFPROTO_IPV4,
        .name           = "filter",
        .type           = NFT_CHAIN_T_DEFAULT,
index cf2c792cd971cc757fb3986c0956c0841922d385..9e535c2c2cd213352e396111235ac51026c5a146 100644 (file)
@@ -164,7 +164,7 @@ static unsigned int nf_nat_output(const struct nf_hook_ops *ops,
        return ret;
 }
 
-static struct nf_chain_type nft_chain_nat_ipv4 = {
+static const struct nf_chain_type nft_chain_nat_ipv4 = {
        .family         = NFPROTO_IPV4,
        .name           = "nat",
        .type           = NFT_CHAIN_T_NAT,
index 4e6bf9a3d7aa21a603f6c93f5a3136a623f5ec7f..2dd2eeaad15f7749191597a90751c0f6b324c0a1 100644 (file)
@@ -61,7 +61,7 @@ static unsigned int nf_route_table_hook(const struct nf_hook_ops *ops,
        return ret;
 }
 
-static struct nf_chain_type nft_chain_route_ipv4 = {
+static const struct nf_chain_type nft_chain_route_ipv4 = {
        .family         = NFPROTO_IPV4,
        .name           = "route",
        .type           = NFT_CHAIN_T_ROUTE,
index a34027687ecd647e06abad220ac0947fbc9ebb42..758a32b0e2ff692e1ba62f369f594449a3bf026a 100644 (file)
@@ -90,7 +90,7 @@ static struct pernet_operations nf_tables_ipv6_net_ops = {
        .exit   = nf_tables_ipv6_exit_net,
 };
 
-static struct nf_chain_type filter_ipv6 = {
+static const struct nf_chain_type filter_ipv6 = {
        .family         = NFPROTO_IPV6,
        .name           = "filter",
        .type           = NFT_CHAIN_T_DEFAULT,
index e86dcd70dc767fb9a64d5155ff60ecd17b17e2d8..efd1d57a610a49fa48192cc21a4492f1673cdd50 100644 (file)
@@ -170,7 +170,7 @@ static unsigned int nf_nat_ipv6_output(const struct nf_hook_ops *ops,
        return ret;
 }
 
-static struct nf_chain_type nft_chain_nat_ipv6 = {
+static const struct nf_chain_type nft_chain_nat_ipv6 = {
        .family         = NFPROTO_IPV6,
        .name           = "nat",
        .type           = NFT_CHAIN_T_NAT,
index 3fe40f0456add7bd0272b25a6df05a4d34752632..3620f8851eba1e1be0b3f57d33214072dc23fb90 100644 (file)
@@ -59,7 +59,7 @@ static unsigned int nf_route_table_hook(const struct nf_hook_ops *ops,
        return ret;
 }
 
-static struct nf_chain_type nft_chain_route_ipv6 = {
+static const struct nf_chain_type nft_chain_route_ipv6 = {
        .family         = NFPROTO_IPV6,
        .name           = "route",
        .type           = NFT_CHAIN_T_ROUTE,
index 7d6a2264ae0aa8fea78a2e2e88ef6e9c7373586d..acdd9d68d52f80be372b79d64caefec00370fb27 100644 (file)
@@ -124,9 +124,9 @@ static inline u64 nf_tables_alloc_handle(struct nft_table *table)
        return ++table->hgenerator;
 }
 
-static struct nf_chain_type *chain_type[AF_MAX][NFT_CHAIN_T_MAX];
+static const struct nf_chain_type *chain_type[AF_MAX][NFT_CHAIN_T_MAX];
 
-static struct nf_chain_type *
+static const struct nf_chain_type *
 __nf_tables_chain_type_lookup(int family, const struct nlattr *nla)
 {
        int i;
@@ -139,12 +139,12 @@ __nf_tables_chain_type_lookup(int family, const struct nlattr *nla)
        return NULL;
 }
 
-static struct nf_chain_type *
+static const struct nf_chain_type *
 nf_tables_chain_type_lookup(const struct nft_af_info *afi,
                            const struct nlattr *nla,
                            bool autoload)
 {
-       struct nf_chain_type *type;
+       const struct nf_chain_type *type;
 
        type = __nf_tables_chain_type_lookup(afi->family, nla);
        if (type != NULL)
@@ -475,7 +475,7 @@ static int nf_tables_deltable(struct sock *nlsk, struct sk_buff *skb,
        return 0;
 }
 
-int nft_register_chain_type(struct nf_chain_type *ctype)
+int nft_register_chain_type(const struct nf_chain_type *ctype)
 {
        int err = 0;
 
@@ -491,7 +491,7 @@ out:
 }
 EXPORT_SYMBOL_GPL(nft_register_chain_type);
 
-void nft_unregister_chain_type(struct nf_chain_type *ctype)
+void nft_unregister_chain_type(const struct nf_chain_type *ctype)
 {
        nfnl_lock(NFNL_SUBSYS_NFTABLES);
        chain_type[ctype->family][ctype->type] = NULL;
@@ -900,7 +900,7 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb,
                return -EOVERFLOW;
 
        if (nla[NFTA_CHAIN_HOOK]) {
-               struct nf_chain_type *type;
+               const struct nf_chain_type *type;
                struct nf_hook_ops *ops;
                nf_hookfn *hookfn;
                u32 hooknum, priority;
index 280d3a2d5abc804d67ff37f07a5e10dcb56d9e27..ee29ba2829d015f3e4d14d640eb0ca588e482484 100644 (file)
@@ -66,7 +66,7 @@ static struct pernet_operations nf_tables_inet_net_ops = {
        .exit   = nf_tables_inet_exit_net,
 };
 
-static struct nf_chain_type filter_inet = {
+static const struct nf_chain_type filter_inet = {
        .family         = NFPROTO_INET,
        .name           = "filter",
        .type           = NFT_CHAIN_T_DEFAULT,