]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/blobdiff - tc/q_red.c
Add reference to tc-codel(8) to the SEE ALSO section
[lisovros/iproute2_canprio.git] / tc / q_red.c
index 0e5d2282980fa4fda40edbc08a59a1a564308416..89e7320181d52ae0c966580c1192f88046842339 100644 (file)
@@ -19,6 +19,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <string.h>
+#include <math.h>
 
 #include "utils.h"
 #include "tc_util.h"
@@ -28,7 +29,7 @@
 static void explain(void)
 {
        fprintf(stderr, "Usage: ... red limit BYTES [min BYTES] [max BYTES] avpkt BYTES [burst PACKETS]\n");
-       fprintf(stderr, "               [adaptative] [probability PROBABILITY] bandwidth KBPS\n");
+       fprintf(stderr, "               [adaptive] [probability PROBABILITY] bandwidth KBPS\n");
        fprintf(stderr, "               [ecn] [harddrop]\n");
 }
 
@@ -95,6 +96,8 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
                        opt.flags |= TC_RED_HARDDROP;
                } else if (strcmp(*argv, "adaptative") == 0) {
                        opt.flags |= TC_RED_ADAPTATIVE;
+               } else if (strcmp(*argv, "adaptive") == 0) {
+                       opt.flags |= TC_RED_ADAPTATIVE;
                } else if (strcmp(*argv, "help") == 0) {
                        explain();
                        return -1;
@@ -173,7 +176,7 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 
        if (tb[TCA_RED_MAX_P] &&
            RTA_PAYLOAD(tb[TCA_RED_MAX_P]) >= sizeof(__u32))
-               max_P = *(__u32 *)RTA_DATA(tb[TCA_RED_MAX_P]);
+               max_P = rta_getattr_u32(tb[TCA_RED_MAX_P]);
 
        fprintf(f, "limit %s min %s max %s ",
                sprint_size(qopt->limit, b1),
@@ -184,7 +187,7 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
        if (qopt->flags & TC_RED_HARDDROP)
                fprintf(f, "harddrop ");
        if (qopt->flags & TC_RED_ADAPTATIVE)
-               fprintf(f, "adaptative ");
+               fprintf(f, "adaptive ");
        if (show_details) {
                fprintf(f, "ewma %u ", qopt->Wlog);
                if (max_P)