diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2012-09-11 17:38:17 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2012-09-11 17:38:17 +0200 |
commit | 3578220cf27c3e7017dd8af6b17c08218cf632d0 (patch) | |
tree | 3dd0a57f443ba93ee4000c40917f2dfbf5646a6e | |
parent | d95c2f1eb788c4ccb1ce6f4add61943dbb334f07 (diff) |
Coding style fixes
-rw-r--r-- | include/libipset/data.h | 3 | ||||
-rw-r--r-- | kernel/include/linux/netfilter/ipset/ip_set.h | 5 | ||||
-rw-r--r-- | kernel/include/linux/netfilter/ipset/ip_set_ahash.h | 2 | ||||
-rw-r--r-- | kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c | 4 | ||||
-rw-r--r-- | kernel/net/netfilter/ipset/ip_set_core.c | 9 | ||||
-rw-r--r-- | kernel/net/netfilter/ipset/ip_set_getport.c | 6 | ||||
-rw-r--r-- | kernel/net/netfilter/ipset/pfxlen.c | 2 | ||||
-rw-r--r-- | lib/data.c | 21 | ||||
-rw-r--r-- | lib/debug.c | 6 | ||||
-rw-r--r-- | lib/libipset.map | 2 | ||||
-rw-r--r-- | lib/parse.c | 13 | ||||
-rw-r--r-- | lib/print.c | 4 | ||||
-rw-r--r-- | lib/session.c | 7 | ||||
-rw-r--r-- | lib/types.c | 22 | ||||
-rw-r--r-- | src/ipset.c | 6 |
15 files changed, 64 insertions, 48 deletions
diff --git a/include/libipset/data.h b/include/libipset/data.h index b7e7747..ce1f1ca 100644 --- a/include/libipset/data.h +++ b/include/libipset/data.h @@ -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); diff --git a/kernel/include/linux/netfilter/ipset/ip_set.h b/kernel/include/linux/netfilter/ipset/ip_set.h index a663dd5..e6bfe3b 100644 --- a/kernel/include/linux/netfilter/ipset/ip_set.h +++ b/kernel/include/linux/netfilter/ipset/ip_set.h @@ -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; diff --git a/kernel/include/linux/netfilter/ipset/ip_set_ahash.h b/kernel/include/linux/netfilter/ipset/ip_set_ahash.h index 8708c34..c43f076 100644 --- a/kernel/include/linux/netfilter/ipset/ip_set_ahash.h +++ b/kernel/include/linux/netfilter/ipset/ip_set_ahash.h @@ -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 diff --git a/kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c index e4c1bcf..0073b09 100644 --- a/kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c +++ b/kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c @@ -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); diff --git a/kernel/net/netfilter/ipset/ip_set_core.c b/kernel/net/netfilter/ipset/ip_set_core.c index f9bd61c..57dc1bd 100644 --- a/kernel/net/netfilter/ipset/ip_set_core.c +++ b/kernel/net/netfilter/ipset/ip_set_core.c @@ -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) && diff --git a/kernel/net/netfilter/ipset/ip_set_getport.c b/kernel/net/netfilter/ipset/ip_set_getport.c index bfe535d..47959a2 100644 --- a/kernel/net/netfilter/ipset/ip_set_getport.c +++ b/kernel/net/netfilter/ipset/ip_set_getport.c @@ -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 diff --git a/kernel/net/netfilter/ipset/pfxlen.c b/kernel/net/netfilter/ipset/pfxlen.c index 56ca480..1fe890f 100644 --- a/kernel/net/netfilter/ipset/pfxlen.c +++ b/kernel/net/netfilter/ipset/pfxlen.c @@ -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> @@ -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; diff --git a/lib/debug.c b/lib/debug.c index 486d910..1350053 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -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); } diff --git a/lib/libipset.map b/lib/libipset.map index 74370b2..689ccb0 100644 --- a/lib/libipset.map +++ b/lib/libipset.map @@ -106,7 +106,7 @@ global: ipset_match_option; ipset_match_envopt; ipset_shift_argv; - + local: *; }; diff --git a/lib/parse.c b/lib/parse.c index 8c67c58..65fddd4 100644 --- a/lib/parse.c +++ b/lib/parse.c @@ -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); diff --git a/lib/print.c b/lib/print.c index f2f848b..1bd8392 100644 --- a/lib/print.c +++ b/lib/print.c @@ -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); } diff --git a/lib/session.c b/lib/session.c index d5f220f..8bb62cc 100644 --- a/lib/session.c +++ b/lib/session.c @@ -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; } diff --git a/lib/types.c b/lib/types.c index 5721705..adaba83 100644 --- a/lib/types.c +++ b/lib/types.c @@ -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 */ } diff --git a/src/ipset.c b/src/ipset.c index 1e69e3e..51b912a 100644 --- a/src/ipset.c +++ b/src/ipset.c @@ -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; } |