Sprout from master 2005-02-10 09:53:25 UTC Paweł Sikora <pluto@pld-linux.org> '- small update: infiniband address decode added.'
Delete:
iproute2-2.2.4-wrr.patch
iproute2-2.6.0-t7-test.patch
iproute2-Makefile.patch
iproute2-fix-2_2.patch
iproute2-htb2_tc.patch
iproute2-htb3.6_tc.patch
iproute2-htb3_tc.patch
iproute2-iprule.patch
iproute2-llh.patch
iproute2-netlink.patch
iproute2-rates-1024-fix.patch
iproute2-stats.patch
+++ /dev/null
-diff -uNrbB org/tc/Makefile new/tc/Makefile
---- org/tc/Makefile Fri Feb 25 20:51:57 2000
-+++ new/tc/Makefile Mon Feb 12 17:24:48 2001
-@@ -9,6 +9,7 @@
- TCMODULES += q_prio.o
- TCMODULES += q_tbf.o
- TCMODULES += q_cbq.o
-+TCMODULES += q_wrr.o
- TCMODULES += f_rsvp.o
- TCMODULES += f_u32.o
- TCMODULES += f_route.o
-diff -uNrbB org/tc/q_wrr.c new/tc/q_wrr.c
---- org/tc/q_wrr.c Thu Jan 1 01:00:00 1970
-+++ new/tc/q_wrr.c Sun Sep 9 12:44:28 2001
-@@ -0,0 +1,437 @@
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <syslog.h>
-+#include <fcntl.h>
-+#include <sys/socket.h>
-+#include <netinet/in.h>
-+#include <arpa/inet.h>
-+#include <string.h>
-+#include <math.h>
-+
-+#include "utils.h"
-+#include "tc_util.h"
-+
-+#define usage() return(-1)
-+
-+#ifdef NEED_WRR_DEFS
-+/* WRR section */
-+
-+/* Other includes */
-+#include <linux/if_ether.h>
-+
-+// A sub weight and of a class
-+// All numbers are represented as parts of (2^64-1).
-+struct tc_wrr_class_weight {
-+ __u64 val; // Current value (0 is not valid)
-+ __u64 decr; // Value pr bytes (2^64-1 is not valid)
-+ __u64 incr; // Value pr seconds (2^64-1 is not valid)
-+ __u64 min; // Minimal value (0 is not valid)
-+ __u64 max; // Minimal value (0 is not valid)
-+
-+ // The time where the above information was correct:
-+ time_t tim;
-+};
-+
-+// Pakcet send when modifying a class:
-+struct tc_wrr_class_modf {
-+ // Not-valid values are ignored.
-+ struct tc_wrr_class_weight weight1;
-+ struct tc_wrr_class_weight weight2;
-+};
-+
-+// Packet returned when quering a class:
-+struct tc_wrr_class_stats {
-+ char used; // If this is false the information below is invalid
-+
-+ struct tc_wrr_class_modf class_modf;
-+
-+ unsigned char addr[ETH_ALEN];
-+ char usemac; // True if addr is a MAC address, else it is an IP address
-+ // (this value is only for convience, it is always the same
-+ // value as in the qdisc)
-+ int heappos; // Current heap position or 0 if not in heap
-+ __u64 penal_ls; // Penalty value in heap (ls)
-+ __u64 penal_ms; // Penalty value in heap (ms)
-+};
-+
-+// Qdisc-wide penalty information (boolean values - 2 not valid)
-+struct tc_wrr_qdisc_weight {
-+ char weight_mode; // 0=No automatic change to weight
-+ // 1=Decrease normally
-+ // 2=Also multiply with number of machines
-+ // 3=Instead multiply with priority divided
-+ // with priority of the other.
-+ // -1=no change
-+};
-+
-+// Packet send when modifing a qdisc:
-+struct tc_wrr_qdisc_modf {
-+ // Not-valid values are ignored:
-+ struct tc_wrr_qdisc_weight weight1;
-+ struct tc_wrr_qdisc_weight weight2;
-+};
-+
-+// Packet send when creating a qdisc:
-+struct tc_wrr_qdisc_crt {
-+ struct tc_wrr_qdisc_modf qdisc_modf;
-+
-+ char srcaddr; // 1=lookup source, 0=lookup destination
-+ char usemac; // 1=Classify on MAC addresses, 0=classify on IP
-+ char usemasq; // 1=Classify based on masqgrading - only valid
-+ // if usemac is zero
-+ int bands_max; // Maximal number of bands (i.e.: classes)
-+ int proxy_maxconn; // If differnt from 0 then we support proxy remapping
-+ // of packets. And this is the number of maximal
-+ // concurrent proxy connections.
-+};
-+
-+// Packet returned when quering a qdisc:
-+struct tc_wrr_qdisc_stats {
-+ struct tc_wrr_qdisc_crt qdisc_crt;
-+ int proxy_curconn;
-+ int nodes_in_heap; // Current number of bands wanting to send something
-+ int bands_cur; // Current number of bands used (i.e.: MAC/IP addresses seen)
-+ int bands_reused; // Number of times this band has been reused.
-+ int packets_requed; // Number of times packets have been requeued.
-+ __u64 priosum; // Sum of priorities in heap where 1 is 2^32
-+};
-+
-+struct tc_wrr_qdisc_modf_std {
-+ // This indicates which of the tc_wrr_qdisc_modf structers this is:
-+ char proxy; // 0=This struct
-+
-+ // Should we also change a class?
-+ char change_class;
-+
-+ // Only valid if change_class is false
-+ struct tc_wrr_qdisc_modf qdisc_modf;
-+
-+ // Only valid if change_class is true:
-+ unsigned char addr[ETH_ALEN]; // Class to change (non-used bytes should be 0)
-+ struct tc_wrr_class_modf class_modf; // The change
-+};
-+
-+// Used for proxyrempping:
-+struct tc_wrr_qdisc_modf_proxy {
-+ // This indicates which of the tc_wrr_qdisc_modf structers this is:
-+ char proxy; // 1=This struct
-+
-+ // This is 1 if the proxyremap information should be reset
-+ char reset;
-+
-+ // changec is the number of elements in changes.
-+ int changec;
-+
-+ // This is an array of type ProxyRemapBlock:
-+ long changes[0];
-+};
-+#endif /* NEED_WRR_DEFS */
-+
-+// Returns -1 on error
-+static int wrr_parse_qdisc_weight(int argc, char** argv,
-+ struct tc_wrr_qdisc_modf* opt) {
-+ int i;
-+
-+ opt->weight1.weight_mode=-1;
-+ opt->weight2.weight_mode=-1;
-+
-+ for(i=0; i<argc; i++) {
-+ if(!memcmp(argv[i],"wmode1=",7)) {
-+ opt->weight1.weight_mode=atoi(argv[i]+7);
-+ } else if(!memcmp(argv[i],"wmode2=",7)) {
-+ opt->weight2.weight_mode=atoi(argv[i]+7);
-+ } else {
-+ printf("Usage: ... [wmode1=0|1|2|3] [wmode2=0|1|2|3]\n");
-+ return -1;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static int wrr_parse_class_modf(int argc, char** argv,
-+ struct tc_wrr_class_modf* modf) {
-+ int i;
-+
-+ if(argc<1) {
-+ fprintf(stderr, "Usage: ... [weight1=val] [decr1=val] [incr1=val] [min1=val] [max1=val] [val2=val] ...\n");
-+ fprintf(stderr, " The values can be floating point like 0.42 or divisions like 42/100\n");
-+ return -1;
-+ }
-+
-+ // Set meaningless values:
-+ modf->weight1.val=0;
-+ modf->weight1.decr=(__u64)-1;
-+ modf->weight1.incr=(__u64)-1;
-+ modf->weight1.min=0;
-+ modf->weight1.max=0;
-+ modf->weight2.val=0;
-+ modf->weight2.decr=(__u64)-1;
-+ modf->weight2.incr=(__u64)-1;
-+ modf->weight2.min=0;
-+ modf->weight2.max=0;
-+
-+ // And read values:
-+ for(i=0; i<argc; i++) {
-+ char arg[80];
-+ char* name,*value1=0,*value2=0;
-+ long double f_val1,f_val2=1,value;
-+ if(strlen(argv[i])>=sizeof(arg)) {
-+ fprintf(stderr,"Argument too long: %s\n",argv[i]);
-+ return -1;
-+ }
-+ strcpy(arg,argv[i]);
-+
-+ name=strtok(arg,"=");
-+ if(name) value1=strtok(0,"/");
-+ if(value1) value2=strtok(0,"");
-+
-+ if(!value1) {
-+ fprintf(stderr,"No = found in argument: %s\n",argv[i]);
-+ return -1;
-+ }
-+
-+ f_val1=atof(value1);
-+ if(value2) f_val2=atof(value2);
-+
-+ if(f_val2==0) {
-+ fprintf(stderr,"Division by 0\n");
-+ return -1;
-+ }
-+
-+ value=f_val1/f_val2;
-+ if(value>1) value=1;
-+ if(value<0) value=0;
-+ value*=((__u64)-1);
-+
-+ // And find the value set
-+ if(!strcmp(name,"weight1")) modf->weight1.val=value;
-+ else if(!strcmp(name,"decr1")) modf->weight1.decr=value;
-+ else if(!strcmp(name,"incr1")) modf->weight1.incr=value;
-+ else if(!strcmp(name,"min1")) modf->weight1.min=value;
-+ else if(!strcmp(name,"max1")) modf->weight1.max=value;
-+ else if(!strcmp(name,"weight2")) modf->weight2.val=value;
-+ else if(!strcmp(name,"decr2")) modf->weight2.decr=value;
-+ else if(!strcmp(name,"incr2")) modf->weight2.incr=value;
-+ else if(!strcmp(name,"min2")) modf->weight2.min=value;
-+ else if(!strcmp(name,"max2")) modf->weight2.max=value;
-+ else {
-+ fprintf(stderr,"illegal value: %s\n",name);
-+ return -1;
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+static int wrr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
-+{
-+ if(n->nlmsg_flags & NLM_F_CREATE) {
-+ // This is a create request:
-+ struct tc_wrr_qdisc_crt opt;
-+
-+ int sour,dest,ip,mac,masq;
-+
-+ if(argc<4) {
-+ fprintf(stderr, "Usage: ... wrr sour|dest ip|masq|mac maxclasses proxymaxcon [penalty-setup]\n");
-+ return -1;
-+ }
-+
-+ // Read sour/dest:
-+ memset(&opt,0,sizeof(opt));
-+ sour=!strcmp(argv[0],"sour");
-+ dest=!strcmp(argv[0],"dest");
-+
-+ if(!sour && !dest) {
-+ fprintf(stderr,"sour or dest must be specified\n");
-+ return -1;
-+ }
-+
-+ // Read ip/mac
-+ ip=!strcmp(argv[1],"ip");
-+ mac=!strcmp(argv[1],"mac");
-+ masq=!strcmp(argv[1],"masq");
-+
-+ if(!ip && !mac && !masq) {
-+ fprintf(stderr,"ip, masq or mac must be specified\n");
-+ return -1;
-+ }
-+
-+ opt.srcaddr=sour;
-+ opt.usemac=mac;
-+ opt.usemasq=masq;
-+ opt.bands_max=atoi(argv[2]);
-+
-+ opt.proxy_maxconn=atoi(argv[3]);
-+
-+ // Read weights:
-+ if(wrr_parse_qdisc_weight(argc-4,argv+4,&opt.qdisc_modf)<0) return -1;
-+ if(opt.qdisc_modf.weight1.weight_mode==-1) opt.qdisc_modf.weight1.weight_mode=0;
-+ if(opt.qdisc_modf.weight2.weight_mode==-1) opt.qdisc_modf.weight2.weight_mode=0;
-+
-+ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
-+ } else {
-+ struct tc_wrr_qdisc_modf_std opt;
-+ char qdisc,class;
-+
-+ // This is a modify request:
-+ if(argc<1) {
-+ fprintf(stderr,"... qdisc ... or ... class ...\n");
-+ return -1;
-+ }
-+
-+ qdisc=!strcmp(argv[0],"qdisc");
-+ class=!strcmp(argv[0],"class");
-+
-+ if(!qdisc && !class) {
-+ fprintf(stderr,"qdisc or class must be specified\n");
-+ return -1;
-+ }
-+
-+ argc--;
-+ argv++;
-+
-+ opt.proxy=0;
-+
-+ if(qdisc) {
-+ opt.change_class=0;
-+ if(wrr_parse_qdisc_weight(argc, argv, &opt.qdisc_modf)<0) return -1;
-+ } else {
-+ int a0,a1,a2,a3,a4=0,a5=0;
-+
-+ opt.change_class=1;
-+
-+ if(argc<1) {
-+ fprintf(stderr,"... <mac>|<ip>|<masq> ...\n");
-+ return -1;
-+ }
-+ memset(opt.addr,0,sizeof(opt.addr));
-+
-+ if((sscanf(argv[0],"%i.%i.%i.%i",&a0,&a1,&a2,&a3)!=4) &&
-+ (sscanf(argv[0],"%x:%x:%x:%x:%x:%x",&a0,&a1,&a2,&a3,&a4,&a5)!=6)) {
-+ fprintf(stderr,"Wrong format of mac or ip address\n");
-+ return -1;
-+ }
-+
-+ opt.addr[0]=a0; opt.addr[1]=a1; opt.addr[2]=a2;
-+ opt.addr[3]=a3; opt.addr[4]=a4; opt.addr[5]=a5;
-+
-+ if(wrr_parse_class_modf(argc-1, argv+1, &opt.class_modf)<0) return -1;
-+ }
-+
-+ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
-+ }
-+ return 0;
-+}
-+
-+static int wrr_parse_copt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) {
-+ struct tc_wrr_class_modf opt;
-+
-+ memset(&opt,0,sizeof(opt));
-+ if(wrr_parse_class_modf(argc,argv,&opt)<0) return -1;
-+
-+ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
-+ return 0;
-+}
-+
-+static int wrr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
-+{
-+ struct tc_wrr_qdisc_stats *qopt;
-+
-+ if (opt == NULL)
-+ return 0;
-+
-+ if (RTA_PAYLOAD(opt) < sizeof(*qopt))
-+ return -1;
-+ qopt = RTA_DATA(opt);
-+
-+ fprintf(f,"\n (%s/%s) (maxclasses %i) (usedclasses %i) (reused classes %i)\n",
-+ qopt->qdisc_crt.srcaddr ? "sour" : "dest",
-+ qopt->qdisc_crt.usemac ? "mac" : (qopt->qdisc_crt.usemasq ? "masq" : "ip"),
-+ qopt->qdisc_crt.bands_max,
-+ qopt->bands_cur,
-+ qopt->bands_reused
-+ );
-+
-+ if(qopt->qdisc_crt.proxy_maxconn) {
-+ fprintf(f," (proxy maxcon %i) (proxy curcon %i)\n",
-+ qopt->qdisc_crt.proxy_maxconn,qopt->proxy_curconn);
-+ }
-+
-+ fprintf(f," (waiting classes %i) (packets requeued %i) (priosum: %Lg)\n",
-+ qopt->nodes_in_heap,
-+ qopt->packets_requed,
-+ qopt->priosum/((long double)((__u32)-1))
-+ );
-+
-+ fprintf(f," (wmode1 %i) (wmode2 %i) \n",
-+ qopt->qdisc_crt.qdisc_modf.weight1.weight_mode,
-+ qopt->qdisc_crt.qdisc_modf.weight2.weight_mode);
-+
-+ return 0;
-+}
-+
-+static int wrr_print_copt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) {
-+ struct tc_wrr_class_stats *copt;
-+ long double d=(__u64)-1;
-+
-+ if (opt == NULL) return 0;
-+
-+ if (RTA_PAYLOAD(opt) < sizeof(*copt))
-+ return -1;
-+ copt = RTA_DATA(opt);
-+
-+ if(!copt->used) {
-+ fprintf(f,"(unused)");
-+ return 0;
-+ }
-+
-+ if(copt->usemac) {
-+ fprintf(f,"\n (address: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X)\n",
-+ copt->addr[0],copt->addr[1],copt->addr[2],
-+ copt->addr[3],copt->addr[4],copt->addr[5]);
-+ } else {
-+ fprintf(f,"\n (address: %i.%i.%i.%i)\n",copt->addr[0],copt->addr[1],copt->addr[2],copt->addr[3]);
-+ }
-+
-+ fprintf(f," (total weight: %Lg) (current position: %i) (counters: %u %u : %u %u)\n",
-+ (copt->class_modf.weight1.val/d)*(copt->class_modf.weight2.val/d),
-+ copt->heappos,
-+ (unsigned)(copt->penal_ms>>32),
-+ (unsigned)(copt->penal_ms & 0xffffffffU),
-+ (unsigned)(copt->penal_ls>>32),
-+ (unsigned)(copt->penal_ls & 0xffffffffU)
-+ );
-+
-+ fprintf(f," Pars 1: (weight %Lg) (decr: %Lg) (incr: %Lg) (min: %Lg) (max: %Lg)\n",
-+ copt->class_modf.weight1.val/d,
-+ copt->class_modf.weight1.decr/d,
-+ copt->class_modf.weight1.incr/d,
-+ copt->class_modf.weight1.min/d,
-+ copt->class_modf.weight1.max/d);
-+
-+ fprintf(f," Pars 2: (weight %Lg) (decr: %Lg) (incr: %Lg) (min: %Lg) (max: %Lg)",
-+ copt->class_modf.weight2.val/d,
-+ copt->class_modf.weight2.decr/d,
-+ copt->class_modf.weight2.incr/d,
-+ copt->class_modf.weight2.min/d,
-+ copt->class_modf.weight2.max/d);
-+
-+ return 0;
-+}
-+
-+static int wrr_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
-+{
-+ return 0;
-+}
-+
-+
-+struct qdisc_util wrr_util = {
-+ NULL,
-+ "wrr",
-+ wrr_parse_opt,
-+ wrr_print_opt,
-+ wrr_print_xstats,
-+ wrr_parse_copt,
-+ wrr_print_copt
-+};
+++ /dev/null
-diff -Nur iproute2.org/tc/q_esfq.c iproute2/tc/q_esfq.c
---- iproute2.org/tc/q_esfq.c 2003-10-12 12:19:27.537543736 +0200
-+++ iproute2/tc/q_esfq.c 2003-10-12 12:07:04.928437480 +0200
-@@ -42,7 +42,7 @@
-
- memset(&opt, 0, sizeof(opt));
-
-- opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
-+// opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
-
- while (argc > 0) {
- if (strcmp(*argv, "quantum") == 0) {
-@@ -85,22 +85,22 @@
- return -1;
- }
- ok++;
-- } else if (strcmp(*argv, "hash") == 0) {
-- NEXT_ARG();
-- if(strcmp(*argv,"classic") == 0) {
-- opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
-- } else
-- if(strcmp(*argv,"dst") == 0) {
-- opt.hash_kind= TCA_SFQ_HASH_DST;
-- } else
-- if(strcmp(*argv,"src") == 0) {
-- opt.hash_kind= TCA_SFQ_HASH_SRC;
-- } else {
-- fprintf(stderr, "Illegal \"hash\"\n");
-- explain();
-- return -1;
-- }
-- ok++;
-+// } else if (strcmp(*argv, "hash") == 0) {
-+// NEXT_ARG();
-+// if(strcmp(*argv,"classic") == 0) {
-+// opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
-+// } else
-+// if(strcmp(*argv,"dst") == 0) {
-+// opt.hash_kind= TCA_SFQ_HASH_DST;
-+// } else
-+// if(strcmp(*argv,"src") == 0) {
-+// opt.hash_kind= TCA_SFQ_HASH_SRC;
-+// } else {
-+// fprintf(stderr, "Illegal \"hash\"\n");
-+// explain();
-+// return -1;
-+// }
-+// ok++;
- } else if (strcmp(*argv, "help") == 0) {
- explain();
- return -1;
-@@ -136,22 +136,22 @@
- if (qopt->perturb_period)
- fprintf(f, "perturb %dsec ", qopt->perturb_period);
-
-- fprintf(f,"hash: ");
-- switch(qopt->hash_kind)
-- {
-- case TCA_SFQ_HASH_CLASSIC:
-- fprintf(f,"classic");
-- break;
-- case TCA_SFQ_HASH_DST:
-- fprintf(f,"dst");
-- break;
-- case TCA_SFQ_HASH_SRC:
-- fprintf(f,"src");
-- break;
-- default:
-- fprintf(f,"Unknown");
-- }
-- return 0;
-+// fprintf(f,"hash: ");
-+// switch(qopt->hash_kind)
-+// {
-+// case TCA_SFQ_HASH_CLASSIC:
-+// fprintf(f,"classic");
-+// break;
-+// case TCA_SFQ_HASH_DST:
-+// fprintf(f,"dst");
-+// break;
-+// case TCA_SFQ_HASH_SRC:
-+// fprintf(f,"src");
-+// break;
-+// default:
-+// fprintf(f,"Unknown");
-+// }
-+// return 0;
- }
-
- static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
-diff -Nur iproute2.org/tc/q_htb.c iproute2/tc/q_htb.c
---- iproute2.org/tc/q_htb.c 2003-10-12 12:19:27.462555136 +0200
-+++ iproute2/tc/q_htb.c 2003-10-12 12:16:53.721927264 +0200
-@@ -108,7 +108,8 @@
- struct tc_htb_glob opt;
- struct rtattr *tail;
- unsigned i; char *p;
-- opt.rate2quantum = 10; opt.defcls = 1; opt.use_dcache = 0;
-+ opt.rate2quantum = 10; opt.defcls = 1;
-+// opt.use_dcache = 0;
- opt.debug = 0;
-
- while (argc > 0) {
-@@ -128,8 +129,8 @@
- if (*p<'0' || *p>'3') break;
- opt.debug |= (*p-'0')<<(2*i);
- }
-- } else if (matches(*argv, "dcache") == 0) {
-- opt.use_dcache = 1;
-+// } else if (matches(*argv, "dcache") == 0) {
-+// opt.use_dcache = 1;
- } else {
- fprintf(stderr, "What is \"%s\"?\n", *argv);
- explain();
-@@ -154,7 +155,7 @@
- struct rtattr *tail;
-
- memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */
-- opt.injectd = 100; /* disable injecting */
-+// opt.injectd = 100; /* disable injecting */
-
- while (argc > 0) {
- if (matches(*argv, "prio") == 0) {
-@@ -168,11 +169,11 @@
- if (get_u32(&mtu, *argv, 10)) {
- explain1("mtu"); return -1;
- }
-- } else if (matches(*argv, "inject") == 0) {
-- NEXT_ARG();
-- if (get_u8(&opt.injectd, *argv, 10)) {
-- explain1("inject"); return -1;
-- }
-+// } else if (matches(*argv, "inject") == 0) {
-+// NEXT_ARG();
-+// if (get_u8(&opt.injectd, *argv, 10)) {
-+// explain1("inject"); return -1;
-+// }
- } else if (matches(*argv, "burst") == 0 ||
- strcmp(*argv, "buffer") == 0 ||
- strcmp(*argv, "maxburst") == 0) {
-@@ -306,10 +307,10 @@
- gopt = RTA_DATA(tb[TCA_HTB_INIT]);
- if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1;
-
-- fprintf(f, "r2q %d default %x dcache %d\n"
-- " deq_util 1/%d deq_rate %d trials_per_deq %d\n dcache_hits %u direct_packets %u",
-- gopt->rate2quantum,gopt->defcls,gopt->use_dcache,1000000/(1+gopt->utilz),
-- gopt->deq_rate, gopt->trials/(1+gopt->deq_rate),gopt->dcache_hits,gopt->direct_pkts);
-+// fprintf(f, "r2q %d default %x dcache %d\n"
-+// " deq_util 1/%d deq_rate %d trials_per_deq %d\n dcache_hits %u direct_packets %u",
-+// gopt->rate2quantum,gopt->defcls,gopt->use_dcache,1000000/(1+gopt->utilz),
-+// gopt->deq_rate, gopt->trials/(1+gopt->deq_rate),gopt->dcache_hits,gopt->direct_pkts);
- }
- return 0;
- }
-@@ -324,8 +325,8 @@
- return -1;
-
- st = RTA_DATA(xstats);
-- fprintf(f, " lended: %u borrowed: %u giants: %u injects: %u\n",
-- st->lends,st->borrows,st->giants,st->injects);
-+ fprintf(f, " lended: %u borrowed: %u giants: %u\n",
-+ st->lends,st->borrows,st->giants);
- fprintf(f, " tokens: %d ctokens: %d\n", st->tokens,st->ctokens);
- return 0;
- }
+++ /dev/null
---- iproute2/misc/Makefile.orig 2002-01-16 00:30:32.000000000 +0100
-+++ iproute2/misc/Makefile 2004-04-04 22:23:44.718120960 +0200
-@@ -6,7 +6,7 @@
- RTSTATOBJ=rtstat.o
-
- ALLOBJ=$(SSOBJ) $(NSTATOBJ) $(IFSTATOBJ) $(RTACCTOBJ) $(ARPDOBJ) $(RTSTATOBJ)
--TARGETS=ss nstat ifstat rtacct arpd rtstat
-+TARGETS=ss nstat ifstat rtacct rtstat
-
- all: $(TARGETS)
-
---- iproute2/Makefile~ 2004-05-01 21:30:53.000000000 +0000
-+++ iproute2/Makefile 2004-05-01 21:33:14.000000000 +0000
-@@ -8,7 +8,7 @@
- DEFINES= -DRESOLVE_HOSTNAMES
-
- #options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
--LDLIBS=-lresolv
-+LDLIBS=
- ADDLIB=
-
- #options if you compile with libc5, and without a bind>=4.9.4 libresolv
-@@ -24,7 +24,7 @@
-
-
- CC = gcc
--CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g
-+CCOPTS = -D_GNU_SOURCE $(OPT) -Wstrict-prototypes -Wall -g
- CFLAGS = $(CCOPTS) -I../include $(DEFINES)
-
- LDLIBS += -L../lib -lnetlink -lutil
+++ /dev/null
---- ./include/pseudo2_4.h.org Sun Oct 28 22:58:55 2001
-+++ ./include/pseudo2_4.h Sun Oct 28 23:09:54 2001
-@@ -0,0 +1,51 @@
-+/*
-+ * These are definitions needed to build iproute2 with kernel 2.2
-+ */
-+
-+#ifndef ARPHRD_IEEE1394
-+#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */
-+#endif
-+
-+#ifndef ARPHRD_HWX25
-+#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */
-+#endif
-+#ifndef ARPHRD_DDCMP
-+#define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */
-+#endif
-+
-+#ifndef ARPHRD_RAWHDLC
-+#define ARPHRD_RAWHDLC 518 /* Raw HDLC */
-+#endif
-+
-+#ifndef ARPHRD_IEEE80211
-+#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
-+#endif
-+
-+#ifndef ETH_P_PUPAT
-+#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
-+#endif
-+
-+#ifndef ETH_P_IEEEPUP
-+#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */
-+#endif
-+
-+#ifndef ETH_P_IEEEPUPAT
-+#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */
-+#endif
-+
-+#ifndef ETH_P_PPP_DISC
-+#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
-+#endif
-+
-+#ifndef ETH_P_PPP_SES
-+#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
-+#endif
-+
-+#ifndef ETH_P_ECONET
-+#define ETH_P_ECONET 0x0018 /* Acorn Econet */
-+#endif
-+
-+#ifndef ARPHRD_ATM
-+#define ARPHRD_ATM 19 /* ATM */
-+#endif
-+
-
---- ./lib/ll_types.c.org Sun Oct 28 23:01:45 2001
-+++ ./lib/ll_types.c Sun Oct 28 23:02:17 2001
-@@ -23,6 +23,7 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <string.h>
-+#include "pseudo2_4.h"
-
- char * ll_type_n2a(int type, char *buf, int len)
- {
---- ./lib/ll_proto.c.org Sun Oct 28 23:10:32 2001
-+++ ./lib/ll_proto.c Sun Oct 28 23:11:01 2001
-@@ -25,7 +25,7 @@
- #include <string.h>
-
- #include "utils.h"
--
-+#include "pseudo2_4.h"
-
- #define __PF(f,n) { ETH_P_##f, #n },
- static struct {
+++ /dev/null
---- iproute2/tc/q_htb.c Sun Oct 21 22:07:29 2001
-+++ iproute2new/tc/q_htb.c Wed Dec 19 16:51:41 2001
-@@ -0,0 +1,342 @@
-+/*
-+ * q_htb.c HTB.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * as published by the Free Software Foundation; either version
-+ * 2 of the License, or (at your option) any later version.
-+ *
-+ * Authors: Martin Devera, devik@cdi.cz
-+ *
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <syslog.h>
-+#include <fcntl.h>
-+#include <sys/socket.h>
-+#include <netinet/in.h>
-+#include <arpa/inet.h>
-+#include <string.h>
-+
-+#include "utils.h"
-+#include "tc_util.h"
-+
-+#ifndef TC_HTB_NUMPRIO
-+/* HTB section */
-+#define TC_HTB_NUMPRIO 4
-+#define TC_HTB_MAXDEPTH 4
-+
-+struct tc_htb_opt
-+{
-+ struct tc_ratespec rate;
-+ struct tc_ratespec ceil;
-+ __u32 buffer;
-+ __u32 cbuffer;
-+ __u32 quantum; /* out only */
-+ __u32 level; /* out only */
-+ __u8 prio;
-+ __u8 injectd; /* inject class distance */
-+ __u8 pad[2];
-+};
-+struct tc_htb_glob
-+{
-+ __u32 rate2quantum; /* bps->quantum divisor */
-+ __u32 defcls; /* default class number */
-+ __u32 use_dcache; /* use dequeue cache ? */
-+ __u32 debug; /* debug flags */
-+
-+
-+ /* stats */
-+ __u32 deq_rate; /* dequeue rate */
-+ __u32 utilz; /* dequeue utilization */
-+ __u32 trials; /* deq_prio trials per dequeue */
-+ __u32 dcache_hits;
-+ __u32 direct_pkts; /* count of non shapped packets */
-+};
-+enum
-+{
-+ TCA_HTB_UNSPEC,
-+ TCA_HTB_PARMS,
-+ TCA_HTB_INIT,
-+ TCA_HTB_CTAB,
-+ TCA_HTB_RTAB,
-+};
-+struct tc_htb_xstats
-+{
-+ __u32 lends;
-+ __u32 borrows;
-+ __u32 giants; /* too big packets (rate will not be accurate) */
-+ __u32 injects; /* how many times leaf used injected bw */
-+ __u32 tokens;
-+ __u32 ctokens;
-+};
-+#endif
-+
-+static void explain(void)
-+{
-+ fprintf(stderr, "Usage: ... qdisc add ... htb [default N] [r2q N]\n"
-+ " default number of class to which unclassified packets are sent {1}\n"
-+ " dcache whether to use dequeue cache; it limits fairness but makes\n"
-+ " possible to use HTB on very fast devices\n"
-+ " r2q DRR quantums are computed as rate in Bps/r2q {10}\n"
-+ " debug string of 16 numbers each 0-3 {0}\n\n"
-+ "... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]\n"
-+ " [ceil R2] [cburst B2] [gated]\n"
-+ " rate rate allocated to this class (class can still borrow)\n"
-+ " burst max bytes burst which can be accumulated during idle period {computed}\n"
-+ " ceil definite upper class rate (no borrows) {rate}\n"
-+ " cburst burst but for ceil {computed}\n"
-+ " mtu max packet size {1600}\n"
-+ " prio priority of leaf; lower are served first {0}\n"
-+ " inject distance to parent we inject bandwidth to {100}\n"
-+ );
-+}
-+
-+static void explain1(char *arg)
-+{
-+ fprintf(stderr, "Illegal \"%s\"\n", arg);
-+ explain();
-+}
-+
-+
-+#define usage() return(-1)
-+
-+static int htb_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
-+{
-+ struct tc_htb_glob opt;
-+ struct rtattr *tail;
-+ unsigned i; char *p;
-+ opt.rate2quantum = 10; opt.defcls = 1; opt.use_dcache = 0;
-+ opt.debug = 0;
-+
-+ while (argc > 0) {
-+ if (matches(*argv, "r2q") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.rate2quantum, *argv, 10)) {
-+ explain1("r2q"); return -1;
-+ }
-+ } else if (matches(*argv, "default") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.defcls, *argv, 16)) {
-+ explain1("default"); return -1;
-+ }
-+ } else if (matches(*argv, "debug") == 0) {
-+ NEXT_ARG(); p = *argv;
-+ for (i=0; i<16; i++,p++) {
-+ if (*p<'0' || *p>'3') break;
-+ opt.debug |= (*p-'0')<<(2*i);
-+ }
-+ } else if (matches(*argv, "dcache") == 0) {
-+ opt.use_dcache = 1;
-+ } else {
-+ fprintf(stderr, "What is \"%s\"?\n", *argv);
-+ explain();
-+ return -1;
-+ }
-+ argc--; argv++;
-+ }
-+ tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
-+ addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
-+ addattr_l(n, 2024, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt)));
-+ tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
-+ return 0;
-+}
-+
-+static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
-+{
-+ int ok=0;
-+ struct tc_htb_opt opt;
-+ __u32 rtab[256],ctab[256];
-+ unsigned buffer=0,cbuffer=0;
-+ int cell_log=-1,ccell_log = -1,mtu;
-+ struct rtattr *tail;
-+
-+ memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */
-+ opt.injectd = 100; /* disable injecting */
-+
-+ while (argc > 0) {
-+ if (matches(*argv, "prio") == 0) {
-+ NEXT_ARG();
-+ if (get_u8(&opt.prio, *argv, 10)) {
-+ explain1("prio"); return -1;
-+ }
-+ ok++;
-+ } else if (matches(*argv, "mtu") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&mtu, *argv, 10)) {
-+ explain1("mtu"); return -1;
-+ }
-+ } else if (matches(*argv, "inject") == 0) {
-+ NEXT_ARG();
-+ if (get_u8(&opt.injectd, *argv, 10)) {
-+ explain1("inject"); return -1;
-+ }
-+ } else if (matches(*argv, "burst") == 0 ||
-+ strcmp(*argv, "buffer") == 0 ||
-+ strcmp(*argv, "maxburst") == 0) {
-+ NEXT_ARG();
-+ if (get_size_and_cell(&buffer, &cell_log, *argv) < 0) {
-+ explain1("buffer");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (matches(*argv, "cburst") == 0 ||
-+ strcmp(*argv, "cbuffer") == 0 ||
-+ strcmp(*argv, "cmaxburst") == 0) {
-+ NEXT_ARG();
-+ if (get_size_and_cell(&cbuffer, &ccell_log, *argv) < 0) {
-+ explain1("cbuffer");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (strcmp(*argv, "ceil") == 0) {
-+ NEXT_ARG();
-+ if (opt.ceil.rate) {
-+ fprintf(stderr, "Double \"ceil\" spec\n");
-+ return -1;
-+ }
-+ if (get_rate(&opt.ceil.rate, *argv)) {
-+ explain1("ceil");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (strcmp(*argv, "rate") == 0) {
-+ NEXT_ARG();
-+ if (opt.rate.rate) {
-+ fprintf(stderr, "Double \"rate\" spec\n");
-+ return -1;
-+ }
-+ if (get_rate(&opt.rate.rate, *argv)) {
-+ explain1("rate");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (strcmp(*argv, "help") == 0) {
-+ explain();
-+ return -1;
-+ } else {
-+ fprintf(stderr, "What is \"%s\"?\n", *argv);
-+ explain();
-+ return -1;
-+ }
-+ argc--; argv++;
-+ }
-+
-+/* if (!ok)
-+ return 0;*/
-+
-+ if (opt.rate.rate == 0) {
-+ fprintf(stderr, "\"rate\" is required.\n");
-+ return -1;
-+ }
-+ /* if ceil params are missing, use the same as rate */
-+ if (!opt.ceil.rate) opt.ceil = opt.rate;
-+
-+ /* compute minimal allowed burst from rate; mtu is added here to make
-+ sute that buffer is larger than mtu and to have some safeguard space */
-+ if (!buffer) buffer = opt.rate.rate / HZ + mtu;
-+ if (!cbuffer) cbuffer = opt.ceil.rate / HZ + mtu;
-+
-+ if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, 0)) < 0) {
-+ fprintf(stderr, "htb: failed to calculate rate table.\n");
-+ return -1;
-+ }
-+ opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer);
-+ opt.rate.cell_log = cell_log;
-+
-+ if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, 0)) < 0) {
-+ fprintf(stderr, "htb: failed to calculate ceil rate table.\n");
-+ return -1;
-+ }
-+ opt.cbuffer = tc_calc_xmittime(opt.ceil.rate, cbuffer);
-+ opt.ceil.cell_log = ccell_log;
-+
-+ tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
-+ addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
-+ addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
-+ addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024);
-+ addattr_l(n, 4024, TCA_HTB_CTAB, ctab, 1024);
-+ tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
-+ return 0;
-+}
-+
-+static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
-+{
-+ struct rtattr *tb[TCA_HTB_RTAB+1];
-+ struct tc_htb_opt *hopt;
-+ struct tc_htb_glob *gopt;
-+ double buffer,cbuffer;
-+ SPRINT_BUF(b1);
-+ SPRINT_BUF(b2);
-+
-+ if (opt == NULL)
-+ return 0;
-+
-+ memset(tb, 0, sizeof(tb));
-+ parse_rtattr(tb, TCA_HTB_RTAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
-+
-+ if (tb[TCA_HTB_PARMS]) {
-+
-+ hopt = RTA_DATA(tb[TCA_HTB_PARMS]);
-+ if (RTA_PAYLOAD(tb[TCA_HTB_PARMS]) < sizeof(*hopt)) return -1;
-+
-+ fprintf(f, "prio %d ", (int)hopt->prio);
-+ fprintf(f, "rate %s ", sprint_rate(hopt->rate.rate, b1));
-+ buffer = ((double)hopt->rate.rate*tc_core_tick2usec(hopt->buffer))/1000000;
-+ fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1));
-+ cbuffer = ((double)hopt->ceil.rate*tc_core_tick2usec(hopt->cbuffer))/1000000;
-+ if (show_details) {
-+ fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1),
-+ 1<<hopt->rate.cell_log, sprint_size(hopt->rate.mpu, b2));
-+ fprintf(f, "cburst %s/%u mpu %s ", sprint_size(cbuffer, b1),
-+ 1<<hopt->ceil.cell_log, sprint_size(hopt->ceil.mpu, b2));
-+ fprintf(f, "quantum %d ", (int)hopt->quantum);
-+ fprintf(f, "level %d ", (int)hopt->level);
-+ } else {
-+ fprintf(f, "burst %s ", sprint_size(buffer, b1));
-+ fprintf(f, "cburst %s ", sprint_size(cbuffer, b1));
-+ }
-+ if (show_raw)
-+ fprintf(f, "buffer [%08x] cbuffer [%08x] ",
-+ hopt->buffer,hopt->cbuffer);
-+ }
-+ if (tb[TCA_HTB_INIT]) {
-+ gopt = RTA_DATA(tb[TCA_HTB_INIT]);
-+ if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1;
-+
-+ fprintf(f, "r2q %d default %x dcache %d\n"
-+ " deq_util 1/%d deq_rate %d trials_per_deq %d\n dcache_hits %u direct_packets %u",
-+ gopt->rate2quantum,gopt->defcls,gopt->use_dcache,1000000/(1+gopt->utilz),
-+ gopt->deq_rate, gopt->trials/(1+gopt->deq_rate),gopt->dcache_hits,gopt->direct_pkts);
-+ }
-+ return 0;
-+}
-+
-+static int htb_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
-+{
-+ struct tc_htb_xstats *st;
-+ if (xstats == NULL)
-+ return 0;
-+
-+ if (RTA_PAYLOAD(xstats) < sizeof(*st))
-+ return -1;
-+
-+ st = RTA_DATA(xstats);
-+ fprintf(f, " lended: %u borrowed: %u giants: %u injects: %u\n",
-+ st->lends,st->borrows,st->giants,st->injects);
-+ fprintf(f, " tokens: %d ctokens: %d\n", st->tokens,st->ctokens);
-+ return 0;
-+}
-+
-+struct qdisc_util htb_util = {
-+ NULL,
-+ "htb",
-+ htb_parse_opt,
-+ htb_print_opt,
-+ htb_print_xstats,
-+ htb_parse_class_opt,
-+ htb_print_opt,
-+};
-+
-diff -uNr iproute2.pld/tc/Makefile iproute2/tc/Makefile
---- iproute2.pld/tc/Makefile Sun Apr 16 19:42:53 2000
-+++ iproute2/tc/Makefile Thu Feb 28 21:09:16 2002
-@@ -25,6 +25,7 @@
- endif
-
- #TCMODULES += q_csz.o
-+TCMODULES += q_htb.o
- #TCMODULES += q_hpfq.o
- #TCMODULES += q_hfsc.o
-
+++ /dev/null
---- iproute2/tc/q_htb.c Sun Oct 21 22:07:29 2001
-+++ iproute2new/tc/q_htb.c Sun May 12 22:18:27 2002
-@@ -0,0 +1,306 @@
-+/*
-+ * q_htb.c HTB.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * as published by the Free Software Foundation; either version
-+ * 2 of the License, or (at your option) any later version.
-+ *
-+ * Authors: Martin Devera, devik@cdi.cz
-+ *
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <syslog.h>
-+#include <fcntl.h>
-+#include <sys/socket.h>
-+#include <netinet/in.h>
-+#include <arpa/inet.h>
-+#include <string.h>
-+
-+#include "utils.h"
-+#include "tc_util.h"
-+
-+#define HTB_TC_VER 0x30003
-+#if HTB_TC_VER >> 16 != TC_HTB_PROTOVER
-+#error "Different kernel and TC HTB versions"
-+#endif
-+
-+static void explain(void)
-+{
-+ fprintf(stderr, "Usage: ... qdisc add ... htb [default N] [r2q N]\n"
-+ " default minor id of class to which unclassified packets are sent {0}\n"
-+ " r2q DRR quantums are computed as rate in Bps/r2q {10}\n"
-+ " debug string of 16 numbers each 0-3 {0}\n\n"
-+ "... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]\n"
-+ " [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n"
-+ " rate rate allocated to this class (class can still borrow)\n"
-+ " burst max bytes burst which can be accumulated during idle period {computed}\n"
-+ " ceil definite upper class rate (no borrows) {rate}\n"
-+ " cburst burst but for ceil {computed}\n"
-+ " mtu max packet size we create rate map for {1600}\n"
-+ " prio priority of leaf; lower are served first {0}\n"
-+ " quantum how much bytes to serve from leaf at once {use r2q}\n"
-+ "\nTC HTB version %d.%d\n",HTB_TC_VER>>16,HTB_TC_VER&0xffff
-+ );
-+}
-+
-+static void explain1(char *arg)
-+{
-+ fprintf(stderr, "Illegal \"%s\"\n", arg);
-+ explain();
-+}
-+
-+
-+#define usage() return(-1)
-+
-+static int htb_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
-+{
-+ struct tc_htb_glob opt;
-+ struct rtattr *tail;
-+ unsigned i; char *p;
-+ memset(&opt,0,sizeof(opt));
-+ opt.rate2quantum = 10;
-+ opt.version = 3;
-+
-+ while (argc > 0) {
-+ if (matches(*argv, "r2q") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.rate2quantum, *argv, 10)) {
-+ explain1("r2q"); return -1;
-+ }
-+ } else if (matches(*argv, "default") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.defcls, *argv, 16)) {
-+ explain1("default"); return -1;
-+ }
-+ } else if (matches(*argv, "debug") == 0) {
-+ NEXT_ARG(); p = *argv;
-+ for (i=0; i<16; i++,p++) {
-+ if (*p<'0' || *p>'3') break;
-+ opt.debug |= (*p-'0')<<(2*i);
-+ }
-+ } else {
-+ fprintf(stderr, "What is \"%s\"?\n", *argv);
-+ explain();
-+ return -1;
-+ }
-+ argc--; argv++;
-+ }
-+ tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
-+ addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
-+ addattr_l(n, 2024, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt)));
-+ tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
-+ return 0;
-+}
-+
-+static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
-+{
-+ int ok=0;
-+ struct tc_htb_opt opt;
-+ __u32 rtab[256],ctab[256];
-+ unsigned buffer=0,cbuffer=0;
-+ int cell_log=-1,ccell_log = -1,mtu;
-+ struct rtattr *tail;
-+
-+ memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */
-+
-+ while (argc > 0) {
-+ if (matches(*argv, "prio") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.prio, *argv, 10)) {
-+ explain1("prio"); return -1;
-+ }
-+ ok++;
-+ } else if (matches(*argv, "mtu") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&mtu, *argv, 10)) {
-+ explain1("mtu"); return -1;
-+ }
-+ } else if (matches(*argv, "quantum") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.quantum, *argv, 10)) {
-+ explain1("quantum"); return -1;
-+ }
-+ } else if (matches(*argv, "burst") == 0 ||
-+ strcmp(*argv, "buffer") == 0 ||
-+ strcmp(*argv, "maxburst") == 0) {
-+ NEXT_ARG();
-+ if (get_size_and_cell(&buffer, &cell_log, *argv) < 0) {
-+ explain1("buffer");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (matches(*argv, "cburst") == 0 ||
-+ strcmp(*argv, "cbuffer") == 0 ||
-+ strcmp(*argv, "cmaxburst") == 0) {
-+ NEXT_ARG();
-+ if (get_size_and_cell(&cbuffer, &ccell_log, *argv) < 0) {
-+ explain1("cbuffer");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (strcmp(*argv, "ceil") == 0) {
-+ NEXT_ARG();
-+ if (opt.ceil.rate) {
-+ fprintf(stderr, "Double \"ceil\" spec\n");
-+ return -1;
-+ }
-+ if (get_rate(&opt.ceil.rate, *argv)) {
-+ explain1("ceil");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (strcmp(*argv, "rate") == 0) {
-+ NEXT_ARG();
-+ if (opt.rate.rate) {
-+ fprintf(stderr, "Double \"rate\" spec\n");
-+ return -1;
-+ }
-+ if (get_rate(&opt.rate.rate, *argv)) {
-+ explain1("rate");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (strcmp(*argv, "help") == 0) {
-+ explain();
-+ return -1;
-+ } else {
-+ fprintf(stderr, "What is \"%s\"?\n", *argv);
-+ explain();
-+ return -1;
-+ }
-+ argc--; argv++;
-+ }
-+
-+/* if (!ok)
-+ return 0;*/
-+
-+ if (opt.rate.rate == 0) {
-+ fprintf(stderr, "\"rate\" is required.\n");
-+ return -1;
-+ }
-+ /* if ceil params are missing, use the same as rate */
-+ if (!opt.ceil.rate) opt.ceil = opt.rate;
-+
-+ /* compute minimal allowed burst from rate; mtu is added here to make
-+ sute that buffer is larger than mtu and to have some safeguard space */
-+ if (!buffer) buffer = opt.rate.rate / HZ + mtu;
-+ if (!cbuffer) cbuffer = opt.ceil.rate / HZ + mtu;
-+
-+ if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, 0)) < 0) {
-+ fprintf(stderr, "htb: failed to calculate rate table.\n");
-+ return -1;
-+ }
-+ opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer);
-+ opt.rate.cell_log = cell_log;
-+
-+ if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, 0)) < 0) {
-+ fprintf(stderr, "htb: failed to calculate ceil rate table.\n");
-+ return -1;
-+ }
-+ opt.cbuffer = tc_calc_xmittime(opt.ceil.rate, cbuffer);
-+ opt.ceil.cell_log = ccell_log;
-+
-+ tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
-+ addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
-+ addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
-+ addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024);
-+ addattr_l(n, 4024, TCA_HTB_CTAB, ctab, 1024);
-+ tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
-+ return 0;
-+}
-+
-+static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
-+{
-+ struct rtattr *tb[TCA_HTB_RTAB+1];
-+ struct tc_htb_opt *hopt;
-+ struct tc_htb_glob *gopt;
-+ double buffer,cbuffer;
-+ SPRINT_BUF(b1);
-+ SPRINT_BUF(b2);
-+
-+ if (opt == NULL)
-+ return 0;
-+
-+ memset(tb, 0, sizeof(tb));
-+ parse_rtattr(tb, TCA_HTB_RTAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
-+
-+ if (tb[TCA_HTB_PARMS]) {
-+
-+ hopt = RTA_DATA(tb[TCA_HTB_PARMS]);
-+ if (RTA_PAYLOAD(tb[TCA_HTB_PARMS]) < sizeof(*hopt)) return -1;
-+
-+ if (!hopt->level) {
-+ fprintf(f, "prio %d ", (int)hopt->prio);
-+ if (show_details)
-+ fprintf(f, "quantum %d ", (int)hopt->quantum);
-+ }
-+ fprintf(f, "rate %s ", sprint_rate(hopt->rate.rate, b1));
-+ buffer = ((double)hopt->rate.rate*tc_core_tick2usec(hopt->buffer))/1000000;
-+ fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1));
-+ cbuffer = ((double)hopt->ceil.rate*tc_core_tick2usec(hopt->cbuffer))/1000000;
-+ if (show_details) {
-+ fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1),
-+ 1<<hopt->rate.cell_log, sprint_size(hopt->rate.mpu, b2));
-+ fprintf(f, "cburst %s/%u mpu %s ", sprint_size(cbuffer, b1),
-+ 1<<hopt->ceil.cell_log, sprint_size(hopt->ceil.mpu, b2));
-+ fprintf(f, "level %d ", (int)hopt->level);
-+ } else {
-+ fprintf(f, "burst %s ", sprint_size(buffer, b1));
-+ fprintf(f, "cburst %s ", sprint_size(cbuffer, b1));
-+ }
-+ if (show_raw)
-+ fprintf(f, "buffer [%08x] cbuffer [%08x] ",
-+ hopt->buffer,hopt->cbuffer);
-+ }
-+ if (tb[TCA_HTB_INIT]) {
-+ gopt = RTA_DATA(tb[TCA_HTB_INIT]);
-+ if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1;
-+
-+ fprintf(f, "r2q %d default %x direct_packets_stat %u",
-+ gopt->rate2quantum,gopt->defcls,gopt->direct_pkts);
-+ if (show_details)
-+ fprintf(f," ver %d.%d",gopt->version >> 16,gopt->version & 0xffff);
-+ }
-+ return 0;
-+}
-+
-+static int htb_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
-+{
-+ struct tc_htb_xstats *st;
-+ if (xstats == NULL)
-+ return 0;
-+
-+ if (RTA_PAYLOAD(xstats) < sizeof(*st))
-+ return -1;
-+
-+ st = RTA_DATA(xstats);
-+ fprintf(f, " lended: %u borrowed: %u giants: %u\n",
-+ st->lends,st->borrows,st->giants);
-+ fprintf(f, " tokens: %d ctokens: %d\n", st->tokens,st->ctokens);
-+ return 0;
-+}
-+
-+struct qdisc_util htb_util = {
-+ NULL,
-+ "htb",
-+ htb_parse_opt,
-+ htb_print_opt,
-+ htb_print_xstats,
-+ htb_parse_class_opt,
-+ htb_print_opt,
-+};
-+
-+/* for testing of old one */
-+struct qdisc_util htb2_util = {
-+ NULL,
-+ "htb2",
-+ htb_parse_opt,
-+ htb_print_opt,
-+ htb_print_xstats,
-+ htb_parse_class_opt,
-+ htb_print_opt,
-+};
---- iproute2/tc/Makefile Tue Jul 6 18:13:07 1999
-+++ iproute2new/tc/Makefile Thu May 9 12:34:19 2002
-@@ -21,6 +21,7 @@ ifeq ($(TC_CONFIG_DIFFSERV),y)
- endif
-
- #TCMODULES += q_csz.o
-+TCMODULES += q_htb.o
- #TCMODULES += q_hpfq.o
- #TCMODULES += q_hfsc.o
-
+++ /dev/null
---- iproute2/tc/q_htb.c Sun Oct 21 22:07:29 2001
-+++ iproute2new/tc/q_htb.c Sun May 12 22:18:27 2002
-@@ -0,0 +1,306 @@
-+/*
-+ * q_htb.c HTB.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * as published by the Free Software Foundation; either version
-+ * 2 of the License, or (at your option) any later version.
-+ *
-+ * Authors: Martin Devera, devik@cdi.cz
-+ *
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <syslog.h>
-+#include <fcntl.h>
-+#include <sys/socket.h>
-+#include <netinet/in.h>
-+#include <arpa/inet.h>
-+#include <string.h>
-+
-+#include "utils.h"
-+#include "tc_util.h"
-+
-+#define HTB_TC_VER 0x30003
-+#if HTB_TC_VER >> 16 != TC_HTB_PROTOVER
-+#error "Different kernel and TC HTB versions"
-+#endif
-+
-+static void explain(void)
-+{
-+ fprintf(stderr, "Usage: ... qdisc add ... htb [default N] [r2q N]\n"
-+ " default minor id of class to which unclassified packets are sent {0}\n"
-+ " r2q DRR quantums are computed as rate in Bps/r2q {10}\n"
-+ " debug string of 16 numbers each 0-3 {0}\n\n"
-+ "... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]\n"
-+ " [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n"
-+ " rate rate allocated to this class (class can still borrow)\n"
-+ " burst max bytes burst which can be accumulated during idle period {computed}\n"
-+ " ceil definite upper class rate (no borrows) {rate}\n"
-+ " cburst burst but for ceil {computed}\n"
-+ " mtu max packet size we create rate map for {1600}\n"
-+ " prio priority of leaf; lower are served first {0}\n"
-+ " quantum how much bytes to serve from leaf at once {use r2q}\n"
-+ "\nTC HTB version %d.%d\n",HTB_TC_VER>>16,HTB_TC_VER&0xffff
-+ );
-+}
-+
-+static void explain1(char *arg)
-+{
-+ fprintf(stderr, "Illegal \"%s\"\n", arg);
-+ explain();
-+}
-+
-+
-+#define usage() return(-1)
-+
-+static int htb_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
-+{
-+ struct tc_htb_glob opt;
-+ struct rtattr *tail;
-+ unsigned i; char *p;
-+ memset(&opt,0,sizeof(opt));
-+ opt.rate2quantum = 10;
-+ opt.version = 3;
-+
-+ while (argc > 0) {
-+ if (matches(*argv, "r2q") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.rate2quantum, *argv, 10)) {
-+ explain1("r2q"); return -1;
-+ }
-+ } else if (matches(*argv, "default") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.defcls, *argv, 16)) {
-+ explain1("default"); return -1;
-+ }
-+ } else if (matches(*argv, "debug") == 0) {
-+ NEXT_ARG(); p = *argv;
-+ for (i=0; i<16; i++,p++) {
-+ if (*p<'0' || *p>'3') break;
-+ opt.debug |= (*p-'0')<<(2*i);
-+ }
-+ } else {
-+ fprintf(stderr, "What is \"%s\"?\n", *argv);
-+ explain();
-+ return -1;
-+ }
-+ argc--; argv++;
-+ }
-+ tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
-+ addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
-+ addattr_l(n, 2024, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt)));
-+ tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
-+ return 0;
-+}
-+
-+static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
-+{
-+ int ok=0;
-+ struct tc_htb_opt opt;
-+ __u32 rtab[256],ctab[256];
-+ unsigned buffer=0,cbuffer=0;
-+ int cell_log=-1,ccell_log = -1,mtu;
-+ struct rtattr *tail;
-+
-+ memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */
-+
-+ while (argc > 0) {
-+ if (matches(*argv, "prio") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.prio, *argv, 10)) {
-+ explain1("prio"); return -1;
-+ }
-+ ok++;
-+ } else if (matches(*argv, "mtu") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&mtu, *argv, 10)) {
-+ explain1("mtu"); return -1;
-+ }
-+ } else if (matches(*argv, "quantum") == 0) {
-+ NEXT_ARG();
-+ if (get_u32(&opt.quantum, *argv, 10)) {
-+ explain1("quantum"); return -1;
-+ }
-+ } else if (matches(*argv, "burst") == 0 ||
-+ strcmp(*argv, "buffer") == 0 ||
-+ strcmp(*argv, "maxburst") == 0) {
-+ NEXT_ARG();
-+ if (get_size_and_cell(&buffer, &cell_log, *argv) < 0) {
-+ explain1("buffer");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (matches(*argv, "cburst") == 0 ||
-+ strcmp(*argv, "cbuffer") == 0 ||
-+ strcmp(*argv, "cmaxburst") == 0) {
-+ NEXT_ARG();
-+ if (get_size_and_cell(&cbuffer, &ccell_log, *argv) < 0) {
-+ explain1("cbuffer");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (strcmp(*argv, "ceil") == 0) {
-+ NEXT_ARG();
-+ if (opt.ceil.rate) {
-+ fprintf(stderr, "Double \"ceil\" spec\n");
-+ return -1;
-+ }
-+ if (get_rate(&opt.ceil.rate, *argv)) {
-+ explain1("ceil");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (strcmp(*argv, "rate") == 0) {
-+ NEXT_ARG();
-+ if (opt.rate.rate) {
-+ fprintf(stderr, "Double \"rate\" spec\n");
-+ return -1;
-+ }
-+ if (get_rate(&opt.rate.rate, *argv)) {
-+ explain1("rate");
-+ return -1;
-+ }
-+ ok++;
-+ } else if (strcmp(*argv, "help") == 0) {
-+ explain();
-+ return -1;
-+ } else {
-+ fprintf(stderr, "What is \"%s\"?\n", *argv);
-+ explain();
-+ return -1;
-+ }
-+ argc--; argv++;
-+ }
-+
-+/* if (!ok)
-+ return 0;*/
-+
-+ if (opt.rate.rate == 0) {
-+ fprintf(stderr, "\"rate\" is required.\n");
-+ return -1;
-+ }
-+ /* if ceil params are missing, use the same as rate */
-+ if (!opt.ceil.rate) opt.ceil = opt.rate;
-+
-+ /* compute minimal allowed burst from rate; mtu is added here to make
-+ sute that buffer is larger than mtu and to have some safeguard space */
-+ if (!buffer) buffer = opt.rate.rate / HZ + mtu;
-+ if (!cbuffer) cbuffer = opt.ceil.rate / HZ + mtu;
-+
-+ if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, 0)) < 0) {
-+ fprintf(stderr, "htb: failed to calculate rate table.\n");
-+ return -1;
-+ }
-+ opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer);
-+ opt.rate.cell_log = cell_log;
-+
-+ if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, 0)) < 0) {
-+ fprintf(stderr, "htb: failed to calculate ceil rate table.\n");
-+ return -1;
-+ }
-+ opt.cbuffer = tc_calc_xmittime(opt.ceil.rate, cbuffer);
-+ opt.ceil.cell_log = ccell_log;
-+
-+ tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
-+ addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
-+ addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
-+ addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024);
-+ addattr_l(n, 4024, TCA_HTB_CTAB, ctab, 1024);
-+ tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
-+ return 0;
-+}
-+
-+static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
-+{
-+ struct rtattr *tb[TCA_HTB_RTAB+1];
-+ struct tc_htb_opt *hopt;
-+ struct tc_htb_glob *gopt;
-+ double buffer,cbuffer;
-+ SPRINT_BUF(b1);
-+ SPRINT_BUF(b2);
-+
-+ if (opt == NULL)
-+ return 0;
-+
-+ memset(tb, 0, sizeof(tb));
-+ parse_rtattr(tb, TCA_HTB_RTAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
-+
-+ if (tb[TCA_HTB_PARMS]) {
-+
-+ hopt = RTA_DATA(tb[TCA_HTB_PARMS]);
-+ if (RTA_PAYLOAD(tb[TCA_HTB_PARMS]) < sizeof(*hopt)) return -1;
-+
-+ if (!hopt->level) {
-+ fprintf(f, "prio %d ", (int)hopt->prio);
-+ if (show_details)
-+ fprintf(f, "quantum %d ", (int)hopt->quantum);
-+ }
-+ fprintf(f, "rate %s ", sprint_rate(hopt->rate.rate, b1));
-+ buffer = ((double)hopt->rate.rate*tc_core_tick2usec(hopt->buffer))/1000000;
-+ fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1));
-+ cbuffer = ((double)hopt->ceil.rate*tc_core_tick2usec(hopt->cbuffer))/1000000;
-+ if (show_details) {
-+ fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1),
-+ 1<<hopt->rate.cell_log, sprint_size(hopt->rate.mpu, b2));
-+ fprintf(f, "cburst %s/%u mpu %s ", sprint_size(cbuffer, b1),
-+ 1<<hopt->ceil.cell_log, sprint_size(hopt->ceil.mpu, b2));
-+ fprintf(f, "level %d ", (int)hopt->level);
-+ } else {
-+ fprintf(f, "burst %s ", sprint_size(buffer, b1));
-+ fprintf(f, "cburst %s ", sprint_size(cbuffer, b1));
-+ }
-+ if (show_raw)
-+ fprintf(f, "buffer [%08x] cbuffer [%08x] ",
-+ hopt->buffer,hopt->cbuffer);
-+ }
-+ if (tb[TCA_HTB_INIT]) {
-+ gopt = RTA_DATA(tb[TCA_HTB_INIT]);
-+ if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1;
-+
-+ fprintf(f, "r2q %d default %x direct_packets_stat %u",
-+ gopt->rate2quantum,gopt->defcls,gopt->direct_pkts);
-+ if (show_details)
-+ fprintf(f," ver %d.%d",gopt->version >> 16,gopt->version & 0xffff);
-+ }
-+ return 0;
-+}
-+
-+static int htb_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
-+{
-+ struct tc_htb_xstats *st;
-+ if (xstats == NULL)
-+ return 0;
-+
-+ if (RTA_PAYLOAD(xstats) < sizeof(*st))
-+ return -1;
-+
-+ st = RTA_DATA(xstats);
-+ fprintf(f, " lended: %u borrowed: %u giants: %u\n",
-+ st->lends,st->borrows,st->giants);
-+ fprintf(f, " tokens: %d ctokens: %d\n", st->tokens,st->ctokens);
-+ return 0;
-+}
-+
-+struct qdisc_util htb_util = {
-+ NULL,
-+ "htb",
-+ htb_parse_opt,
-+ htb_print_opt,
-+ htb_print_xstats,
-+ htb_parse_class_opt,
-+ htb_print_opt,
-+};
-+
-+/* for testing of old one */
-+struct qdisc_util htb2_util = {
-+ NULL,
-+ "htb2",
-+ htb_parse_opt,
-+ htb_print_opt,
-+ htb_print_xstats,
-+ htb_parse_class_opt,
-+ htb_print_opt,
-+};
---- iproute2/tc/Makefile Tue Jul 6 18:13:07 1999
-+++ iproute2new/tc/Makefile Thu May 9 12:34:19 2002
-@@ -21,6 +21,7 @@ ifeq ($(TC_CONFIG_DIFFSERV),y)
- endif
-
- #TCMODULES += q_csz.o
-+TCMODULES += q_htb.o
- #TCMODULES += q_hpfq.o
- #TCMODULES += q_hfsc.o
-
+++ /dev/null
---- iproute2/ip/iprule.c.fwhex Sun Apr 16 13:42:51 2000
-+++ iproute2/ip/iprule.c Fri May 24 22:22:21 2002
-@@ -120,7 +120,7 @@
- fprintf(fp, "tos %s ", rtnl_dsfield_n2a(r->rtm_tos, b1, sizeof(b1)));
- }
- if (tb[RTA_PROTOINFO]) {
-- fprintf(fp, "fwmark %8x ", *(__u32*)RTA_DATA(tb[RTA_PROTOINFO]));
-+ fprintf(fp, "fwmark %#x ", *(__u32*)RTA_DATA(tb[RTA_PROTOINFO]));
- }
-
- if (tb[RTA_IIF]) {
-@@ -245,7 +245,7 @@
- } else if (strcmp(*argv, "fwmark") == 0) {
- __u32 fwmark;
- NEXT_ARG();
-- if (get_u32(&fwmark, *argv, 16))
-+ if (get_u32(&fwmark, *argv, 0))
- invarg("fwmark value is invalid\n", *argv);
- addattr32(&req.n, sizeof(req), RTA_PROTOINFO, fwmark);
- } else if (matches(*argv, "realms") == 0) {
+++ /dev/null
-diff -urN iproute2.orig/Makefile iproute2/Makefile
---- iproute2.orig/Makefile 2002-01-15 23:30:32.000000000 +0000
-+++ iproute2/Makefile 2004-05-01 15:46:50.000000000 +0000
-@@ -4,7 +4,5 @@
- CONFDIR=/etc/iproute2
- DOCDIR=/usr/doc/iproute2
-
--KERNEL_INCLUDE=/usr/src/linux/include
--LIBC_INCLUDE=/usr/include
-
- DEFINES= -DRESOLVE_HOSTNAMES
-@@ -23,19 +22,11 @@
- #options for ipx
- ADDLIB+=ipx_ntop.o ipx_pton.o
-
--ifeq ($(LIBC_INCLUDE)/socketbits.h,$(wildcard $(LIBC_INCLUDE)/socketbits.h))
-- ifeq ($(LIBC_INCLUDE)/net/if_packet.h,$(wildcard $(LIBC_INCLUDE)/net/if_packet.h))
-- GLIBCFIX=-I../include-glibc -include ../include-glibc/glibc-bugs.h
-- endif
--endif
--ifeq ($(LIBC_INCLUDE)/bits/socket.h,$(wildcard $(LIBC_INCLUDE)/bits/socket.h))
-- GLIBCFIX=-I../include-glibc -I/usr/include/db3 -include ../include-glibc/glibc-bugs.h
--endif
-
-
- CC = gcc
- CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g
--CFLAGS = $(CCOPTS) $(GLIBCFIX) -I$(KERNEL_INCLUDE) -I../include $(DEFINES)
-+CFLAGS = $(CCOPTS) -I../include $(DEFINES)
-
- LDLIBS += -L../lib -lnetlink -lutil
-
-@@ -43,19 +34,11 @@
-
- LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
-
--all: check-kernel
-+all:
- @set -e; \
- for i in $(SUBDIRS); \
- do $(MAKE) -C $$i; done
-
--check-kernel:
--ifeq ($(KERNEL_INCLUDE),)
-- @echo "Please, set correct KERNEL_INCLUDE"; false
--else
-- @set -e; \
-- if [ ! -r $(KERNEL_INCLUDE)/linux/autoconf.h ]; then \
-- echo "Please, compile the kernel first"; false; fi
--endif
-
- install: all
- install -m 0755 -d $(DESTDIR)$(SBINDIR)
-diff -urN iproute2.orig/include/rt_names.h iproute2/include/rt_names.h
---- iproute2.orig/include/rt_names.h 2000-04-16 17:42:50.000000000 +0000
-+++ iproute2/include/rt_names.h 2004-05-01 15:50:25.000000000 +0000
-@@ -1,6 +1,8 @@
- #ifndef RT_NAMES_H_
- #define RT_NAMES_H_ 1
-
-+#include <asm/byteorder.h>
-+
- const char* rtnl_rtprot_n2a(int id, char *buf, int len);
- const char* rtnl_rtscope_n2a(int id, char *buf, int len);
- const char* rtnl_rttable_n2a(int id, char *buf, int len);
-diff -urN iproute2.orig/lib/rt_names.c iproute2/lib/rt_names.c
---- iproute2.orig/lib/rt_names.c 2000-04-16 17:42:52.000000000 +0000
-+++ iproute2/lib/rt_names.c 2004-05-01 15:49:52.000000000 +0000
-@@ -16,6 +16,7 @@
- #include <fcntl.h>
- #include <string.h>
- #include <sys/time.h>
-+#include <asm/byteorder.h>
-
- static void rtnl_tab_initialize(char *file, char **tab, int size)
- {
-diff -urN iproute2.orig/misc/arpd.c iproute2/misc/arpd.c
---- iproute2.orig/misc/arpd.c 2002-01-10 04:02:26.000000000 +0000
-+++ iproute2/misc/arpd.c 2004-05-01 17:19:54.000000000 +0000
-@@ -16,7 +16,7 @@
- #include <unistd.h>
- #include <stdlib.h>
- #include <netdb.h>
--#include <db.h>
-+#include <db_185.h>
- #include <sys/ioctl.h>
- #include <sys/poll.h>
- #include <errno.h>
-@@ -28,6 +28,7 @@
- #include <signal.h>
- #include <linux/if.h>
- #include <linux/if_arp.h>
-+#include <linux/if_ether.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <linux/if_packet.h>
+++ /dev/null
-CAN-2003-0856 fix from RH
---- iproute2/lib/libnetlink.c.orig 2003-08-10 15:02:10.000000000 +1000
-+++ iproute2/lib/libnetlink.c 2003-10-13 19:36:41.000000000 +1000
-@@ -169,7 +169,8 @@
- while (NLMSG_OK(h, status)) {
- int err;
-
-- if (h->nlmsg_pid != rth->local.nl_pid ||
-+ if (nladdr.nl_pid != 0 ||
-+ h->nlmsg_pid != rth->local.nl_pid ||
- h->nlmsg_seq != rth->dump) {
- if (junk) {
- err = junk(&nladdr, h, arg2);
-@@ -277,7 +278,8 @@
- exit(1);
- }
-
-- if (h->nlmsg_pid != rtnl->local.nl_pid ||
-+ if (nladdr.nl_pid != peer ||
-+ h->nlmsg_pid != rtnl->local.nl_pid ||
- h->nlmsg_seq != seq) {
- if (junk) {
- err = junk(&nladdr, h, jarg);
+++ /dev/null
---- iproute2-2.6.8/tc/tc_util.c 2004-07-02 17:53:03.000000000 +0000
-+++ iproute2-2.6.8.new/tc/tc_util.c 2004-07-25 17:40:46.427882688 +0000
-@@ -125,11 +125,11 @@
- else if (strcasecmp(p, "gibit") == 0)
- bps *= 1024*1024*1024/8;
- else if (strcasecmp(p, "kbps") == 0)
-- bps *= 1024;
-+ bps *= 1000;
- else if (strcasecmp(p, "mbps") == 0)
-- bps *= 1024*1024;
-+ bps *= 1000*1000;
- else if (strcasecmp(p, "gbps") == 0)
-- bps *= 1024*1024*1024;
-+ bps *= 1000*1000*1000;
- else if (strcasecmp(p, "bps") != 0)
- return -1;
-
+++ /dev/null
-diff -urN iproute2/ip/ipaddress.c.orig iproute2/ip/ipaddress.c
---- iproute2/ip/ipaddress.c.orig Sat Sep 27 03:56:06 2003
-+++ iproute2/ip/ipaddress.c Sat Sep 27 04:02:40 2003
-@@ -220,9 +220,9 @@
- s = &slocal;
- }
- fprintf(fp, "%s", _SL_);
-- fprintf(fp, " RX: bytes packets errors dropped overrun mcast %s%s",
-+ fprintf(fp, " RX: bytes packets errors dropped overrun mcast %s%s",
- s->rx_compressed ? "compressed" : "", _SL_);
-- fprintf(fp, " %-10lu %-8lu %-7lu %-7lu %-7lu %-7lu",
-+ fprintf(fp, " %-14llu %-8lu %-7lu %-7lu %-7lu %-7lu",
- s->rx_bytes, s->rx_packets, s->rx_errors,
- s->rx_dropped, s->rx_over_errors,
- s->multicast
-@@ -232,7 +232,7 @@
- if (show_stats > 1) {
- fprintf(fp, "%s", _SL_);
- fprintf(fp, " RX errors: length crc frame fifo missed%s", _SL_);
-- fprintf(fp, " %-7lu %-7lu %-7lu %-7lu %-7lu",
-+ fprintf(fp, " %-7lu %-7lu %-7lu %-7lu %-7lu",
- s->rx_length_errors,
- s->rx_crc_errors,
- s->rx_frame_errors,
-@@ -241,9 +241,9 @@
- );
- }
- fprintf(fp, "%s", _SL_);
-- fprintf(fp, " TX: bytes packets errors dropped carrier collsns %s%s",
-+ fprintf(fp, " TX: bytes packets errors dropped carrier collsns %s%s",
- s->tx_compressed ? "compressed" : "", _SL_);
-- fprintf(fp, " %-10lu %-8lu %-7lu %-7lu %-7lu %-7lu",
-+ fprintf(fp, " %-14llu %-8lu %-7lu %-7lu %-7lu %-7lu",
- s->tx_bytes, s->tx_packets, s->tx_errors,
- s->tx_dropped, s->tx_carrier_errors, s->collisions);
- if (s->tx_compressed)
-@@ -251,7 +251,7 @@
- if (show_stats > 1) {
- fprintf(fp, "%s", _SL_);
- fprintf(fp, " TX errors: aborted fifo window heartbeat%s", _SL_);
-- fprintf(fp, " %-7lu %-7lu %-7lu %-7lu",
-+ fprintf(fp, " %-7lu %-7lu %-7lu %-7lu",
- s->tx_aborted_errors,
- s->tx_fifo_errors,
- s->tx_window_errors,