From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Henriksson Subject: iproute2: resend of patches from Debian. Date: Thu, 11 Oct 2007 20:25:32 +0200 Message-ID: <1192127132.4732.9.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-apWSfGRCy7bRtxktbriF" Cc: netdev@vger.kernel.org To: shemminger@linux-foundation.org Return-path: Received: from 1-1-1-9a.ghn.gbg.bostream.se ([82.182.69.4]:57659 "EHLO scream.fatal.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753443AbXJKS0T (ORCPT ); Thu, 11 Oct 2007 14:26:19 -0400 Sender: netdev-owner@vger.kernel.org List-Id: netdev.vger.kernel.org --=-apWSfGRCy7bRtxktbriF Content-Type: text/plain Content-Transfer-Encoding: 7bit Hello all! Posting this set of patches again, since there where no reaction last time I sent them. Regards, Andreas Henriksson ---- Hello Stephen Hemminger and the rest of the people on the nevdev list! I'm posting a bunch of patches for iproute2. A few I've written myself and have a Signed-off-by with my name in them, the others I've picked up from the iproute package in Debian. I tried my best to add a decent description, references to debian bug number and when possible a From header suggesting who the original author might be. They should all apply with some offset and sometimes a bit fuzz to the current iproute2 git tree. new patches posted to the debian bug tracking system: add-mpath-docs.diff doublefree.diff fix-layer-syntax.diff new-manpages.diff tick2time-fix.diff wrandom-fix.diff fixes in the debian iproute package: empty_linkname.diff ip_address_flush_loop.diff lartc.diff netbug_fix.diff okey-ikey.diff remove_tc_filters_reference.diff patches updating help text syntax: ip_route_usage.diff ip_rule_usage.diff patches fixing documentation typos: fix_ss_typo.diff ip.8-typo.diff ip_address.diff libnetlink_typo.diff manpages-typo.diff tcb_htb_typo.diff tc_cbq_details_typo.diff -- Regards, Andreas Henriksson --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=empty_linkname.diff Content-Type: text/x-patch; name=empty_linkname.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Disallow empty link name. From: Alexander Wirt Patch from debian iproute package. diff -urNad iproute-20060323~/ip/iplink.c iproute-20060323/ip/iplink.c --- iproute-20060323~/ip/iplink.c 2006-03-22 00:57:50.000000000 +0100 +++ iproute-20060323/ip/iplink.c 2006-09-08 21:07:14.000000000 +0200 @@ -384,6 +384,10 @@ } if (newname && strcmp(dev, newname)) { + if (strlen(newname) == 0) { + printf("\"\" is not valid device identifier\n",dev); + return -1; + } if (do_changename(dev, newname) < 0) return -1; dev = newname; --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=ip_address_flush_loop.diff Content-Type: text/x-patch; name=ip_address_flush_loop.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Abort flush after 10 seconds. From: Alexander Wirt Patch from Debian iproute package. diff -urNad iproute-20060323~/ip/ipaddress.c iproute-20060323/ip/ipaddress.c --- iproute-20060323~/ip/ipaddress.c 2006-09-08 17:02:03.000000000 +0200 +++ iproute-20060323/ip/ipaddress.c 2006-09-08 17:03:01.000000000 +0200 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -589,6 +590,7 @@ if (flush) { int round = 0; char flushb[4096-512]; + time_t start = time(0); filter.flushb = flushb; filter.flushp = 0; @@ -617,6 +619,12 @@ printf("Warum?\n"); return 1; + if (time(0) - start > 10) { + printf("\n*** Flush not completed after %ld seconds, %d entries remain ***\n", + time(0) - start, filter.flushed); + exit(1); + } + if (show_stats) { printf("\n*** Round %d, deleting %d addresses ***\n", round, filter.flushed); fflush(stdout); --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=lartc.diff Content-Type: text/x-patch; name=lartc.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Add references to lartc, also drop bogus reference to tc-filters Patch from Debian iproute package. diff -Nur old/man/man8/ip.8 new/man/man8/ip.8 --- old/man/man8/ip.8 2005-01-05 22:40:29.000000000 +0000 +++ new/man/man8/ip.8 2005-01-05 22:47:03.000000000 +0000 @@ -1803,6 +1803,8 @@ .RB "IP Command reference " ip-cref.ps .br .RB "IP tunnels " ip-cref.ps +.br +.RB http://lartc.org/ .SH AUTHOR diff -Nur old/man/man8/tc.8 new/man/man8/tc.8 --- old/man/man8/tc.8 2004-10-19 20:49:02.000000000 +0000 +++ new/man/man8/tc.8 2005-01-05 22:46:15.000000000 +0000 @@ -341,7 +341,7 @@ .BR tc-pfifo (8), .BR tc-bfifo (8), .BR tc-pfifo_fast (8), -.BR tc-filters (8) +.BR http://lartc.org/ .SH AUTHOR Manpage maintained by bert hubert (ahu@ds9a.nl) --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=netbug_fix.diff Content-Type: text/x-patch; name=netbug_fix.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Fix misc/netbug script. See the following debian bugs: http://bugs.debian.org/289541 http://bugs.debian.org/313540 http://bugs.debian.org/313541 http://bugs.debian.org/313544 http://bugs.debian.org/347699 Changes from Debian iproute package rediffed to apply against current iproute2 git tree. --- iproute2/misc/netbug 2007-09-09 17:36:19.000000000 +0200 +++ iproute-20070313/misc/netbug 2007-09-09 20:42:01.000000000 +0200 @@ -1,23 +1,16 @@ #! /bin/bash +set -e + echo -n "Send network configuration summary to [ENTER means kuznet@ms2.inr.ac.ru] " IFS="" read mail || exit 1 [ -z "$mail" ] && mail=kuznet@ms2.inr.ac.ru +netbug=`mktemp -d -t netbug.XXXXXX` || (echo "$0: Cannot create temporary directory" >&2; exit 1; ) +netbugtar=`tempfile -d $netbug --suffix=tar.gz` || (echo "$0: Cannot create temporary file" >&2; exit 1; ) +tmppath=$netbug +trap "/bin/rm -rf $netbug $netbugtar" 0 1 2 3 13 15 -netbug="" -while [ "$netbug" = "" ]; do - netbug=`echo netbug.$$.$RANDOM` - if [ -e /tmp/$netbug ]; then - netbug="" - fi -done - -tmppath=/tmp/$netbug - -trap "rm -rf $tmppath $tmppath.tar.gz" 0 SIGINT - -mkdir $tmppath mkdir $tmppath/net cat /proc/slabinfo > $tmppath/slabinfo @@ -44,9 +37,8 @@ fi cd /tmp -tar c $netbug | gzip -9c > $netbug.tar.gz - -uuencode $netbug.tar.gz $netbug.tar.gz | mail -s $netbug "$mail" +tar c $tmppath | gzip -9c > $netbugtar +uuencode $netbugtar $netbugtar | mail -s $netbug "$mail" echo "Sending to <$mail>; subject is $netbug" --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=okey-ikey.diff Content-Type: text/x-patch; name=okey-ikey.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Fix typo in GRE tunnels (i_key vs. o_key). From: If a dotted quad ikey is specified for GRE tunnels, it gets set as the okey instead. This patch fixes it. See Debian bug #200714 - http://bugs.debian.org/200714 Patch from Debian iproute package. --- iproute/ip/iptunnel.c.orig 2003-07-10 11:47:06.000000000 +1000 +++ iproute/ip/iptunnel.c 2003-07-10 11:47:11.000000000 +1000 @@ -221,7 +221,7 @@ NEXT_ARG(); p->i_flags |= GRE_KEY; if (strchr(*argv, '.')) - p->o_key = get_addr32(*argv); + p->i_key = get_addr32(*argv); else { if (get_unsigned(&uval, *argv, 0)<0) { fprintf(stderr, "invalid value of \"ikey\"\n"); --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=remove_tc_filters_reference.diff Content-Type: text/x-patch; name=remove_tc_filters_reference.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Remove bogus reference to tc-filters(8) from tc(8) manpage. See debian bug #289225 - http://bugs.debian.org/289225 Patch from Debian iproute package. diff -urNad iproute-20070313~/man/man8/tc.8 iproute-20070313/man/man8/tc.8 --- iproute-20070313~/man/man8/tc.8 2007-06-10 20:22:40.000000000 +0200 +++ iproute-20070313/man/man8/tc.8 2007-06-10 20:23:16.000000000 +0200 @@ -202,8 +202,7 @@ tc filters If tc filters are attached to a class, they are consulted first for relevant instructions. Filters can match on all fields of a packet header, -as well as on the firewall mark applied by ipchains or iptables. See -.BR tc-filters (8). +as well as on the firewall mark applied by ipchains or iptables. .TP Type of Service Some qdiscs have built in rules for classifying packets based on the TOS field. @@ -242,8 +241,7 @@ .TP FILTERS Filters have a three part ID, which is only needed when using a hashed -filter hierarchy, for which see -.BR tc-filters (8). +filter hierarchy. .SH UNITS All parameters accept a floating point number, possibly followed by a unit. .P --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=add-mpath-docs.diff Content-Type: text/x-patch; name=add-mpath-docs.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Add mpath to ip manpage. From: Norbert Buchmuller The 'mpath' parameter of 'ip route' is not documented in the manual page nor in ip-cref.tex. ...huge part of the text in the patch was taken from the net/ipv4/Kconfig file in the Linux kernel source (2.6.18). I suppose that's OK because both Linux and iproute2 are GPL'd, but I let you know anyway. See Debian bug #428442 - http://bugs.debian.org/428442 diff -Naur iproute-20061002/doc/ip-cref.tex iproute-20061002.fixed/doc/ip-cref.tex --- iproute-20061002/doc/ip-cref.tex 2007-06-11 19:26:52.000000000 +0200 +++ iproute-20061002.fixed/doc/ip-cref.tex 2007-06-11 20:34:09.000000000 +0200 @@ -1348,6 +1348,28 @@ route reflecting its relative bandwidth or quality. \end{itemize} +\item \verb|mpath MP_ALGO| + +--- the multipath algo to use. +\verb|MP_ALGO| may be one of the following values: +\begin{itemize} +\item \verb|rr| --- round robin algorithm. +Multipath routes are chosen according to Round Robin. +\item \verb|drr| --- interface round robin algorithm. +Connections are distributed in a round robin fashion over the +available interfaces. This policy makes sense if the connections +should be primarily distributed on interfaces and not on routes. +\item \verb|random| --- random algorithm. +Multipath routes are chosen in a random fashion. Actually, +there is no weight for a route. The advantage of this policy +is that it is implemented stateless and therefore introduces only +a very small delay. +\item \verb|wrandom| --- weighted random algorithm. +Multipath routes are chosen in a weighted random fashion. +The per route weights are the weights visible via ip route 2. As the +corresponding state management introduces some overhead routing delay +is increased. +\end{itemize} \item \verb|scope SCOPE_VAL| --- the scope of the destinations covered by the route prefix. diff -Naur iproute-20061002/man/man8/ip.8 iproute-20061002.fixed/man/man8/ip.8 --- iproute-20061002/man/man8/ip.8 2007-06-11 19:26:52.000000000 +0200 +++ iproute-20061002.fixed/man/man8/ip.8 2007-06-11 20:26:43.000000000 +0200 @@ -146,7 +146,9 @@ .B scope .IR SCOPE " ] [ " .B metric -.IR METRIC " ]" +.IR METRIC " ] [ " +.B mpath +.IR MP_ALGO " ]" .ti -8 .IR INFO_SPEC " := " "NH OPTIONS FLAGS" " [" @@ -205,6 +207,10 @@ .BR onlink " | " pervasive " ]" .ti -8 +.IR MP_ALGO " := [ " +.BR rr " | " drr " | " random " | " wrandom " ]" + +.ti -8 .IR RTPROTO " := [ " .BR kernel " | " boot " | " static " |" .IR NUMBER " ]" @@ -1116,6 +1122,38 @@ .in -8 .TP +.BI mpath " MP_ALGO" +the multipath algo to use. +.I MP_ALGO +may be one of the following values: + +.in +8 +.B rr +- round robin algorithm. +Multipath routes are chosen according to Round Robin. +.sp +.B drr +- interface round robin algorithm. +Connections are distributed in a round robin fashion over the +available interfaces. This policy makes sense if the connections +should be primarily distributed on interfaces and not on routes. +.sp +.B random +- random algorithm. +Multipath routes are chosen in a random fashion. Actually, +there is no weight for a route. The advantage of this policy +is that it is implemented stateless and therefore introduces only +a very small delay. +.sp +.B wrandom +- weighted random algorithm. +Multipath routes are chosen in a weighted random fashion. +The per route weights are the weights visible via ip route 2. As the +corresponding state management introduces some overhead routing delay +is increased. +.in -8 + +.TP .BI scope " SCOPE_VAL" the scope of the destinations covered by the route prefix. .I SCOPE_VAL --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=doublefree.diff Content-Type: text/x-patch; name=doublefree.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Fix corruption when using batch files with comments and broken lines. See Debian bug #398912 - http://bugs.debian.org/398912 Signed-off-by: Andreas Henriksson diff -urip iproute-20061002/include/utils.h iproute-20061002.fixed2/include/utils.h --- iproute-20061002/include/utils.h 2006-10-02 22:13:34.000000000 +0200 +++ iproute-20061002.fixed2/include/utils.h 2007-08-16 00:51:58.000000000 +0200 @@ -132,7 +132,7 @@ int print_timestamp(FILE *fp); #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) extern int cmdlineno; -extern size_t getcmdline(char **line, size_t *len, FILE *in); +extern ssize_t getcmdline(char **line, size_t *len, FILE *in); extern int makeargs(char *line, char *argv[], int maxargs); #endif /* __UTILS_H__ */ diff -urip iproute-20061002/lib/utils.c iproute-20061002.fixed2/lib/utils.c --- iproute-20061002/lib/utils.c 2006-10-02 22:13:34.000000000 +0200 +++ iproute-20061002.fixed2/lib/utils.c 2007-08-16 00:49:02.000000000 +0200 @@ -578,9 +578,9 @@ int print_timestamp(FILE *fp) int cmdlineno; /* Like glibc getline but handle continuation lines and comments */ -size_t getcmdline(char **linep, size_t *lenp, FILE *in) +ssize_t getcmdline(char **linep, size_t *lenp, FILE *in) { - size_t cc; + ssize_t cc; char *cp; if ((cc = getline(linep, lenp, in)) < 0) @@ -608,9 +608,11 @@ size_t getcmdline(char **linep, size_t * if (cp) *cp = '\0'; - *linep = realloc(*linep, strlen(*linep) + strlen(line1) + 1); + *lenp = strlen(*linep) + strlen(line1) + 1; + *linep = realloc(*linep, *lenp); if (!*linep) { fprintf(stderr, "Out of memory\n"); + *lenp = 0; return -1; } cc += cc1 - 2; --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=fix-layer-syntax.diff Content-Type: text/x-patch; name=fix-layer-syntax.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Fix ematch cmp and nbyte syntax help text. From: Lionel Elie Mamane The help/usage screen of ematch cmp and nbyte say recognised symbolic values for "layer FOO" are link, header and next-header, but the code does _not_ implement that: it will recognise "next-header" as what is supposed to be "header" and will not recognise "header". The right symbolic values seem to be link, network, transport. Here is a patch that changes the help/usage screen to match the code. See Debian bug #438653 - http://bugs.debian.org/438653 diff --recursive -N -u iproute-20070313.deb/tc/em_cmp.c iproute-20070313.lio/tc/em_cmp.c --- iproute-20070313.deb/tc/em_cmp.c 2007-03-13 22:50:56.000000000 +0100 +++ iproute-20070313.lio/tc/em_cmp.c 2007-08-18 18:44:26.773897785 +0200 @@ -1,5 +1,5 @@ /* - * em_cmp.c Simle coparison Ematch + * em_cmp.c Simple comparison Ematch * * This program is free software; you can distribute it and/or * modify it under the terms of the GNU General Public License @@ -32,7 +32,7 @@ "Usage: cmp(ALIGN at OFFSET [ ATTRS ] { eq | lt | gt } VALUE)\n" \ "where: ALIGN := { u8 | u16 | u32 }\n" \ " ATTRS := [ layer LAYER ] [ mask MASK ] [ trans ]\n" \ - " LAYER := { link | header | next-header | 0..%d }\n" \ + " LAYER := { link | network | transport | 0..%d }\n" \ "\n" \ "Example: cmp(u16 at 3 layer 2 mask 0xff00 gt 20)\n", TCF_LAYER_MAX); diff --recursive -N -u iproute-20070313.deb/tc/em_nbyte.c iproute-20070313.lio/tc/em_nbyte.c --- iproute-20070313.deb/tc/em_nbyte.c 2007-03-13 22:50:56.000000000 +0100 +++ iproute-20070313.lio/tc/em_nbyte.c 2007-08-18 18:45:48.159607231 +0200 @@ -32,7 +32,7 @@ "Usage: nbyte(NEEDLE at OFFSET [layer LAYER])\n" \ "where: NEEDLE := { string | \"c-escape-sequence\" }\n" \ " OFFSET := int\n" \ - " LAYER := { link | header | next-header | 0..%d }\n" \ + " LAYER := { link | network | transport | 0..%d }\n" \ "\n" \ "Example: nbyte(\"ababa\" at 12 layer 1)\n", TCF_LAYER_MAX); --=-apWSfGRCy7bRtxktbriF Content-Disposition: attachment; filename=new-manpages.diff Content-Type: text/x-patch; name=new-manpages.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Add new manpages and symlinks. Symlink rtstat(8) and ctstat(8) to lnstat(8). Add rtacct/nstat manpage based on doc/nstat.sgml as rtacct(8). Symlink nstat(8) to rtacct(8). Add arpd(8) symlink based on doc/arpd.sgml. Signed-off-by: Andreas Henriksson diff --git a/Makefile b/Makefile index af0d5e4..6c976dd 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,9 @@ install: all install -m 0755 -d $(DESTDIR)$(MANDIR)/man8 install -m 0644 $(shell find man/man8 -maxdepth 1 -type f) $(DESTDIR)$(MANDIR)/man8 ln -sf tc-bfifo.8 $(DESTDIR)$(MANDIR)/man8/tc-pfifo.8 + ln -sf lnstat.8 $(DESTDIR)$(MANDIR)/man8/rtstat.8 + ln -sf lnstat.8 $(DESTDIR)$(MANDIR)/man8/ctstat.8 + ln -sf rtacct.8 $(DESTDIR)$(MANDIR)/man8/nstat.8 install -m 0755 -d $(DESTDIR)$(MANDIR)/man3 install -m 0644 $(shell find man/man3 -maxdepth 1 -type f) $(DESTDIR)$(MANDIR)/man3 diff --git a/man/man8/arpd.8 b/man/man8/arpd.8 new file mode 100644 index 0000000..d172600 --- /dev/null +++ b/man/man8/arpd.8 @@ -0,0 +1,66 @@ +.TH ARPD 8 "28 June, 2007" + +.SH NAME +arpd \- userspace arp daemon. + +.SH SYNOPSIS +Usage: arpd [ -lk ] [ -a N ] [ -b dbase ] [ -f file ] [ interfaces ] + +.SH DESCRIPTION +The +.B arpd +daemon collects gratuitous ARP information, saving it on local disk and feeding it to kernel on demand to avoid redundant broadcasting due to limited size of kernel ARP cache. + +.SH OPTIONS +.TP +-h -? +Print help +.TP +-l +Dump arpd database to stdout and exit. Output consists of three columns: interface index, IP address and MAC address. Negative entries for dead hosts are also shown, in this case MAC address is replaced by word FAILED followed by colon and time when the fact that host is dead was proven the last time. +.TP +-f +Read and load arpd database from FILE in text format similar dumped by option -l. Exit after load, probably listing resulting database, if option -l is also given. If FILE is -, stdin is read to get ARP table. +.TP +-b +location of database file. Default location is /var/lib/arpd/arpd.db +.TP +-a +arpd not only passively listens ARP on wire, but also send brodcast queries itself. NUMBER is number of such queries to make before destination is considered as dead. When arpd is started as kernel helper (i.e. with app_solicit enabled in sysctl or even with option -k) without this option and still did not learn enough information, you can observe 1 second gaps in service. Not fatal, but not good. +.TP +-k +Suppress sending broadcast queries by kernel. It takes sense together with option -a. +.TP +-n