diff -Nur iproute2-2.4.7-now-ss020116-try/tc/Makefile iproute2-2.4.7-now-ss020116-try-dup/tc/Makefile --- iproute2-2.4.7-now-ss020116-try/tc/Makefile 2002-01-10 05:08:18.000000000 +0200 +++ iproute2-2.4.7-now-ss020116-try-dup/tc/Makefile 2004-03-29 11:56:15.000000000 +0300 @@ -27,6 +27,7 @@ #TCMODULES += q_csz.o #TCMODULES += q_hpfq.o #TCMODULES += q_hfsc.o +TCMODULES += q_dup.o TCOBJ += $(TCMODULES) diff -Nur iproute2-2.4.7-now-ss020116-try/tc/q_dup.c iproute2-2.4.7-now-ss020116-try-dup/tc/q_dup.c --- iproute2-2.4.7-now-ss020116-try/tc/q_dup.c 1970-01-01 02:00:00.000000000 +0200 +++ iproute2-2.4.7-now-ss020116-try-dup/tc/q_dup.c 2004-03-29 12:04:09.000000000 +0300 @@ -0,0 +1,108 @@ +/* + * q_dup.c dup packet + * + * 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: Catali(ux aka Dino) BOIE, + * + */ + + +/* Temporary, till glibc gets this */ +/* Dup section */ +struct tc_dup_qopt +{ + __u32 gap; + __u32 limit; +}; + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utils.h" +#include "tc_util.h" + +static void explain(void) +{ + fprintf(stderr, "Usage: ... dup [ gap NUMBER ] [ limit NUMBER ]\n"); +} + +#define usage() return(-1) + +static int dup_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +{ + int ok=0; + struct tc_dup_qopt opt; + + memset(&opt, 0, sizeof(opt)); + + while (argc > 0) { + if (strcmp(*argv, "limit") == 0) { + NEXT_ARG(); + if (get_size(&opt.limit, *argv)) { + fprintf(stderr, "Illegal \"limit\"\n"); + return -1; + } + ok++; + } else if (strcmp(*argv, "gap") == 0) { + NEXT_ARG(); + if (get_size(&opt.gap, *argv)) { + fprintf(stderr, "Illegal \"gap\"\n"); + 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) + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)); + return 0; +} + +static int dup_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct tc_dup_qopt *qopt; + + if (opt == NULL) + return 0; + + if (RTA_PAYLOAD(opt) < sizeof(*qopt)) + return -1; + qopt = RTA_DATA(opt); + + fprintf (f, "limit %up gap %up", qopt -> limit, qopt -> gap); + return 0; +} + +static int dup_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) +{ + return 0; +} + + +struct qdisc_util dup_util = { + NULL, + "dup", + dup_parse_opt, + dup_print_opt, + dup_print_xstats, +}; diff -Nur iproute2-2.4.7-now-ss020116-try/tc/tc_qdisc.c iproute2-2.4.7-now-ss020116-try-dup/tc/tc_qdisc.c --- iproute2-2.4.7-now-ss020116-try/tc/tc_qdisc.c 2002-01-15 13:15:23.000000000 +0200 +++ iproute2-2.4.7-now-ss020116-try-dup/tc/tc_qdisc.c 2004-03-29 11:56:56.000000000 +0300 @@ -36,7 +36,7 @@ fprintf(stderr, "\n"); fprintf(stderr, " tc qdisc show [ dev STRING ] [ingress]\n"); fprintf(stderr, "Where:\n"); - fprintf(stderr, "QDISC_KIND := { [p|b]fifo | tbf | prio | cbq | red | etc. }\n"); + fprintf(stderr, "QDISC_KIND := { [p|b]fifo | tbf | prio | cbq | red | dup | etc. }\n"); fprintf(stderr, "OPTIONS := ... try tc qdisc add help\n"); exit(-1); }