1 diff -urN iproute2.orig/tc/Makefile iproute2/tc/Makefile
2 --- iproute2.orig/tc/Makefile Sun Apr 16 20:42:53 2000
3 +++ iproute2/tc/Makefile Tue May 14 23:04:10 2002
12 diff -urN iproute2.orig/tc/q_esfq.c iproute2/tc/q_esfq.c
13 --- iproute2.orig/tc/q_esfq.c Thu Jan 1 02:00:00 1970
14 +++ iproute2/tc/q_esfq.c Thu May 16 02:13:30 2002
19 + * This program is free software; you can redistribute it and/or
20 + * modify it under the terms of the GNU General Public License
21 + * as published by the Free Software Foundation; either version
22 + * 2 of the License, or (at your option) any later version.
24 + * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
26 + * Changes: Alexander Atanasov, <alex@ssi.bg>
27 + * Added depth,limit,divisor,hash_kind options.
36 +#include <sys/socket.h>
37 +#include <netinet/in.h>
38 +#include <arpa/inet.h>
44 +static void explain(void)
46 + fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
47 + fprintf(stderr,"Where: \n");
48 + fprintf(stderr,"HASHTYPE := { classic | src | dst }\n");
51 +#define usage() return(-1)
53 +static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
56 + struct tc_sfq_qopt opt;
58 + memset(&opt, 0, sizeof(opt));
60 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
63 + if (strcmp(*argv, "quantum") == 0) {
65 + if (get_size(&opt.quantum, *argv)) {
66 + fprintf(stderr, "Illegal \"quantum\"\n");
70 + } else if (strcmp(*argv, "perturb") == 0) {
72 + if (get_integer(&opt.perturb_period, *argv, 0)) {
73 + fprintf(stderr, "Illegal \"perturb\"\n");
77 + } else if (strcmp(*argv, "depth") == 0) {
79 + if (get_integer(&opt.flows, *argv, 0)) {
80 + fprintf(stderr, "Illegal \"depth\"\n");
84 + } else if (strcmp(*argv, "divisor") == 0) {
86 + if (get_integer(&opt.divisor, *argv, 0)) {
87 + fprintf(stderr, "Illegal \"divisor\"\n");
90 + if(opt.divisor >= 15) {
91 + fprintf(stderr, "Illegal \"divisor\" must be < 15\n");
94 + opt.divisor=pow(2,opt.divisor);
96 + } else if (strcmp(*argv, "limit") == 0) {
98 + if (get_integer(&opt.limit, *argv, 0)) {
99 + fprintf(stderr, "Illegal \"limit\"\n");
103 + } else if (strcmp(*argv, "hash") == 0) {
105 + if(strcmp(*argv,"classic") == 0) {
106 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
108 + if(strcmp(*argv,"dst") == 0) {
109 + opt.hash_kind= TCA_SFQ_HASH_DST;
111 + if(strcmp(*argv,"src") == 0) {
112 + opt.hash_kind= TCA_SFQ_HASH_SRC;
114 + fprintf(stderr, "Illegal \"hash\"\n");
119 + } else if (strcmp(*argv, "help") == 0) {
123 + fprintf(stderr, "What is \"%s\"?\n", *argv);
131 + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
135 +static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
137 + struct tc_sfq_qopt *qopt;
143 + if (RTA_PAYLOAD(opt) < sizeof(*qopt))
145 + qopt = RTA_DATA(opt);
146 + fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
147 + if (show_details) {
148 + fprintf(f, "limit %up flows %u/%u ",
149 + qopt->limit, qopt->flows, qopt->divisor);
151 + if (qopt->perturb_period)
152 + fprintf(f, "perturb %dsec ", qopt->perturb_period);
154 + fprintf(f,"hash: ");
155 + switch(qopt->hash_kind)
157 + case TCA_SFQ_HASH_CLASSIC:
158 + fprintf(f,"classic");
160 + case TCA_SFQ_HASH_DST:
163 + case TCA_SFQ_HASH_SRC:
167 + fprintf(f,"Unknown");
172 +static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
178 +struct qdisc_util esfq_util = {