1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## esfq-support.dpatch by Alexander Wirt <formorer@debian.org>
4
## All lines beginning with `## DP:' are a description of the patch.
8
diff -urNad iproute-20060323~/tc/Makefile iproute-20060323/tc/Makefile
9
--- iproute-20060323~/tc/Makefile 2006-09-08 18:57:26.000000000 +0200
10
+++ iproute-20060323/tc/Makefile 2006-09-08 18:57:54.000000000 +0200
15
+TCMODULES += q_esfq.o
19
diff -urNad iproute-20060323~/tc/Makefile.orig iproute-20060323/tc/Makefile.orig
20
--- iproute-20060323~/tc/Makefile.orig 1970-01-01 01:00:00.000000000 +0100
21
+++ iproute-20060323/tc/Makefile.orig 2006-09-08 18:57:26.000000000 +0200
23
+TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o \
24
+ m_police.o m_estimator.o m_action.o m_ematch.o \
25
+ emp_ematch.yacc.o emp_ematch.lex.o
30
+TCMODULES += q_fifo.o
33
+TCMODULES += q_prio.o
36
+TCMODULES += f_rsvp.o
38
+TCMODULES += f_route.o
40
+TCMODULES += f_basic.o
41
+TCMODULES += q_dsmark.o
42
+TCMODULES += q_gred.o
43
+TCMODULES += f_tcindex.o
44
+TCMODULES += q_ingress.o
45
+TCMODULES += q_hfsc.o
47
+TCMODULES += m_gact.o
48
+TCMODULES += m_mirred.o
50
+TCMODULES += m_pedit.o
52
+TCMODULES += p_icmp.o
55
+TCMODULES += em_nbyte.o
56
+TCMODULES += em_cmp.o
57
+TCMODULES += em_u32.o
58
+TCMODULES += em_meta.o
60
+TCOBJ += $(TCMODULES)
65
+TCLIB += tc_estimator.o
67
+CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB
71
+ifeq ($(TC_CONFIG_ATM),y)
75
+LDLIBS += -L. -ltc -lm -ldl
77
+LDFLAGS += -Wl,-export-dynamic
83
+ $(CC) $(CFLAGS) -shared -fpic $< -o $@
86
+all: libtc.a tc $(TCSO)
88
+tc: $(TCOBJ) $(LIBNETLINK) $(LIBUTIL) $(TCLIB)
91
+ $(AR) rcs $@ $(TCLIB)
94
+ mkdir -p $(DESTDIR)/usr/lib/tc
95
+ install -m 0755 -s tc $(DESTDIR)$(SBINDIR)
97
+ do install -m 755 -s $$i $(DESTDIR)/usr/lib/tc; \
101
+ rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \
102
+ rm -f emp_ematch.yacc.output
105
+ $(CC) $(CFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
108
+ $(YACC) $(YACCFLAGS) -o $@ $<
111
+ $(LEX) $(LEXFLAGS) -o$@ $<
112
diff -urNad iproute-20060323~/tc/q_esfq.c iproute-20060323/tc/q_esfq.c
113
--- iproute-20060323~/tc/q_esfq.c 1970-01-01 01:00:00.000000000 +0100
114
+++ iproute-20060323/tc/q_esfq.c 2006-09-08 18:57:54.000000000 +0200
119
+ * This program is free software; you can redistribute it and/or
120
+ * modify it under the terms of the GNU General Public License
121
+ * as published by the Free Software Foundation; either version
122
+ * 2 of the License, or (at your option) any later version.
124
+ * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
126
+ * Changes: Alexander Atanasov, <alex@ssi.bg>
127
+ * Added depth,limit,divisor,hash_kind options.
136
+#include <sys/socket.h>
137
+#include <netinet/in.h>
138
+#include <arpa/inet.h>
142
+#include "tc_util.h"
144
+static void explain(void)
146
+ fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
147
+ fprintf(stderr,"Where: \n");
148
+ fprintf(stderr,"HASHTYPE := { classic | src | dst }\n");
151
+#define usage() return(-1)
153
+static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
156
+ struct tc_sfq_qopt opt;
158
+ memset(&opt, 0, sizeof(opt));
160
+ opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
163
+ if (strcmp(*argv, "quantum") == 0) {
165
+ if (get_size(&opt.quantum, *argv)) {
166
+ fprintf(stderr, "Illegal \"quantum\"\n");
170
+ } else if (strcmp(*argv, "perturb") == 0) {
172
+ if (get_integer(&opt.perturb_period, *argv, 0)) {
173
+ fprintf(stderr, "Illegal \"perturb\"\n");
177
+ } else if (strcmp(*argv, "depth") == 0) {
179
+ if (get_integer(&opt.flows, *argv, 0)) {
180
+ fprintf(stderr, "Illegal \"depth\"\n");
184
+ } else if (strcmp(*argv, "divisor") == 0) {
186
+ if (get_integer(&opt.divisor, *argv, 0)) {
187
+ fprintf(stderr, "Illegal \"divisor\"\n");
190
+ if(opt.divisor >= 15) {
191
+ fprintf(stderr, "Illegal \"divisor\" must be < 15\n");
194
+ opt.divisor=pow(2,opt.divisor);
196
+ } else if (strcmp(*argv, "limit") == 0) {
198
+ if (get_integer(&opt.limit, *argv, 0)) {
199
+ fprintf(stderr, "Illegal \"limit\"\n");
203
+ } else if (strcmp(*argv, "hash") == 0) {
205
+ if(strcmp(*argv,"classic") == 0) {
206
+ opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
208
+ if(strcmp(*argv,"dst") == 0) {
209
+ opt.hash_kind= TCA_SFQ_HASH_DST;
211
+ if(strcmp(*argv,"src") == 0) {
212
+ opt.hash_kind= TCA_SFQ_HASH_SRC;
214
+ fprintf(stderr, "Illegal \"hash\"\n");
219
+ } else if (strcmp(*argv, "help") == 0) {
223
+ fprintf(stderr, "What is \"%s\"?\n", *argv);
231
+ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
235
+static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
237
+ struct tc_sfq_qopt *qopt;
243
+ if (RTA_PAYLOAD(opt) < sizeof(*qopt))
245
+ qopt = RTA_DATA(opt);
246
+ fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
247
+ if (show_details) {
248
+ fprintf(f, "limit %up flows %u/%u ",
249
+ qopt->limit, qopt->flows, qopt->divisor);
251
+ if (qopt->perturb_period)
252
+ fprintf(f, "perturb %dsec ", qopt->perturb_period);
254
+ fprintf(f,"hash: ");
255
+ switch(qopt->hash_kind)
257
+ case TCA_SFQ_HASH_CLASSIC:
258
+ fprintf(f,"classic");
260
+ case TCA_SFQ_HASH_DST:
263
+ case TCA_SFQ_HASH_SRC:
267
+ fprintf(f,"Unknown");
272
+static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
278
+struct qdisc_util esfq_util = {