]> granicus.if.org Git - ipset/commitdiff
Fix the placement style of boolean operators at continued lines
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 20 Jan 2011 09:20:14 +0000 (10:20 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 20 Jan 2011 09:20:14 +0000 (10:20 +0100)
Fix "&&" and "||" continuation style (Patrick McHardy's review)

14 files changed:
kernel/include/linux/netfilter/ipset/ip_set_ahash.h
kernel/include/linux/netfilter/ipset/ip_set_timeout.h
kernel/ip_set_bitmap_ip.c
kernel/ip_set_bitmap_ipmac.c
kernel/ip_set_bitmap_port.c
kernel/ip_set_core.c
kernel/ip_set_hash_ip.c
kernel/ip_set_hash_ipport.c
kernel/ip_set_hash_ipportip.c
kernel/ip_set_hash_ipportnet.c
kernel/ip_set_hash_net.c
kernel/ip_set_hash_netport.c
kernel/ip_set_list_set.c
kernel/xt_set.c

index 29750412a2279060a276a67825829f65010a0444..621e119b817b82f5a786f1e67d722864faf7356e 100644 (file)
@@ -807,8 +807,8 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout)
                                ret = -IPSET_ERR_EXIST;
                                goto out;
                        }
-               } else if (j == AHASH_MAX_SIZE + 1 
-                        && type_pf_data_expired(data))
+               } else if (j == AHASH_MAX_SIZE + 1 && 
+                          type_pf_data_expired(data))
                        j = i;
        }
        if (j != AHASH_MAX_SIZE + 1) {
index 738371604b26a568a819f189b0a85ee6d39575a2..9f30c5f2ec1cfcd6f02bb3d76413f4e223402827 100644 (file)
@@ -43,17 +43,17 @@ ip_set_timeout_uget(struct nlattr *tb)
 static inline bool
 ip_set_timeout_test(unsigned long timeout)
 {
-       return timeout != IPSET_ELEM_UNSET
-               && (timeout == IPSET_ELEM_PERMANENT
-                   || time_after(timeout, jiffies));
+       return timeout != IPSET_ELEM_UNSET &&
+              (timeout == IPSET_ELEM_PERMANENT ||
+               time_after(timeout, jiffies));
 }
 
 static inline bool
 ip_set_timeout_expired(unsigned long timeout)
 {
-       return timeout != IPSET_ELEM_UNSET
-              && timeout != IPSET_ELEM_PERMANENT
-              && time_before(timeout, jiffies);
+       return timeout != IPSET_ELEM_UNSET &&
+              timeout != IPSET_ELEM_PERMANENT &&
+              time_before(timeout, jiffies);
 }
 
 static inline unsigned long
@@ -88,15 +88,15 @@ ip_set_timeout_get(unsigned long timeout)
 static inline bool
 ip_set_timeout_test(unsigned long timeout)
 {
-       return timeout == IPSET_ELEM_PERMANENT
-              || time_after(timeout, jiffies);
+       return timeout == IPSET_ELEM_PERMANENT ||
+              time_after(timeout, jiffies);
 }
 
 static inline bool
 ip_set_timeout_expired(unsigned long timeout)
 {
-       return timeout != IPSET_ELEM_PERMANENT
-              && time_before(timeout, jiffies);
+       return timeout != IPSET_ELEM_PERMANENT &&
+              time_before(timeout, jiffies);
 }
 
 static inline unsigned long
index 1a8eed0058cd73b3d0d3f990504a201ef865ec67..b653036a600ac6b9879dd3aac6b3ef5e74c89b1f 100644 (file)
@@ -264,9 +264,9 @@ bitmap_ip_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct bitmap_ip *x = a->data;
        const struct bitmap_ip *y = b->data;
 
-       return x->first_ip == y->first_ip
-              && x->last_ip == y->last_ip
-              && x->netmask == y->netmask;
+       return x->first_ip == y->first_ip &&
+              x->last_ip == y->last_ip &&
+              x->netmask == y->netmask;
 }
 
 static const struct ip_set_type_variant bitmap_ip = {
@@ -511,10 +511,10 @@ bitmap_ip_timeout_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct bitmap_ip_timeout *x = a->data;
        const struct bitmap_ip_timeout *y = b->data;
 
-       return x->first_ip == y->first_ip
-              && x->last_ip == y->last_ip
-              && x->netmask == y->netmask
-              && x->timeout == y->timeout;
+       return x->first_ip == y->first_ip &&
+              x->last_ip == y->last_ip &&
+              x->netmask == y->netmask &&
+              x->timeout == y->timeout;
 }
 
 static const struct ip_set_type_variant bitmap_ip_timeout = {
@@ -647,8 +647,8 @@ bitmap_ip_create(struct ip_set *set, struct nlattr *head, int len,
 
                mask = range_to_mask(first_ip, last_ip, &mask_bits);
 
-               if ((!mask && (first_ip || last_ip != 0xFFFFFFFF))
-                   || netmask <= mask_bits)
+               if ((!mask && (first_ip || last_ip != 0xFFFFFFFF)) ||
+                   netmask <= mask_bits)
                        return -IPSET_ERR_BITMAP_RANGE;
 
                pr_debug("mask_bits %u, netmask %u", mask_bits, netmask);
index d5a2e0f2ff6411e8d67d364175707a2c8d4a49b4..c451b598d219b6eefbaa30e1170c38f88eb8dc2b 100644 (file)
@@ -95,9 +95,9 @@ bitmap_expired(const struct bitmap_ipmac *map, u32 id)
 static inline int
 bitmap_ipmac_exist(const struct ipmac_telem *elem)
 {
-       return elem->match == MAC_UNSET
-               || (elem->match == MAC_FILLED
-                   && !ip_set_timeout_expired(elem->timeout));
+       return elem->match == MAC_UNSET ||
+              (elem->match == MAC_FILLED &&
+               !ip_set_timeout_expired(elem->timeout));
 }
 
 /* Base variant */
@@ -114,8 +114,8 @@ bitmap_ipmac_test(struct ip_set *set, void *value, u32 timeout)
                /* Trigger kernel to fill out the ethernet address */
                return -EAGAIN;
        case MAC_FILLED:
-               return data->ether == NULL
-                      || compare_ether_addr(data->ether, elem->ether) == 0;
+               return data->ether == NULL ||
+                      compare_ether_addr(data->ether, elem->ether) == 0;
        }
        return 0;
 }
