--- a/tc/tc_filter.c 2004-08-13 19:57:35.000000000 -0400 +++ b/tc/tc_filter.c 2004-08-13 21:54:49.000000000 -0400 @@ -254,18 +254,14 @@ if (show_stats) { if (tb[TCA_STATS]) { -#ifndef STOOPID_8BYTE if (RTA_PAYLOAD(tb[TCA_STATS]) < sizeof(struct tc_stats)) fprintf(fp, "statistics truncated"); else { -#endif struct tc_stats st; memcpy(&st, RTA_DATA(tb[TCA_STATS]), sizeof(st)); print_tcstats(fp, &st); fprintf(fp, "\n"); -#ifndef STOOPID_8BYTE } -#endif } } fflush(fp); --- a/tc/tc_class.c 2004-08-13 19:57:34.000000000 -0400 +++ b/tc/tc_class.c 2004-08-13 21:58:37.000000000 -0400 @@ -241,18 +241,14 @@ fprintf(fp, "\n"); if (show_stats) { if (tb[TCA_STATS]) { -#ifndef STOOPID_8BYTE if (RTA_PAYLOAD(tb[TCA_STATS]) < sizeof(struct tc_stats)) fprintf(fp, "statistics truncated"); else { -#endif struct tc_stats st; memcpy(&st, RTA_DATA(tb[TCA_STATS]), sizeof(st)); print_class_tcstats(fp, &st); fprintf(fp, "\n"); -#ifndef STOOPID_8BYTE } -#endif } if (q && tb[TCA_XSTATS]) { q->print_xstats(q, fp, tb[TCA_XSTATS]); --- a/tc/tc_qdisc.c 2004-08-13 19:57:34.000000000 -0400 +++ b/tc/tc_qdisc.c 2004-08-13 22:01:52.000000000 -0400 @@ -173,7 +173,6 @@ fprintf(fp, " Sent %llu bytes %u pkts (dropped %u, overlimits %u ) ", (unsigned long long)st->bytes, st->packets, st->drops, st->overlimits); - if (st->bps || st->pps || st->qlen || st->backlog) { fprintf(fp, "\n "); if (st->bps || st->pps) { @@ -256,19 +255,15 @@ fprintf(fp, "\n"); if (show_stats) { if (tb[TCA_STATS]) { -#ifndef STOOPID_8BYTE if (RTA_PAYLOAD(tb[TCA_STATS]) < sizeof(struct tc_stats)) fprintf(fp, "statistics truncated"); else { -#endif struct tc_stats st; memcpy(&st, RTA_DATA(tb[TCA_STATS]), sizeof(st)); print_tcstats(fp, &st); fprintf(fp, "\n"); } -#ifndef STOOPID_8BYTE } -#endif if (q && tb[TCA_XSTATS]) { q->print_xstats(q, fp, tb[TCA_XSTATS]); fprintf(fp, "\n"); --- a/tc/m_action.c 2004-08-13 19:57:35.000000000 -0400 +++ b/tc/m_action.c 2004-08-13 22:34:09.000000000 -0400 @@ -262,21 +262,17 @@ if (show_stats) { if (tb[TCA_STATS]) { -#ifndef STOOPID_8BYTE if (RTA_PAYLOAD(tb[TCA_STATS]) < sizeof (struct tc_stats)) fprintf(f, "statistics truncated"); else { -#endif struct tc_stats st; memcpy(&st, RTA_DATA(tb[TCA_STATS]), sizeof (st)); fprintf(f, "\t"); print_tcstats(f, &st); fprintf(f, "\n"); -#ifndef STOOPID_8BYTE } -#endif } } --- a/tc/f_u32.c 2004-08-13 19:57:35.000000000 -0400 +++ b/tc/f_u32.c 2004-08-13 22:54:08.000000000 -0400 @@ -123,8 +123,6 @@ return -1; sel->keys[i].val |= key; sel->keys[i].mask |= mask; - sel->keys[i].off = 0; - sel->keys[i].offmask = 0; return 0; } } @@ -710,19 +708,10 @@ while (argc > 0) { if (matches(*argv, "mask") == 0) { __u32 mask; - int i = 0; NEXT_ARG(); if (get_u32(&mask, *argv, 16)) return -1; sel->hmask = htonl(mask); - mask = sel->hmask; - while (!(mask & 1)) { - i++; - mask>>=1; - } -#ifdef fix_u32_bug - sel->fshift = i; -#endif } else if (matches(*argv, "at") == 0) { int num; NEXT_ARG(); @@ -875,6 +864,7 @@ } strncpy(ind, *argv, sizeof (ind) - 1); addattr_l(n, MAX_MSG, TCA_U32_INDEV, ind, strlen(ind) + 1); + } else if (matches(*argv, "action") == 0) { NEXT_ARG(); if (parse_action(&argc, &argv, TCA_U32_ACT, n)) { @@ -882,6 +872,7 @@ return -1; } continue; + } else if (matches(*argv, "police") == 0) { NEXT_ARG(); if (parse_police(&argc, &argv, TCA_U32_POLICE, n)) { @@ -920,6 +911,7 @@ { struct rtattr *tb[TCA_U32_MAX+1]; struct tc_u32_sel *sel = NULL; + struct tc_u32_pcnt *pf = NULL; if (opt == NULL) return 0; @@ -964,10 +956,19 @@ fprintf(f, "link %s ", sprint_u32_handle(*(__u32*)RTA_DATA(tb[TCA_U32_LINK]), b1)); } + if (tb[TCA_U32_PCNT]) { + if (RTA_PAYLOAD(tb[TCA_U32_PCNT]) < sizeof(*pf)) { + fprintf(f, "Broken perf counters \n"); + return -1; + } + pf = RTA_DATA(tb[TCA_U32_PCNT]); + } if (sel) { int i; struct tc_u32_key *key = sel->keys; + if (show_stats && NULL != pf) + fprintf(f, " (rule hit %llu success %llu)",pf->rcnt,pf->rhit); if (sel->nkeys) { for (i=0; inkeys; i++, key++) { fprintf(f, "\n match %08x/%08x at %s%d", @@ -975,6 +976,8 @@ (unsigned int)ntohl(key->mask), key->offmask ? "nexthdr+" : "", key->off); + if (show_stats && NULL != pf) + fprintf(f, " (success %lld ) ",pf->kcnts[i]); } } @@ -994,11 +997,6 @@ } } - if (show_stats && tb[TCA_U32_PCNT]){ - struct tc_u32_pcnt *p = RTA_DATA(tb[TCA_U32_PCNT]); - fprintf(f, " (rule hit %llu success %llu)", - p->rcnt, p->rhit); - } if (tb[TCA_U32_POLICE]) { fprintf(f, "\n"); tc_print_police(f, tb[TCA_U32_POLICE]);