1 --- iproute-20041019.orig/ip/Makefile
2 +++ iproute-20041019/ip/Makefile
6 ALLOBJ=$(IPOBJ) $(RTMONOBJ)
7 -TARGETS=ip rtmon ifcfg rtpr
12 --- iproute-20041019.orig/tc/q_htb.c
13 +++ iproute-20041019/tc/q_htb.c
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: Martin Devera, devik@cdi.cz
33 +#include <sys/socket.h>
34 +#include <netinet/in.h>
35 +#include <arpa/inet.h>
41 +#define HTB_TC_VER 0x30003
42 +#if HTB_TC_VER >> 16 != TC_HTB_PROTOVER
43 +#error "Different kernel and TC HTB versions"
46 +static void explain(void)
48 + fprintf(stderr, "Usage: ... qdisc add ... htb [default N] [r2q N]\n"
49 + " default minor id of class to which unclassified packets are sent {0}\n"
50 + " r2q DRR quantums are computed as rate in Bps/r2q {10}\n"
51 + " debug string of 16 numbers each 0-3 {0}\n\n"
52 + "... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]\n"
53 + " [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n"
54 + " rate rate allocated to this class (class can still borrow)\n"
55 + " burst max bytes burst which can be accumulated during idle period {computed}\n"
56 + " ceil definite upper class rate (no borrows) {rate}\n"
57 + " cburst burst but for ceil {computed}\n"
58 + " mtu max packet size we create rate map for {1600}\n"
59 + " prio priority of leaf; lower are served first {0}\n"
60 + " quantum how much bytes to serve from leaf at once {use r2q}\n"
61 + "\nTC HTB version %d.%d\n",HTB_TC_VER>>16,HTB_TC_VER&0xffff
65 +static void explain1(char *arg)
67 + fprintf(stderr, "Illegal \"%s\"\n", arg);
72 +#define usage() return(-1)
74 +static int htb_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
76 + struct tc_htb_glob opt;
77 + struct rtattr *tail;
78 + unsigned i; char *p;
79 + memset(&opt,0,sizeof(opt));
80 + opt.rate2quantum = 10;
84 + if (matches(*argv, "r2q") == 0) {
86 + if (get_u32(&opt.rate2quantum, *argv, 10)) {
87 + explain1("r2q"); return -1;
89 + } else if (matches(*argv, "default") == 0) {
91 + if (get_u32(&opt.defcls, *argv, 16)) {
92 + explain1("default"); return -1;
94 + } else if (matches(*argv, "debug") == 0) {
95 + NEXT_ARG(); p = *argv;
96 + for (i=0; i<16; i++,p++) {
97 + if (*p<'0' || *p>'3') break;
98 + opt.debug |= (*p-'0')<<(2*i);
101 + fprintf(stderr, "What is \"%s\"?\n", *argv);
107 + tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
108 + addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
109 + addattr_l(n, 2024, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt)));
110 + tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
114 +static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
117 + struct tc_htb_opt opt;
118 + __u32 rtab[256],ctab[256];
119 + unsigned buffer=0,cbuffer=0;
120 + int cell_log=-1,ccell_log = -1,mtu;
121 + struct rtattr *tail;
123 + memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */
126 + if (matches(*argv, "prio") == 0) {
128 + if (get_u32(&opt.prio, *argv, 10)) {
129 + explain1("prio"); return -1;
132 + } else if (matches(*argv, "mtu") == 0) {
134 + if (get_u32(&mtu, *argv, 10)) {
135 + explain1("mtu"); return -1;
137 + } else if (matches(*argv, "quantum") == 0) {
139 + if (get_u32(&opt.quantum, *argv, 10)) {
140 + explain1("quantum"); return -1;
142 + } else if (matches(*argv, "burst") == 0 ||
143 + strcmp(*argv, "buffer") == 0 ||
144 + strcmp(*argv, "maxburst") == 0) {
146 + if (get_size_and_cell(&buffer, &cell_log, *argv) < 0) {
147 + explain1("buffer");
151 + } else if (matches(*argv, "cburst") == 0 ||
152 + strcmp(*argv, "cbuffer") == 0 ||
153 + strcmp(*argv, "cmaxburst") == 0) {
155 + if (get_size_and_cell(&cbuffer, &ccell_log, *argv) < 0) {
156 + explain1("cbuffer");
160 + } else if (strcmp(*argv, "ceil") == 0) {
162 + if (opt.ceil.rate) {
163 + fprintf(stderr, "Double \"ceil\" spec\n");
166 + if (get_rate(&opt.ceil.rate, *argv)) {
171 + } else if (strcmp(*argv, "rate") == 0) {
173 + if (opt.rate.rate) {
174 + fprintf(stderr, "Double \"rate\" spec\n");
177 + if (get_rate(&opt.rate.rate, *argv)) {
182 + } else if (strcmp(*argv, "help") == 0) {
186 + fprintf(stderr, "What is \"%s\"?\n", *argv);
196 + if (opt.rate.rate == 0) {
197 + fprintf(stderr, "\"rate\" is required.\n");
200 + /* if ceil params are missing, use the same as rate */
201 + if (!opt.ceil.rate) opt.ceil = opt.rate;
203 + /* compute minimal allowed burst from rate; mtu is added here to make
204 + sute that buffer is larger than mtu and to have some safeguard space */
205 + if (!buffer) buffer = opt.rate.rate / HZ + mtu;
206 + if (!cbuffer) cbuffer = opt.ceil.rate / HZ + mtu;
208 + if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, 0)) < 0) {
209 + fprintf(stderr, "htb: failed to calculate rate table.\n");
212 + opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer);
213 + opt.rate.cell_log = cell_log;
215 + if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, 0)) < 0) {
216 + fprintf(stderr, "htb: failed to calculate ceil rate table.\n");
219 + opt.cbuffer = tc_calc_xmittime(opt.ceil.rate, cbuffer);
220 + opt.ceil.cell_log = ccell_log;
222 + tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
223 + addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
224 + addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
225 + addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024);
226 + addattr_l(n, 4024, TCA_HTB_CTAB, ctab, 1024);
227 + tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
231 +static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
233 + struct rtattr *tb[TCA_HTB_RTAB+1];
234 + struct tc_htb_opt *hopt;
235 + struct tc_htb_glob *gopt;
236 + double buffer,cbuffer;
243 + memset(tb, 0, sizeof(tb));
244 + parse_rtattr(tb, TCA_HTB_RTAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
246 + if (tb[TCA_HTB_PARMS]) {
248 + hopt = RTA_DATA(tb[TCA_HTB_PARMS]);
249 + if (RTA_PAYLOAD(tb[TCA_HTB_PARMS]) < sizeof(*hopt)) return -1;
251 + if (!hopt->level) {
252 + fprintf(f, "prio %d ", (int)hopt->prio);
254 + fprintf(f, "quantum %d ", (int)hopt->quantum);
256 + fprintf(f, "rate %s ", sprint_rate(hopt->rate.rate, b1));
257 + buffer = ((double)hopt->rate.rate*tc_core_tick2usec(hopt->buffer))/1000000;
258 + fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1));
259 + cbuffer = ((double)hopt->ceil.rate*tc_core_tick2usec(hopt->cbuffer))/1000000;
260 + if (show_details) {
261 + fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1),
262 + 1<<hopt->rate.cell_log, sprint_size(hopt->rate.mpu, b2));
263 + fprintf(f, "cburst %s/%u mpu %s ", sprint_size(cbuffer, b1),
264 + 1<<hopt->ceil.cell_log, sprint_size(hopt->ceil.mpu, b2));
265 + fprintf(f, "level %d ", (int)hopt->level);
267 + fprintf(f, "burst %s ", sprint_size(buffer, b1));
268 + fprintf(f, "cburst %s ", sprint_size(cbuffer, b1));
271 + fprintf(f, "buffer [%08x] cbuffer [%08x] ",
272 + hopt->buffer,hopt->cbuffer);
274 + if (tb[TCA_HTB_INIT]) {
275 + gopt = RTA_DATA(tb[TCA_HTB_INIT]);
276 + if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1;
278 + fprintf(f, "r2q %d default %x direct_packets_stat %u",
279 + gopt->rate2quantum,gopt->defcls,gopt->direct_pkts);
281 + fprintf(f," ver %d.%d",gopt->version >> 16,gopt->version & 0xffff);
286 +static int htb_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
288 + struct tc_htb_xstats *st;
289 + if (xstats == NULL)
292 + if (RTA_PAYLOAD(xstats) < sizeof(*st))
295 + st = RTA_DATA(xstats);
296 + fprintf(f, " lended: %u borrowed: %u giants: %u\n",
297 + st->lends,st->borrows,st->giants);
298 + fprintf(f, " tokens: %d ctokens: %d\n", st->tokens,st->ctokens);
302 +struct qdisc_util htb_util = {
308 + htb_parse_class_opt,
312 +/* for testing of old one */
313 +struct qdisc_util htb2_util = {
319 + htb_parse_class_opt,
326 --- iproute-20041019.orig/doc/Makefile
327 +++ iproute-20041019/doc/Makefile
331 HTMLFILES=$(subst .sgml,.html,$(shell echo *.sgml))
332 +TXTFILES=$(subst .sgml,.txt,$(shell echo *.sgml))
333 DVIFILES=$(subst .ps,.dvi,$(PSFILES))
349 - $(DVIPS) $< -o $@.tmp
350 - ./do-psnup $@.tmp $@ $(PAGESIZE) $(PAGESPERPAGE)
358 + lynx -nolist -dump $< > $@
361 install -m 0644 $(shell echo *.tex) $(DESTDIR)$(DOCDIR)
362 install -m 0644 $(shell echo *.sgml) $(DESTDIR)$(DOCDIR)
365 - rm -f *.aux *.log *.toc $(PSFILES) $(DVIFILES) *.html
366 + rm -f *.aux *.log *.toc $(PSFILES) $(DVIFILES) *.html $(TXTFILES)
367 --- iproute-20041019.orig/misc/Makefile
368 +++ iproute-20041019/misc/Makefile
370 SSOBJ=ss.o ssfilter.o
371 LNSTATOBJ=lnstat.o lnstat_util.o
373 -TARGETS=ss nstat ifstat rtacct arpd lnstat
374 +#TARGETS=ss nstat ifstat rtacct arpd lnstat
375 +TARGETS=ss nstat rtacct lnstat
379 --- iproute-20041019.orig/misc/netbug
380 +++ iproute-20041019/misc/netbug
386 echo -n "Send network configuration summary to [ENTER means kuznet@ms2.inr.ac.ru] "
387 IFS="" read mail || exit 1
388 [ -z "$mail" ] && mail=kuznet@ms2.inr.ac.ru
390 +netbug=`mktemp -d -t netbug.XXXXXX` || {echo "$0: Cannot create temporary directory" >&2; exit 1; }
391 +netbugtar=`tempfile -d $netbug --suffix=tar.gz` || {echo "$0: Cannot create temporary file" >&2; exit 1; }
393 +trap "/bin/rm -rf $netbug $netbugtar" 0 1 2 3 13 15
396 -while [ "$netbug" = "" ]; do
397 - netbug=`echo netbug.$$.$RANDOM`
398 - if [ -e /tmp/$netbug ]; then
403 -tmppath=/tmp/$netbug
405 -trap "rm -rf $tmppath $tmppath.tar.gz" 0 SIGINT
410 cat /proc/slabinfo > $tmppath/slabinfo
415 -tar c $netbug | gzip -9c > $netbug.tar.gz
417 -uuencode $netbug.tar.gz $netbug.tar.gz | mail -s $netbug "$mail"
418 +tar c $tmppath | gzip -9c > $netbugtar
419 +uuencode $netbugtar $netbugtar | mail -s $netbug "$mail"
421 echo "Sending to <$mail>; subject is $netbug"
423 --- iproute-20041019.orig/Makefile
424 +++ iproute-20041019/Makefile
426 LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
429 - @for i in $(SUBDIRS); \
430 + @set -e; for i in $(SUBDIRS); \
431 do $(MAKE) $(MFLAGS) -C $$i; done
435 $(DESTDIR)$(DOCDIR)/examples
436 install -m 0644 $(shell find examples/diffserv -type f -maxdepth 1) \
437 $(DESTDIR)$(DOCDIR)/examples/diffserv
438 - @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
439 + @set -e; for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
440 install -m 0644 $(shell find etc/iproute2 -type f -maxdepth 1) $(DESTDIR)$(CONFDIR)
441 install -m 0755 -d $(DESTDIR)$(MANDIR)/man8
442 install -m 0644 $(shell find man/man8 -type f -maxdepth 1) $(DESTDIR)$(MANDIR)/man8
444 ln -sf $(MANDIR)/man8/tc-pbfifo.8 $(DESTDIR)$(MANDIR)/man8/tc-pfifo.8
447 - @for i in $(SUBDIRS) doc; \
448 + @set -e; for i in $(SUBDIRS) doc; \
449 do $(MAKE) $(MFLAGS) -C $$i clean; done
452 --- iproute-20041019.orig/include/linux/pkt_sched.h
453 +++ iproute-20041019/include/linux/pkt_sched.h
456 +#ifndef __LINUX_PKT_SCHED_H
457 +#define __LINUX_PKT_SCHED_H
459 +/* Logical priority bands not depending on specific packet scheduler.
460 + Every scheduler will map them to real traffic classes, if it has
461 + no more precise mechanism to classify packets.
463 + These numbers have no special meaning, though their coincidence
464 + with obsolete IPv6 values is not occasional :-). New IPv6 drafts
465 + preferred full anarchy inspired by diffserv group.
467 + Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy
468 + class, actually, as rule it will be handled with more care than
469 + filler or even bulk.
472 +#define TC_PRIO_BESTEFFORT 0
473 +#define TC_PRIO_FILLER 1
474 +#define TC_PRIO_BULK 2
475 +#define TC_PRIO_INTERACTIVE_BULK 4
476 +#define TC_PRIO_INTERACTIVE 6
477 +#define TC_PRIO_CONTROL 7
479 +#define TC_PRIO_MAX 15
481 +/* Generic queue statistics, available for all the elements.
482 + Particular schedulers may have also their private records.
487 + __u64 bytes; /* NUmber of enqueues bytes */
488 + __u32 packets; /* Number of enqueued packets */
489 + __u32 drops; /* Packets dropped because of lack of resources */
490 + __u32 overlimits; /* Number of throttle events when this
491 + * flow goes out of allocated bandwidth */
492 + __u32 bps; /* Current flow byte rate */
493 + __u32 pps; /* Current flow packet rate */
504 + unsigned char ewma_log;
510 + All the traffic control objects have 32bit identifiers, or "handles".
512 + They can be considered as opaque numbers from user API viewpoint,
513 + but actually they always consist of two fields: major and
514 + minor numbers, which are interpreted by kernel specially,
515 + that may be used by applications, though not recommended.
517 + F.e. qdisc handles always have minor number equal to zero,
518 + classes (or flows) have major equal to parent qdisc major, and
519 + minor uniquely identifying class inside qdisc.
521 + Macros to manipulate handles:
524 +#define TC_H_MAJ_MASK (0xFFFF0000U)
525 +#define TC_H_MIN_MASK (0x0000FFFFU)
526 +#define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK)
527 +#define TC_H_MIN(h) ((h)&TC_H_MIN_MASK)
528 +#define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK))
530 +#define TC_H_UNSPEC (0U)
531 +#define TC_H_ROOT (0xFFFFFFFFU)
532 +#define TC_H_INGRESS (0xFFFFFFF1U)
536 + unsigned char cell_log;
537 + unsigned char __reserved;
538 + unsigned short feature;
540 + unsigned short mpu;
548 + __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */
553 +#define TCQ_PRIO_BANDS 16
557 + int bands; /* Number of bands */
558 + __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
565 + int flows; /* Maximal number of guaranteed flows */
566 + unsigned char R_log; /* Fixed point position for round number */
567 + unsigned char delta_log; /* Log of maximal managed time interval */
568 + __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> CSZ band */
573 + struct tc_ratespec slice;
574 + struct tc_ratespec rate;
575 + struct tc_ratespec peakrate;
593 + struct tc_ratespec rate;
594 + struct tc_ratespec peakrate;
611 +/* TEQL does not require any parameters */
617 + unsigned quantum; /* Bytes per round allocated to flow */
618 + int perturb_period; /* Period of hash perturbation */
619 + __u32 limit; /* Maximal packets in queue */
620 + unsigned divisor; /* Hash divisor */
621 + unsigned flows; /* Maximal number of flows */
625 + * NOTE: limit, divisor and flows are hardwired to code at the moment.
627 + * limit=flows=128, divisor=1024;
629 + * The only reason for this is efficiency, it is possible
630 + * to change these parameters in compile time.
644 + __u32 limit; /* HARD maximal queue length (bytes) */
645 + __u32 qth_min; /* Min average length threshold (bytes) */
646 + __u32 qth_max; /* Max average length threshold (bytes) */
647 + unsigned char Wlog; /* log(W) */
648 + unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
649 + unsigned char Scell_log; /* cell size for idle damping */
650 + unsigned char flags;
651 +#define TC_RED_ECN 1
654 +struct tc_red_xstats
656 + __u32 early; /* Early drops */
657 + __u32 pdrop; /* Drops due to queue limits */
658 + __u32 other; /* Drops due to drop() calls */
659 + __u32 marked; /* Marked packets */
674 +#define TCA_SET_OFF TCA_GRED_PARMS
677 + __u32 limit; /* HARD maximal queue length (bytes)
679 + __u32 qth_min; /* Min average length threshold (bytes)
681 + __u32 qth_max; /* Max average length threshold (bytes)
683 + __u32 DP; /* upto 2^32 DPs */
691 + unsigned char Wlog; /* log(W) */
692 + unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
693 + unsigned char Scell_log; /* cell size for idle damping */
694 + __u8 prio; /* prio of this VQ */
707 +#define TC_HTB_NUMPRIO 8
708 +#define TC_HTB_MAXDEPTH 8
709 +#define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */
713 + struct tc_ratespec rate;
714 + struct tc_ratespec ceil;
718 + __u32 level; /* out only */
723 + __u32 version; /* to match HTB/TC */
724 + __u32 rate2quantum; /* bps->quantum divisor */
725 + __u32 defcls; /* default class number */
726 + __u32 debug; /* debug flags */
729 + __u32 direct_pkts; /* count of non shapped packets */
739 +struct tc_htb_xstats
743 + __u32 giants; /* too big packets (rate will not be accurate) */
750 +#define TC_CBQ_MAXPRIO 8
751 +#define TC_CBQ_MAXLEVEL 8
752 +#define TC_CBQ_DEF_EWMA 5
754 +struct tc_cbq_lssopt
756 + unsigned char change;
757 + unsigned char flags;
758 +#define TCF_CBQ_LSS_BOUNDED 1
759 +#define TCF_CBQ_LSS_ISOLATED 2
760 + unsigned char ewma_log;
761 + unsigned char level;
762 +#define TCF_CBQ_LSS_FLAGS 1
763 +#define TCF_CBQ_LSS_EWMA 2
764 +#define TCF_CBQ_LSS_MAXIDLE 4
765 +#define TCF_CBQ_LSS_MINIDLE 8
766 +#define TCF_CBQ_LSS_OFFTIME 0x10
767 +#define TCF_CBQ_LSS_AVPKT 0x20
774 +struct tc_cbq_wrropt
776 + unsigned char flags;
777 + unsigned char priority;
778 + unsigned char cpriority;
779 + unsigned char __reserved;
786 + unsigned char strategy;
787 +#define TC_CBQ_OVL_CLASSIC 0
788 +#define TC_CBQ_OVL_DELAY 1
789 +#define TC_CBQ_OVL_LOWPRIO 2
790 +#define TC_CBQ_OVL_DROP 3
791 +#define TC_CBQ_OVL_RCLASSIC 4
792 + unsigned char priority2;
796 +struct tc_cbq_police
798 + unsigned char police;
799 + unsigned char __res1;
800 + unsigned short __res2;
810 +struct tc_cbq_xstats
824 + TCA_CBQ_OVL_STRATEGY,
830 +#define TCA_CBQ_MAX TCA_CBQ_POLICE
832 +/* dsmark section */
836 + TCA_DSMARK_INDICES,
837 + TCA_DSMARK_DEFAULT_INDEX,
838 + TCA_DSMARK_SET_TC_INDEX,
843 +#define TCA_DSMARK_MAX TCA_DSMARK_VALUE
849 + TCA_ATM_FD, /* file/socket descriptor */
850 + TCA_ATM_PTR, /* pointer to descriptor - later */
851 + TCA_ATM_HDR, /* LL header */
852 + TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */
853 + TCA_ATM_ADDR, /* PVC address (for output only) */
854 + TCA_ATM_STATE /* VC state (ATM_VS_*; for output only) */
857 +#define TCA_ATM_MAX TCA_ATM_STATE
861 #ifndef __LINUX_PKT_SCHED_H
862 #define __LINUX_PKT_SCHED_H
864 --- iproute-20010824/ip/iproute.c
865 +++ iproute-20010824/ip/iproute.c
867 fprintf(stderr, "OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ]\n");
868 fprintf(stderr, " [ rtt NUMBER ] [ rttvar NUMBER ]\n");
869 fprintf(stderr, " [ window NUMBER] [ cwnd NUMBER ] [ ssthresh REALM ]\n");
870 - fprintf(stderr, " [ realms REALM ]\n");
871 + fprintf(stderr, " [ realms REALM ] [ hoplimit NUMBER ] [ initcwnd NUMBER ]\n");
872 fprintf(stderr, "TYPE := [ unicast | local | broadcast | multicast | throw |\n");
873 fprintf(stderr, " unreachable | prohibit | blackhole | nat ]\n");
874 fprintf(stderr, "TABLE_ID := [ local | main | default | all | NUMBER ]\n");
883 if (mxrta[i] == NULL)
885 invarg("\"reordering\" value is invalid\n", *argv);
886 rta_addattr32(mxrta, sizeof(mxbuf), RTAX_REORDERING, reord);
888 +#ifdef RTAX_HOPLIMIT
889 + } else if (strcmp(*argv, "hoplimit") == 0) {
892 + if (strcmp(*argv, "lock") == 0) {
893 + mxlock |= (1<<RTAX_HOPLIMIT);
896 + if (get_unsigned(&hoplim, *argv, 0))
897 + invarg("\"hoplimit\" value is invalid\n", *argv);
898 + rta_addattr32(mxrta, sizeof(mxbuf), RTAX_HOPLIMIT, hoplim);
900 +#ifdef RTAX_INITCWND
901 + } else if (strcmp(*argv, "initcwnd") == 0) {
904 + if (strcmp(*argv, "lock") == 0) {
905 + mxlock |= (1<<RTAX_HOPLIMIT);
908 + if (get_unsigned(&initcwnd, *argv, 0))
909 + invarg("\"initcwnd\" value is invalid\n", *argv);
910 + rta_addattr32(mxrta, sizeof(mxbuf), RTAX_INITCWND, initcwnd);
912 } else if (strcmp(*argv, "rtt") == 0) {
915 --- iproute-20010824.orig/doc/ip-cref.tex
916 +++ iproute-20010824/doc/ip-cref.tex
917 @@ -1324,2 +1324,15 @@
919 +\item \verb|hoplimit NUMBER|
921 +--- [2.5.74+ only] Hop limit on the path to this destination. If it is not
922 + given, Linux uses the value selected with \verb|sysctl| variable
923 + \verb|net/ipv4/ip_default_ttl|.
925 +\item \verb|initcwnd NUMBER|
927 +--- [2.5.70+ only] Initial congestion window size when establishing
928 + connections to this destination. This value is multiplied with the
929 + MSS (``Maximal Segment Size'') for the connection to get the actual
930 + window size. If it is not given (or set to zero), Linux uses the
931 + values specified in~\cite{RFC2414}.
933 @@ -2653,2 +2666,5 @@
935 +\bibitem{RFC2414} M.~Allman, S.~Floyd, C.~Partridge.
936 +``Increasing TCP's Initial Window'', RFC-2414.
938 \end{thebibliography}
941 ## All lines beginning with `## DP:' are a description of the patch.
942 ## DP: add references to lartc
943 ## DP: also drop bogus reference to tc-filters
945 [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
946 patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
948 if [ $# -ne 1 ]; then
949 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
953 -patch) patch $patch_opts -p1 < $0;;
954 -unpatch) patch $patch_opts -p1 -R < $0;;
956 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
962 diff -Nur old/man/man8/ip.8 new/man/man8/ip.8
963 --- old/man/man8/ip.8 2005-01-05 22:40:29.000000000 +0000
964 +++ new/man/man8/ip.8 2005-01-05 22:47:03.000000000 +0000
965 @@ -1803,6 +1803,8 @@
966 .RB "IP Command reference " ip-cref.ps
968 .RB "IP tunnels " ip-cref.ps
970 +.RB http://lartc.org/
974 diff -Nur old/man/man8/tc.8 new/man/man8/tc.8
975 --- old/man/man8/tc.8 2004-10-19 20:49:02.000000000 +0000
976 +++ new/man/man8/tc.8 2005-01-05 22:46:15.000000000 +0000
980 .BR tc-pfifo_fast (8),
982 +.BR http://lartc.org/
985 Manpage maintained by bert hubert (ahu@ds9a.nl)
988 ## All lines beginning with `## DP:' are a description of the patch.
991 [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
992 patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
994 if [ $# -ne 1 ]; then
995 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
999 -patch) patch $patch_opts -p1 < $0;;
1000 -unpatch) patch $patch_opts -p1 -R < $0;;
1002 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
1008 --- iproute/ip/iptunnel.c.orig 2003-07-10 11:47:06.000000000 +1000
1009 +++ iproute/ip/iptunnel.c 2003-07-10 11:47:11.000000000 +1000
1012 p->i_flags |= GRE_KEY;
1013 if (strchr(*argv, '.'))
1014 - p->o_key = get_addr32(*argv);
1015 + p->i_key = get_addr32(*argv);
1017 if (get_unsigned(&uval, *argv, 0)<0) {
1018 fprintf(stderr, "invalid value of \"ikey\"\n");
1021 ## All lines beginning with `## DP:' are a description of the patch.
1022 ## DP: add the wrr qdisc scheduler, see #198414
1024 [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
1025 patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
1027 if [ $# -ne 1 ]; then
1028 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
1032 -patch) patch $patch_opts -p1 < $0;;
1033 -unpatch) patch $patch_opts -p1 -R < $0;;
1035 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
1041 diff -urN iproute-20041019.orig/include/linux/pkt_sched.h iproute-20041019/include/linux/pkt_sched.h
1042 --- iproute-20041019.orig/include/linux/pkt_sched.h 2005-01-06 00:42:42.000000000 +0100
1043 +++ iproute-20041019/include/linux/pkt_sched.h 2005-01-06 00:38:06.000000000 +0100
1044 @@ -837,4 +837,116 @@
1046 #define NETEM_DIST_SCALE 8192
1050 +/* Other includes */
1051 +#include <linux/if_ether.h>
1053 +// A sub weight and of a class
1054 +// All numbers are represented as parts of (2^64-1).
1055 +struct tc_wrr_class_weight {
1056 + __u64 val; // Current value (0 is not valid)
1057 + __u64 decr; // Value pr bytes (2^64-1 is not valid)
1058 + __u64 incr; // Value pr seconds (2^64-1 is not valid)
1059 + __u64 min; // Minimal value (0 is not valid)
1060 + __u64 max; // Minimal value (0 is not valid)
1062 +// The time where the above information was correct:
1066 +// Packet send when modifying a class:
1067 +struct tc_wrr_class_modf {
1068 + // Not-valid values are ignored.
1069 + struct tc_wrr_class_weight weight1;
1070 + struct tc_wrr_class_weight weight2;
1073 +// Packet returned when quering a class:
1074 +struct tc_wrr_class_stats {
1075 + char used; // If this is false the information below is invalid
1077 + struct tc_wrr_class_modf class_modf;
1079 + unsigned char addr[ETH_ALEN];
1080 + char usemac; // True if addr is a MAC address, else it is an IP address
1081 + // (this value is only for convience, it is always the same
1082 + // value as in the qdisc)
1083 + int heappos; // Current heap position or 0 if not in heap
1084 + __u64 penal_ls; // Penalty value in heap (ls)
1085 + __u64 penal_ms; // Penalty value in heap (ms)
1088 +// Qdisc-wide penalty information (boolean values - 2 not valid)
1089 +struct tc_wrr_qdisc_weight {
1090 + char weight_mode; // 0=No automatic change to weight
1091 + // 1=Decrease normally
1092 + // 2=Also multiply with number of machines
1093 + // 3=Instead multiply with priority divided
1094 + // with priority of the other.
1098 +// Packet send when modifing a qdisc:
1099 +struct tc_wrr_qdisc_modf {
1100 + // Not-valid values are ignored:
1101 + struct tc_wrr_qdisc_weight weight1;
1102 + struct tc_wrr_qdisc_weight weight2;
1105 +// Packet send when creating a qdisc:
1106 +struct tc_wrr_qdisc_crt {
1107 + struct tc_wrr_qdisc_modf qdisc_modf;
1109 + char srcaddr; // 1=lookup source, 0=lookup destination
1110 + char usemac; // 1=Classify on MAC addresses, 0=classify on IP
1111 + char usemasq; // 1=Classify based on masqgrading - only valid
1112 + // if usemac is zero
1113 + int bands_max; // Maximal number of bands (i.e.: classes)
1114 + int proxy_maxconn;// If differnt from 0 then we support proxy remapping
1115 + // of packets. And this is the number of maximal
1116 + // concurrent proxy connections.
1119 +// Packet returned when quering a qdisc:
1120 +struct tc_wrr_qdisc_stats {
1121 + struct tc_wrr_qdisc_crt qdisc_crt;
1122 + int proxy_curconn;
1123 + int nodes_in_heap; // Current number of bands wanting to send something
1124 + int bands_cur; // Current number of bands used (i.e.: MAC/IP addresses seen)
1125 + int bands_reused; // Number of times this band has been reused.
1126 + int packets_requed; // Number of times packets have been requeued.
1127 + __u64 priosum; // Sum of priorities in heap where 1 is 2^32
1130 +struct tc_wrr_qdisc_modf_std {
1131 + // This indicates which of the tc_wrr_qdisc_modf structers this is:
1132 + char proxy; // 0=This struct
1134 + // Should we also change a class?
1135 + char change_class;
1137 + // Only valid if change_class is false
1138 + struct tc_wrr_qdisc_modf qdisc_modf;
1140 + // Only valid if change_class is true:
1141 + unsigned char addr[ETH_ALEN]; // Class to change (non-used bytes should be 0)
1142 + struct tc_wrr_class_modf class_modf; // The change
1145 +// Used for proxyrempping:
1146 +struct tc_wrr_qdisc_modf_proxy {
1147 + // This indicates which of the tc_wrr_qdisc_modf structers this is:
1148 + char proxy; // 1=This struct
1150 + // This is 1 if the proxyremap information should be reset
1153 + // changec is the number of elements in changes.
1156 + // This is an array of type ProxyRemapBlock:
1161 diff -urN iproute-20041019.orig/tc/Makefile iproute-20041019/tc/Makefile
1162 --- iproute-20041019.orig/tc/Makefile 2004-10-19 22:49:02.000000000 +0200
1163 +++ iproute-20041019/tc/Makefile 2005-01-06 00:33:47.000000000 +0100
1165 TCMODULES += q_prio.o
1166 TCMODULES += q_tbf.o
1167 TCMODULES += q_cbq.o
1168 +TCMODULES += q_wrr.o
1169 TCMODULES += f_rsvp.o
1170 TCMODULES += f_u32.o
1171 TCMODULES += f_route.o
1172 diff -urN iproute-20041019.orig/tc/q_wrr.c iproute-20041019/tc/q_wrr.c
1173 --- iproute-20041019.orig/tc/q_wrr.c 1970-01-01 01:00:00.000000000 +0100
1174 +++ iproute-20041019/tc/q_wrr.c 2005-01-06 00:34:06.000000000 +0100
1177 +#include <stdlib.h>
1178 +#include <unistd.h>
1179 +#include <syslog.h>
1181 +#include <sys/socket.h>
1182 +#include <netinet/in.h>
1183 +#include <arpa/inet.h>
1184 +#include <string.h>
1188 +#include "tc_util.h"
1190 +#define usage() return(-1)
1192 +// Returns -1 on error
1193 +static int wrr_parse_qdisc_weight(int argc, char** argv,
1194 + struct tc_wrr_qdisc_modf* opt) {
1197 + opt->weight1.weight_mode=-1;
1198 + opt->weight2.weight_mode=-1;
1200 + for(i=0; i<argc; i++) {
1201 + if(!memcmp(argv[i],"wmode1=",7)) {
1202 + opt->weight1.weight_mode=atoi(argv[i]+7);
1203 + } else if(!memcmp(argv[i],"wmode2=",7)) {
1204 + opt->weight2.weight_mode=atoi(argv[i]+7);
1206 + printf("Usage: ... [wmode1=0|1|2|3] [wmode2=0|1|2|3]\n");
1213 +static int wrr_parse_class_modf(int argc, char** argv,
1214 + struct tc_wrr_class_modf* modf) {
1218 + fprintf(stderr, "Usage: ... [weight1=val] [decr1=val] [incr1=val] [min1=val] [max1=val] [val2=val] ...\n");
1219 + fprintf(stderr, " The values can be floating point like 0.42 or divisions like 42/100\n");
1223 + // Set meaningless values:
1224 + modf->weight1.val=0;
1225 + modf->weight1.decr=(__u64)-1;
1226 + modf->weight1.incr=(__u64)-1;
1227 + modf->weight1.min=0;
1228 + modf->weight1.max=0;
1229 + modf->weight2.val=0;
1230 + modf->weight2.decr=(__u64)-1;
1231 + modf->weight2.incr=(__u64)-1;
1232 + modf->weight2.min=0;
1233 + modf->weight2.max=0;
1235 + // And read values:
1236 + for(i=0; i<argc; i++) {
1238 + char* name,*value1=0,*value2=0;
1239 + long double f_val1,f_val2=1,value;
1240 + if(strlen(argv[i])>=sizeof(arg)) {
1241 + fprintf(stderr,"Argument too long: %s\n",argv[i]);
1244 + strcpy(arg,argv[i]);
1246 + name=strtok(arg,"=");
1247 + if(name) value1=strtok(0,"/");
1248 + if(value1) value2=strtok(0,"");
1251 + fprintf(stderr,"No = found in argument: %s\n",argv[i]);
1255 + f_val1=atof(value1);
1256 + if(value2) f_val2=atof(value2);
1259 + fprintf(stderr,"Division by 0\n");
1263 + value=f_val1/f_val2;
1264 + if(value>1) value=1;
1265 + if(value<0) value=0;
1266 + value*=((__u64)-1);
1268 + // And find the value set
1269 + if(!strcmp(name,"weight1")) modf->weight1.val=value;
1270 + else if(!strcmp(name,"decr1")) modf->weight1.decr=value;
1271 + else if(!strcmp(name,"incr1")) modf->weight1.incr=value;
1272 + else if(!strcmp(name,"min1")) modf->weight1.min=value;
1273 + else if(!strcmp(name,"max1")) modf->weight1.max=value;
1274 + else if(!strcmp(name,"weight2")) modf->weight2.val=value;
1275 + else if(!strcmp(name,"decr2")) modf->weight2.decr=value;
1276 + else if(!strcmp(name,"incr2")) modf->weight2.incr=value;
1277 + else if(!strcmp(name,"min2")) modf->weight2.min=value;
1278 + else if(!strcmp(name,"max2")) modf->weight2.max=value;
1280 + fprintf(stderr,"illegal value: %s\n",name);
1288 +static int wrr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
1290 + if(n->nlmsg_flags & NLM_F_CREATE) {
1291 + // This is a create request:
1292 + struct tc_wrr_qdisc_crt opt;
1294 + int sour,dest,ip,mac,masq;
1297 + fprintf(stderr, "Usage: ... wrr sour|dest ip|masq|mac maxclasses proxymaxcon [penalty-setup]\n");
1301 + // Read sour/dest:
1302 + memset(&opt,0,sizeof(opt));
1303 + sour=!strcmp(argv[0],"sour");
1304 + dest=!strcmp(argv[0],"dest");
1306 + if(!sour && !dest) {
1307 + fprintf(stderr,"sour or dest must be specified\n");
1312 + ip=!strcmp(argv[1],"ip");
1313 + mac=!strcmp(argv[1],"mac");
1314 + masq=!strcmp(argv[1],"masq");
1316 + if(!ip && !mac && !masq) {
1317 + fprintf(stderr,"ip, masq or mac must be specified\n");
1324 + opt.bands_max=atoi(argv[2]);
1326 + opt.proxy_maxconn=atoi(argv[3]);
1329 + if(wrr_parse_qdisc_weight(argc-4,argv+4,&opt.qdisc_modf)<0) return -1;
1330 + if(opt.qdisc_modf.weight1.weight_mode==-1) opt.qdisc_modf.weight1.weight_mode=0;
1331 + if(opt.qdisc_modf.weight2.weight_mode==-1) opt.qdisc_modf.weight2.weight_mode=0;
1333 + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
1335 + struct tc_wrr_qdisc_modf_std opt;
1338 + // This is a modify request:
1340 + fprintf(stderr,"... qdisc ... or ... class ...\n");
1344 + qdisc=!strcmp(argv[0],"qdisc");
1345 + class=!strcmp(argv[0],"class");
1347 + if(!qdisc && !class) {
1348 + fprintf(stderr,"qdisc or class must be specified\n");
1358 + opt.change_class=0;
1359 + if(wrr_parse_qdisc_weight(argc, argv, &opt.qdisc_modf)<0) return -1;
1361 + int a0,a1,a2,a3,a4=0,a5=0;
1363 + opt.change_class=1;
1366 + fprintf(stderr,"... <mac>|<ip>|<masq> ...\n");
1369 + memset(opt.addr,0,sizeof(opt.addr));
1371 + if((sscanf(argv[0],"%i.%i.%i.%i",&a0,&a1,&a2,&a3)!=4) &&
1372 + (sscanf(argv[0],"%x:%x:%x:%x:%x:%x",&a0,&a1,&a2,&a3,&a4,&a5)!=6)) {
1373 + fprintf(stderr,"Wrong format of mac or ip address\n");
1377 + opt.addr[0]=a0; opt.addr[1]=a1; opt.addr[2]=a2;
1378 + opt.addr[3]=a3; opt.addr[4]=a4; opt.addr[5]=a5;
1380 + if(wrr_parse_class_modf(argc-1, argv+1, &opt.class_modf)<0) return -1;
1383 + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
1388 +static int wrr_parse_copt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) {
1389 + struct tc_wrr_class_modf opt;
1391 + memset(&opt,0,sizeof(opt));
1392 + if(wrr_parse_class_modf(argc,argv,&opt)<0) return -1;
1394 + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
1398 +static int wrr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
1400 + struct tc_wrr_qdisc_stats *qopt;
1405 + if (RTA_PAYLOAD(opt) < sizeof(*qopt))
1407 + qopt = RTA_DATA(opt);
1409 + fprintf(f,"\n (%s/%s) (maxclasses %i) (usedclasses %i) (reused classes %i)\n",
1410 + qopt->qdisc_crt.srcaddr ? "sour" : "dest",
1411 + qopt->qdisc_crt.usemac ? "mac" : (qopt->qdisc_crt.usemasq ? "masq" : "ip"),
1412 + qopt->qdisc_crt.bands_max,
1414 + qopt->bands_reused
1417 + if(qopt->qdisc_crt.proxy_maxconn) {
1418 + fprintf(f," (proxy maxcon %i) (proxy curcon %i)\n",
1419 + qopt->qdisc_crt.proxy_maxconn,qopt->proxy_curconn);
1422 + fprintf(f," (waiting classes %i) (packets requeued %i) (priosum: %Lg)\n",
1423 + qopt->nodes_in_heap,
1424 + qopt->packets_requed,
1425 + qopt->priosum/((long double)((__u32)-1))
1428 + fprintf(f," (wmode1 %i) (wmode2 %i) \n",
1429 + qopt->qdisc_crt.qdisc_modf.weight1.weight_mode,
1430 + qopt->qdisc_crt.qdisc_modf.weight2.weight_mode);
1435 +static int wrr_print_copt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) {
1436 + struct tc_wrr_class_stats *copt;
1437 + long double d=(__u64)-1;
1439 + if (opt == NULL) return 0;
1441 + if (RTA_PAYLOAD(opt) < sizeof(*copt))
1443 + copt = RTA_DATA(opt);
1446 + fprintf(f,"(unused)");
1450 + if(copt->usemac) {
1451 + fprintf(f,"\n (address: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X)\n",
1452 + copt->addr[0],copt->addr[1],copt->addr[2],
1453 + copt->addr[3],copt->addr[4],copt->addr[5]);
1455 + fprintf(f,"\n (address: %i.%i.%i.%i)\n",copt->addr[0],copt->addr[1],copt->addr[2],copt->addr[3]);
1458 + fprintf(f," (total weight: %Lg) (current position: %i) (counters: %u %u : %u %u)\n",
1459 + (copt->class_modf.weight1.val/d)*(copt->class_modf.weight2.val/d),
1461 + (unsigned)(copt->penal_ms>>32),
1462 + (unsigned)(copt->penal_ms & 0xffffffffU),
1463 + (unsigned)(copt->penal_ls>>32),
1464 + (unsigned)(copt->penal_ls & 0xffffffffU)
1467 + fprintf(f," Pars 1: (weight %Lg) (decr: %Lg) (incr: %Lg) (min: %Lg) (max: %Lg)\n",
1468 + copt->class_modf.weight1.val/d,
1469 + copt->class_modf.weight1.decr/d,
1470 + copt->class_modf.weight1.incr/d,
1471 + copt->class_modf.weight1.min/d,
1472 + copt->class_modf.weight1.max/d);
1474 + fprintf(f," Pars 2: (weight %Lg) (decr: %Lg) (incr: %Lg) (min: %Lg) (max: %Lg)",
1475 + copt->class_modf.weight2.val/d,
1476 + copt->class_modf.weight2.decr/d,
1477 + copt->class_modf.weight2.incr/d,
1478 + copt->class_modf.weight2.min/d,
1479 + copt->class_modf.weight2.max/d);
1484 +static int wrr_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
1490 +struct qdisc_util wrr_qdisc_util = {
1492 + .parse_qopt = wrr_parse_opt,
1493 + .print_qopt = wrr_print_opt,
1494 + .print_xstats = wrr_print_xstats,
1495 + .parse_copt = wrr_parse_copt,
1496 + .print_copt = wrr_print_copt