@@ -223,9 +223,9 @@ bitmap_ipmac_ttest(struct ip_set *set, void *value, u32 timeout)
                /* Trigger kernel to fill out the ethernet address */
                return -EAGAIN;
        case MAC_FILLED:
-               return (data->ether == NULL
-                       || compare_ether_addr(data->ether, elem->ether) == 0)
-                      && !bitmap_expired(map, data->id);
+               return (data->ether == NULL ||
+                       compare_ether_addr(data->ether, elem->ether) == 0) &&
+                      !bitmap_expired(map, data->id);
        }
        return 0;
 }
@@ -348,8 +348,8 @@ bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb,
                return -IPSET_ERR_BITMAP_RANGE;
 
        /* Backward compatibility: we don't check the second flag */
-       if (skb_mac_header(skb) < skb->head
-           || (skb_mac_header(skb) + ETH_HLEN) > skb->data)
+       if (skb_mac_header(skb) < skb->head ||
+           (skb_mac_header(skb) + ETH_HLEN) > skb->data)
                return -EINVAL;
 
        data.id -= map->first_ip;
@@ -464,9 +464,9 @@ bitmap_ipmac_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct bitmap_ipmac *x = a->data;
        const struct bitmap_ipmac *y = b->data;
 
-       return x->first_ip == y->first_ip
-              && x->last_ip == y->last_ip
-              && x->timeout == y->timeout;
+       return x->first_ip == y->first_ip &&
+              x->last_ip == y->last_ip &&
+              x->timeout == y->timeout;
 }
 
 const struct ip_set_type_variant bitmap_ipmac = {
@@ -512,8 +512,8 @@ bitmap_ipmac_gc(unsigned long ul_set)
        read_lock_bh(&set->lock);
        for (id = 0; id <= last; id++) {
                elem = bitmap_ipmac_elem(map, id);
-               if (elem->match == MAC_FILLED
-                   && ip_set_timeout_expired(elem->timeout))
+               if (elem->match == MAC_FILLED &&
+                   ip_set_timeout_expired(elem->timeout))
                        elem->match = MAC_EMPTY;
        }
        read_unlock_bh(&set->lock);
index bcffe0ca15b6245990d9d35d72ac8645f8b6718b..3d5e6e339df77ebe80cc073ee258a9e9d9f9c1f3 100644 (file)
@@ -246,8 +246,8 @@ bitmap_port_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct bitmap_port *x = a->data;
        const struct bitmap_port *y = b->data;
 
-       return x->first_port == y->first_port
-              && x->last_port == y->last_port;
+       return x->first_port == y->first_port &&
+              x->last_port == y->last_port;
 }
 
 const struct ip_set_type_variant bitmap_port = {
@@ -483,9 +483,9 @@ bitmap_port_timeout_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct bitmap_port_timeout *x = a->data;
        const struct bitmap_port_timeout *y = b->data;
 
-       return x->first_port == y->first_port
-              && x->last_port == y->last_port
-              && x->timeout == y->timeout;
+       return x->first_port == y->first_port &&
+              x->last_port == y->last_port &&
+              x->timeout == y->timeout;
 }
 
 const struct ip_set_type_variant bitmap_port_timeout = {
index 4634fd6df56e254d5bfed91def5683b7e87dcba7..1a9f72d33387a795b312b61ab72653a08587540e 100644 (file)
@@ -67,9 +67,9 @@ find_set_type(const char *name, u8 family, u8 revision)
        struct ip_set_type *type;
 
        list_for_each_entry_rcu(type, &ip_set_type_list, list)
-               if (STREQ(type->name, name)
-                   && (type->family == family || type->family == AF_UNSPEC)
-                   && type->revision == revision)
+               if (STREQ(type->name, name) &&
+                   (type->family == family || type->family == AF_UNSPEC) &&
+                   type->revision == revision)
                        return type;
        return NULL;
 }
@@ -104,8 +104,8 @@ find_set_type_minmax(const char *name, u8 family, u8 *min, u8 *max)
        *min = *max = 0;
        rcu_read_lock();
        list_for_each_entry_rcu(type, &ip_set_type_list, list)
