~ubuntu-branches/ubuntu/precise/iproute/precise

« back to all changes in this revision

Viewing changes to debian/patches/esfq-support.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt, Andreas Henriksson, Justin B Rye, Alexander Wirt
  • Date: 2008-05-11 11:18:29 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080511111829-rfewew7s6kiev0bh
Tags: 20080417-1
[ Andreas Henriksson ]
* New upstream release, v2.6.25 a.k.a. snapshot 20080417.
  - Initial documentation for xfrm (Partially fixes #451337)
  - Fixes manpage error caught by lintian!
* Fix typos (syntax error) in ip(8) manpage.
  - Introduced by upstream, caught by lintian yet again!
* Don't ship useless headers in iproute-dev (Closes: #467557)
* Cherry-pick "Fix bad hash calculation because of signed address" from
  upstream. (Closes: #480173)

[ Justin B Rye ]
* Update package description (Closes: #464521)

[ Alexander Wirt ]
* Fix typo in short package description.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## esfq-support.dpatch by Alexander Wirt <formorer@debian.org>
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
## DP: No description.
6
 
 
7
 
@DPATCH@
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
11
 
@@ -7,6 +7,7 @@
12
 
 TCMODULES :=
13
 
 TCMODULES += q_fifo.o
14
 
 TCMODULES += q_sfq.o
15
 
+TCMODULES += q_esfq.o
16
 
 TCMODULES += q_red.o
17
 
 TCMODULES += q_prio.o
18
 
 TCMODULES += q_tbf.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
22
 
@@ -0,0 +1,89 @@
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
26
 
+
27
 
+include ../Config
28
 
+
29
 
+TCMODULES :=
30
 
+TCMODULES += q_fifo.o
31
 
+TCMODULES += q_sfq.o
32
 
+TCMODULES += q_red.o
33
 
+TCMODULES += q_prio.o
34
 
+TCMODULES += q_tbf.o
35
 
+TCMODULES += q_cbq.o
36
 
+TCMODULES += f_rsvp.o
37
 
+TCMODULES += f_u32.o
38
 
+TCMODULES += f_route.o
39
 
+TCMODULES += f_fw.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
46
 
+TCMODULES += q_htb.o
47
 
+TCMODULES += m_gact.o
48
 
+TCMODULES += m_mirred.o
49
 
+TCMODULES += m_ipt.o
50
 
+TCMODULES += m_pedit.o
51
 
+TCMODULES += p_ip.o
52
 
+TCMODULES += p_icmp.o
53
 
+TCMODULES += p_tcp.o
54
 
+TCMODULES += p_udp.o
55
 
+TCMODULES += em_nbyte.o
56
 
+TCMODULES += em_cmp.o
57
 
+TCMODULES += em_u32.o
58
 
+TCMODULES += em_meta.o
59
 
+
60
 
+TCOBJ += $(TCMODULES)
61
 
+
62
 
+TCLIB := tc_core.o
63
 
+TCLIB += tc_red.o
64
 
+TCLIB += tc_cbq.o
65
 
+TCLIB += tc_estimator.o
66
 
+
67
 
+CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB
68
 
+
69
 
+TCSO :=
70
 
+TCSO += q_netem.so
71
 
+ifeq ($(TC_CONFIG_ATM),y)
72
 
+  TCSO += q_atm.so
73
 
+endif
74
 
+
75
 
+LDLIBS += -L. -ltc -lm -ldl
76
 
+
77
 
+LDFLAGS += -Wl,-export-dynamic
78
 
+
79
 
+YACC := bison
80
 
+LEX := flex
81
 
+
82
 
+%.so: %.c
83
 
+       $(CC) $(CFLAGS) -shared -fpic $< -o $@
84
 
+
85
 
+
86
 
+all: libtc.a tc $(TCSO)
87
 
+
88
 
+tc: $(TCOBJ) $(LIBNETLINK) $(LIBUTIL) $(TCLIB)
89
 
+
90
 
+libtc.a: $(TCLIB)
91
 
+       $(AR) rcs $@ $(TCLIB)
92
 
+
93
 
+install: all
94
 
+       mkdir -p $(DESTDIR)/usr/lib/tc
95
 
+       install -m 0755 -s tc $(DESTDIR)$(SBINDIR)
96
 
+       for i in $(TCSO); \
97
 
+       do install -m 755 -s $$i $(DESTDIR)/usr/lib/tc; \
98
 
+       done
99
 
+
100
 
+clean:
101
 
+       rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \
102
 
+       rm -f emp_ematch.yacc.output
103
 
+
104
 
+q_atm.so: q_atm.c
105
 
+       $(CC) $(CFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
106
 
+
107
 
+%.yacc.c: %.y
108
 
+       $(YACC) $(YACCFLAGS) -o $@ $<
109
 
+
110
 
+%.lex.c: %.l
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
115
 
@@ -0,0 +1,169 @@
116
 
+/*
117
 
+ * q_esfq.c            ESFQ.
118
 
+ *
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.
123
 
+ *
124
 
+ * Authors:    Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
125
 
+ *
126
 
+ * Changes:    Alexander Atanasov, <alex@ssi.bg>
127
 
+ *             Added depth,limit,divisor,hash_kind options.
128
 
+ */
129
 
+
130
 
+#include <stdio.h>
131
 
+#include <stdlib.h>
132
 
+#include <unistd.h>
133
 
+#include <syslog.h>
134
 
+#include <fcntl.h>
135
 
+#include <math.h> 
136
 
+#include <sys/socket.h>
137
 
+#include <netinet/in.h>
138
 
+#include <arpa/inet.h>
139
 
+#include <string.h>
140
 
+
141
 
+#include "utils.h"
142
 
+#include "tc_util.h"
143
 
+
144
 
+static void explain(void)
145
 
+{
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");
149
 
+}
150
 
+
151
 
+#define usage() return(-1)
152
 
+
153
 
+static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
154
 
+{
155
 
+       int ok=0;
156
 
+       struct tc_sfq_qopt opt;
157
 
+
158
 
+       memset(&opt, 0, sizeof(opt));
159
 
+
160
 
+       opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
161
 
+       
162
 
+       while (argc > 0) {
163
 
+               if (strcmp(*argv, "quantum") == 0) {
164
 
+                       NEXT_ARG();
165
 
+                       if (get_size(&opt.quantum, *argv)) {
166
 
+                               fprintf(stderr, "Illegal \"quantum\"\n");
167
 
+                               return -1;
168
 
+                       }
169
 
+                       ok++;
170
 
+               } else if (strcmp(*argv, "perturb") == 0) {
171
 
+                       NEXT_ARG();
172
 
+                       if (get_integer(&opt.perturb_period, *argv, 0)) {
173
 
+                               fprintf(stderr, "Illegal \"perturb\"\n");
174
 
+                               return -1;
175
 
+                       }
176
 
+                       ok++;
177
 
+               } else if (strcmp(*argv, "depth") == 0) {
178
 
+                       NEXT_ARG();
179
 
+                       if (get_integer(&opt.flows, *argv, 0)) {
180
 
+                               fprintf(stderr, "Illegal \"depth\"\n");
181
 
+                               return -1;
182
 
+                       }
183
 
+                       ok++;
184
 
+               } else if (strcmp(*argv, "divisor") == 0) {
185
 
+                       NEXT_ARG();
186
 
+                       if (get_integer(&opt.divisor, *argv, 0)) {
187
 
+                               fprintf(stderr, "Illegal \"divisor\"\n");
188
 
+                               return -1;
189
 
+                       }
190
 
+                       if(opt.divisor >= 15) {
191
 
+                               fprintf(stderr, "Illegal \"divisor\" must be < 15\n");
192
 
+                               return -1;
193
 
+                       }
194
 
+                       opt.divisor=pow(2,opt.divisor);
195
 
+                       ok++;
196
 
+               } else if (strcmp(*argv, "limit") == 0) {
197
 
+                       NEXT_ARG();
198
 
+                       if (get_integer(&opt.limit, *argv, 0)) {
199
 
+                               fprintf(stderr, "Illegal \"limit\"\n");
200
 
+                               return -1;
201
 
+                       }
202
 
+                       ok++;
203
 
+               } else if (strcmp(*argv, "hash") == 0) {
204
 
+                       NEXT_ARG();
205
 
+                       if(strcmp(*argv,"classic") == 0) {
206
 
+                               opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
207
 
+                       } else 
208
 
+                       if(strcmp(*argv,"dst") == 0) {
209
 
+                               opt.hash_kind= TCA_SFQ_HASH_DST;
210
 
+                       } else
211
 
+                       if(strcmp(*argv,"src") == 0) {
212
 
+                               opt.hash_kind= TCA_SFQ_HASH_SRC;
213
 
+                       } else {
214
 
+                               fprintf(stderr, "Illegal \"hash\"\n");
215
 
+                               explain();
216
 
+                               return -1;
217
 
+                       }
218
 
+                       ok++;
219
 
+               } else if (strcmp(*argv, "help") == 0) {
220
 
+                       explain();
221
 
+                       return -1;
222
 
+               } else {
223
 
+                       fprintf(stderr, "What is \"%s\"?\n", *argv);
224
 
+                       explain();
225
 
+                       return -1;
226
 
+               }
227
 
+               argc--; argv++;
228
 
+       }
229
 
+
230
 
+       if (ok)
231
 
+               addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
232
 
+       return 0;
233
 
+}
234
 
+
235
 
+static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
236
 
+{
237
 
+       struct tc_sfq_qopt *qopt;
238
 
+       SPRINT_BUF(b1);
239
 
+
240
 
+       if (opt == NULL)
241
 
+               return 0;
242
 
+
243
 
+       if (RTA_PAYLOAD(opt)  < sizeof(*qopt))
244
 
+               return -1;
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);
250
 
+       }
251
 
+       if (qopt->perturb_period)
252
 
+               fprintf(f, "perturb %dsec ", qopt->perturb_period);
253
 
+
254
 
+               fprintf(f,"hash: ");
255
 
+       switch(qopt->hash_kind)
256
 
+       {
257
 
+       case TCA_SFQ_HASH_CLASSIC:
258
 
+               fprintf(f,"classic");
259
 
+               break;
260
 
+       case TCA_SFQ_HASH_DST:
261
 
+               fprintf(f,"dst");
262
 
+               break;
263
 
+       case TCA_SFQ_HASH_SRC:
264
 
+               fprintf(f,"src");
265
 
+               break;
266
 
+       default:
267
 
+               fprintf(f,"Unknown");
268
 
+       }
269
 
+       return 0;
270
 
+}
271
 
+
272
 
+static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
273
 
+{
274
 
+       return 0;
275
 
+}
276
 
+
277
 
+
278
 
+struct qdisc_util esfq_util = {
279
 
+       NULL,
280
 
+       "esfq",
281
 
+       esfq_parse_opt,
282
 
+       esfq_print_opt,
283
 
+       esfq_print_xstats,
284
 
+};