From: Peter Wu Date: Mon, 8 Aug 2016 10:04:01 +0000 (+0200) Subject: trivial: whitespace-only fixes for src and lib X-Git-Tag: libnl3_2_29rc1~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c52087601198f3fb8ec97839e30c6f6309f0d680;p=libnl trivial: whitespace-only fixes for src and lib Fixes alignment, lines with just whitespace and mixed tab/space indentation. Searched, reviewed and optionally fixed in vim using regex ^\t* [\t ]*\([^*us ]\|$\)\|\t\+$ http://lists.infradead.org/pipermail/libnl/2016-August/002183.html Signed-off-by: Peter Wu Signed-off-by: Thomas Haller --- diff --git a/lib/cache.c b/lib/cache.c index 9aba0c9..d8592b6 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -235,7 +235,7 @@ int nl_cache_alloc_and_fill(struct nl_cache_ops *ops, struct nl_sock *sock, { struct nl_cache *cache; int err; - + if (!(cache = nl_cache_alloc(ops))) return -NLE_NOMEM; @@ -527,7 +527,7 @@ int nl_cache_move(struct nl_cache *cache, struct nl_object *obj) NL_DBG(3, "Moving object %p from cache %p to cache %p\n", obj, obj->ce_cache, cache); - + /* Acquire reference, if already in a cache this will be * reverted during removal */ nl_object_get(obj); @@ -589,7 +589,7 @@ void nl_cache_remove(struct nl_object *obj) */ void nl_cache_set_arg1(struct nl_cache *cache, int arg) { - cache->c_iarg1 = arg; + cache->c_iarg1 = arg; } /** @@ -602,7 +602,7 @@ void nl_cache_set_arg1(struct nl_cache *cache, int arg) */ void nl_cache_set_arg2(struct nl_cache *cache, int arg) { - cache->c_iarg2 = arg; + cache->c_iarg2 = arg; } /** @@ -1038,8 +1038,8 @@ static struct nl_object *__cache_fast_lookup(struct nl_cache *cache, obj = nl_hash_table_lookup(cache->hashtable, needle); if (obj) { - nl_object_get(obj); - return obj; + nl_object_get(obj); + return obj; } return NULL; diff --git a/lib/cli/cls/basic.c b/lib/cli/cls/basic.c index 1939988..1a6b188 100644 --- a/lib/cli/cls/basic.c +++ b/lib/cli/cls/basic.c @@ -49,7 +49,7 @@ static void parse_argv(struct rtnl_tc *tc, int argc, char **argv) { "ematch", 1, 0, 'e' }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "ht:e:", long_opts, &optidx); if (c == -1) break; @@ -72,7 +72,7 @@ static void parse_argv(struct rtnl_tc *tc, int argc, char **argv) rtnl_basic_set_ematch(cls, tree); break; } - } + } } static struct nl_cli_tc_module basic_module = diff --git a/lib/cli/cls/cgroup.c b/lib/cli/cls/cgroup.c index fae6208..9e1443c 100644 --- a/lib/cli/cls/cgroup.c +++ b/lib/cli/cls/cgroup.c @@ -39,7 +39,7 @@ static void parse_argv(struct rtnl_tc *tc, int argc, char **argv) { "ematch", 1, 0, 'e' }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "he:", long_opts, &optidx); if (c == -1) break; @@ -54,7 +54,7 @@ static void parse_argv(struct rtnl_tc *tc, int argc, char **argv) rtnl_cgroup_set_ematch(cls, tree); break; } - } + } } static struct nl_cli_tc_module cgroup_module = diff --git a/lib/cli/qdisc/bfifo.c b/lib/cli/qdisc/bfifo.c index 1ee4777..6b0206f 100644 --- a/lib/cli/qdisc/bfifo.c +++ b/lib/cli/qdisc/bfifo.c @@ -42,7 +42,7 @@ static void bfifo_parse_argv(struct rtnl_tc *tc, int argc, char **argv) { "limit", 1, 0, ARG_LIMIT }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "h", long_opts, &optidx); if (c == -1) break; @@ -62,7 +62,7 @@ static void bfifo_parse_argv(struct rtnl_tc *tc, int argc, char **argv) rtnl_qdisc_fifo_set_limit(qdisc, limit); break; } - } + } } static struct nl_cli_tc_module bfifo_module = diff --git a/lib/cli/qdisc/blackhole.c b/lib/cli/qdisc/blackhole.c index af9dc6d..372855f 100644 --- a/lib/cli/qdisc/blackhole.c +++ b/lib/cli/qdisc/blackhole.c @@ -33,7 +33,7 @@ static void blackhole_parse_argv(struct rtnl_tc *tc, int argc, char **argv) { "help", 0, 0, 'h' }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "h", long_opts, &optidx); if (c == -1) break; @@ -43,7 +43,7 @@ static void blackhole_parse_argv(struct rtnl_tc *tc, int argc, char **argv) print_usage(); return; } - } + } } static struct nl_cli_tc_module blackhole_module = diff --git a/lib/cli/qdisc/fq_codel.c b/lib/cli/qdisc/fq_codel.c index 1602bcb..a592f90 100644 --- a/lib/cli/qdisc/fq_codel.c +++ b/lib/cli/qdisc/fq_codel.c @@ -55,7 +55,7 @@ static void fq_codel_parse_argv(struct rtnl_tc *tc, int argc, char **argv) { "target", 1, 0, ARG_TARGET}, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "h", long_opts, &optidx); if (c == -1) break; @@ -91,7 +91,7 @@ static void fq_codel_parse_argv(struct rtnl_tc *tc, int argc, char **argv) break; } - } + } } static struct nl_cli_tc_module fq_codel_module = diff --git a/lib/cli/qdisc/htb.c b/lib/cli/qdisc/htb.c index 1751595..628e6cc 100644 --- a/lib/cli/qdisc/htb.c +++ b/lib/cli/qdisc/htb.c @@ -44,7 +44,7 @@ static void htb_parse_qdisc_argv(struct rtnl_tc *tc, int argc, char **argv) { "default", 1, 0, ARG_DEFAULT }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "hv", long_opts, &optidx); if (c == -1) break; @@ -62,7 +62,7 @@ static void htb_parse_qdisc_argv(struct rtnl_tc *tc, int argc, char **argv) rtnl_htb_set_defcls(qdisc, nl_cli_parse_u32(optarg)); break; } - } + } } static void print_class_usage(void) @@ -109,7 +109,7 @@ static void htb_parse_class_argv(struct rtnl_tc *tc, int argc, char **argv) { "cburst", 1, 0, ARG_CBURST }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "h", long_opts, &optidx); if (c == -1) break; @@ -173,7 +173,7 @@ static void htb_parse_class_argv(struct rtnl_tc *tc, int argc, char **argv) rtnl_htb_set_cbuffer(class, rate); break; } - } + } } static struct nl_cli_tc_module htb_qdisc_module = diff --git a/lib/cli/qdisc/pfifo.c b/lib/cli/qdisc/pfifo.c index 02c4d22..7aac7df 100644 --- a/lib/cli/qdisc/pfifo.c +++ b/lib/cli/qdisc/pfifo.c @@ -42,7 +42,7 @@ static void pfifo_parse_argv(struct rtnl_tc *tc, int argc, char **argv) { "limit", 1, 0, ARG_LIMIT }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "h", long_opts, &optidx); if (c == -1) break; @@ -56,7 +56,7 @@ static void pfifo_parse_argv(struct rtnl_tc *tc, int argc, char **argv) rtnl_qdisc_fifo_set_limit(qdisc, nl_cli_parse_u32(optarg)); break; } - } + } } static struct nl_cli_tc_module pfifo_module = diff --git a/lib/cli/qdisc/plug.c b/lib/cli/qdisc/plug.c index 2b8d5d6..227082d 100644 --- a/lib/cli/qdisc/plug.c +++ b/lib/cli/qdisc/plug.c @@ -66,7 +66,7 @@ static void plug_parse_argv(struct rtnl_tc *tc, int argc, char **argv) { "release-indefinite", 0, 0, ARG_RELEASE_INDEFINITE }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "h", long_opts, &optidx); if (c == -1) break; @@ -85,14 +85,14 @@ static void plug_parse_argv(struct rtnl_tc *tc, int argc, char **argv) break; case ARG_RELEASE_ONE: - rtnl_qdisc_plug_release_one(qdisc); + rtnl_qdisc_plug_release_one(qdisc); break; case ARG_RELEASE_INDEFINITE: rtnl_qdisc_plug_release_indefinite(qdisc); break; } - } + } } static struct nl_cli_tc_module plug_module = diff --git a/lib/idiag/idiag.c b/lib/idiag/idiag.c index 26681c7..5fd7447 100644 --- a/lib/idiag/idiag.c +++ b/lib/idiag/idiag.c @@ -259,18 +259,18 @@ char *idiagnl_tcpopts2str(uint8_t attrs, char *buf, size_t len) */ char * idiagnl_shutdown2str(uint8_t shutdown, char *buf, size_t len) { - if (shutdown == 0) { - snprintf(buf, len, " "); - return buf; - } else if (shutdown == 1) { - snprintf(buf, len, "receive shutdown"); - return buf; - } else if (shutdown == 2) { - snprintf(buf, len, "send shutdown"); - return buf; - } + if (shutdown == 0) { + snprintf(buf, len, " "); + return buf; + } else if (shutdown == 1) { + snprintf(buf, len, "receive shutdown"); + return buf; + } else if (shutdown == 2) { + snprintf(buf, len, "send shutdown"); + return buf; + } - return NULL; + return NULL; } /** @} */ diff --git a/lib/netfilter/ct.c b/lib/netfilter/ct.c index d589790..62ee77f 100644 --- a/lib/netfilter/ct.c +++ b/lib/netfilter/ct.c @@ -114,7 +114,7 @@ static int ct_parse_ip(struct nfnl_ct *ct, int repl, struct nlattr *attr) struct nl_addr *addr; int err; - err = nla_parse_nested(tb, CTA_IP_MAX, attr, ct_ip_policy); + err = nla_parse_nested(tb, CTA_IP_MAX, attr, ct_ip_policy); if (err < 0) goto errout; diff --git a/lib/netfilter/ct_obj.c b/lib/netfilter/ct_obj.c index 1079ec0..0cc87be 100644 --- a/lib/netfilter/ct_obj.c +++ b/lib/netfilter/ct_obj.c @@ -477,7 +477,7 @@ char *nfnl_ct_tcp_state2str(uint8_t state, char *buf, size_t len) int nfnl_ct_str2tcp_state(const char *name) { - return __str2type(name, tcp_states, ARRAY_SIZE(tcp_states)); + return __str2type(name, tcp_states, ARRAY_SIZE(tcp_states)); } void nfnl_ct_set_status(struct nfnl_ct *ct, uint32_t status) diff --git a/lib/netfilter/exp_obj.c b/lib/netfilter/exp_obj.c index aef43b7..cf61209 100644 --- a/lib/netfilter/exp_obj.c +++ b/lib/netfilter/exp_obj.c @@ -132,7 +132,7 @@ static int exp_clone(struct nl_object *_dst, struct nl_object *_src) dst->exp_mask.dst = addr; } - // NAT + // NAT if (src->exp_nat.src) { addr = nl_addr_clone(src->exp_nat.src); if (!addr) @@ -200,7 +200,7 @@ static void exp_dump_tuples(struct nfnl_exp *exp, struct nl_dump_params *p) if (nfnl_exp_test_dst(exp, i)) tuple_dst = nfnl_exp_get_dst(exp, i); - // Don't have tests for individual ports/types/codes/ids, + // Don't have tests for individual ports/types/codes/ids, if (nfnl_exp_test_l4protonum(exp, i)) { nl_dump(p, "%s ", nl_ip_proto2str(nfnl_exp_get_l4protonum(exp, i), buf, sizeof(buf))); @@ -286,17 +286,17 @@ static int exp_cmp_l4proto_ports (union nfnl_exp_protodata *a, union nfnl_exp_pr // Must return 0 for match, 1 for mismatch int d = 0; d = ( (a->port.src != b->port.src) || - (a->port.dst != b->port.dst) ); + (a->port.dst != b->port.dst) ); return d; } static int exp_cmp_l4proto_icmp (union nfnl_exp_protodata *a, union nfnl_exp_protodata *b) { - // Must return 0 for match, 1 for mismatch + // Must return 0 for match, 1 for mismatch int d = 0; d = ( (a->icmp.code != b->icmp.code) || - (a->icmp.type != b->icmp.type) || - (a->icmp.id != b->icmp.id) ); + (a->icmp.type != b->icmp.type) || + (a->icmp.id != b->icmp.id) ); return d; } diff --git a/lib/nl.c b/lib/nl.c index 2d1ce81..123f657 100644 --- a/lib/nl.c +++ b/lib/nl.c @@ -761,7 +761,7 @@ retry: goto retry; } - if (flags != 0) { + if (flags != 0) { /* Buffer is big enough, do the actual reading */ flags = 0; goto retry; @@ -988,7 +988,7 @@ continue_reading: /* Error message reported back from kernel. */ if (cb->cb_err) { err = cb->cb_err(&nla, e, - cb->cb_err_arg); + cb->cb_err_arg); if (err < 0) goto out; else if (err == NL_SKIP) @@ -1206,7 +1206,7 @@ int nl_pickup_keep_syserr(struct nl_sock *sk, struct nl_cb *cb; int err; struct pickup_param pp = { - .parser = parser, + .parser = parser, }; cb = nl_cb_clone(sk->s_cb); diff --git a/lib/object.c b/lib/object.c index 06c2a95..64e3b07 100644 --- a/lib/object.c +++ b/lib/object.c @@ -295,12 +295,12 @@ void nl_object_dump(struct nl_object *obj, struct nl_dump_params *params) void nl_object_dump_buf(struct nl_object *obj, char *buf, size_t len) { - struct nl_dump_params dp = { - .dp_buf = buf, - .dp_buflen = len, - }; + struct nl_dump_params dp = { + .dp_buf = buf, + .dp_buflen = len, + }; - return nl_object_dump(obj, &dp); + return nl_object_dump(obj, &dp); } /** diff --git a/lib/route/act.c b/lib/route/act.c index 7ec91ba..e429e00 100644 --- a/lib/route/act.c +++ b/lib/route/act.c @@ -54,14 +54,14 @@ int rtnl_act_remove(struct rtnl_act **head, struct rtnl_act *act) { struct rtnl_act *a, **ap; - for (ap = head; (a = *ap) != NULL; ap = &a->a_next) - if (a == act) - break; - if (a) { - *ap = a->a_next; - a->a_next = NULL; - return 0; - } + for (ap = head; (a = *ap) != NULL; ap = &a->a_next) + if (a == act) + break; + if (a) { + *ap = a->a_next; + a->a_next = NULL; + return 0; + } return -NLE_OBJ_NOTFOUND; } diff --git a/lib/route/cls/ematch_syntax.y b/lib/route/cls/ematch_syntax.y index da21039..b28eb3c 100644 --- a/lib/route/cls/ematch_syntax.y +++ b/lib/route/cls/ematch_syntax.y @@ -53,9 +53,9 @@ extern int ematch_lex(YYSTYPE *, void *); static void yyerror(void *scanner, char **errp, struct nl_list_head *root, const char *msg) { if (msg) - *errp = strdup(msg); - else - *errp = NULL; + *errp = strdup(msg); + else + *errp = NULL; } %} diff --git a/lib/route/link.c b/lib/route/link.c index 4f86b0e..a18e885 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -364,7 +364,7 @@ int rtnl_link_info_parse(struct rtnl_link *link, struct nlattr **tb) nla_memcpy(&st, tb[IFLA_STATS64], sizeof(struct rtnl_link_stats64)); - + link->l_stats[RTNL_LINK_RX_PACKETS] = st.rx_packets; link->l_stats[RTNL_LINK_TX_PACKETS] = st.tx_packets; link->l_stats[RTNL_LINK_RX_BYTES] = st.rx_bytes; @@ -523,8 +523,8 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, link->l_flags = ifi->ifi_flags; link->l_change = ifi->ifi_change; link->ce_mask = (LINK_ATTR_IFNAME | LINK_ATTR_FAMILY | - LINK_ATTR_ARPTYPE| LINK_ATTR_IFINDEX | - LINK_ATTR_FLAGS | LINK_ATTR_CHANGE); + LINK_ATTR_ARPTYPE| LINK_ATTR_IFINDEX | + LINK_ATTR_FLAGS | LINK_ATTR_CHANGE); if ((af_ops_family = af_ops = af_lookup_and_alloc(link, family))) { if (af_ops->ao_protinfo_policy) { @@ -835,7 +835,7 @@ static void link_dump_stats(struct nl_object *obj, struct nl_dump_params *p) struct rtnl_link *link = (struct rtnl_link *) obj; char *unit, fmt[64]; float res; - + link_dump_details(obj, p); nl_dump_line(p, " Stats: bytes packets errors " @@ -845,7 +845,7 @@ static void link_dump_stats(struct nl_object *obj, struct nl_dump_params *p) strcpy(fmt, " RX %X.2f %s %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 "\n"); fmt[9] = *unit == 'B' ? '9' : '7'; - + nl_dump_line(p, fmt, res, unit, link->l_stats[RTNL_LINK_RX_PACKETS], link->l_stats[RTNL_LINK_RX_ERRORS], @@ -857,7 +857,7 @@ static void link_dump_stats(struct nl_object *obj, struct nl_dump_params *p) strcpy(fmt, " TX %X.2f %s %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 "\n"); fmt[9] = *unit == 'B' ? '9' : '7'; - + nl_dump_line(p, fmt, res, unit, link->l_stats[RTNL_LINK_TX_PACKETS], link->l_stats[RTNL_LINK_TX_ERRORS], @@ -880,7 +880,7 @@ static void link_dump_stats(struct nl_object *obj, struct nl_dump_params *p) nl_dump_line(p, " aborted carrier heartbeat " " window collision\n"); - + nl_dump_line(p, " TX %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 "\n", link->l_stats[RTNL_LINK_TX_ABORT_ERR], @@ -1093,7 +1093,7 @@ int rtnl_link_alloc_cache_flags(struct nl_sock *sk, int family, { struct nl_cache * cache; int err; - + cache = nl_cache_alloc(&rtnl_link_ops); if (!cache) return -NLE_NOMEM; @@ -1316,8 +1316,8 @@ int rtnl_link_get_kernel(struct nl_sock *sk, int ifindex, const char *name, *result = (struct rtnl_link *) obj; /* If an object has been returned, we also need to wait for the ACK */ - if (err == 0 && obj) - wait_for_ack(sk); + if (err == 0 && obj) + wait_for_ack(sk); return 0; } @@ -1363,7 +1363,7 @@ int rtnl_link_name2i(struct nl_cache *cache, const char *name) { int ifindex = 0; struct rtnl_link *link; - + link = rtnl_link_get_by_name(cache, name); if (link) { ifindex = link->l_index; @@ -1540,7 +1540,7 @@ int rtnl_link_add(struct nl_sock *sk, struct rtnl_link *link, int flags) { struct nl_msg *msg; int err; - + err = rtnl_link_build_add_request(link, flags, &msg); if (err < 0) return err; @@ -1641,7 +1641,7 @@ int rtnl_link_change(struct nl_sock *sk, struct rtnl_link *orig, { struct nl_msg *msg; int err; - + err = rtnl_link_build_change_request(orig, changes, flags, &msg); if (err < 0) return err; @@ -1740,7 +1740,7 @@ int rtnl_link_delete(struct nl_sock *sk, const struct rtnl_link *link) { struct nl_msg *msg; int err; - + if ((err = rtnl_link_build_delete_request(link, &msg)) < 0) return err; @@ -2578,7 +2578,7 @@ int rtnl_link_enslave_ifindex(struct nl_sock *sock, int master, int slave) rtnl_link_set_ifindex(link, slave); rtnl_link_set_master(link, master); - + if ((err = rtnl_link_change(sock, link, link, 0)) < 0) goto errout; diff --git a/lib/route/link/ipgre.c b/lib/route/link/ipgre.c index 7be311a..7dca4d5 100644 --- a/lib/route/link/ipgre.c +++ b/lib/route/link/ipgre.c @@ -159,7 +159,7 @@ static int ipgre_parse(struct rtnl_link *link, struct nlattr *data, err = 0; - errout: +errout: return err; } @@ -204,7 +204,7 @@ static int ipgre_put_attrs(struct nl_msg *msg, struct rtnl_link *link) nla_nest_end(msg, data); - nla_put_failure: +nla_put_failure: return 0; } diff --git a/lib/route/link/ipvti.c b/lib/route/link/ipvti.c index 7021a94..edf71f5 100644 --- a/lib/route/link/ipvti.c +++ b/lib/route/link/ipvti.c @@ -1,4 +1,4 @@ - /* +/* * lib/route/link/ipvti.c IPVTI Link Info * * This library is free software; you can redistribute it and/or @@ -118,7 +118,7 @@ static int ipvti_parse(struct rtnl_link *link, struct nlattr *data, err = 0; - errout: +errout: return err; } diff --git a/lib/route/link/sit.c b/lib/route/link/sit.c index c64cbf5..8856513 100644 --- a/lib/route/link/sit.c +++ b/lib/route/link/sit.c @@ -176,7 +176,7 @@ static int sit_parse(struct rtnl_link *link, struct nlattr *data, err = 0; - errout: +errout: return err; } diff --git a/lib/route/neightbl.c b/lib/route/neightbl.c index 7fd106b..e381249 100644 --- a/lib/route/neightbl.c +++ b/lib/route/neightbl.c @@ -135,7 +135,7 @@ static int neightbl_msg_parser(struct nl_cache_ops *ops, ntbl->ce_msgtype = n->nlmsg_type; rtmsg = nlmsg_data(n); - + err = nlmsg_parse(n, sizeof(*rtmsg), tb, NDTA_MAX, neightbl_policy); if (err < 0) goto errout; @@ -236,7 +236,7 @@ static void neightbl_dump_line(struct nl_object *arg, struct nl_dump_params *p) if (ntbl->nt_parms.ntp_mask & NEIGHTBLPARM_ATTR_IFINDEX) { struct nl_cache *link_cache; - + link_cache = nl_cache_mngt_require_safe("route/link"); if (link_cache) { @@ -278,10 +278,10 @@ static void neightbl_dump_details(struct nl_object *arg, struct nl_dump_params * ntbl->nt_config.ndtc_key_len, ntbl->nt_config.ndtc_entry_size, nl_msec2str(ntbl->nt_config.ndtc_last_flush, - x, sizeof(x))); + x, sizeof(x))); nl_dump_line(p, " gc threshold %u/%u/%u interval %s " \ - "chain-position %u\n", + "chain-position %u\n", ntbl->nt_gc_thresh1, ntbl->nt_gc_thresh2, ntbl->nt_gc_thresh3, nl_msec2str(ntbl->nt_gc_interval, x, sizeof(x)), @@ -291,33 +291,33 @@ static void neightbl_dump_details(struct nl_object *arg, struct nl_dump_params * ntbl->nt_config.ndtc_hash_rnd, ntbl->nt_config.ndtc_hash_mask, nl_msec2str(ntbl->nt_config.ndtc_last_rand, - x, sizeof(x))); + x, sizeof(x))); } if (ntbl->ce_mask & NEIGHTBL_ATTR_PARMS) { struct rtnl_neightbl_parms *pa = &ntbl->nt_parms; nl_dump_line(p, " refcnt %u pending-queue-limit %u " \ - "proxy-delayed-queue-limit %u\n", + "proxy-delayed-queue-limit %u\n", pa->ntp_refcnt, pa->ntp_queue_len, pa->ntp_proxy_qlen); nl_dump_line(p, " num-userspace-probes %u num-unicast-probes " \ - "%u num-multicast-probes %u\n", + "%u num-multicast-probes %u\n", pa->ntp_app_probes, pa->ntp_ucast_probes, pa->ntp_mcast_probes); nl_dump_line(p, " min-age %s base-reachable-time %s " \ - "stale-check-interval %s\n", + "stale-check-interval %s\n", nl_msec2str(pa->ntp_locktime, x, sizeof(x)), nl_msec2str(pa->ntp_base_reachable_time, - y, sizeof(y)), + y, sizeof(y)), nl_msec2str(pa->ntp_gc_stale_time, z, sizeof(z))); nl_dump_line(p, " initial-probe-delay %s answer-delay %s " \ - "proxy-answer-delay %s\n", + "proxy-answer-delay %s\n", nl_msec2str(pa->ntp_probe_delay, x, sizeof(x)), nl_msec2str(pa->ntp_anycast_delay, y, sizeof(y)), nl_msec2str(pa->ntp_proxy_delay, z, sizeof(z))); @@ -334,12 +334,12 @@ static void neightbl_dump_stats(struct nl_object *arg, struct nl_dump_params *p) return; nl_dump_line(p, " " \ - " lookups %" PRIu64 \ - " hits %" PRIu64 \ - " failed %" PRIu64 \ - " allocations %" PRIu64 \ - " destroys %" PRIu64 \ - "\n", + " lookups %" PRIu64 \ + " hits %" PRIu64 \ + " failed %" PRIu64 \ + " allocations %" PRIu64 \ + " destroys %" PRIu64 \ + "\n", ntbl->nt_stats.ndts_lookups, ntbl->nt_stats.ndts_hits, ntbl->nt_stats.ndts_res_failed, @@ -347,18 +347,18 @@ static void neightbl_dump_stats(struct nl_object *arg, struct nl_dump_params *p) ntbl->nt_stats.ndts_destroys); nl_dump_line(p, " " \ - " hash-grows %" PRIu64 \ - " forced-gc-runs %" PRIu64 \ - " periodic-gc-runs %" PRIu64 \ - "\n", + " hash-grows %" PRIu64 \ + " forced-gc-runs %" PRIu64 \ + " periodic-gc-runs %" PRIu64 \ + "\n", ntbl->nt_stats.ndts_hash_grows, ntbl->nt_stats.ndts_forced_gc_runs, ntbl->nt_stats.ndts_periodic_gc_runs); nl_dump_line(p, " " \ - " rcv-unicast-probes %" PRIu64 \ - " rcv-multicast-probes %" PRIu64 \ - "\n", + " rcv-unicast-probes %" PRIu64 \ + " rcv-multicast-probes %" PRIu64 \ + "\n", ntbl->nt_stats.ndts_rcv_probes_ucast, ntbl->nt_stats.ndts_rcv_probes_mcast); } diff --git a/lib/route/qdisc/htb.c b/lib/route/qdisc/htb.c index 0277000..c1e3230 100644 --- a/lib/route/qdisc/htb.c +++ b/lib/route/qdisc/htb.c @@ -55,7 +55,7 @@ static int htb_qdisc_msg_parser(struct rtnl_tc *tc, void *data) if ((err = tca_parse(tb, TCA_HTB_MAX, tc, htb_policy)) < 0) return err; - + if (tb[TCA_HTB_INIT]) { struct tc_htb_glob opts; @@ -78,7 +78,7 @@ static int htb_class_msg_parser(struct rtnl_tc *tc, void *data) if ((err = tca_parse(tb, TCA_HTB_MAX, tc, htb_policy)) < 0) return err; - + if (tb[TCA_HTB_PARMS]) { struct tc_htb_opt opts; @@ -191,9 +191,9 @@ static int htb_qdisc_msg_fill(struct rtnl_tc *tc, void *data, { struct rtnl_htb_qdisc *htb = data; struct tc_htb_glob opts = { - .version = TC_HTB_PROTOVER, - .rate2quantum = 10, - }; + .version = TC_HTB_PROTOVER, + .rate2quantum = 10, + }; if (htb) { if (htb->qh_mask & SCH_HTB_HAS_RATE2QUANTUM) diff --git a/lib/route/qdisc/netem.c b/lib/route/qdisc/netem.c index abca855..399fd2c 100644 --- a/lib/route/qdisc/netem.c +++ b/lib/route/qdisc/netem.c @@ -106,18 +106,18 @@ static int netem_msg_parser(struct rtnl_tc *tc, void *data) netem->qnm_mask |= (SCH_NETEM_ATTR_RO_PROB | SCH_NETEM_ATTR_RO_CORR); } - + if (tb[TCA_NETEM_CORRUPT]) { struct tc_netem_corrupt corrupt; - + nla_memcpy(&corrupt, tb[TCA_NETEM_CORRUPT], sizeof(corrupt)); netem->qnm_crpt.nmcr_probability = corrupt.probability; netem->qnm_crpt.nmcr_correlation = corrupt.correlation; - + netem->qnm_mask |= (SCH_NETEM_ATTR_CORRUPT_PROB | SCH_NETEM_ATTR_CORRUPT_CORR); } - + /* sch_netem does not currently dump TCA_NETEM_DELAY_DIST */ netem->qnm_dist.dist_data = NULL; netem->qnm_dist.dist_size = 0; @@ -129,10 +129,10 @@ static int netem_msg_parser(struct rtnl_tc *tc, void *data) static void netem_free_data(struct rtnl_tc *tc, void *data) { struct rtnl_netem *netem = data; - + if (!netem) return; - + free(netem->qnm_dist.dist_data); } @@ -211,7 +211,7 @@ static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, struct tc_netem_reorder reorder; struct tc_netem_corrupt corrupt; struct rtnl_netem *netem = data; - + unsigned char set_correlation = 0, set_reorder = 0, set_corrupt = 0, set_dist = 0; @@ -224,7 +224,7 @@ static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, memset(&corrupt, 0, sizeof(corrupt)); msg->nm_nlh->nlmsg_flags |= NLM_F_REQUEST; - + if ( netem->qnm_ro.nmro_probability != 0 ) { if (netem->qnm_latency == 0) { return -NLE_MISSING_ATTR; @@ -241,7 +241,7 @@ static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, } set_correlation = 1; } - + if ( netem->qnm_corr.nmc_loss != 0 ) { if ( netem->qnm_loss == 0 ) { return -NLE_MISSING_ATTR; @@ -255,17 +255,17 @@ static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, } set_correlation = 1; } - + if ( netem->qnm_ro.nmro_probability != 0 ) set_reorder = 1; else if ( netem->qnm_ro.nmro_correlation != 0 ) { return -NLE_MISSING_ATTR; } - + if ( netem->qnm_crpt.nmcr_probability != 0 ) set_corrupt = 1; else if ( netem->qnm_crpt.nmcr_correlation != 0 ) { return -NLE_MISSING_ATTR; } - + if ( netem->qnm_dist.dist_data && netem->qnm_dist.dist_size ) { if (netem->qnm_latency == 0 || netem->qnm_jitter == 0) { return -NLE_MISSING_ATTR; @@ -274,7 +274,7 @@ static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, /* Resize to accomodate the large distribution table */ int new_msg_len = msg->nm_size + netem->qnm_dist.dist_size * sizeof(netem->qnm_dist.dist_data[0]); - + msg->nm_nlh = (struct nlmsghdr *) realloc(msg->nm_nlh, new_msg_len); if ( msg->nm_nlh == NULL ) return -NLE_NOMEM; @@ -282,16 +282,16 @@ static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, set_dist = 1; } } - + opts.latency = netem->qnm_latency; opts.limit = netem->qnm_limit ? netem->qnm_limit : 1000; opts.loss = netem->qnm_loss; opts.gap = netem->qnm_gap; opts.duplicate = netem->qnm_duplicate; opts.jitter = netem->qnm_jitter; - + NLA_PUT(msg, TCA_OPTIONS, sizeof(opts), &opts); - + if ( set_correlation ) { cor.delay_corr = netem->qnm_corr.nmc_delay; cor.loss_corr = netem->qnm_corr.nmc_loss; @@ -299,21 +299,21 @@ static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, NLA_PUT(msg, TCA_NETEM_CORR, sizeof(cor), &cor); } - + if ( set_reorder ) { reorder.probability = netem->qnm_ro.nmro_probability; reorder.correlation = netem->qnm_ro.nmro_correlation; NLA_PUT(msg, TCA_NETEM_REORDER, sizeof(reorder), &reorder); } - + if ( set_corrupt ) { corrupt.probability = netem->qnm_crpt.nmcr_probability; corrupt.correlation = netem->qnm_crpt.nmcr_correlation; NLA_PUT(msg, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt); } - + if ( set_dist ) { NLA_PUT(msg, TCA_NETEM_DELAY_DIST, netem->qnm_dist.dist_size * sizeof(netem->qnm_dist.dist_data[0]), @@ -326,14 +326,14 @@ static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, */ struct nlattr* head = (struct nlattr *)(NLMSG_DATA(msg->nm_nlh) + NLMSG_LENGTH(sizeof(struct tcmsg)) - NLMSG_ALIGNTO); - + struct nlattr* tail = (struct nlattr *)(((void *) (msg->nm_nlh)) + NLMSG_ALIGN(msg->nm_nlh->nlmsg_len)); - + int old_len = head->nla_len; head->nla_len = (void *)tail - (void *)head; msg->nm_nlh->nlmsg_len += (head->nla_len - old_len); - + return err; nla_put_failure: return -NLE_MSGSIZE; @@ -356,7 +356,7 @@ void rtnl_netem_set_limit(struct rtnl_qdisc *qdisc, int limit) if (!(netem = rtnl_tc_data(TC_CAST(qdisc)))) BUG(); - + netem->qnm_limit = limit; netem->qnm_mask |= SCH_NETEM_ATTR_LIMIT; } @@ -497,7 +497,7 @@ int rtnl_netem_get_reorder_correlation(struct rtnl_qdisc *qdisc) * @name Corruption * @{ */ - + /** * Set corruption probability of netem qdisc. * @arg qdisc Netem qdisc to be modified. @@ -882,7 +882,7 @@ int rtnl_netem_set_delay_distribution(struct rtnl_qdisc *qdisc, const char *dist if (!(netem = rtnl_tc_data(TC_CAST(qdisc)))) BUG(); - + FILE *f; int n = 0; size_t i; @@ -890,31 +890,31 @@ int rtnl_netem_set_delay_distribution(struct rtnl_qdisc *qdisc, const char *dist char *line; char name[NAME_MAX]; char dist_suffix[] = ".dist"; - + /* If the given filename already ends in .dist, don't append it later */ char *test_suffix = strstr(dist_type, dist_suffix); if (test_suffix != NULL && strlen(test_suffix) == 5) strcpy(dist_suffix, ""); - + /* Check several locations for the dist file */ char *test_path[] = { "", "./", "/usr/lib/tc/", "/usr/local/lib/tc/" }; - + for (i = 0; i < ARRAY_SIZE(test_path); i++) { snprintf(name, NAME_MAX, "%s%s%s", test_path[i], dist_type, dist_suffix); if ((f = fopen(name, "r"))) break; } - + if ( f == NULL ) return -nl_syserr2nlerr(errno); - + netem->qnm_dist.dist_data = (int16_t *) calloc (MAXDIST, sizeof(int16_t)); - + line = (char *) calloc (sizeof(char), len + 1); - + while (getline(&line, &len, f) != -1) { char *p, *endp; - + if (*line == '\n' || *line == '#') continue; @@ -928,16 +928,16 @@ int rtnl_netem_set_delay_distribution(struct rtnl_qdisc *qdisc, const char *dist return -NLE_INVAL; } netem->qnm_dist.dist_data[n++] = x; - } + } } - + free(line); - + netem->qnm_dist.dist_size = n; netem->qnm_mask |= SCH_NETEM_ATTR_DIST; - + fclose(f); - return 0; + return 0; } /** @} */ diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c index 0f52e00..7347ed2 100644 --- a/lib/route/route_obj.c +++ b/lib/route/route_obj.c @@ -682,7 +682,7 @@ int rtnl_route_set_dst(struct rtnl_route *route, struct nl_addr *addr) nl_addr_get(addr); route->rt_dst = addr; - + route->ce_mask |= (ROUTE_ATTR_DST | ROUTE_ATTR_FAMILY); return 0; @@ -868,10 +868,10 @@ void rtnl_route_foreach_nexthop(struct rtnl_route *r, void *arg) { struct rtnl_nexthop *nh; - + if (r->ce_mask & ROUTE_ATTR_MULTIPATH) { nl_list_for_each_entry(nh, &r->rt_nexthops, rtnh_list) { - cb(nh, arg); + cb(nh, arg); } } } @@ -880,15 +880,15 @@ struct rtnl_nexthop *rtnl_route_nexthop_n(struct rtnl_route *r, int n) { struct rtnl_nexthop *nh; uint32_t i; - + if (r->ce_mask & ROUTE_ATTR_MULTIPATH && r->rt_nr_nh > n) { i = 0; nl_list_for_each_entry(nh, &r->rt_nexthops, rtnh_list) { - if (i == n) return nh; + if (i == n) return nh; i++; } } - return NULL; + return NULL; } /** @} */ @@ -986,7 +986,7 @@ static int parse_multipath(struct rtnl_route *route, struct nlattr *attr) if (ntb[RTA_FLOW]) { uint32_t realms; - + realms = nla_get_u32(ntb[RTA_FLOW]); rtnl_route_nh_set_realms(nh, realms); } diff --git a/lib/socket.c b/lib/socket.c index 109c416..97b2f69 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -204,18 +204,18 @@ static struct nl_sock *__alloc_socket(struct nl_cb *cb) struct nl_sock *nl_socket_alloc(void) { struct nl_cb *cb; - struct nl_sock *sk; + struct nl_sock *sk; cb = nl_cb_alloc(default_cb); if (!cb) return NULL; - /* will increment cb reference count on success */ + /* will increment cb reference count on success */ sk = __alloc_socket(cb); - nl_cb_put(cb); + nl_cb_put(cb); - return sk; + return sk; } /** @@ -751,8 +751,8 @@ struct nl_cb *nl_socket_get_cb(const struct nl_sock *sk) void nl_socket_set_cb(struct nl_sock *sk, struct nl_cb *cb) { - if (cb == NULL) - BUG(); + if (cb == NULL) + BUG(); nl_cb_put(sk->s_cb); sk->s_cb = nl_cb_get(cb); @@ -823,7 +823,7 @@ int nl_socket_set_buffer_size(struct nl_sock *sk, int rxbuf, int txbuf) if (sk->s_fd == -1) return -NLE_BAD_SOCK; - + err = setsockopt(sk->s_fd, SOL_SOCKET, SO_SNDBUF, &txbuf, sizeof(txbuf)); if (err < 0) { diff --git a/lib/utils.c b/lib/utils.c index 3399c03..7bcc251 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -57,7 +57,7 @@ struct nl_dump_params nl_debug_dp = { static void __init nl_debug_init(void) { char *nldbg, *end; - + if ((nldbg = getenv("NLDBG"))) { long level = strtol(nldbg, &end, 0); if (nldbg != end) @@ -202,11 +202,11 @@ int nl_rate2str(unsigned long long rate, int type, char *buf, size_t len) case NL_BYTE_RATE: frac = nl_cancel_down_bytes(rate, &unit); break; - + case NL_BIT_RATE: frac = nl_cancel_down_bits(rate, &unit); break; - + default: BUG(); } @@ -435,19 +435,19 @@ static void __init get_psched_settings(void) getenv("PROC_ROOT")); else strncpy(name, "/proc/net/psched", sizeof(name) - 1); - + if ((fd = fopen(name, "r"))) { unsigned int ns_per_usec, ns_per_tick, nom, denom; if (fscanf(fd, "%08x %08x %08x %08x", &ns_per_usec, &ns_per_tick, &nom, &denom) != 4) { - NL_DBG(1, "Fatal error: can not read psched settings from \"%s\". " \ - "Try to set TICKS_PER_USEC, PROC_NET_PSCHED or PROC_ROOT " \ - "environment variables\n", name); - exit(1); - } + NL_DBG(1, "Fatal error: can not read psched settings from \"%s\". " \ + "Try to set TICKS_PER_USEC, PROC_NET_PSCHED or PROC_ROOT " \ + "environment variables\n", name); + exit(1); + } - ticks_per_usec = (double) ns_per_usec / + ticks_per_usec = (double) ns_per_usec / (double) ns_per_tick; if (nom == 1000000) @@ -1066,7 +1066,7 @@ int __str2flags(const char *buf, const struct trans_tbl *tbl, size_t tbl_len) for (;;) { if (*p == ' ') p++; - + t = strchr(p, ','); len = t ? t - p : strlen(p); for (i = 0; i < tbl_len; i++) diff --git a/lib/xfrm/ae.c b/lib/xfrm/ae.c index bfe481f..e802d7a 100644 --- a/lib/xfrm/ae.c +++ b/lib/xfrm/ae.c @@ -648,8 +648,8 @@ int xfrmnl_ae_get_kernel(struct nl_sock* sock, struct nl_addr* daddr, unsigned i *result = (struct xfrmnl_ae *) obj; /* If an object has been returned, we also need to wait for the ACK */ - if (err == 0 && obj) - nl_wait_for_ack(sock); + if (err == 0 && obj) + nl_wait_for_ack(sock); return 0; } diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c index 1c0888b..74b7ee9 100644 --- a/lib/xfrm/sa.c +++ b/lib/xfrm/sa.c @@ -1067,8 +1067,8 @@ int xfrmnl_sa_get_kernel(struct nl_sock* sock, struct nl_addr* daddr, unsigned i *result = (struct xfrmnl_sa *) obj; /* If an object has been returned, we also need to wait for the ACK */ - if (err == 0 && obj) - nl_wait_for_ack(sock); + if (err == 0 && obj) + nl_wait_for_ack(sock); return 0; } diff --git a/lib/xfrm/selector.c b/lib/xfrm/selector.c index d52d8df..f3bc737 100644 --- a/lib/xfrm/selector.c +++ b/lib/xfrm/selector.c @@ -198,7 +198,7 @@ void xfrmnl_sel_dump(struct xfrmnl_sel* sel, struct nl_dump_params *p) */ struct nl_addr* xfrmnl_sel_get_daddr (struct xfrmnl_sel* sel) { - return sel->daddr; + return sel->daddr; } int xfrmnl_sel_set_daddr (struct xfrmnl_sel* sel, struct nl_addr* addr) @@ -214,7 +214,7 @@ int xfrmnl_sel_set_daddr (struct xfrmnl_sel* sel, struct nl_addr* addr) struct nl_addr* xfrmnl_sel_get_saddr (struct xfrmnl_sel* sel) { - return sel->saddr; + return sel->saddr; } int xfrmnl_sel_set_saddr (struct xfrmnl_sel* sel, struct nl_addr* addr) diff --git a/lib/xfrm/sp.c b/lib/xfrm/sp.c index cc2fcb1..8558150 100644 --- a/lib/xfrm/sp.c +++ b/lib/xfrm/sp.c @@ -409,7 +409,7 @@ static void xfrm_sp_dump_line(struct nl_object *a, struct nl_dump_params *p) nl_dump_line(p, "\tUser template: \n"); nl_list_for_each_entry(utmpl, &sp->usertmpl_list, utmpl_list) - xfrmnl_user_tmpl_dump (utmpl, p); + xfrmnl_user_tmpl_dump (utmpl, p); } if (sp->ce_mask & XFRM_SP_ATTR_MARK) @@ -750,8 +750,8 @@ int xfrmnl_sp_get_kernel(struct nl_sock* sock, unsigned int index, unsigned int *result = (struct xfrmnl_sp *) obj; /* If an object has been returned, we also need to wait for the ACK */ - if (err == 0 && obj) - nl_wait_for_ack(sock); + if (err == 0 && obj) + nl_wait_for_ack(sock); return 0; } diff --git a/lib/xfrm/template.c b/lib/xfrm/template.c index fdfa4c2..21cfb2d 100644 --- a/lib/xfrm/template.c +++ b/lib/xfrm/template.c @@ -186,7 +186,7 @@ void xfrmnl_user_tmpl_dump(struct xfrmnl_user_tmpl* tmpl, struct nl_dump_params */ struct nl_addr* xfrmnl_user_tmpl_get_daddr (struct xfrmnl_user_tmpl* utmpl) { - return utmpl->id.daddr; + return utmpl->id.daddr; } int xfrmnl_user_tmpl_set_daddr (struct xfrmnl_user_tmpl* utmpl, struct nl_addr* addr) @@ -238,7 +238,7 @@ int xfrmnl_user_tmpl_set_family(struct xfrmnl_user_tmpl *utmpl, int family) struct nl_addr* xfrmnl_user_tmpl_get_saddr (struct xfrmnl_user_tmpl* utmpl) { - return utmpl->saddr; + return utmpl->saddr; } int xfrmnl_user_tmpl_set_saddr (struct xfrmnl_user_tmpl* utmpl, struct nl_addr* addr) diff --git a/src/genl-ctrl-list.c b/src/genl-ctrl-list.c index 0895bcc..078c30c 100644 --- a/src/genl-ctrl-list.c +++ b/src/genl-ctrl-list.c @@ -14,7 +14,7 @@ static struct nl_cache *alloc_genl_family_cache(struct nl_sock *sk) { return nl_cli_alloc_cache(sk, "generic netlink family", - genl_ctrl_alloc_cache); + genl_ctrl_alloc_cache); } static void print_usage(void) @@ -38,11 +38,11 @@ int main(int argc, char *argv[]) .dp_type = NL_DUMP_LINE, .dp_fd = stdout, }; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_GENERIC); family_cache = alloc_genl_family_cache(sock); - + for (;;) { int c, optidx = 0; static struct option long_opts[] = { @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { "version", 0, 0, 'v' }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "df:hv", long_opts, &optidx); if (c == -1) break; @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) case 'h': print_usage(); break; case 'v': nl_cli_print_version(); break; } - } + } nl_cache_dump(family_cache, ¶ms); diff --git a/src/nf-ct-list.c b/src/nf-ct-list.c index 5f72998..bc6a337 100644 --- a/src/nf-ct-list.c +++ b/src/nf-ct-list.c @@ -54,9 +54,9 @@ int main(int argc, char *argv[]) .dp_type = NL_DUMP_LINE, .dp_fd = stdout, }; - - ct = nl_cli_ct_alloc(); - + + ct = nl_cli_ct_alloc(); + for (;;) { int c, optidx = 0; enum { @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) { "refcnt", 1, 0, ARG_REFCNT }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "46f:hvi:p:F:", long_opts, &optidx); if (c == -1) break; @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) case ARG_REFCNT: nl_cli_ct_parse_use(ct, optarg); break; case ARG_FLAGS: nl_cli_ct_parse_status(ct, optarg); break; } - } + } sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_NETFILTER); diff --git a/src/nf-exp-add.c b/src/nf-exp-add.c index 4b7f9d9..a81147e 100644 --- a/src/nf-exp-add.c +++ b/src/nf-exp-add.c @@ -64,8 +64,8 @@ int main(int argc, char *argv[]) }; int err, nlflags = NLM_F_CREATE; - exp = nl_cli_exp_alloc(); - + exp = nl_cli_exp_alloc(); + for (;;) { int c, optidx = 0; enum { @@ -86,12 +86,12 @@ int main(int argc, char *argv[]) ARG_MASK_SPORT, ARG_MASK_DST, ARG_MASK_DPORT, - ARG_NAT_PROTO, - ARG_NAT_SRC, - ARG_NAT_SPORT, - ARG_NAT_DST, - ARG_NAT_DPORT, - ARG_NAT_DIR, + ARG_NAT_PROTO, + ARG_NAT_SRC, + ARG_NAT_SPORT, + ARG_NAT_DST, + ARG_NAT_DPORT, + ARG_NAT_DIR, ARG_TIMEOUT, ARG_HELPER_NAME, ARG_REPLACE, @@ -118,19 +118,19 @@ int main(int argc, char *argv[]) { "mask-sport", 1, 0, ARG_MASK_SPORT }, { "mask-dst", 1, 0, ARG_MASK_DST }, { "mask-dport", 1, 0, ARG_MASK_DPORT }, - { "nat-proto", 1, 0, ARG_NAT_PROTO }, - { "nat-src", 1, 0, ARG_NAT_SRC }, - { "nat-sport", 1, 0, ARG_NAT_SPORT }, - { "nat-dst", 1, 0, ARG_NAT_DST }, - { "nat-dport", 1, 0, ARG_NAT_DPORT }, - { "nat-dir", 1, 0, ARG_NAT_DIR }, + { "nat-proto", 1, 0, ARG_NAT_PROTO }, + { "nat-src", 1, 0, ARG_NAT_SRC }, + { "nat-sport", 1, 0, ARG_NAT_SPORT }, + { "nat-dst", 1, 0, ARG_NAT_DST }, + { "nat-dport", 1, 0, ARG_NAT_DPORT }, + { "nat-dir", 1, 0, ARG_NAT_DIR }, { "family", 1, 0, 'F' }, { "timeout", 1, 0, ARG_TIMEOUT }, { "helper", 1, 0, ARG_HELPER_NAME }, { "flags", 1, 0, ARG_FLAGS}, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "46f:hvi:p:F:", long_opts, &optidx); if (c == -1) break; @@ -159,18 +159,18 @@ int main(int argc, char *argv[]) case ARG_MASK_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; case ARG_MASK_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_MASK, optarg); break; case ARG_MASK_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_NAT_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_NAT, optarg); break; - case ARG_NAT_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_NAT, optarg); break; - case ARG_NAT_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_NAT, optarg); break; - case ARG_NAT_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_NAT, optarg); break; - case ARG_NAT_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_NAT, optarg); break; - case ARG_NAT_DIR: nl_cli_exp_parse_nat_dir(exp, optarg); break; + case ARG_NAT_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_NAT, optarg); break; + case ARG_NAT_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_NAT, optarg); break; + case ARG_NAT_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_NAT, optarg); break; + case ARG_NAT_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_NAT, optarg); break; + case ARG_NAT_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_NAT, optarg); break; + case ARG_NAT_DIR: nl_cli_exp_parse_nat_dir(exp, optarg); break; case 'F': nl_cli_exp_parse_family(exp, optarg); break; case ARG_TIMEOUT: nl_cli_exp_parse_timeout(exp, optarg); break; case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break; case ARG_FLAGS: nl_cli_exp_parse_flags(exp, optarg); break; } - } + } sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_NETFILTER); diff --git a/src/nf-exp-delete.c b/src/nf-exp-delete.c index 2ec45ae..0965e90 100644 --- a/src/nf-exp-delete.c +++ b/src/nf-exp-delete.c @@ -63,8 +63,8 @@ int main(int argc, char *argv[]) }; int err, nlflags = 0; - exp = nl_cli_exp_alloc(); - + exp = nl_cli_exp_alloc(); + for (;;) { int c, optidx = 0; enum { @@ -80,17 +80,17 @@ int main(int argc, char *argv[]) ARG_MASTER_SPORT, ARG_MASTER_DST, ARG_MASTER_DPORT, - ARG_MASK_PROTO, - ARG_MASK_SRC, + ARG_MASK_PROTO, + ARG_MASK_SRC, ARG_MASK_SPORT, ARG_MASK_DST, ARG_MASK_DPORT, ARG_TIMEOUT, - ARG_HELPER_NAME, + ARG_HELPER_NAME, ARG_FLAGS, }; static struct option long_opts[] = { - { "quiet", 0, 0, 'q' }, + { "quiet", 0, 0, 'q' }, { "help", 0, 0, 'h' }, { "version", 0, 0, 'v' }, { "id", 1, 0, 'i' }, @@ -105,17 +105,17 @@ int main(int argc, char *argv[]) { "master-dst", 1, 0, ARG_MASTER_DST }, { "master-dport", 1, 0, ARG_MASTER_DPORT }, { "mask-proto", 1, 0, ARG_MASK_PROTO }, - { "mask-src", 1, 0, ARG_MASK_SRC }, - { "mask-sport", 1, 0, ARG_MASK_SPORT }, - { "mask-dst", 1, 0, ARG_MASK_DST }, - { "mask-dport", 1, 0, ARG_MASK_DPORT }, + { "mask-src", 1, 0, ARG_MASK_SRC }, + { "mask-sport", 1, 0, ARG_MASK_SPORT }, + { "mask-dst", 1, 0, ARG_MASK_DST }, + { "mask-dport", 1, 0, ARG_MASK_DPORT }, { "family", 1, 0, 'F' }, { "timeout", 1, 0, ARG_TIMEOUT }, { "helper", 1, 0, ARG_HELPER_NAME }, - { "flags", 1, 0, ARG_FLAGS}, + { "flags", 1, 0, ARG_FLAGS}, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "46f:hvi:p:F:", long_opts, &optidx); if (c == -1) break; @@ -142,13 +142,13 @@ int main(int argc, char *argv[]) case ARG_MASK_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_MASK, optarg); break; case ARG_MASK_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; case ARG_MASK_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_MASK_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; case 'F': nl_cli_exp_parse_family(exp, optarg); break; case ARG_TIMEOUT: nl_cli_exp_parse_timeout(exp, optarg); break; case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break; case ARG_FLAGS: nl_cli_exp_parse_flags(exp, optarg); break; } - } + } sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_NETFILTER); diff --git a/src/nf-exp-list.c b/src/nf-exp-list.c index 1c6ec69..7f5624d 100644 --- a/src/nf-exp-list.c +++ b/src/nf-exp-list.c @@ -54,9 +54,9 @@ int main(int argc, char *argv[]) .dp_type = NL_DUMP_LINE, .dp_fd = stdout, }; - - exp = nl_cli_exp_alloc(); - + + exp = nl_cli_exp_alloc(); + for (;;) { int c, optidx = 0; enum { @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) ARG_MASTER_DST, ARG_MASTER_DPORT, ARG_TIMEOUT, - ARG_HELPER_NAME, + ARG_HELPER_NAME, ARG_FLAGS, }; static struct option long_opts[] = { @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) { "flags", 1, 0, ARG_FLAGS}, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "46f:hvi:p:F:", long_opts, &optidx); if (c == -1) break; @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break; case ARG_FLAGS: nl_cli_exp_parse_flags(exp, optarg); break; } - } + } sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_NETFILTER); diff --git a/src/nl-addr-add.c b/src/nl-addr-add.c index 52995ec..19d07b3 100644 --- a/src/nl-addr-add.c +++ b/src/nl-addr-add.c @@ -50,12 +50,12 @@ int main(int argc, char *argv[]) .dp_fd = stdout, }; int err, nlflags = NLM_F_CREATE; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); - addr = nl_cli_addr_alloc(); - + addr = nl_cli_addr_alloc(); + for (;;) { int c, optidx = 0; enum { @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) { "valid", 1, 0, ARG_VALID }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "qhva:d:", long_opts, &optidx); if (c == -1) break; @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) case ARG_PREFERRED: nl_cli_addr_parse_preferred(addr, optarg); break; case ARG_VALID: nl_cli_addr_parse_valid(addr, optarg); break; } - } + } if ((err = rtnl_addr_add(sock, addr, nlflags)) < 0) nl_cli_fatal(err, "Unable to add address: %s", @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) if (!quiet) { printf("Added "); nl_object_dump(OBJ_CAST(addr), &dp); - } + } return 0; } diff --git a/src/nl-addr-delete.c b/src/nl-addr-delete.c index 2849c01..981930f 100644 --- a/src/nl-addr-delete.c +++ b/src/nl-addr-delete.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) { "valid", 1, 0, ARG_VALID }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "iqhva:d:", long_opts, &optidx); if (c == -1) break; @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) case ARG_PREFERRED: nl_cli_addr_parse_preferred(addr, optarg); break; case ARG_VALID: nl_cli_addr_parse_valid(addr, optarg); break; } - } + } nl_cache_foreach_filter(addr_cache, OBJ_CAST(addr), delete_cb, NULL); diff --git a/src/nl-class-add.c b/src/nl-class-add.c index b9a17dc..4593471 100644 --- a/src/nl-class-add.c +++ b/src/nl-class-add.c @@ -62,15 +62,15 @@ int main(int argc, char *argv[]) struct rtnl_tc_ops *ops; int err, flags = NLM_F_CREATE | NLM_F_EXCL; char *kind, *id = NULL; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); - class = nl_cli_class_alloc(); + class = nl_cli_class_alloc(); tc = (struct rtnl_tc *) class; - + for (;;) { int c, optidx = 0; enum { @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) { "linktype", 1, 0, ARG_LINKTYPE }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "+qhvd:p:i:", long_opts, &optidx); if (c == -1) @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) case ARG_OVERHEAD: nl_cli_tc_parse_overhead(tc, optarg); break; case ARG_LINKTYPE: nl_cli_tc_parse_linktype(tc, optarg); break; } - } + } if (optind >= argc) print_usage(); @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) if (!quiet) { printf("Adding "); nl_object_dump(OBJ_CAST(class), &dp); - } + } if ((err = rtnl_class_add(sock, class, flags)) < 0) nl_cli_fatal(EINVAL, "Unable to add class: %s", nl_geterror(err)); diff --git a/src/nl-class-delete.c b/src/nl-class-delete.c index 37657a4..e4be2c0 100644 --- a/src/nl-class-delete.c +++ b/src/nl-class-delete.c @@ -70,13 +70,13 @@ int main(int argc, char *argv[]) struct rtnl_class *class; struct rtnl_tc *tc; struct nl_cache *link_cache, *class_cache; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); - class = nl_cli_class_alloc(); + class = nl_cli_class_alloc(); tc = (struct rtnl_tc *) class; - + for (;;) { int c, optidx = 0; enum { @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) { "kind", 1, 0, 'k' }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "qhvd:p:i:k:", long_opts, &optidx); if (c == -1) break; @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) case 'i': nl_cli_tc_parse_handle(tc, optarg, 0); break; case 'k': nl_cli_tc_parse_kind(tc, optarg); break; } - } + } if (!rtnl_tc_get_ifindex(tc)) nl_cli_fatal(EINVAL, "You must specify a network device (--dev=XXX)"); diff --git a/src/nl-class-list.c b/src/nl-class-list.c index c2423fb..e8cc71a 100644 --- a/src/nl-class-list.c +++ b/src/nl-class-list.c @@ -65,15 +65,15 @@ int main(int argc, char *argv[]) struct rtnl_tc *tc; struct nl_cache *link_cache; int ifindex; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); - class = nl_cli_class_alloc(); + class = nl_cli_class_alloc(); tc = (struct rtnl_tc *) class; params.dp_fd = stdout; - + for (;;) { int c, optidx = 0; enum { @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) { "kind", 1, 0, 'k' }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "hvd:p:i:k:", long_opts, &optidx); if (c == -1) break; @@ -106,11 +106,11 @@ int main(int argc, char *argv[]) case 'i': nl_cli_tc_parse_handle(tc, optarg, 0); break; case 'k': nl_cli_tc_parse_kind(tc, optarg); break; } - } + } if ((ifindex = rtnl_tc_get_ifindex(tc))) __dump_class(ifindex, class); - else + else nl_cache_foreach(link_cache, dump_class, class); return 0; diff --git a/src/nl-classid-lookup.c b/src/nl-classid-lookup.c index 1d45d0b..1493ebf 100644 --- a/src/nl-classid-lookup.c +++ b/src/nl-classid-lookup.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) { "raw", 0, 0, ARG_RAW }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "hvr", long_opts, &optidx); if (c == -1) break; @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) case 'r': reverse = 1; break; case ARG_RAW: raw = 1; break; } - } + } if (optind >= argc) print_usage(); diff --git a/src/nl-cls-add.c b/src/nl-cls-add.c index ada234d..6ac8590 100644 --- a/src/nl-cls-add.c +++ b/src/nl-cls-add.c @@ -62,15 +62,15 @@ int main(int argc, char *argv[]) struct rtnl_tc_ops *ops; int err, flags = NLM_F_CREATE | NLM_F_EXCL; char *kind, *id = NULL; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); - cls = nl_cli_cls_alloc(); + cls = nl_cli_cls_alloc(); tc = (struct rtnl_tc *) cls; - + for (;;) { int c, optidx = 0; enum { @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { "linktype", 1, 0, ARG_LINKTYPE }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "+qhvd:p:i:", long_opts, &optidx); if (c == -1) @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) rtnl_cls_set_prio(cls, nl_cli_parse_u32(optarg)); break; } - } + } if (optind >= argc) print_usage(); @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) if (!quiet) { printf("Adding "); nl_object_dump(OBJ_CAST(cls), &dp); - } + } if ((err = rtnl_cls_add(sock, cls, flags)) < 0) nl_cli_fatal(EINVAL, "Unable to add classifier: %s", nl_geterror(err)); diff --git a/src/nl-cls-delete.c b/src/nl-cls-delete.c index c6abac7..78b93ec 100644 --- a/src/nl-cls-delete.c +++ b/src/nl-cls-delete.c @@ -91,13 +91,13 @@ int main(int argc, char *argv[]) struct rtnl_tc *tc; struct nl_cache *link_cache; int ifindex; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); - cls = nl_cli_cls_alloc(); + cls = nl_cli_cls_alloc(); tc = (struct rtnl_tc *) cls; - + for (;;) { int c, optidx = 0; enum { @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) { "prio", 1, 0, ARG_PRIO }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "qhvd:p:i:k:", long_opts, &optidx); if (c == -1) break; @@ -141,11 +141,11 @@ int main(int argc, char *argv[]) rtnl_cls_set_prio(cls, nl_cli_parse_u32(optarg)); break; } - } + } if ((ifindex = rtnl_tc_get_ifindex(tc))) __delete_link(ifindex, cls); - else + else nl_cache_foreach(link_cache, delete_link, cls); if (!quiet) diff --git a/src/nl-cls-list.c b/src/nl-cls-list.c index cae7e27..08956e0 100644 --- a/src/nl-cls-list.c +++ b/src/nl-cls-list.c @@ -69,15 +69,15 @@ int main(int argc, char *argv[]) struct rtnl_tc *tc; struct nl_cache *link_cache; int ifindex; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); - cls = nl_cli_cls_alloc(); + cls = nl_cli_cls_alloc(); tc = (struct rtnl_tc *) cls; params.dp_fd = stdout; - + for (;;) { int c, optidx = 0; enum { @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) { "prio", 1, 0, ARG_PRIO }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "hvd:p:i:k:", long_opts, &optidx); if (c == -1) break; @@ -118,11 +118,11 @@ int main(int argc, char *argv[]) rtnl_cls_set_prio(cls, nl_cli_parse_u32(optarg)); break; } - } + } if ((ifindex = rtnl_tc_get_ifindex(tc))) __dump_link(ifindex, cls); - else + else nl_cache_foreach(link_cache, dump_link, cls); return 0; diff --git a/src/nl-neigh-add.c b/src/nl-neigh-add.c index 4cddabe..09cef9a 100644 --- a/src/nl-neigh-add.c +++ b/src/nl-neigh-add.c @@ -51,12 +51,12 @@ int main(int argc, char *argv[]) .dp_fd = stdout, }; int err, ok = 0, nlflags = NLM_F_REPLACE | NLM_F_CREATE; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); - neigh = nl_cli_neigh_alloc(); - + neigh = nl_cli_neigh_alloc(); + for (;;) { int c, optidx = 0; enum { @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) { "state", 1, 0, ARG_STATE }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "qhva:l:d:", long_opts, &optidx); if (c == -1) break; @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) case 'd': nl_cli_neigh_parse_dev(neigh, link_cache, optarg); break; case ARG_STATE: nl_cli_neigh_parse_state(neigh, optarg); break; } - } + } if (!ok) print_usage(); @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) if (!quiet) { printf("Added "); nl_object_dump(OBJ_CAST(neigh), &dp); - } + } return 0; } diff --git a/src/nl-neigh-delete.c b/src/nl-neigh-delete.c index c418608..b6be44c 100644 --- a/src/nl-neigh-delete.c +++ b/src/nl-neigh-delete.c @@ -67,13 +67,13 @@ int main(int argc, char *argv[]) { struct rtnl_neigh *neigh; struct nl_cache *link_cache, *neigh_cache; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); neigh_cache = nl_cli_neigh_alloc_cache(sock); - neigh = nl_cli_neigh_alloc(); - + neigh = nl_cli_neigh_alloc(); + for (;;) { int c, optidx = 0; enum { @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) { "state", 1, 0, ARG_STATE }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "qhva:l:d:", long_opts, &optidx); if (c == -1) break; @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) case ARG_FAMILY: nl_cli_neigh_parse_family(neigh, optarg); break; case ARG_STATE: nl_cli_neigh_parse_state(neigh, optarg); break; } - } + } nl_cache_foreach_filter(neigh_cache, OBJ_CAST(neigh), delete_cb, NULL); diff --git a/src/nl-neigh-list.c b/src/nl-neigh-list.c index 8390d4b..c99d237 100644 --- a/src/nl-neigh-list.c +++ b/src/nl-neigh-list.c @@ -42,13 +42,13 @@ int main(int argc, char *argv[]) .dp_type = NL_DUMP_LINE, .dp_fd = stdout, }; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache_flags(sock, NL_CACHE_AF_ITER); neigh_cache = nl_cli_neigh_alloc_cache(sock); - neigh = nl_cli_neigh_alloc(); - + neigh = nl_cli_neigh_alloc(); + for (;;) { int c, optidx = 0; enum { @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { "state", 1, 0, ARG_STATE }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "f:hva:l:d:", long_opts, &optidx); if (c == -1) break; @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) case ARG_FAMILY: nl_cli_neigh_parse_family(neigh, optarg); break; case ARG_STATE: nl_cli_neigh_parse_state(neigh, optarg); break; } - } + } nl_cache_dump_filter(neigh_cache, ¶ms, OBJ_CAST(neigh)); diff --git a/src/nl-neightbl-list.c b/src/nl-neightbl-list.c index 4c4230f..2380e01 100644 --- a/src/nl-neightbl-list.c +++ b/src/nl-neightbl-list.c @@ -33,13 +33,13 @@ int main(int argc, char *argv[]) .dp_type = NL_DUMP_LINE, .dp_fd = stdout, }; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); nl_cli_link_alloc_cache(sock); neightbl_cache = nl_cli_alloc_cache(sock, "neighbour table", rtnl_neightbl_alloc_cache); - + for (;;) { int c, optidx = 0; static struct option long_opts[] = { @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) { "version", 0, 0, 'v' }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "f:hv", long_opts, &optidx); if (c == -1) break; @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) case 'h': print_usage(); break; case 'v': nl_cli_print_version(); break; } - } + } nl_cache_dump(neightbl_cache, ¶ms); diff --git a/src/nl-pktloc-lookup.c b/src/nl-pktloc-lookup.c index 17c867b..7d24402 100644 --- a/src/nl-pktloc-lookup.c +++ b/src/nl-pktloc-lookup.c @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) { "u32", 1, 0, ARG_U32 }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "hvl", long_opts, &optidx); if (c == -1) break; @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) uvalue = nl_cli_parse_u32(optarg); break; } - } + } if (optind >= argc) print_usage(); diff --git a/src/nl-qdisc-add.c b/src/nl-qdisc-add.c index c2a7c9f..d8a1f73 100644 --- a/src/nl-qdisc-add.c +++ b/src/nl-qdisc-add.c @@ -59,15 +59,15 @@ int main(int argc, char *argv[]) struct rtnl_tc_ops *ops; int err, flags = NLM_F_CREATE | NLM_F_EXCL; char *kind, *id = NULL; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); - qdisc = nl_cli_qdisc_alloc(); + qdisc = nl_cli_qdisc_alloc(); tc = (struct rtnl_tc *) qdisc; - + for (;;) { int c, optidx = 0; enum { @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) { "update-only", 0, 0, ARG_UPDATE_ONLY }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "+qhvd:p:i:", long_opts, &optidx); if (c == -1) @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) case ARG_UPDATE_ONLY: flags = 0; break; case ARG_REPLACE_ONLY: flags = NLM_F_REPLACE; break; } - } + } if (optind >= argc) print_usage(); @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) if (!quiet) { printf("Adding "); nl_object_dump(OBJ_CAST(qdisc), &dp); - } + } if ((err = rtnl_qdisc_add(sock, qdisc, flags)) < 0) nl_cli_fatal(EINVAL, "Unable to add qdisc: %s", nl_geterror(err)); diff --git a/src/nl-qdisc-delete.c b/src/nl-qdisc-delete.c index 2f945bb..c4acbfe 100644 --- a/src/nl-qdisc-delete.c +++ b/src/nl-qdisc-delete.c @@ -71,14 +71,14 @@ int main(int argc, char *argv[]) struct rtnl_tc *tc; struct nl_cache *link_cache, *qdisc_cache; int nfilter = 0; - + sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); qdisc_cache = nl_cli_qdisc_alloc_cache(sock); - qdisc = nl_cli_qdisc_alloc(); + qdisc = nl_cli_qdisc_alloc(); tc = (struct rtnl_tc *) qdisc; - + for (;;) { int c, optidx = 0; enum { @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) { "kind", 1, 0, 'k' }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "qhvd:p:i:k:", long_opts, &optidx); if (c == -1) break; @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) nl_cli_tc_parse_kind(tc, optarg); break; } - } + } if (nfilter == 0 && !interactive && !default_yes) { nl_cli_fatal(EINVAL, diff --git a/src/nl-qdisc-list.c b/src/nl-qdisc-list.c index 5b0a3f0..b8110f1 100644 --- a/src/nl-qdisc-list.c +++ b/src/nl-qdisc-list.c @@ -129,15 +129,15 @@ int main(int argc, char *argv[]) struct rtnl_qdisc *qdisc; struct rtnl_tc *tc; struct nl_cache *link_cache, *qdisc_cache; - + params.dp_fd = stdout; sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_ROUTE); link_cache = nl_cli_link_alloc_cache(sock); qdisc_cache = nl_cli_qdisc_alloc_cache(sock); - qdisc = nl_cli_qdisc_alloc(); + qdisc = nl_cli_qdisc_alloc(); tc = (struct rtnl_tc *) qdisc; - + for (;;) { int c, optidx = 0; enum { @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) { "kind", 1, 0, 'k' }, { 0, 0, 0, 0 } }; - + c = getopt_long(argc, argv, "rhvd:p:i:k:", long_opts, &optidx); if (c == -1) break; @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) case 'i': nl_cli_tc_parse_handle(tc, optarg, 0); break; case 'k': nl_cli_tc_parse_kind(tc, optarg); break; } - } + } if (recursive) nl_cache_foreach_filter(qdisc_cache, OBJ_CAST(qdisc), list_qdisc, NULL);