-               if (STREQ(type->name, name)
-                   && (type->family == family || type->family == AF_UNSPEC)) {
+               if (STREQ(type->name, name) &&
+                   (type->family == family || type->family == AF_UNSPEC)) {
                        ret = true;
                        if (type->revision < *min)
                                *min = type->revision;
@@ -215,8 +215,8 @@ ip_set_test(ip_set_id_t index, const struct sk_buff *skb,
        BUG_ON(set == NULL || atomic_read(&set->ref) == 0);
        pr_debug("set %s, index %u", set->name, index);
 
-       if (dim < set->type->dimension
-           || !(family == set->family || set->family == AF_UNSPEC))
+       if (dim < set->type->dimension ||
+           !(family == set->family || set->family == AF_UNSPEC))
                return 0;
 
        read_lock_bh(&set->lock);
@@ -247,8 +247,8 @@ ip_set_add(ip_set_id_t index, const struct sk_buff *skb,
        BUG_ON(set == NULL || atomic_read(&set->ref) == 0);
        pr_debug("set %s, index %u", set->name, index);
 
-       if (dim < set->type->dimension
-           || !(family == set->family || set->family == AF_UNSPEC))
+       if (dim < set->type->dimension ||
+           !(family == set->family || set->family == AF_UNSPEC))
                return 0;
 
        write_lock_bh(&set->lock);
@@ -269,8 +269,8 @@ ip_set_del(ip_set_id_t index, const struct sk_buff *skb,
        BUG_ON(set == NULL || atomic_read(&set->ref) == 0);
        pr_debug("set %s, index %u", set->name, index);
 
-       if (dim < set->type->dimension
-           || !(family == set->family || set->family == AF_UNSPEC))
+       if (dim < set->type->dimension ||
+           !(family == set->family || set->family == AF_UNSPEC))
                return 0;
 
        write_lock_bh(&set->lock);
@@ -420,8 +420,8 @@ EXPORT_SYMBOL_GPL(ip_set_nfnl_put);
 static inline bool
 protocol_failed(const struct nlattr * const tb[])
 {
-       return !tb[IPSET_ATTR_PROTOCOL]
-              || nla_get_u8(tb[IPSET_ATTR_PROTOCOL]) != IPSET_PROTOCOL;
+       return !tb[IPSET_ATTR_PROTOCOL] ||
+              nla_get_u8(tb[IPSET_ATTR_PROTOCOL]) != IPSET_PROTOCOL;
 }
 
 static inline u32
@@ -532,13 +532,13 @@ ip_set_create(struct sock *ctnl, struct sk_buff *skb,
        u32 flags = flag_exist(nlh);
        int ret = 0, len;
 
-       if (unlikely(protocol_failed(attr)
-                    || attr[IPSET_ATTR_SETNAME] == NULL
-                    || attr[IPSET_ATTR_TYPENAME] == NULL
-                    || attr[IPSET_ATTR_REVISION] == NULL
-                    || attr[IPSET_ATTR_FAMILY] == NULL
-                    || (attr[IPSET_ATTR_DATA] != NULL
-                        && !flag_nested(attr[IPSET_ATTR_DATA]))))
+       if (unlikely(protocol_failed(attr) ||
+                    attr[IPSET_ATTR_SETNAME] == NULL ||
+                    attr[IPSET_ATTR_TYPENAME] == NULL ||
+                    attr[IPSET_ATTR_REVISION] == NULL ||
+                    attr[IPSET_ATTR_FAMILY] == NULL ||
+                    (attr[IPSET_ATTR_DATA] != NULL &&
+                     !flag_nested(attr[IPSET_ATTR_DATA]))))
                return -IPSET_ERR_PROTOCOL;
 
        name = nla_data(attr[IPSET_ATTR_SETNAME]);
@@ -609,12 +609,12 @@ ip_set_create(struct sock *ctnl, struct sk_buff *skb,
         */
        if ((ret = find_free_id(set->name, &index, &clash)) != 0) {
                /* If this is the same set and requested, ignore error */
-               if (ret == -EEXIST
-                   && (flags & IPSET_FLAG_EXIST)
-                   && STREQ(set->type->name, clash->type->name)
-                   && set->type->family == clash->type->family
-                   && set->type->revision == clash->type->revision
-                   && set->variant->same_set(set, clash))
+               if (ret == -EEXIST &&
+                   (flags & IPSET_FLAG_EXIST) &&
+                   STREQ(set->type->name, clash->type->name) &&
+                   set->type->family == clash->type->family &&
+                   set->type->revision == clash->type->revision &&
+                   set->variant->same_set(set, clash))
                        ret = 0;
                goto cleanup;
        }
@@ -672,8 +672,8 @@ ip_set_destroy(struct sock *ctnl, struct sk_buff *skb,
        /* References are protected by the nfnl mutex */
        if (!attr[IPSET_ATTR_SETNAME]) {
                for (i = 0; i < ip_set_max; i++) {
-                       if (ip_set_list[i] != NULL
-                           && (atomic_read(&ip_set_list[i]->ref)))
+                       if (ip_set_list[i] != NULL &&
+                           (atomic_read(&ip_set_list[i]->ref)))
                                return -IPSET_ERR_BUSY;
                }
                for (i = 0; i < ip_set_max; i++) {
@@ -749,9 +749,9 @@ ip_set_rename(struct sock *ctnl, struct sk_buff *skb,
        const char *name2;
        ip_set_id_t i;
 
-       if (unlikely(protocol_failed(attr)
-                    || attr[IPSET_ATTR_SETNAME] == NULL
-                    || attr[IPSET_ATTR_SETNAME2] == NULL))
+       if (unlikely(protocol_failed(attr) ||
+                    attr[IPSET_ATTR_SETNAME] == NULL ||
+                    attr[IPSET_ATTR_SETNAME2] == NULL))
                return -IPSET_ERR_PROTOCOL;
 
        set = find_set(nla_data(attr[IPSET_ATTR_SETNAME]));
@@ -762,8 +762,8 @@ ip_set_rename(struct sock *ctnl, struct sk_buff *skb,
 
        name2 = nla_data(attr[IPSET_ATTR_SETNAME2]);
        for (i = 0; i < ip_set_max; i++) {
-               if (ip_set_list[i] != NULL
-                   && STREQ(ip_set_list[i]->name, name2))
+               if (ip_set_list[i] != NULL &&
+                   STREQ(ip_set_list[i]->name, name2))
                        return -IPSET_ERR_EXIST_SETNAME2;
        }
        strncpy(set->name, name2, IPSET_MAXNAMELEN);
@@ -790,9 +790,9 @@ ip_set_swap(struct sock *ctnl, struct sk_buff *skb,
        char from_name[IPSET_MAXNAMELEN];
        u32 from_ref;
 
-       if (unlikely(protocol_failed(attr)
-                    || attr[IPSET_ATTR_SETNAME] == NULL
-                    || attr[IPSET_ATTR_SETNAME2] == NULL))
+       if (unlikely(protocol_failed(attr) ||
+                    attr[IPSET_ATTR_SETNAME] == NULL ||
+                    attr[IPSET_ATTR_SETNAME2] == NULL))
                return -IPSET_ERR_PROTOCOL;
 
        from_id = find_set_id(nla_data(attr[IPSET_ATTR_SETNAME]));
@@ -809,8 +809,8 @@ ip_set_swap(struct sock *ctnl, struct sk_buff *skb,
        /* Features must not change.
         * Not an artifical restriction anymore, as we must prevent
         * possible loops created by swapping in setlist type of sets. */
-       if (!(from->type->features == to->type->features
-             && from->type->family == to->type->family))
+       if (!(from->type->features == to->type->features &&
+             from->type->family == to->type->family))
                return -IPSET_ERR_TYPE_MISMATCH;
 
        /* No magic here: ref munging protected by the nfnl_lock */
@@ -926,9 +926,9 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb)
                /* When dumping all sets, we must dump "sorted"
                 * so that lists (unions of sets) are dumped last.
                 */
-               if (cb->args[0] != DUMP_ONE
-                   && !((cb->args[0] == DUMP_ALL)
-                        ^ (set->type->features & IPSET_DUMP_LAST)))
+               if (cb->args[0] != DUMP_ONE &&
+                   !((cb->args[0] == DUMP_ALL) ^
+                     (set->type->features & IPSET_DUMP_LAST)))
                        continue;
                pr_debug("List set: %s", set->name);
                if (!cb->args[2]) {
@@ -1036,9 +1036,9 @@ call_ad(struct sk_buff *skb, const struct nlattr *const attr[],
                ret = set->variant->uadt(set, head, len, adt,
                                         &lineno, flags);
                write_unlock_bh(&set->lock);
-       } while (ret == -EAGAIN
-                && set->variant->resize
-                && (ret = set->variant->resize(set, retried++)) == 0);
+       } while (ret == -EAGAIN &&
+                set->variant->resize &&
+                (ret = set->variant->resize(set, retried++)) == 0);
 
        if (!ret || (ret == -IPSET_ERR_EXIST && eexist))
                return 0;
@@ -1062,15 +1062,15 @@ ip_set_uadd(struct sock *ctnl, struct sk_buff *skb,
        u32 flags = flag_exist(nlh);
        int ret = 0;
 
-       if (unlikely(protocol_failed(attr)
-                    || attr[IPSET_ATTR_SETNAME] == NULL
-                    || !((attr[IPSET_ATTR_DATA] != NULL)
-                         ^ (attr[IPSET_ATTR_ADT] != NULL))
-                    || (attr[IPSET_ATTR_DATA] != NULL
-                        && !flag_nested(attr[IPSET_ATTR_DATA]))
-                    || (attr[IPSET_ATTR_ADT] != NULL
-                        && (!flag_nested(attr[IPSET_ATTR_ADT])
-                            || attr[IPSET_ATTR_LINENO] == NULL))))
+       if (unlikely(protocol_failed(attr) ||
+                    attr[IPSET_ATTR_SETNAME] == NULL ||
+                    !((attr[IPSET_ATTR_DATA] != NULL) ^
+                      (attr[IPSET_ATTR_ADT] != NULL)) ||
+                    (attr[IPSET_ATTR_DATA] != NULL &&
+                     !flag_nested(attr[IPSET_ATTR_DATA])) ||
+                    (attr[IPSET_ATTR_ADT] != NULL &&
+                     (!flag_nested(attr[IPSET_ATTR_ADT]) ||
+                      attr[IPSET_ATTR_LINENO] == NULL))))
                return -IPSET_ERR_PROTOCOL;
 
        set = find_set(nla_data(attr[IPSET_ATTR_SETNAME]));
@@ -1084,8 +1084,8 @@ ip_set_uadd(struct sock *ctnl, struct sk_buff *skb,
                int nla_rem;
 
                nla_for_each_nested(nla, attr[IPSET_ATTR_ADT], nla_rem) {
-                       if (nla_type(nla) != IPSET_ATTR_DATA
-                           || !flag_nested(nla))
+                       if (nla_type(nla) != IPSET_ATTR_DATA ||
+                           !flag_nested(nla))
                                return -IPSET_ERR_PROTOCOL;
                        ret = call_ad(skb, attr,
                                       set, nla, IPSET_ADD, flags);
@@ -1106,15 +1106,15 @@ ip_set_udel(struct sock *ctnl, struct sk_buff *skb,
        u32 flags = flag_exist(nlh);
        int ret = 0;
 
-       if (unlikely(protocol_failed(attr)
-                    || attr[IPSET_ATTR_SETNAME] == NULL
-                    || !((attr[IPSET_ATTR_DATA] != NULL)
-                         ^ (attr[IPSET_ATTR_ADT] != NULL))
-                    || (attr[IPSET_ATTR_DATA] != NULL
-                        && !flag_nested(attr[IPSET_ATTR_DATA]))
-                    || (attr[IPSET_ATTR_ADT] != NULL
-                        && (!flag_nested(attr[IPSET_ATTR_ADT])
-                           || attr[IPSET_ATTR_LINENO] == NULL))))
+       if (unlikely(protocol_failed(attr) ||
+                    attr[IPSET_ATTR_SETNAME] == NULL ||
+                    !((attr[IPSET_ATTR_DATA] != NULL) ^
+                      (attr[IPSET_ATTR_ADT] != NULL)) ||
+                    (attr[IPSET_ATTR_DATA] != NULL &&
+                     !flag_nested(attr[IPSET_ATTR_DATA])) ||
+                    (attr[IPSET_ATTR_ADT] != NULL &&
+                     (!flag_nested(attr[IPSET_ATTR_ADT]) ||
+                      attr[IPSET_ATTR_LINENO] == NULL))))
                return -IPSET_ERR_PROTOCOL;
 
        set = find_set(nla_data(attr[IPSET_ATTR_SETNAME]));
@@ -1128,8 +1128,8 @@ ip_set_udel(struct sock *ctnl, struct sk_buff *skb,
                int nla_rem;
 
                nla_for_each_nested(nla, attr[IPSET_ATTR_ADT], nla_rem) {
-                       if (nla_type(nla) != IPSET_ATTR_DATA
-                           || !flag_nested(nla))
+                       if (nla_type(nla) != IPSET_ATTR_DATA ||
+                           !flag_nested(nla))
                                return -IPSET_ERR_PROTOCOL;
                        ret = call_ad(skb, attr,
                                       set, nla, IPSET_DEL, flags);
@@ -1148,10 +1148,10 @@ ip_set_utest(struct sock *ctnl, struct sk_buff *skb,
        struct ip_set *set;
        int ret = 0;
 
-       if (unlikely(protocol_failed(attr)
-                    || attr[IPSET_ATTR_SETNAME] == NULL
-                    || attr[IPSET_ATTR_DATA] == NULL
-                    || !flag_nested(attr[IPSET_ATTR_DATA])))
+       if (unlikely(protocol_failed(attr) ||
+                    attr[IPSET_ATTR_SETNAME] == NULL ||
+                    attr[IPSET_ATTR_DATA] == NULL ||
+                    !flag_nested(attr[IPSET_ATTR_DATA])))
                return -IPSET_ERR_PROTOCOL;
 
        set = find_set(nla_data(attr[IPSET_ATTR_SETNAME]));
@@ -1184,8 +1184,8 @@ ip_set_header(struct sock *ctnl, struct sk_buff *skb,
        ip_set_id_t index;
        int ret = 0;
 
-       if (unlikely(protocol_failed(attr)
-                    || attr[IPSET_ATTR_SETNAME] == NULL))
+       if (unlikely(protocol_failed(attr) ||
+                    attr[IPSET_ATTR_SETNAME] == NULL))
                return -IPSET_ERR_PROTOCOL;
 
        index = find_set_id(nla_data(attr[IPSET_ATTR_SETNAME]));
@@ -1241,9 +1241,9 @@ ip_set_type(struct sock *ctnl, struct sk_buff *skb,
        const char *typename;
        int ret = 0;
 
-       if (unlikely(protocol_failed(attr)
-                    || attr[IPSET_ATTR_TYPENAME] == NULL
-                    || attr[IPSET_ATTR_FAMILY] == NULL))
+       if (unlikely(protocol_failed(attr) ||
+                    attr[IPSET_ATTR_TYPENAME] == NULL ||
+                    attr[IPSET_ATTR_FAMILY] == NULL))
                return -IPSET_ERR_PROTOCOL;
 
        family = nla_get_u8(attr[IPSET_ATTR_FAMILY]);
@@ -1469,8 +1469,8 @@ ip_set_sockfn_get(struct sock *sk, int optval, void *user, int *len)
        case IP_SET_OP_GET_BYINDEX: {
                struct ip_set_req_get_set *req_get = data;
 
-               if (*len != sizeof(struct ip_set_req_get_set)
-                   || req_get->set.index >= ip_set_max) {
+               if (*len != sizeof(struct ip_set_req_get_set) ||
+                   req_get->set.index >= ip_set_max) {
                        ret = -EINVAL;
                        goto done;
                }
index f07f14b583ff86ef8703eb9d0d849c191e1e17de..b3744629144ad62d8c8ea7399d595bda5106cd9f 100644 (file)
@@ -215,9 +215,9 @@ hash_ip_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct ip_set_hash *y = b->data;
 
        /* Resizing changes htable_bits, so we ignore it */
-       return x->maxelem == y->maxelem
-              && x->timeout == y->timeout
-              && x->netmask == y->netmask;
+       return x->maxelem == y->maxelem &&
+              x->timeout == y->timeout &&
+              x->netmask == y->netmask;
 }
 
 /* The type variant functions: IPv6 */
@@ -408,9 +408,9 @@ hash_ip_create(struct ip_set *set, struct nlattr *head, int len, u32 flags)
        if (tb[IPSET_ATTR_NETMASK]) {
                netmask = nla_get_u8(tb[IPSET_ATTR_NETMASK]);
 
-               if ((set->family == AF_INET && netmask > 32)
-                   || (set->family == AF_INET6 && netmask > 128)
-                   || netmask == 0)
+               if ((set->family == AF_INET && netmask > 32) ||
+                   (set->family == AF_INET6 && netmask > 128) ||
+                   netmask == 0)
                        return -IPSET_ERR_INVALID_NETMASK;
        }
 
index 891d045fb76ae18779ad0ae9d906c1c023773523..6953042362682bbb21e778981f3dec0810828675 100644 (file)
@@ -66,9 +66,9 @@ static inline bool
 hash_ipport4_data_equal(const struct hash_ipport4_elem *ip1,
                        const struct hash_ipport4_elem *ip2)
 {
-       return ip1->ip == ip2->ip
-              && ip1->port == ip2->port
-              && ip1->proto == ip2->proto;
+       return ip1->ip == ip2->ip &&
+              ip1->port == ip2->port &&
+              ip1->proto == ip2->proto;
 }
 
 static inline bool
@@ -218,10 +218,10 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *head, int len,
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST
-           || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP)
-           || !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR]
-                || tb[IPSET_ATTR_PORT_TO])) {
+       if (adt == IPSET_TEST ||
+           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
+           !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] ||
+             tb[IPSET_ATTR_PORT_TO])) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
@@ -273,8 +273,8 @@ hash_ipport_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct ip_set_hash *y = b->data;
 
        /* Resizing changes htable_bits, so we ignore it */
-       return x->maxelem == y->maxelem
-              && x->timeout == y->timeout;
+       return x->maxelem == y->maxelem &&
+              x->timeout == y->timeout;
 }
 
 /* The type variant functions: IPv6 */
@@ -298,9 +298,9 @@ static inline bool
 hash_ipport6_data_equal(const struct hash_ipport6_elem *ip1,
                        const struct hash_ipport6_elem *ip2)
 {
-       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0
-              && ip1->port == ip2->port
-              && ip1->proto == ip2->proto;
+       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 &&
+              ip1->port == ip2->port &&
+              ip1->proto == ip2->proto;
 }
 
 static inline bool
@@ -440,9 +440,9 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *head, int len,
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST
-           || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP)
-           || !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST ||
+           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
+           !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
index 264fe9e060bb7914e6e883819a8bf39130db0f51..94c6634452403a149247b83598ab81184c3303e5 100644 (file)
@@ -68,10 +68,10 @@ static inline bool
 hash_ipportip4_data_equal(const struct hash_ipportip4_elem *ip1,
                          const struct hash_ipportip4_elem *ip2)
 {
-       return ip1->ip == ip2->ip
-              && ip1->ip2 == ip2->ip2
-              && ip1->port == ip2->port
-              && ip1->proto == ip2->proto;
+       return ip1->ip == ip2->ip &&
+              ip1->ip2 == ip2->ip2 &&
+              ip1->port == ip2->port &&
+              ip1->proto == ip2->proto;
 }
 
 static inline bool
@@ -229,10 +229,10 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *head, int len,
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST
-           || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP)
-           || !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR]
-                || tb[IPSET_ATTR_PORT_TO])) {
+       if (adt == IPSET_TEST ||
+           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
+           !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] ||
+             tb[IPSET_ATTR_PORT_TO])) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
@@ -284,8 +284,8 @@ hash_ipportip_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct ip_set_hash *y = b->data;
 
        /* Resizing changes htable_bits, so we ignore it */
-       return x->maxelem == y->maxelem
-              && x->timeout == y->timeout;
+       return x->maxelem == y->maxelem &&
+              x->timeout == y->timeout;
 }
 
 /* The type variant functions: IPv6 */
@@ -311,10 +311,10 @@ static inline bool
 hash_ipportip6_data_equal(const struct hash_ipportip6_elem *ip1,
                          const struct hash_ipportip6_elem *ip2)
 {
-       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0
-              && ipv6_addr_cmp(&ip1->ip2.in6, &ip2->ip2.in6) == 0
-              && ip1->port == ip2->port
-              && ip1->proto == ip2->proto;
+       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 &&
+              ipv6_addr_cmp(&ip1->ip2.in6, &ip2->ip2.in6) == 0 &&
+              ip1->port == ip2->port &&
+              ip1->proto == ip2->proto;
 }
 
 static inline bool
@@ -461,9 +461,9 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *head, int len,
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST
-           || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP)
-           || !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST ||
+           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
+           !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
index b9aea4368e8a0ea72c3b988b0f861328be76b108..0768981989737578e60d819e0c963ac206223df5 100644 (file)
@@ -68,11 +68,11 @@ static inline bool
 hash_ipportnet4_data_equal(const struct hash_ipportnet4_elem *ip1,
                           const struct hash_ipportnet4_elem *ip2)
 {
-       return ip1->ip == ip2->ip
-              && ip1->ip2 == ip2->ip2
-              && ip1->cidr == ip2->cidr
-              && ip1->port == ip2->port
-              && ip1->proto == ip2->proto;
+       return ip1->ip == ip2->ip &&
+              ip1->ip2 == ip2->ip2 &&
+              ip1->cidr == ip2->cidr &&
+              ip1->port == ip2->port &&
+              ip1->proto == ip2->proto;
 }
 
 static inline bool
@@ -258,10 +258,10 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *head, int len,
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST
-           || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP)
-           || !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR]
-                || tb[IPSET_ATTR_PORT_TO])) {
+       if (adt == IPSET_TEST ||
+           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
+           !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] ||
+             tb[IPSET_ATTR_PORT_TO])) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
@@ -313,8 +313,8 @@ hash_ipportnet_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct ip_set_hash *y = b->data;
        
        /* Resizing changes htable_bits, so we ignore it */
-       return x->maxelem == y->maxelem
-              && x->timeout == y->timeout;
+       return x->maxelem == y->maxelem &&
+              x->timeout == y->timeout;
 }
 
 /* The type variant functions: IPv6 */
@@ -340,11 +340,11 @@ static inline bool
 hash_ipportnet6_data_equal(const struct hash_ipportnet6_elem *ip1,
                           const struct hash_ipportnet6_elem *ip2)
 {
-       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0
-              && ipv6_addr_cmp(&ip1->ip2.in6, &ip2->ip2.in6) == 0
-              && ip1->cidr == ip2->cidr
-              && ip1->port == ip2->port
-              && ip1->proto == ip2->proto;
+       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 &&
+              ipv6_addr_cmp(&ip1->ip2.in6, &ip2->ip2.in6) == 0 &&
+              ip1->cidr == ip2->cidr &&
+              ip1->port == ip2->port &&
+              ip1->proto == ip2->proto;
 }
 
 static inline bool
@@ -524,9 +524,9 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *head, int len,
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST
-           || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP)
-           || !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST ||
+           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
+           !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
index a249e07a9628af639e4521f4b1fe73ef9a77399c..e7f4016b4740fd3bf8f8e852fab998311a77083d 100644 (file)
@@ -210,8 +210,8 @@ hash_net_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct ip_set_hash *y = b->data;
 
        /* Resizing changes htable_bits, so we ignore it */
-       return x->maxelem == y->maxelem
-              && x->timeout == y->timeout;
+       return x->maxelem == y->maxelem &&
+              x->timeout == y->timeout;
 }
 
 /* The type variant functions: IPv6 */
@@ -235,8 +235,8 @@ static inline bool
 hash_net6_data_equal(const struct hash_net6_elem *ip1,
                     const struct hash_net6_elem *ip2)
 {
-       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0
-              && ip1->cidr == ip2->cidr;
+       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 &&
+              ip1->cidr == ip2->cidr;
 }
 
 static inline bool
index ebcb73de89c0f5e0da96e36a2f0fd3953e2a1ce3..d17f0779a43ffb91168f8d4c91e28966d7cc71fe 100644 (file)
@@ -65,10 +65,10 @@ static inline bool
 hash_netport4_data_equal(const struct hash_netport4_elem *ip1,
                         const struct hash_netport4_elem *ip2)
 {
-       return ip1->ip == ip2->ip
-              && ip1->port == ip2->port
-              && ip1->proto == ip2->proto
-              && ip1->cidr == ip2->cidr;
+       return ip1->ip == ip2->ip &&
+              ip1->port == ip2->port &&
+              ip1->proto == ip2->proto &&
+              ip1->cidr == ip2->cidr;
 }
 
 static inline bool
@@ -244,9 +244,9 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *head, int len,
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST
-           || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP)
-           || !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST ||
+           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
+           !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
@@ -275,8 +275,8 @@ hash_netport_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct ip_set_hash *y = b->data;
 
        /* Resizing changes htable_bits, so we ignore it */
