diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2011-05-31 19:38:00 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2011-05-31 19:38:00 +0200 |
commit | 3f83fda46c14e47392ce3bb4d7aef5780a80ac78 (patch) | |
tree | 27283f40fe6410a06649095b24fd35039f44929b /lib/debug.c | |
parent | 418a3a4f4d4e38abd1d691f81f2445590f02ecaf (diff) |
Whitespace and coding fixes detected by checkpatch.pl
Diffstat (limited to 'lib/debug.c')
-rw-r--r-- | lib/debug.c | 71 |
1 files changed, 45 insertions, 26 deletions
diff --git a/lib/debug.c b/lib/debug.c index 5b97e6e..931b0c1 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -1,12 +1,12 @@ /* Copyright 2011 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <arpa/inet.h> /* inet_ntop */ -#include <libmnl/libmnl.h> /* libmnl backend */ +#include <libmnl/libmnl.h> /* libmnl backend */ struct ipset_attrname { const char *name; @@ -74,23 +74,24 @@ debug_cadt_attrs(int max, const struct ipset_attr_policy *policy, uint32_t v; int i; - fprintf(stderr,"\t\t%s attributes:\n", policy == create_attrs ? "CREATE" : "ADT"); + fprintf(stderr, "\t\t%s attributes:\n", + policy == create_attrs ? "CREATE" : "ADT"); for (i = IPSET_ATTR_UNSPEC + 1; i <= max; i++) { if (!nla[i]) continue; switch (policy[i].type) { case MNL_TYPE_U8: - v = * (uint8_t *) mnl_attr_get_payload(nla[i]); + v = *(uint8_t *) mnl_attr_get_payload(nla[i]); fprintf(stderr, "\t\t%s: %u\n", attr2name[i].name, v); break; case MNL_TYPE_U16: - v = * (uint16_t *) mnl_attr_get_payload(nla[i]); + v = *(uint16_t *) mnl_attr_get_payload(nla[i]); fprintf(stderr, "\t\t%s: %u\n", attr2name[i].name, ntohs(v)); break; case MNL_TYPE_U32: - v = * (uint32_t *) mnl_attr_get_payload(nla[i]); + v = *(uint32_t *) mnl_attr_get_payload(nla[i]); fprintf(stderr, "\t\t%s: %u\n", attr2name[i].name, ntohl(v)); break; @@ -104,18 +105,23 @@ debug_cadt_attrs(int max, const struct ipset_attr_policy *policy, char addr[INET6_ADDRSTRLEN]; void *d; - if (mnl_attr_parse_nested(nla[i], ipaddr_attr_cb, ipattr) < 0) { - fprintf(stderr, "\t\tIPADDR: cannot validate and parse attributes\n"); + if (mnl_attr_parse_nested(nla[i], ipaddr_attr_cb, + ipattr) < 0) { + fprintf(stderr, + "\t\tIPADDR: cannot validate " + "and parse attributes\n"); continue; } if (ipattr[IPSET_ATTR_IPADDR_IPV4]) { - d = mnl_attr_get_payload(ipattr[IPSET_ATTR_IPADDR_IPV4]); + d = mnl_attr_get_payload( + ipattr[IPSET_ATTR_IPADDR_IPV4]); inet_ntop(AF_INET, 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]); + d = mnl_attr_get_payload( + ipattr[IPSET_ATTR_IPADDR_IPV6]); inet_ntop(AF_INET6, d, addr, INET6_ADDRSTRLEN); fprintf(stderr, "\t\t%s: %s\n", @@ -138,23 +144,23 @@ debug_cmd_attrs(int cmd, struct nlattr *nla[]) uint32_t v; int i; - fprintf(stderr,"\tCommand attributes:\n"); + fprintf(stderr, "\tCommand attributes:\n"); for (i = IPSET_ATTR_UNSPEC + 1; i <= IPSET_ATTR_CMD_MAX; i++) { if (!nla[i]) continue; switch (cmd_attrs[i].type) { case MNL_TYPE_U8: - v = * (uint8_t *) mnl_attr_get_payload(nla[i]); + v = *(uint8_t *) mnl_attr_get_payload(nla[i]); fprintf(stderr, "\t%s: %u\n", cmdattr2name[i].name, v); break; case MNL_TYPE_U16: - v = * (uint16_t *) mnl_attr_get_payload(nla[i]); + v = *(uint16_t *) mnl_attr_get_payload(nla[i]); fprintf(stderr, "\t%s: %u\n", cmdattr2name[i].name, ntohs(v)); break; case MNL_TYPE_U32: - v = * (uint32_t *) mnl_attr_get_payload(nla[i]); + v = *(uint32_t *) mnl_attr_get_payload(nla[i]); fprintf(stderr, "\t%s: %u\n", cmdattr2name[i].name, ntohl(v)); break; @@ -169,8 +175,11 @@ debug_cmd_attrs(int cmd, struct nlattr *nla[]) case IPSET_CMD_ADD: case IPSET_CMD_DEL: case IPSET_CMD_TEST: - if (mnl_attr_parse_nested(nla[i], adt_attr_cb, adt) < 0) { - fprintf(stderr, "\tADT: cannot validate and parse attributes\n"); + if (mnl_attr_parse_nested(nla[i], + adt_attr_cb, adt) < 0) { + fprintf(stderr, + "\tADT: cannot validate " + "and parse attributes\n"); continue; } debug_cadt_attrs(IPSET_ATTR_ADT_MAX, @@ -179,8 +188,12 @@ debug_cmd_attrs(int cmd, struct nlattr *nla[]) adt); break; default: - if (mnl_attr_parse_nested(nla[i], create_attr_cb, cattr) < 0) { - fprintf(stderr, "\tCREATE: cannot validate and parse attributes\n"); + if (mnl_attr_parse_nested(nla[i], + create_attr_cb, + cattr) < 0) { + fprintf(stderr, + "\tCREATE: cannot validate " + "and parse attributes\n"); continue; } debug_cadt_attrs(IPSET_ATTR_CREATE_MAX, @@ -192,15 +205,18 @@ debug_cmd_attrs(int cmd, struct nlattr *nla[]) struct nlattr *tb; mnl_attr_for_each_nested(tb, nla[i]) { memset(adt, 0, sizeof(adt)); - if (mnl_attr_parse_nested(tb, adt_attr_cb, adt) < 0) { - fprintf(stderr, "\tADT: cannot validate and parse attributes\n"); + if (mnl_attr_parse_nested(tb, + adt_attr_cb, adt) < 0) { + fprintf(stderr, + "\tADT: cannot validate " + "and parse attributes\n"); continue; } debug_cadt_attrs(IPSET_ATTR_ADT_MAX, adt_attrs, adtattr2name, adt); - } + } } break; default: @@ -227,8 +243,9 @@ ipset_debug_msg(const char *dir, void *buffer, int len) "\tlen %d\n" "\tseq %u\n", dir, - nlh->nlmsg_type == NLMSG_NOOP ? "NOOP" : - nlh->nlmsg_type == NLMSG_DONE ? "DONE" : "OVERRUN", + nlh->nlmsg_type == NLMSG_NOOP ? "NOOP" : + nlh->nlmsg_type == NLMSG_DONE ? "DONE" : + "OVERRUN", len, nlh->nlmsg_seq); goto next_msg; case NLMSG_ERROR: { @@ -257,8 +274,10 @@ ipset_debug_msg(const char *dir, void *buffer, int len) if (cmd <= IPSET_CMD_NONE || cmd >= IPSET_CMD_MAX) goto next_msg; memset(nla, 0, sizeof(nla)); - if (mnl_attr_parse(nlh, nfmsglen, cmd_attr_cb, nla) < MNL_CB_STOP) { - fprintf(stderr, "\tcannot validate and parse attributes\n"); + if (mnl_attr_parse(nlh, nfmsglen, + cmd_attr_cb, nla) < MNL_CB_STOP) { + fprintf(stderr, "\tcannot validate " + "and parse attributes\n"); goto next_msg; } debug_cmd_attrs(cmd, nla); |