]> granicus.if.org Git - ipset/commitdiff
Coding style fixes
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 11 Sep 2012 15:38:17 +0000 (17:38 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 11 Sep 2012 15:38:17 +0000 (17:38 +0200)
15 files changed:
include/libipset/data.h
kernel/include/linux/netfilter/ipset/ip_set.h
kernel/include/linux/netfilter/ipset/ip_set_ahash.h
kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c
kernel/net/netfilter/ipset/ip_set_core.c
kernel/net/netfilter/ipset/ip_set_getport.c
kernel/net/netfilter/ipset/pfxlen.c
lib/data.c
lib/debug.c
lib/libipset.map
lib/parse.c
lib/print.c
lib/session.c
lib/types.c
src/ipset.c

index b7e7747f4c6f13ad309d8c637f9f9f74b033e778..ce1f1cac904996a5d03678ce4ca130170e2093d7 100644 (file)
@@ -113,7 +113,8 @@ extern bool ipset_data_flags_test(const struct ipset_data *data,
 extern void ipset_data_flags_set(struct ipset_data *data, uint64_t flags);
 extern void ipset_data_flags_unset(struct ipset_data *data, uint64_t flags);
 extern bool ipset_data_ignored(struct ipset_data *data, enum ipset_opt opt);
-extern bool ipset_data_test_ignored(struct ipset_data *data, enum ipset_opt opt);
+extern bool ipset_data_test_ignored(struct ipset_data *data,
+                                   enum ipset_opt opt);
 
 extern int ipset_data_set(struct ipset_data *data, enum ipset_opt opt,
                          const void *value);
index a663dd59eab19a419718123f2d3822e32110a1c4..e6bfe3bf1c2e6488e9f383c1a39541cdd6e61588 100644 (file)
@@ -255,7 +255,7 @@ struct ip_set_type_variant {
         *              returns negative error code,
         *                      zero for no match/success to add/delete
         *                      positive for matching element */
-       int (*kadt)(struct ip_set *set, const struct sk_buff * skb,
+       int (*kadt)(struct ip_set *set, const struct sk_buff *skb,
                    const struct xt_action_param *par,
                    enum ipset_adt adt, const struct ip_set_adt_opt *opt);
 
@@ -452,7 +452,8 @@ static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
        return ret;
 }
 
-static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, const struct in6_addr *ipaddrptr)
+static inline int nla_put_ipaddr6(struct sk_buff *skb, int type,
+                                 const struct in6_addr *ipaddrptr)
 {
        struct nlattr *__nested = ipset_nest_start(skb, type);
        int ret;
index 8708c343f656b488978030b32ed347167808513f..c43f076944c199548cc3268308ed616a3a044150 100644 (file)
@@ -696,7 +696,7 @@ nla_put_failure:
 }
 
 static int
-type_pf_kadt(struct ip_set *set, const struct sk_buff * skb,
+type_pf_kadt(struct ip_set *set, const struct sk_buff *skb,
             const struct xt_action_param *par,
             enum ipset_adt adt, const struct ip_set_adt_opt *opt);
 static int
index e4c1bcf11ee4c55e9d3dad8489a6db210902fdc7..0073b09f3eef21ba0b5fa5873969bf824ea520f2 100644 (file)
@@ -332,11 +332,11 @@ bitmap_ipmac_tlist(const struct ip_set *set,
                    (elem->match == MAC_FILLED &&
                     nla_put(skb, IPSET_ATTR_ETHER, ETH_ALEN,
                             elem->ether)))
-                   goto nla_put_failure;
+                       goto nla_put_failure;
                timeout = elem->match == MAC_UNSET ? elem->timeout
                                : ip_set_timeout_get(elem->timeout);
                if (nla_put_net32(skb, IPSET_ATTR_TIMEOUT, htonl(timeout)))
-                   goto nla_put_failure;
+                       goto nla_put_failure;
                ipset_nest_end(skb, nested);
        }
        ipset_nest_end(skb, atd);
index f9bd61ce4342929b918a49fa129a4c0cdc036db5..57dc1bd4c6cec24a067e8558c3c78005242cdb3b 100644 (file)
@@ -72,7 +72,8 @@ find_set_type(const char *name, u8 family, u8 revision)
 
        list_for_each_entry_rcu(type, &ip_set_type_list, list)
                if (STREQ(type->name, name) &&
-                   (type->family == family || type->family == NFPROTO_UNSPEC) &&
+                   (type->family == family ||
+                    type->family == NFPROTO_UNSPEC) &&
                    revision >= type->revision_min &&
                    revision <= type->revision_max)
                        return type;
@@ -152,7 +153,8 @@ __find_set_type_minmax(const char *name, u8 family, u8 *min, u8 *max,
        rcu_read_lock();
        list_for_each_entry_rcu(type, &ip_set_type_list, list)
                if (STREQ(type->name, name) &&
-                   (type->family == family || type->family == NFPROTO_UNSPEC)) {
+                   (type->family == family ||
+                    type->family == NFPROTO_UNSPEC)) {
                        found = true;
                        if (type->revision_min < *min)
                                *min = type->revision_min;
@@ -729,7 +731,8 @@ ip_set_create(struct sock *ctnl, struct sk_buff *skb,
         * by the nfnl mutex. Find the first free index in ip_set_list
         * and check clashing.
         */
-       if ((ret = find_free_id(set->name, &index, &clash)) != 0) {
+       ret = find_free_id(set->name, &index, &clash);
+       if (ret != 0) {
                /* If this is the same set and requested, ignore error */
                if (ret == -EEXIST &&
                    (flags & IPSET_FLAG_EXIST) &&
index bfe535de3fcf64a3ee9669fbde757be2d42bbee6..47959a21296d6f184865eab25b961c253927adf1 100644 (file)
@@ -8,7 +8,7 @@
 /* Get Layer-4 data from the packets */
 
 #include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
 #include <linux/export.h>
 #endif
 #include <linux/ip.h>
@@ -119,12 +119,12 @@ ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
 {
        int protoff;
        u8 nexthdr;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
        __be16 frag_off;
 #endif
 
        nexthdr = ipv6_hdr(skb)->nexthdr;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
        protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr,
                                   &frag_off);
 #else
index 56ca48015f8d8dbfcb91b6ce2c57fc36ea47ff3b..1fe890f1c387641053c7636663c586a82af256ee 100644 (file)
@@ -1,5 +1,5 @@
 #include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
 #include <linux/export.h>
 #endif
 #include <linux/netfilter/ipset/pfxlen.h>
index d6d29c2d353ed84b944eb19e2aa495b487e5073e..1973307b27d92f995c18f02b9f747c576b4218c9 100644 (file)
@@ -228,12 +228,14 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value)
                break;
        /* CADT options */
        case IPSET_OPT_IP:
-               if (!(data->family == NFPROTO_IPV4 || data->family == NFPROTO_IPV6))
+               if (!(data->family == NFPROTO_IPV4 ||
+                     data->family == NFPROTO_IPV6))
                        return -1;
                copy_addr(data->family, &data->ip, value);
                break;
        case IPSET_OPT_IP_TO:
-               if (!(data->family == NFPROTO_IPV4 || data->family == NFPROTO_IPV6))
+               if (!(data->family == NFPROTO_IPV4 ||
+                     data->family == NFPROTO_IPV6))
                        return -1;
                copy_addr(data->family, &data->ip_to, value);
                break;
@@ -303,12 +305,14 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value)
                ipset_strlcpy(data->adt.nameref, value, IPSET_MAXNAMELEN);
                break;
        case IPSET_OPT_IP2:
-               if (!(data->family == NFPROTO_IPV4 || data->family == NFPROTO_IPV6))
+               if (!(data->family == NFPROTO_IPV4 ||
+                     data->family == NFPROTO_IPV6))
                        return -1;
                copy_addr(data->family, &data->adt.ip2, value);
                break;
        case IPSET_OPT_IP2_TO:
-               if (!(data->family == NFPROTO_IPV4 || data->family == NFPROTO_IPV6))
+               if (!(data->family == NFPROTO_IPV4 ||
+                     data->family == NFPROTO_IPV6))
                        return -1;
                copy_addr(data->family, &data->adt.ip2_to, value);
                break;
@@ -344,11 +348,14 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value)
        case IPSET_OPT_CADT_FLAGS:
                data->cadt_flags = *(const uint32_t *)value;
                if (data->cadt_flags & IPSET_FLAG_BEFORE)
-                       ipset_data_flags_set(data, IPSET_FLAG(IPSET_OPT_BEFORE));
+                       ipset_data_flags_set(data,
+                                            IPSET_FLAG(IPSET_OPT_BEFORE));
                if (data->cadt_flags & IPSET_FLAG_PHYSDEV)
-                       ipset_data_flags_set(data, IPSET_FLAG(IPSET_OPT_PHYSDEV));
+                       ipset_data_flags_set(data,
+                                            IPSET_FLAG(IPSET_OPT_PHYSDEV));
                if (data->cadt_flags & IPSET_FLAG_NOMATCH)
-                       ipset_data_flags_set(data, IPSET_FLAG(IPSET_OPT_NOMATCH));
+                       ipset_data_flags_set(data,
+                                            IPSET_FLAG(IPSET_OPT_NOMATCH));
                break;
        default:
                return -1;
index 486d910c460efe98eea9f2ef9bac3ed8cbbfb8c9..1350053db10d338c346ccbafa8d2872ad2a1460e 100644 (file)
@@ -116,14 +116,16 @@ debug_cadt_attrs(int max, const struct ipset_attr_policy *policy,
                                d = mnl_attr_get_payload(
                                        ipattr[IPSET_ATTR_IPADDR_IPV4]);
 
-                               inet_ntop(NFPROTO_IPV4, d, addr, INET6_ADDRSTRLEN);
+                               inet_ntop(NFPROTO_IPV4, d, addr,
+                                         INET6_ADDRSTRLEN);
                                fprintf(stderr, "\t\t%s: %s\n",
                                        attr2name[i].name, addr);
                        } else if (ipattr[IPSET_ATTR_IPADDR_IPV6]) {
                                d = mnl_attr_get_payload(
                                        ipattr[IPSET_ATTR_IPADDR_IPV6]);
 
-                               inet_ntop(NFPROTO_IPV6, d, addr, INET6_ADDRSTRLEN);
+                               inet_ntop(NFPROTO_IPV6, d, addr,
+                                         INET6_ADDRSTRLEN);
                                fprintf(stderr, "\t\t%s: %s\n",
                                        attr2name[i].name, addr);
                        }
index 74370b2ef72c26217fa2739db96549b935e76351..689ccb0993ca3534042caf24fee7beb3f0f14324 100644 (file)
@@ -106,7 +106,7 @@ global:
   ipset_match_option;
   ipset_match_envopt;
   ipset_shift_argv;
-  
+
 local: *;
 };
 
index 8c67c5899c34ede71e7f524fd0d44ca72218a6bf..65fddd4cb99e6f5f0e6e6414e4f86c247ea753c9 100644 (file)
@@ -63,13 +63,13 @@ static char *
 escape_range_separator(const char *str)
 {
        const char *tmp = NULL;
-       
+
        if (STRNEQ(str, IPSET_ESCAPE_START, 1)) {
                tmp = strstr(str, IPSET_ESCAPE_END);
                if (tmp == NULL)
                        return NULL;
        }
-       
+
        return range_separator(tmp == NULL ? str : tmp);
 }
 
@@ -248,7 +248,7 @@ find_range_separator(struct ipset_session *session, char *str)
 }
 
 static char *
-strip_escape(struct ipset_session *session, char * str)
+strip_escape(struct ipset_session *session, char *str)
 {
        if (STRNEQ(str, IPSET_ESCAPE_START, 1)) {
                if (!STREQ(str + strlen(str) - 1, IPSET_ESCAPE_END)) {
@@ -279,7 +279,7 @@ parse_portname(struct ipset_session *session, const char *str,
        if (tmp == NULL)
                goto error;
 
-       service = getservbyname(tmp, proto);    
+       service = getservbyname(tmp, proto);
        if (service != NULL) {
                *port = ntohs((uint16_t) service->s_port);
                free(saved);
@@ -748,7 +748,8 @@ get_addrinfo(struct ipset_session *session,
        if (found == 0)
                return syntax_err("cannot parse %s: "
                                  "%s address could not be resolved",
-                                 str, family == NFPROTO_IPV4 ? "IPv4" : "IPv6");
+                                 str,
+                                 family == NFPROTO_IPV4 ? "IPv4" : "IPv6");
        return err;
 }
 
@@ -1642,7 +1643,7 @@ ipset_call_parser(struct ipset_session *session,
 
        if (ipset_data_flags_test(data, IPSET_FLAG(arg->opt))
            && !(arg->opt == IPSET_OPT_FAMILY
-                && ipset_data_test_ignored(data, IPSET_OPT_FAMILY)))
+                && ipset_data_test_ignored(data, IPSET_OPT_FAMILY)))
                return syntax_err("%s already specified", arg->name[0]);
 
        return arg->parse(session, arg->opt, str);
index f2f848bf2d9bc76925652c94a77ba8c4cda8eff1..1bd8392a750096f9617f18aeb2db245a6daf7948 100644 (file)
@@ -174,7 +174,7 @@ __getnameinfo4(char *buf, unsigned int len,
                memmove(buf + 1, buf, strlen(buf) + 1);
                buf[0] = escape[0];
                strcat(buf, IPSET_ESCAPE_END);
-       }       
+       }
        return (err == 0 ? (int)strlen(buf) :
               (err == EAI_OVERFLOW || err == EAI_SYSTEM) ? (int)len : -1);
 }
@@ -210,7 +210,7 @@ __getnameinfo6(char *buf, unsigned int len,
                memmove(buf + 1, buf, strlen(buf) + 1);
                buf[0] = escape[0];
                strcat(buf, IPSET_ESCAPE_END);
-       }       
+       }
        return (err == 0 ? (int)strlen(buf) :
               (err == EAI_OVERFLOW || err == EAI_SYSTEM) ? (int)len : -1);
 }
index d5f220f3a7aa8adb73bde2bcee2235ac3ee97d21..8bb62ccd6a04f5d3d98f8c474fb3e1cb89a6c6be 100644 (file)
@@ -1507,7 +1507,8 @@ data2attr(struct ipset_session *session, struct nlmsghdr *nlh,
        data2attr(session, nlh, data, type, family, attrs)
 
 #define ADDATTR_SETNAME(session, nlh, data)                            \
-       data2attr(session, nlh, data, IPSET_ATTR_SETNAME, NFPROTO_IPV4, cmd_attrs)
+       data2attr(session, nlh, data, IPSET_ATTR_SETNAME, NFPROTO_IPV4, \
+                 cmd_attrs)
 
 #define ADDATTR_IF(session, nlh, data, type, family, attrs)            \
        ipset_data_test(data, attrs[type].opt) ?                        \
@@ -1673,8 +1674,8 @@ build_msg(struct ipset_session *session, bool aggregate)
                        ADDATTR_SETNAME(session, nlh, data);
                if (flags && session->mode != IPSET_LIST_SAVE) {
                        ipset_data_set(data, IPSET_OPT_FLAGS, &flags);
-                       ADDATTR(session, nlh, data, IPSET_ATTR_FLAGS, NFPROTO_IPV4,
-                               cmd_attrs);
+                       ADDATTR(session, nlh, data, IPSET_ATTR_FLAGS,
+                               NFPROTO_IPV4, cmd_attrs);
                }
                break;
        }
index 57217059258566bd1fe7f4384c4a8e5102d6a826..adaba83460b250e66f264b530244f9f6dd1271fe 100644 (file)
@@ -306,7 +306,7 @@ found:
 }
 
 #define set_family_and_type(data, match, family) do {          \
-       if (family == NFPROTO_UNSPEC && match->family != NFPROTO_UNSPEC)        \
+       if (family == NFPROTO_UNSPEC && match->family != NFPROTO_UNSPEC) \
                family = match->family == NFPROTO_IPSET_IPV46 ? \
                         NFPROTO_IPV4 : match->family;\
        ipset_data_set(data, IPSET_OPT_FAMILY, &family);        \
@@ -578,9 +578,9 @@ ipset_cache_fini(void)
  *
  * Load in (register) all known set types for the system
  */
- void
- ipset_load_types(void)
- {
+void
+ipset_load_types(void)
+{
 #ifdef ENABLE_SETTYPE_MODULES
        const char *dir  = IPSET_MODSDIR;
        const char *next = NULL;
@@ -591,8 +591,8 @@ ipset_cache_fini(void)
        int    len;
 #endif
 
-       if (typelist != NULL)
-               return;
+       if (typelist != NULL)
+               return;
 
        /* Initialize static types */
        ipset_types_init();
@@ -605,7 +605,7 @@ ipset_cache_fini(void)
                        next = dir + strlen(dir);
 
                len = snprintf(path, sizeof(path), "%.*s",
-                              (unsigned int)(next - dir), dir);
+                              (unsigned int)(next - dir), dir);
 
                if (len >= sizeof(path) || len < 0)
                        continue;
@@ -618,13 +618,13 @@ ipset_cache_fini(void)
                        if (strstr(list[n]->d_name, ".so") == NULL)
                                goto nextf;
 
-                       len = snprintf(file, sizeof(file), "%s/%s", path, list[n]->d_name);
+                       len = snprintf(file, sizeof(file), "%s/%s",
+                                      path, list[n]->d_name);
                        if (len >= sizeof(file) || len < 0)
                                goto nextf;
 
-                       if (dlopen(file, RTLD_NOW) == NULL) {
+                       if (dlopen(file, RTLD_NOW) == NULL)
                                fprintf(stderr, "%s: %s\n", file, dlerror());
-                       }
 
 nextf:
                        free(list[n]);
@@ -634,5 +634,5 @@ nextf:
 
                dir = next + 1;
        } while (*next != '\0');
-#endif // ENABLE_SETTYPE_MODULES
+#endif /* ENABLE_SETTYPE_MODULES */
 }
index 1e69e3ee26be9535597435db9220ad6801426999..51b912a094e9c807edb395af8080a6860e5b7895 100644 (file)
@@ -136,11 +136,11 @@ ipset_parse_file(struct ipset_session *s UNUSED,
                return exit_error(PARAMETER_PROBLEM,
                                  "-file option can be specified once");
        filename = str;
-       
+
        return 0;
 }
 
-static 
+static
 int __attribute__ ((format (printf, 1, 2)))
 ipset_print_file(const char *fmt, ...)
 {
@@ -150,7 +150,7 @@ ipset_print_file(const char *fmt, ...)
        assert(fd != NULL);
        va_start(args, fmt);
        len = vfprintf(fd, fmt, args);
-       va_end(args); 
+       va_end(args);
 
        return len;
 }