diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-12-05 10:10:22 -0800 |
---|---|---|
committer | Stephen Hemminger <shemminger@osdl.org> | 2006-12-05 10:10:22 -0800 |
commit | ae665a522bd46bea44c5ea84c89c8b1731954170 (patch) | |
tree | 523b0a5b51e264ebad295e517606123e9e8e04bd /tc | |
parent | 0bf0fbc47e33cc968c1c1d20d938de31e497c753 (diff) |
Remove trailing whitespace
Go through source files and remove all trailing whitespace
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Diffstat (limited to 'tc')
-rw-r--r-- | tc/em_cmp.c | 4 | ||||
-rw-r--r-- | tc/em_meta.c | 20 | ||||
-rw-r--r-- | tc/em_nbyte.c | 4 | ||||
-rw-r--r-- | tc/em_u32.c | 2 | ||||
-rw-r--r-- | tc/emp_ematch.l | 8 | ||||
-rw-r--r-- | tc/f_basic.c | 2 | ||||
-rw-r--r-- | tc/f_fw.c | 2 | ||||
-rw-r--r-- | tc/f_u32.c | 2 | ||||
-rw-r--r-- | tc/m_action.c | 24 | ||||
-rw-r--r-- | tc/m_ematch.c | 12 | ||||
-rw-r--r-- | tc/m_ematch.h | 2 | ||||
-rw-r--r-- | tc/m_estimator.c | 2 | ||||
-rw-r--r-- | tc/m_gact.c | 8 | ||||
-rw-r--r-- | tc/m_ipt.c | 16 | ||||
-rw-r--r-- | tc/m_mirred.c | 8 | ||||
-rw-r--r-- | tc/m_pedit.c | 26 | ||||
-rw-r--r-- | tc/m_pedit.h | 6 | ||||
-rw-r--r-- | tc/m_police.c | 14 | ||||
-rw-r--r-- | tc/p_icmp.c | 4 | ||||
-rw-r--r-- | tc/p_ip.c | 6 | ||||
-rw-r--r-- | tc/p_tcp.c | 4 | ||||
-rw-r--r-- | tc/p_udp.c | 4 | ||||
-rw-r--r-- | tc/q_cbq.c | 6 | ||||
-rw-r--r-- | tc/q_gred.c | 10 | ||||
-rw-r--r-- | tc/q_hfsc.c | 4 | ||||
-rw-r--r-- | tc/q_htb.c | 8 | ||||
-rw-r--r-- | tc/q_netem.c | 30 | ||||
-rw-r--r-- | tc/q_red.c | 2 | ||||
-rw-r--r-- | tc/q_tbf.c | 2 | ||||
-rw-r--r-- | tc/tc.c | 10 | ||||
-rw-r--r-- | tc/tc_class.c | 4 | ||||
-rw-r--r-- | tc/tc_filter.c | 2 | ||||
-rw-r--r-- | tc/tc_qdisc.c | 14 | ||||
-rw-r--r-- | tc/tc_util.c | 4 | ||||
-rw-r--r-- | tc/tc_util.h | 8 |
35 files changed, 142 insertions, 142 deletions
diff --git a/tc/em_cmp.c b/tc/em_cmp.c index c636c53a..b8f9b467 100644 --- a/tc/em_cmp.c +++ b/tc/em_cmp.c @@ -63,7 +63,7 @@ static int cmp_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, align = TCF_EM_ALIGN_U32; else return PARSE_ERR(args, "cmp: invalid alignment"); - + for (a = bstr_next(args); a; a = bstr_next(a)) { if (!bstrcmp(a, "at")) { if (a->next == NULL) @@ -111,7 +111,7 @@ static int cmp_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, opnd = TCF_EM_OPND_GT; else if (!bstrcmp(a, "lt")) opnd = TCF_EM_OPND_LT; - + if (a->next == NULL) return PARSE_ERR(a, "cmp: missing argument"); a = bstr_next(a); diff --git a/tc/em_meta.c b/tc/em_meta.c index bd1e1512..5fc0c597 100644 --- a/tc/em_meta.c +++ b/tc/em_meta.c @@ -131,7 +131,7 @@ static struct meta_entry * lookup_meta_entry(struct bstr *kind) if (!bstrcmp(kind, meta_table[i].kind) && meta_table[i].id != 0) return &meta_table[i]; - + return NULL; } @@ -142,7 +142,7 @@ static struct meta_entry * lookup_meta_entry_byid(int id) for (i = 0; i < (sizeof(meta_table)/sizeof(meta_table[0])); i++) if (meta_table[i].id == id) return &meta_table[i]; - + return NULL; } @@ -171,12 +171,12 @@ static inline int is_compatible(struct tcf_meta_val *what, { char *p; struct meta_entry *entry; - + entry = lookup_meta_entry_byid(TCF_META_ID(what->kind)); if (entry == NULL) return 0; - + for (p = entry->mask; p; p++) if (map_type(*p) == TCF_META_TYPE(needed->kind)) return 1; @@ -244,7 +244,7 @@ static inline int overwrite_type(struct tcf_meta_val *src, { return (TCF_META_TYPE(dst->kind) << 12) | TCF_META_ID(src->kind); } - + static inline struct bstr * parse_object(struct bstr *args, struct bstr *arg, struct tcf_meta_val *obj, @@ -280,7 +280,7 @@ parse_object(struct bstr *args, struct bstr *arg, struct tcf_meta_val *obj, if (left) { struct tcf_meta_val *right = obj; - + if (TCF_META_TYPE(right->kind) == TCF_META_TYPE(left->kind)) goto compatible; @@ -301,7 +301,7 @@ parse_object(struct bstr *args, struct bstr *arg, struct tcf_meta_val *obj, right->kind = overwrite_type(right, left); else goto not_compatible; - } else + } else goto not_compatible; } @@ -318,7 +318,7 @@ compatible: return PARSE_FAILURE; } a = bstr_next(a); - + shift = bstrtoul(a); if (shift == LONG_MAX) { PARSE_ERR(a, "meta: invalid shift, must " \ @@ -336,7 +336,7 @@ compatible: return PARSE_FAILURE; } a = bstr_next(a); - + mask = bstrtoul(a); if (mask == LONG_MAX) { PARSE_ERR(a, "meta: invalid mask, must be " \ @@ -400,7 +400,7 @@ static int meta_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, return -1; else if (a != NULL) return PARSE_ERR(a, "meta: unexpected trailer"); - + addraw_l(n, MAX_MSG, hdr, sizeof(*hdr)); diff --git a/tc/em_nbyte.c b/tc/em_nbyte.c index e0ed5baf..98f98837 100644 --- a/tc/em_nbyte.c +++ b/tc/em_nbyte.c @@ -92,7 +92,7 @@ static int nbyte_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, if (offset_present == 0) return PARSE_ERR(a, "nbyte: offset required"); - + nb.len = needle->len; nb.layer = (__u8) layer; nb.off = (__u16) offset; @@ -131,7 +131,7 @@ static int nbyte_print_eopt(FILE *fd, struct tcf_ematch_hdr *hdr, void *data, for (i = 0; i < nb->len; i++) fprintf(fd, "%c", isprint(needle[i]) ? needle[i] : '.'); fprintf(fd, "\" at %d layer %d", nb->off, nb->layer); - + return 0; } diff --git a/tc/em_u32.c b/tc/em_u32.c index b8857f16..402bea0e 100644 --- a/tc/em_u32.c +++ b/tc/em_u32.c @@ -96,7 +96,7 @@ static int u32_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, offset = bstrtoul(a); } else offset = bstrtoul(a); - + if (offset == ULONG_MAX) return PARSE_ERR(a, "u32: invalid offset"); diff --git a/tc/emp_ematch.l b/tc/emp_ematch.l index 09d535d0..0184753a 100644 --- a/tc/emp_ematch.l +++ b/tc/emp_ematch.l @@ -77,7 +77,7 @@ return ERROR; } strbuf_index = 0; - + BEGIN(str); } @@ -90,7 +90,7 @@ <str>\\[0-7]{1,3} { /* octal escape sequence */ int res; - + sscanf(yytext + 1, "%o", &res); if (res > 0xFF) { fprintf(stderr, "error: octal escape sequence" \ @@ -107,9 +107,9 @@ <str>\\x[0-9a-fA-F]{1,2} { int res; - + sscanf(yytext + 2, "%x", &res); - + if (res > 0xFF) { fprintf(stderr, "error: hexadecimal escape " \ "sequence out of range\n"); diff --git a/tc/f_basic.c b/tc/f_basic.c index 264f3584..19a7edf2 100644 --- a/tc/f_basic.c +++ b/tc/f_basic.c @@ -52,7 +52,7 @@ static int basic_parse_opt(struct filter_util *qu, char *handle, return -1; } } - + t->tcm_handle = h; tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len)); @@ -125,7 +125,7 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u struct rtattr *idev = tb[TCA_FW_INDEV]; fprintf(f, "input dev %s ",(char *)RTA_DATA(idev)); } - + if (tb[TCA_FW_ACT]) { fprintf(f, "\n"); tc_print_action(f, tb[TCA_FW_ACT]); @@ -833,7 +833,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char ** } else if (matches(*argv, "divisor") == 0) { unsigned divisor; NEXT_ARG(); - if (get_unsigned(&divisor, *argv, 0) || + if (get_unsigned(&divisor, *argv, 0) || divisor == 0 || divisor > 0x100 || ((divisor - 1) & divisor)) { fprintf(stderr, "Illegal \"divisor\"\n"); diff --git a/tc/m_action.c b/tc/m_action.c index 3808a860..9f240228 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -6,8 +6,8 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * * TODO: * - parse to be passed a filedescriptor for logging purposes * @@ -65,7 +65,7 @@ void act_usage(void) static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt) { if (opt && RTA_PAYLOAD(opt)) - fprintf(f, "[Unknown action, optlen=%u] ", + fprintf(f, "[Unknown action, optlen=%u] ", (unsigned) RTA_PAYLOAD(opt)); return 0; } @@ -139,7 +139,7 @@ noexist: } int -new_cmd(char **argv) +new_cmd(char **argv) { if ((matches(*argv, "change") == 0) || (matches(*argv, "replace") == 0)|| @@ -203,7 +203,7 @@ done0: goto done; } - if (NULL == a) { + if (NULL == a) { goto bad_val; } @@ -235,7 +235,7 @@ done: *argv_p = argv; return 0; bad_val: - /* no need to undo things, returning from here should + /* no need to undo things, returning from here should * cause enough pain */ fprintf(stderr, "parse_action: bad value (%d:%s)!\n",argc,*argv); return -1; @@ -337,11 +337,11 @@ int print_action(const struct sockaddr_nl *who, if (n->nlmsg_type != RTM_GETACTION) fprintf(stderr, "print_action: NULL kind\n"); return -1; - } + } if (n->nlmsg_type == RTM_DELACTION) { if (n->nlmsg_flags & NLM_F_ROOT) { - fprintf(fp, "Flushed table "); + fprintf(fp, "Flushed table "); tab_flush = 1; } else { fprintf(fp, "deleted action "); @@ -403,7 +403,7 @@ int tc_action_gd(int cmd, unsigned flags, int *argc_p, char ***argv_p) strncpy(k, *argv, sizeof (k) - 1); a = get_action_kind(k); - if (NULL == a) { + if (NULL == a) { fprintf(stderr, "Error: non existent action: %s\n",k); ret = -1; goto bad_val; @@ -536,7 +536,7 @@ int tc_act_list_or_flush(int argc, char **argv, int event) } #endif a = get_action_kind(k); - if (NULL == a) { + if (NULL == a) { fprintf(stderr,"bad action %s\n",k); goto bad_val; } @@ -553,7 +553,7 @@ int tc_act_list_or_flush(int argc, char **argv, int event) msg_size = NLMSG_ALIGN(req.n.nlmsg_len) - NLMSG_ALIGN(sizeof(struct nlmsghdr)); - if (event == RTM_GETACTION) { + if (event == RTM_GETACTION) { if (rtnl_dump_request(&rth, event, (void *)&req.t, msg_size) < 0) { perror("Cannot send dump request"); return 1; @@ -561,7 +561,7 @@ int tc_act_list_or_flush(int argc, char **argv, int event) ret = rtnl_dump_filter(&rth, print_action, stdout, NULL, NULL); } - if (event == RTM_DELACTION) { + if (event == RTM_DELACTION) { req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len); req.n.nlmsg_type = RTM_DELACTION; req.n.nlmsg_flags |= NLM_F_ROOT; diff --git a/tc/m_ematch.c b/tc/m_ematch.c index 44c621bc..da4f22b2 100644 --- a/tc/m_ematch.c +++ b/tc/m_ematch.c @@ -45,7 +45,7 @@ static inline void map_warning(int num, char *kind) "Error: Unable to find ematch \"%s\" in %s\n" \ "Please assign a unique ID to the ematch kind the suggested " \ "entry is:\n" \ - "\t%d\t%s\n", + "\t%d\t%s\n", kind, EMATCH_MAP, num, kind); } @@ -66,7 +66,7 @@ static int lookup_map(__u16 num, char *dst, int len, const char *file) p++; if (*p == '#' || *p == '\n' || *p == 0) continue; - + if (sscanf(p, "%d %s", &id, namebuf) != 2) { fprintf(stderr, "ematch map %s corrupted at %s\n", file, p); @@ -104,7 +104,7 @@ static int lookup_map_id(char *kind, int *dst, const char *file) p++; if (*p == '#' || *p == '\n' || *p == 0) continue; - + if (sscanf(p, "%d %s", &id, namebuf) != 2) { fprintf(stderr, "ematch map %s corrupted at %s\n", file, p); @@ -185,7 +185,7 @@ static int parse_tree(struct nlmsghdr *n, struct ematch *tree) if (t->inverted) hdr.flags |= TCF_EM_INVERT; - + addattr_l(n, MAX_MSG, index++, NULL, 0); if (t->child) { @@ -278,7 +278,7 @@ int em_parse_error(int err, struct bstr *args, struct bstr *carg, begin_argv++; begin_argc--; } - + fprintf(stderr, "...\n"); if (args) { @@ -437,7 +437,7 @@ static int print_ematch_seq(FILE *fd, struct rtattr **tb, int start, i++; } - + return 0; } diff --git a/tc/m_ematch.h b/tc/m_ematch.h index ed984461..2b5d2938 100644 --- a/tc/m_ematch.h +++ b/tc/m_ematch.h @@ -68,7 +68,7 @@ static inline unsigned long bstrtoul(struct bstr *b) memcpy(buf, b->data, b->len); buf[b->len] = '\0'; - + l = strtol(buf, &inv, 0); if (l == ULONG_MAX || inv == buf) return LONG_MAX; diff --git a/tc/m_estimator.c b/tc/m_estimator.c index 78eda7a8..d931551a 100644 --- a/tc/m_estimator.c +++ b/tc/m_estimator.c @@ -39,7 +39,7 @@ int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est) int argc = *p_argc; char **argv = *p_argv; unsigned A, time_const; - + NEXT_ARG(); if (est->ewma_log) duparg("estimator", *argv); diff --git a/tc/m_gact.c b/tc/m_gact.c index cfbaf874..9f07851a 100644 --- a/tc/m_gact.c +++ b/tc/m_gact.c @@ -1,13 +1,13 @@ /* - * m_gact.c generic actions module + * m_gact.c generic actions module * * This program is free software; you can distribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * */ #include <stdio.h> @@ -27,7 +27,7 @@ /* define to turn on probablity stuff */ #ifdef CONFIG_GACT_PROB -static const char *prob_n2a(int p) +static const char *prob_n2a(int p) { if (p == PGACT_NONE) return "none"; @@ -1,5 +1,5 @@ /* - * m_ipt.c iptables based targets + * m_ipt.c iptables based targets * utilities mostly ripped from iptables <duh, its the linux way> * * This program is free software; you can distribute it and/or @@ -7,8 +7,8 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * * TODO: bad bad hardcoding IPT_LIB_DIR and PROC_SYS_MODPROBE * */ @@ -126,7 +126,7 @@ addr_to_dotted(const struct in_addr *addrp) return buf; } -int string_to_number_ll(const char *s, unsigned long long min, +int string_to_number_ll(const char *s, unsigned long long min, unsigned long long max, unsigned long long *ret) { @@ -341,7 +341,7 @@ static void set_revision(char *name, u_int8_t revision) name[IPT_FUNCTION_MAXNAMELEN - 1] = revision; } -/* +/* * we may need to check for version mismatch */ int @@ -372,7 +372,7 @@ build_st(struct iptables_target *target, struct ipt_entry_target *t) return -1; } -static int parse_ipt(struct action_util *a,int *argc_p, +static int parse_ipt(struct action_util *a,int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct iptables_target *m = NULL; @@ -503,7 +503,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, argv += optind; *argc_p = rargc - iargc; *argv_p = argv; - + optind = 1; free_opts(opts); @@ -578,7 +578,7 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg) struct tcf_t *tm = RTA_DATA(tb[TCA_IPT_TM]); print_tm(f,tm); } - } + } fprintf(f, " \n"); } diff --git a/tc/m_mirred.c b/tc/m_mirred.c index ed87c818..226df4d2 100644 --- a/tc/m_mirred.c +++ b/tc/m_mirred.c @@ -1,13 +1,13 @@ /* - * m_egress.c ingress/egress packet mirror/redir actions module + * m_egress.c ingress/egress packet mirror/redir actions module * * This program is free software; you can distribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * * TODO: Add Ingress support * */ @@ -247,7 +247,7 @@ parse_mirred(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, str } return -1; - + } int diff --git a/tc/m_pedit.c b/tc/m_pedit.c index 5ac84a58..74998463 100644 --- a/tc/m_pedit.c +++ b/tc/m_pedit.c @@ -1,18 +1,18 @@ /* - * m_pedit.c generic packet editor actions module + * m_pedit.c generic packet editor actions module * * This program is free software; you can distribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * - * TODO: + * Authors: J Hadi Salim (hadi@cyberus.ca) + * + * TODO: * 1) Big endian broken in some spots * 2) A lot of this stuff was added on the fly; get a big double-double * and clean it up at some point. - * + * */ #include <stdio.h> @@ -37,7 +37,7 @@ explain(void) { fprintf(stderr, "Usage: ... pedit munge <MUNGE>\n"); fprintf(stderr, - "Where: MUNGE := <RAW>|<LAYERED>\n" + "Where: MUNGE := <RAW>|<LAYERED>\n" "\t<RAW>:= <OFFSETC>[ATC]<CMD>\n " "\t\tOFFSETC:= offset <offval> <u8|u16|u32>\n " "\t\tATC:= at <atval> offmask <maskval> shift <shiftval>\n " @@ -58,8 +58,8 @@ usage(void) exit(-1); } -static int -pedit_parse_nopopt (int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +static int +pedit_parse_nopopt (int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) { int argc = *argc_p; char **argv = *argv_p; @@ -73,7 +73,7 @@ pedit_parse_nopopt (int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct } -struct m_pedit_util +struct m_pedit_util *get_pedit_kind(char *str) { static void *pBODY; @@ -227,7 +227,7 @@ pack_key8(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) retain <<= stride; tkey->mask = retain|m[ind]; tkey->off &= ~3; - + if (pedit_debug) printf("pack_key8: Final word off %d val %08x mask %08x \n",tkey->off , tkey->val,tkey->mask); return pack_key(sel,tkey); @@ -293,7 +293,7 @@ parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct t } else if (matches(*argv, "preserve") == 0) { retain = mask = o; } else { - if (matches(*argv, "clear") != 0) + if (matches(*argv, "clear") != 0) return -1; } @@ -390,7 +390,7 @@ done: tkey->at = atv; NEXT_ARG(); - + if (get_u32(&offmask, *argv, 16)) return -1; tkey->offmask = offmask; @@ -595,7 +595,7 @@ print_pedit(struct action_util *au,FILE * f, struct rtattr *arg) return 0; } -int +int pedit_print_xstats(struct action_util *au, FILE *f, struct rtattr *xstats) { return 0; diff --git a/tc/m_pedit.h b/tc/m_pedit.h index 0a6d24e0..1698c954 100644 --- a/tc/m_pedit.h +++ b/tc/m_pedit.h @@ -1,13 +1,13 @@ /* - * m_pedit.h generic packet editor actions module + * m_pedit.h generic packet editor actions module * * This program is free software; you can distribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * */ #ifndef _ACT_PEDIT_H_ diff --git a/tc/m_police.c b/tc/m_police.c index 7b803672..93f317c0 100644 --- a/tc/m_police.c +++ b/tc/m_police.c @@ -7,8 +7,8 @@ * 2 of the License, or (at your option) any later version. * * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> - * FIXES: 19990619 - J Hadi Salim (hadi@cyberus.ca) - * simple addattr packaging fix. + * FIXES: 19990619 - J Hadi Salim (hadi@cyberus.ca) + * simple addattr packaging fix. * 2002: J Hadi Salim - Add tc action extensions syntax * */ @@ -37,8 +37,8 @@ static void usage(void) fprintf(stderr, "Usage: ... police rate BPS burst BYTES[/BYTES] [ mtu BYTES[/BYTES] ]\n"); fprintf(stderr, " [ peakrate BPS ] [ avrate BPS ]\n"); fprintf(stderr, " [ ACTIONTERM ]\n"); - fprintf(stderr, "Old Syntax ACTIONTERM := action <EXCEEDACT>[/NOTEXCEEDACT] \n"); - fprintf(stderr, "New Syntax ACTIONTERM := conform-exceed <EXCEEDACT>[/NOTEXCEEDACT] \n"); + fprintf(stderr, "Old Syntax ACTIONTERM := action <EXCEEDACT>[/NOTEXCEEDACT] \n"); + fprintf(stderr, "New Syntax ACTIONTERM := conform-exceed <EXCEEDACT>[/NOTEXCEEDACT] \n"); fprintf(stderr, "Where: *EXCEEDACT := pipe | ok | reclassify | drop | continue \n"); fprintf(stderr, "Where: pipe is only valid for new syntax \n"); exit(-1); @@ -133,7 +133,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_ __u32 avrate = 0; int presult = 0; unsigned buffer=0, mtu=0, mpu=0; - int Rcell_log=-1, Pcell_log = -1; + int Rcell_log=-1, Pcell_log = -1; struct rtattr *tail; memset(&p, 0, sizeof(p)); @@ -304,7 +304,7 @@ int parse_police(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) return act_parse_police(NULL,argc_p,argv_p,tca_id,n); } -int +int print_police(struct action_util *a, FILE *f, struct rtattr *arg) { SPRINT_BUF(b1); @@ -350,7 +350,7 @@ print_police(struct action_util *a, FILE *f, struct rtattr *arg) return 0; } -int +int tc_print_police(FILE *f, struct rtattr *arg) { return print_police(&police_action_util,f,arg); } diff --git a/tc/p_icmp.c b/tc/p_icmp.c index f9ddbe33..a4b80c2c 100644 --- a/tc/p_icmp.c +++ b/tc/p_icmp.c @@ -6,8 +6,8 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * */ #include <stdio.h> @@ -1,13 +1,13 @@ /* - * m_pedit.c packet editor: IPV4/6 header + * m_pedit.c packet editor: IPV4/6 header * * This program is free software; you can distribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * */ #include <stdio.h> @@ -6,8 +6,8 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * */ #include <stdio.h> @@ -6,8 +6,8 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim (hadi@cyberus.ca) - * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * */ #include <stdio.h> @@ -53,7 +53,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl struct tc_cbq_lssopt lss; __u32 rtab[256]; unsigned mpu=0, avpkt=0, allot=0; - int cell_log=-1; + int cell_log=-1; int ewma_log=-1; struct rtattr *tail; @@ -176,7 +176,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str struct tc_cbq_ovl ovl; __u32 rtab[256]; unsigned mpu=0; - int cell_log=-1; + int cell_log=-1; int ewma_log=-1; unsigned bndw = 0; unsigned minburst=0, maxburst=0; @@ -451,7 +451,7 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) if (tb[TCA_CBQ_OVL_STRATEGY]) { if (RTA_PAYLOAD(tb[TCA_CBQ_OVL_STRATEGY]) < sizeof(*ovl)) fprintf(stderr, "CBQ: too short overlimit strategy %u/%u\n", - (unsigned) RTA_PAYLOAD(tb[TCA_CBQ_OVL_STRATEGY]), + (unsigned) RTA_PAYLOAD(tb[TCA_CBQ_OVL_STRATEGY]), (unsigned) sizeof(*ovl)); else ovl = RTA_DATA(tb[TCA_CBQ_OVL_STRATEGY]); diff --git a/tc/q_gred.c b/tc/q_gred.c index 0526c75a..4aaa29b7 100644 --- a/tc/q_gred.c +++ b/tc/q_gred.c @@ -6,9 +6,9 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Authors: J Hadi Salim(hadi@nortelnetworks.com) - * code ruthlessly ripped from - * Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> + * Authors: J Hadi Salim(hadi@nortelnetworks.com) + * code ruthlessly ripped from + * Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> * */ @@ -140,7 +140,7 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n return -1; } return init_gred(qu,argc-1, argv+1,n); - + } else if (strcmp(*argv, "min") == 0) { NEXT_ARG(); if (get_size(&opt.qth_min, *argv)) { @@ -276,7 +276,7 @@ static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) fprintf(f,"\n GRED received message smaller than expected\n"); return -1; } - + /* Bad hack! should really return a proper message as shown above*/ for (i=0;i<MAX_DPs;i++, qopt++) { diff --git a/tc/q_hfsc.c b/tc/q_hfsc.c index f09c6067..4e8c09b7 100644 --- a/tc/q_hfsc.c +++ b/tc/q_hfsc.c @@ -260,7 +260,7 @@ hfsc_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) usc = RTA_DATA(tb[TCA_HFSC_USC]); } - + if (rsc != NULL && fsc != NULL && memcmp(rsc, fsc, sizeof(*rsc)) == 0) hfsc_print_sc(f, "sc", rsc); @@ -275,7 +275,7 @@ hfsc_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } - + struct qdisc_util hfsc_qdisc_util = { .id = "hfsc", .parse_qopt = hfsc_parse_opt, @@ -216,7 +216,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str } opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer); opt.rate.cell_log = cell_log; - + if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, mpu)) < 0) { fprintf(stderr, "htb: failed to calculate ceil rate table.\n"); return -1; @@ -279,14 +279,14 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) fprintf(f, "cburst %s ", sprint_size(cbuffer, b1)); } if (show_raw) - fprintf(f, "buffer [%08x] cbuffer [%08x] ", + fprintf(f, "buffer [%08x] cbuffer [%08x] ", hopt->buffer,hopt->cbuffer); } if (tb[TCA_HTB_INIT]) { gopt = RTA_DATA(tb[TCA_HTB_INIT]); if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1; - fprintf(f, "r2q %d default %x direct_packets_stat %u", + fprintf(f, "r2q %d default %x direct_packets_stat %u", gopt->rate2quantum,gopt->defcls,gopt->direct_pkts); if (show_details) fprintf(f," ver %d.%d",gopt->version >> 16,gopt->version & 0xffff); @@ -304,7 +304,7 @@ static int htb_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstat return -1; st = RTA_DATA(xstats); - fprintf(f, " lended: %u borrowed: %u giants: %u\n", + fprintf(f, " lended: %u borrowed: %u giants: %u\n", st->lends,st->borrows,st->giants); fprintf(f, " tokens: %d ctokens: %d\n", st->tokens,st->ctokens); return 0; diff --git a/tc/q_netem.c b/tc/q_netem.c index 7fbc771c..a3ae71c1 100644 --- a/tc/q_netem.c +++ b/tc/q_netem.c @@ -27,7 +27,7 @@ static void explain(void) { - fprintf(stderr, + fprintf(stderr, "Usage: ... netem [ limit PACKETS ] \n" \ " [ delay TIME [ JITTER [CORRELATION]]]\n" \ " [ distribution {uniform|normal|pareto|paretonormal} ]\n" \ @@ -62,11 +62,11 @@ static int get_distribution(const char *type, __s16 *data) snprintf(name, sizeof(name), "/usr/lib/tc/%s.dist", type); if ((f = fopen(name, "r")) == NULL) { - fprintf(stderr, "No distribution data for %s (%s: %s)\n", + fprintf(stderr, "No distribution data for %s (%s: %s)\n", type, name, strerror(errno)); return -1; } - + n = 0; while (getline(&line, &len, f) != -1) { char *p, *endp; @@ -75,7 +75,7 @@ static int get_distribution(const char *type, __s16 *data) for (p = line; ; p = endp) { x = strtol(p, &endp, 0); - if (endp == p) + if (endp == p) break; if (n >= MAXDIST) { @@ -93,7 +93,7 @@ static int get_distribution(const char *type, __s16 *data) return n; } -static int isnumber(const char *arg) +static int isnumber(const char *arg) { char *p; (void) strtod(arg, &p); @@ -102,7 +102,7 @@ static int isnumber(const char *arg) #define NEXT_IS_NUMBER() (NEXT_ARG_OK() && isnumber(argv[1])) -/* Adjust for the fact that psched_ticks aren't always usecs +/* Adjust for the fact that psched_ticks aren't always usecs (based on kernel PSCHED_CLOCK configuration */ static int get_ticks(__u32 *ticks, const char *str) { @@ -110,7 +110,7 @@ static int get_ticks(__u32 *ticks, const char *str) if(get_usecs(&t, str)) return -1; - + if (tc_core_usec2big(t)) { fprintf(stderr, "Illegal %d usecs (too large)\n", t); return -1; @@ -126,7 +126,7 @@ static char *sprint_ticks(__u32 ticks, char *buf) } -static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) { size_t dist_size = 0; @@ -167,7 +167,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, if (NEXT_IS_NUMBER()) { NEXT_ARG(); - if (get_percent(&cor.delay_corr, + if (get_percent(&cor.delay_corr, *argv)) { explain1("latency"); return -1; @@ -317,7 +317,7 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) struct rtattr *tb[TCA_NETEM_MAX+1]; parse_rtattr(tb, TCA_NETEM_MAX, RTA_DATA(opt) + sizeof(qopt), len); - + if (tb[TCA_NETEM_CORR]) { if (RTA_PAYLOAD(tb[TCA_NETEM_CORR]) < sizeof(*cor)) return -1; @@ -359,20 +359,20 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) if (cor && cor->dup_corr) fprintf(f, " %s", sprint_percent(cor->dup_corr, b1)); } - + if (reorder && reorder->probability) { - fprintf(f, " reorder %s", + fprintf(f, " reorder %s", sprint_percent(reorder->probability, b1)); if (reorder->correlation) - fprintf(f, " %s", + fprintf(f, " %s", sprint_percent(reorder->correlation, b1)); } if (corrupt && corrupt->probability) { - fprintf(f, " corrupt %s", + fprintf(f, " corrupt %s", sprint_percent(corrupt->probability, b1)); if (corrupt->correlation) - fprintf(f, " %s", + fprintf(f, " %s", sprint_percent(corrupt->correlation, b1)); } @@ -205,7 +205,7 @@ static int red_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstat fprintf(f, " marked %u early %u pdrop %u other %u", st->marked, st->early, st->pdrop, st->other); return 0; - + #endif return 0; } @@ -44,7 +44,7 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl __u32 rtab[256]; __u32 ptab[256]; unsigned buffer=0, mtu=0, mpu=0, latency=0; - int Rcell_log=-1, Pcell_log = -1; + int Rcell_log=-1, Pcell_log = -1; struct rtattr *tail; memset(&opt, 0, sizeof(opt)); @@ -42,11 +42,11 @@ static void *BODY = NULL; /* cached handle dlopen(NULL) */ static struct qdisc_util * qdisc_list; static struct filter_util * filter_list; -static int print_noqopt(struct qdisc_util *qu, FILE *f, +static int print_noqopt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) { if (opt && RTA_PAYLOAD(opt)) - fprintf(f, "[Unknown qdisc, optlen=%u] ", + fprintf(f, "[Unknown qdisc, optlen=%u] ", (unsigned) RTA_PAYLOAD(opt)); return 0; } @@ -63,7 +63,7 @@ static int parse_noqopt(struct qdisc_util *qu, int argc, char **argv, struct nlm static int print_nofopt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle) { if (opt && RTA_PAYLOAD(opt)) - fprintf(f, "fh %08x [Unknown filter, optlen=%u] ", + fprintf(f, "fh %08x [Unknown filter, optlen=%u] ", fhandle, (unsigned) RTA_PAYLOAD(opt)); else if (fhandle) fprintf(f, "fh %08x ", fhandle); @@ -206,8 +206,8 @@ static int do_cmd(int argc, char **argv) usage(); return 0; } - - fprintf(stderr, "Object \"%s\" is unknown, try \"tc help\".\n", + + fprintf(stderr, "Object \"%s\" is unknown, try \"tc help\".\n", *argv); return -1; } diff --git a/tc/tc_class.c b/tc/tc_class.c index 049584e1..fb0b6b2e 100644 --- a/tc/tc_class.c +++ b/tc/tc_class.c @@ -147,7 +147,7 @@ int tc_class_modify(int cmd, unsigned flags, int argc, char **argv) int filter_ifindex; __u32 filter_qdisc; -int print_class(const struct sockaddr_nl *who, +int print_class(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) { FILE *fp = (FILE*)arg; @@ -213,7 +213,7 @@ int print_class(const struct sockaddr_nl *who, fprintf(fp, "\n"); if (show_stats) { struct rtattr *xstats = NULL; - + if (tb[TCA_STATS] || tb[TCA_STATS2]) { print_tcstats_attr(fp, tb, " ", &xstats); fprintf(fp, "\n"); diff --git a/tc/tc_filter.c b/tc/tc_filter.c index 3341b13f..3e102cdd 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -177,7 +177,7 @@ static __u32 filter_prio; static __u32 filter_protocol; int print_filter(const struct sockaddr_nl *who, - struct nlmsghdr *n, + struct nlmsghdr *n, void *arg) { FILE *fp = (FILE*)arg; diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c index 76c78f2e..0b169232 100644 --- a/tc/tc_qdisc.c +++ b/tc/tc_qdisc.c @@ -154,7 +154,7 @@ int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv) req.t.tcm_ifindex = idx; } - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) return 2; return 0; @@ -162,8 +162,8 @@ int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv) static int filter_ifindex; -int print_qdisc(const struct sockaddr_nl *who, - struct nlmsghdr *n, +int print_qdisc(const struct sockaddr_nl *who, + struct nlmsghdr *n, void *arg) { FILE *fp = (FILE*)arg; @@ -209,13 +209,13 @@ int print_qdisc(const struct sockaddr_nl *who, if (t->tcm_info != 1) { fprintf(fp, "refcnt %d ", t->tcm_info); } - /* pfifo_fast is generic enough to warrant the hardcoding --JHS */ - + /* pfifo_fast is generic enough to warrant the hardcoding --JHS */ + if (0 == strcmp("pfifo_fast", RTA_DATA(tb[TCA_KIND]))) q = get_qdisc_kind("prio"); else q = get_qdisc_kind(RTA_DATA(tb[TCA_KIND])); - + if (tb[TCA_OPTIONS]) { if (q) q->print_qopt(q, fp, tb[TCA_OPTIONS]); @@ -249,7 +249,7 @@ int tc_qdisc_list(int argc, char **argv) memset(&t, 0, sizeof(t)); t.tcm_family = AF_UNSPEC; memset(&d, 0, sizeof(d)); - + while (argc > 0) { if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); diff --git a/tc/tc_util.c b/tc/tc_util.c index 9cde1441..8cdb9a1d 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -450,7 +450,7 @@ void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtat fprintf(fp, " (dropped %u, overlimits %u requeues %u) ", q.drops, q.overlimits, q.requeues); } - + if (tbs[TCA_STATS_RATE_EST]) { struct gnet_stats_rate_est re = {0}; memcpy(&re, RTA_DATA(tbs[TCA_STATS_RATE_EST]), MIN(RTA_PAYLOAD(tbs[TCA_STATS_RATE_EST]), sizeof(re))); @@ -490,7 +490,7 @@ void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtat memcpy(&st, RTA_DATA(tb[TCA_STATS]), MIN(RTA_PAYLOAD(tb[TCA_STATS]), sizeof(st))); fprintf(fp, "%sSent %llu bytes %u pkts (dropped %u, overlimits %u) ", - prefix, (unsigned long long)st.bytes, st.packets, st.drops, + prefix, (unsigned long long)st.bytes, st.packets, st.drops, st.overlimits); if (st.bps || st.pps || st.qlen || st.backlog) { diff --git a/tc/tc_util.h b/tc/tc_util.h index 1aa1bdaf..0778693a 100644 --- a/tc/tc_util.h +++ b/tc/tc_util.h @@ -23,7 +23,7 @@ struct filter_util { struct filter_util *next; char id[16]; - int (*parse_fopt)(struct filter_util *qu, char *fhandle, int argc, + int (*parse_fopt)(struct filter_util *qu, char *fhandle, int argc, char **argv, struct nlmsghdr *n); int (*print_fopt)(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle); }; @@ -32,7 +32,7 @@ struct action_util { struct action_util *next; char id[16]; - int (*parse_aopt)(struct action_util *a, int *argc, char ***argv, + int (*parse_aopt)(struct action_util *a, int *argc, char ***argv, int code, struct nlmsghdr *n); int (*print_aopt)(struct action_util *au, FILE *f, struct rtattr *opt); int (*print_xstats)(struct action_util *au, FILE *f, struct rtattr *xstats); @@ -72,9 +72,9 @@ extern int parse_police(int *, char ***, int, struct nlmsghdr *); extern char *action_n2a(int action, char *buf, int len); extern int action_a2n(char *arg, int *result); extern int act_parse_police(struct action_util *a,int *, char ***, int, struct nlmsghdr *); -extern int print_police(struct action_util *a, FILE *f, +extern int print_police(struct action_util *a, FILE *f, struct rtattr *tb); -extern int police_print_xstats(struct action_util *a,FILE *f, +extern int police_print_xstats(struct action_util *a,FILE *f, struct rtattr *tb); extern int tc_print_action(FILE *f, const struct rtattr *tb); extern int tc_print_ipt(FILE *f, const struct rtattr *tb); |