-       return x->maxelem == y->maxelem
-              && x->timeout == y->timeout;
+       return x->maxelem == y->maxelem &&
+              x->timeout == y->timeout;
 }
 
 /* The type variant functions: IPv6 */
@@ -300,10 +300,10 @@ static inline bool
 hash_netport6_data_equal(const struct hash_netport6_elem *ip1,
                         const struct hash_netport6_elem *ip2)
 {
-       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0
-              && ip1->port == ip2->port
-              && ip1->proto == ip2->proto
-              && ip1->cidr == ip2->cidr;
+       return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 &&
+              ip1->port == ip2->port &&
+              ip1->proto == ip2->proto &&
+              ip1->cidr == ip2->cidr;
 }
 
 static inline bool
@@ -474,9 +474,9 @@ hash_netport6_uadt(struct ip_set *set, struct nlattr *head, int len,
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST
-           || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP)
-           || !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST ||
+           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
+           !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
index 770c39df273610899f7dd491b7328cbf045afdd2..486e6a9a1610a461ab52344972e3a4707bf7467f 100644 (file)
@@ -68,8 +68,8 @@ list_set_expired(const struct list_set *map, u32 id)
 static inline int
 list_set_exist(const struct set_telem *elem)
 {
-       return elem->id != IPSET_INVALID_ID
-              && !ip_set_timeout_expired(elem->timeout);
+       return elem->id != IPSET_INVALID_ID &&
+              !ip_set_timeout_expired(elem->timeout);
 }
 
 /* Set list without and with timeout */
