[NETFILTER]: add some consts, remove some casts
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / netfilter / ipt_MASQUERADE.c
index d4f2d777533080e01dfa6f43de64588e349f1b32..846a0e7272184d11cb198e23f6185613f22d5946 100644 (file)
@@ -37,7 +37,7 @@ MODULE_DESCRIPTION("iptables MASQUERADE target module");
 static DEFINE_RWLOCK(masq_lock);
 
 /* FIXME: Multiple targets. --RR */
-static int
+static bool
 masquerade_check(const char *tablename,
                 const void *e,
                 const struct xt_target *target,
@@ -48,13 +48,13 @@ masquerade_check(const char *tablename,
 
        if (mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) {
                DEBUGP("masquerade_check: bad MAP_IPS.\n");
-               return 0;
+               return false;
        }
        if (mr->rangesize != 1) {
                DEBUGP("masquerade_check: bad rangesize %u.\n", mr->rangesize);
-               return 0;
+               return false;
        }
-       return 1;
+       return true;
 }
 
 static unsigned int
@@ -70,7 +70,7 @@ masquerade_target(struct sk_buff **pskb,
        enum ip_conntrack_info ctinfo;
        struct nf_nat_range newrange;
        const struct nf_nat_multi_range_compat *mr;
-       struct rtable *rt;
+       const struct rtable *rt;
        __be32 newsrc;
 
        NF_CT_ASSERT(hooknum == NF_IP_POST_ROUTING);
@@ -112,7 +112,7 @@ masquerade_target(struct sk_buff **pskb,
 static inline int
 device_cmp(struct nf_conn *i, void *ifindex)
 {
-       struct nf_conn_nat *nat = nfct_nat(i);
+       const struct nf_conn_nat *nat = nfct_nat(i);
        int ret;
 
        if (!nat)
@@ -129,7 +129,7 @@ static int masq_device_event(struct notifier_block *this,
                             unsigned long event,
                             void *ptr)
 {
-       struct net_device *dev = ptr;
+       const struct net_device *dev = ptr;
 
        if (event == NETDEV_DOWN) {
                /* Device was downed.  Search entire table for
@@ -147,7 +147,7 @@ static int masq_inet_event(struct notifier_block *this,
                           unsigned long event,
                           void *ptr)
 {
-       struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
+       const struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
 
        if (event == NETDEV_DOWN) {
                /* IP address was deleted.  Search entire table for