@@ -129,9 +129,9 @@ next_id_eq(const struct list_set *map, u32 i, ip_set_id_t id)
 
        if (i + 1 < map->size) {
                elem = list_set_elem(map, i + 1);
-               return !!(elem->id == id
-                         && !(with_timeout(map->timeout)
-                              && list_set_expired(map, i + 1)));
+               return !!(elem->id == id &&
+                         !(with_timeout(map->timeout) &&
+                           list_set_expired(map, i + 1)));
        }
 
        return 0;
@@ -270,8 +270,8 @@ list_set_uadt(struct ip_set *set, struct nlattr *head, int len,
        case IPSET_TEST:
                for (i = 0; i < map->size && !ret; i++) {
                        elem = list_set_elem(map, i);
-                       if (elem->id == IPSET_INVALID_ID
-                           || (before != 0 && i + 1 >= map->size))
+                       if (elem->id == IPSET_INVALID_ID ||
+                           (before != 0 && i + 1 >= map->size))
                                break;
                        else if (with_timeout && list_set_expired(map, i))
                                continue;
@@ -286,8 +286,8 @@ list_set_uadt(struct ip_set *set, struct nlattr *head, int len,
        case IPSET_ADD:
                for (i = 0; i < map->size && !ret; i++) {
                        elem = list_set_elem(map, i);
-                       if (elem->id == id
-                           && !(with_timeout && list_set_expired(map, i)))
+                       if (elem->id == id &&
+                           !(with_timeout && list_set_expired(map, i)))
                                ret = -IPSET_ERR_EXIST;
                }
                if (ret == -IPSET_ERR_EXIST)
@@ -318,14 +318,14 @@ list_set_uadt(struct ip_set *set, struct nlattr *head, int len,
                                break;
                        } else if (with_timeout && list_set_expired(map, i))
                                continue;
-                       else if (elem->id == id
-                                && (before == 0
-                                    || (before > 0
-                                        && next_id_eq(map, i, refid))))
+                       else if (elem->id == id &&
+                                (before == 0 ||
+                                 (before > 0 &&
+                                  next_id_eq(map, i, refid))))
                                ret = list_set_del(map, id, i);
-                       else if (before < 0
-                                && elem->id == refid
-                                && next_id_eq(map, i, id))
+                       else if (before < 0 &&
+                                elem->id == refid &&
+                                next_id_eq(map, i, id))
                                ret = list_set_del(map, id, i + 1);
                }
                break;
@@ -449,8 +449,8 @@ list_set_same_set(const struct ip_set *a, const struct ip_set *b)
        const struct list_set *x = a->data;
        const struct list_set *y = b->data;
 
-       return x->size == y->size
-              && x->timeout == y->timeout;
+       return x->size == y->size &&
+              x->timeout == y->timeout;
 }
 
 static const struct ip_set_type_variant list_set = {
@@ -476,8 +476,8 @@ list_set_gc(unsigned long ul_set)
        read_lock_bh(&set->lock);
        for (i = map->size - 1; i >= 0; i--) {
                e = (struct set_telem *) list_set_elem(map, i);
-               if (e->id != IPSET_INVALID_ID
-                   && list_set_expired(map, i))
+               if (e->id != IPSET_INVALID_ID &&
+                   list_set_expired(map, i))
                        list_set_del(map, e->id, i);
        }
        read_unlock_bh(&set->lock);
index fdd18763354c7c6c1c7316348cc053b02b27edab..d580c6cbc5066e6a7d94f64dee3601d4df09da20 100644 (file)
@@ -181,8 +181,8 @@ set_target_v0_checkentry(const struct xt_tgchk_param *par)
                        return CHECK_FAIL;      /* error */
                }
        }
-       if (info->add_set.u.flags[IPSET_DIM_MAX-1] != 0
-           || info->del_set.u.flags[IPSET_DIM_MAX-1] != 0) {
+       if (info->add_set.u.flags[IPSET_DIM_MAX-1] != 0 ||
+           info->del_set.u.flags[IPSET_DIM_MAX-1] != 0) {
                pr_warning("That's nasty!");
                return CHECK_FAIL;      /* error */
        }
@@ -309,8 +309,8 @@ set_target_checkentry(const struct xt_tgchk_param *par)
                        return CHECK_FAIL;      /* error */
                }
        }
-       if (info->add_set.dim > IPSET_DIM_MAX
-           || info->del_set.flags > IPSET_DIM_MAX) {
+       if (info->add_set.dim > IPSET_DIM_MAX ||
+           info->del_set.flags > IPSET_DIM_MAX) {
                pr_warning("That's nasty!");
                return CHECK_FAIL;      /* error */
        }