Commit Graph

312 Commits

Author SHA1 Message Date
Stephen Hemminger
bcd7abddd4 tc filter: fix dport/sport in pretty print output
Problem reported by Peter Lebbing on Debian.
The decode of source and destination port filters in pretty print
mode was backwards.
2011-05-19 09:19:17 -07:00
John Fastabend
892eba309f iproute2: improve mqprio inputs for queue offsets and counts
This changes mqprio input format to be more user friendly.

Old usage,

 # ./tc/tc qdisc add dev eth3 root mqprio help
Usage: ... mqprio [num_tc NUMBER] [map P0 P1...]
                  [offset txq0 txq1 ...] [count cnt0 cnt1 ...] [hw 1|0]

New usage,

 # ./tc/tc qdisc add dev eth3 root mqprio help
Usage: ... mqprio [num_tc NUMBER] [map P0 P1 ...]
                  [queues count1@offset1 count2@offset2 ...] [hw 1|0]

Suggested-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
2011-04-26 14:59:32 -07:00
John Fastabend
914953046a iproute2: tc add mqprio qdisc support
Add mqprio qdisc support. Output matches the following,

qdisc mq 0: dev eth1 root
qdisc mq 0: dev eth2 root
qdisc mqprio 8001: dev eth3 root  tc 8 map 0 1 2 3 4 5 6 7 1 1 1 1 1 1 1 1
             queues:(0:7) (8:15) (16:23) (24:31) (32:39) (40:47) (48:55) (56:63)

And usage is,

Usage: ... mclass [num_tc NUMBER] [map P0 P1...]
                  [offset txq0 txq1 ...] [count cnt0 cnt1 ...] [hw 1|0]

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
2011-04-12 14:28:19 -07:00
Juliusz Chroboczek
d7f3299d59 tc : SFB flow scheduler
Supports SFB qdisc (included in linux-2.6.39)

1) Setup phase : accept non default parameters

2) dump information

qdisc sfb 11: parent 1:11 limit 1 max 25 target 20
  increment 0.00050 decrement 0.00005 penalty rate 10 burst 20 (600000ms 60000ms)
 Sent 47991616 bytes 521648 pkt (dropped 549245, overlimits 549245 requeues 0)
 rate 7193Kbit 9774pps backlog 0b 0p requeues 0
  earlydrop 0 penaltydrop 0 bucketdrop 0 queuedrop 549245 childdrop 0 marked 0
  maxqlen 0 maxprob 0.00000 avgprob 0.00000

Signed-off-by: Juliusz Chroboczek <Juliusz.Chroboczek@pps.jussieu.fr>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
2011-04-12 14:27:37 -07:00
Stephen Hemminger
59a935d204 Update email address of netem 2011-04-12 14:24:01 -07:00
Stephen Hemminger
d7ac9ad4f4 Fix warning in u32 from assignment in conditional 2011-04-12 14:23:39 -07:00
Eric Dumazet
f3f28c2126 sfq: add divisor support
In 2.6.39, we can build SFQ queues with a given hash table size,
2011-02-25 12:59:53 -08:00
Stephen Hemminger
a4eca97cff CHOKe scheduler
TC commands for CHOKe qdisc
2011-01-31 09:09:50 -08:00
Gregoire Baron
3822cc986c tc: add ACT_CSUM action support (csum)
Add the iproute2 support for the ACT_CSUM action. Can be used as
following, certainly in conjunction with the ACT_PEDIT action (pedit):

 # In order to DNAT (stateless) IPv4 packet from 192.168.1.100 to
 #  0x12345678 (18.52.86.120), and update the IPv4 header checksum and
 #  the UDP checksum (the last one, only if the packet is UDP).
tc filter add eth0 prio 1 protocol ip parent ffff: \
  u32 match ip src 192.168.1.100/32 flowid :1 \
    action pedit munge offset 16 u32 set 0x12345678 \
      pipe csum ip and udp

 # In order to alter destination address of IPv6 TCP packets from fc00::1
 #  and correct the TCP checksum (nothing happened? except maybe for
 #  checksums in the TCP payload ...).
tc filter add eth0 prio 1 protocol ipv6 parent ffff: \
  u32 match ip6 src fc00::1/128 match ip6 protocol 0x06 0xff flowid :1 \
    action pedit munge offset 24 u32 set 0x12345678 \
      pipe csum tcp
2010-12-01 11:17:46 -08:00
Changli Gao
7162c92148 iproute2: tc: f_flow: add key rxhash
We can use rxhash to classify the traffic into flows. As rxhash maybe
supplied by NIC or RPS, it is cheaper.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Acked-by: Jamal Hadi Salim <hadi@cyberus.ca>
2010-11-30 09:57:36 -08:00
Mike Frysinger
be3c4d4f3c m_xt: stop using xtables_set_revision()
iptables dropped the xtables_set_revision() function around version 1.4.9,
so set the rev directly ourselves.  This should be compatible back to the
original version m_xt itself is designed for.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-30 09:48:38 -08:00
Stephen Hemminger
cb4bd0ec8d Fix GRED options clearing
Bug reported where priorities of GRED DP's are ignored.
The option parsing sets opt then memset was clearing these
values.
2010-08-25 09:04:55 -07:00
Stephen Hemminger
e3d153c1fb Fix byte order of ether address match for u32
The u32 key match was incorrect byte order when using ether source
or destination address matching.
2010-08-02 11:55:30 -07:00
Andreas Henriksson
02833d1b38 tc: make symbols loaded from tc action modules global.
Fixes problems with xtables based MARK target ("ipt" module).
When tc loads the "ipt" (xt) module it kept the symbols local,
this made loading of libxtables not find the required struct.

currently ipt/xt is the only tc action module.
iproute2 never seem to do dlclose.
hopefully the modules doesn't export more symbols then needed.

In this situation hopefully the RTLD_GLOBAL flag won't hurt us.

I've been using this patch in the Debian package of iproute for
the last 3 weeks and noone has complained.
( This fixes http://bugs.debian.org/584898 )

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2010-08-02 09:54:59 -07:00
Stephen Hemminger
4b45abd1f0 Fix NULL pointer reference when using basic match
If basic match has no tree of matches underneath
then print_ematch would core dump.
2010-07-29 18:03:35 -07:00
Petr Lautrbach
0156412215 iproute: fix tc generating ipv6 priority filter
This patch adds ipv6 filter priority/traffic class function
static int parse_ip6_class(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
shifting filter value to 5th bit and ignoring "at" as header position
is exactly given.

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2010-07-23 12:29:35 -07:00
Mike Frysinger
bf512683e0 tc: revert "echo" in install target
The recent commit "iproute2: add option to build m_xt as a tc module"
(ab814d6355) looks like it wrongly included debug changes in the
install target.  So drop the `echo` so the tc binary actually gets
installed again.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-23 12:28:25 -07:00
Bart Trojanowski
608a96c727 fix build issues with flex ver 2.5
When building on an old environment, the flex generated
tc/emp_ematch.lex.c file would not compile.  The error given was:

emp_ematch.lex.c:1686: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant

The emp_ematch.l uses 'str' as a start symbol name, and  flex would create
a '#define str 1' statement.  This particular version of flex,
unfortunately, used 'str' as names of string variables in the generated
parser functions.  This is line 1686 in the generated file:

YY_BUFFER_STATE ematch__scan_string (yyconst char * str )

This patch just substitutes 'str' for 'lexstr' in emp_ematch.l to avoid
the collision.
2010-04-22 15:27:42 -07:00
Andreas Henriksson
ab814d6355 iproute2: add option to build m_xt as a tc module (v3)
This will build the xt module (action ipt) of tc as a
shared object that is linked at runtime by tc if used,
rather then built into tc.

This is similar to how the atm qdisc support
is handled (q_atm.so).

Signed-off-by: Andreas Henriksson <andreas@xxxxxxxx>
2010-04-12 11:40:29 -07:00
Stephen Hemminger
edaaa11e5a Workaround missing ALIGN() macro. 2010-03-29 17:37:49 -07:00
Stephen Hemminger
1b84ad557e Remove mirred debug message
Other commands are quiet if successful. mirred action had leftover
debug message.
2010-03-29 17:32:37 -07:00
Stephen Hemminger
609ceb807d Workaround missing ALIGN() macro
XT_ALIGN() calls ALIGN macro but ALIGN is in kernel source not userspace.
2010-03-29 15:17:48 -07:00
Andreas Henriksson
12ddfff76c iproute2: detect iptables modules dir in configure.
Try to automatically detect iptables modules directory.

Make the configure script look for iptables modules.
This also makes it possible to specify it on the
command line while building via "make IPT_LIB_DIR=/foo/bar".

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2010-03-29 15:10:20 -07:00
jamal
e906975a53 skbedit: use get_u32 for parsing mark
parsing a mark as a classid allows for acceptance of strange
informal input.

cheers,
jamal
commit aad0da6507ff8a95a63ed8e529c05f52be5b0e75
Author: Jamal Hadi Salim <hadi@cyberus.ca>
Date:   Mon Feb 15 06:45:29 2010 -0500

    skbedit: use get_u32 for parsing mark

    get_u32 is the more appropriate parser for a mark.

    Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
2010-03-03 16:35:30 -08:00
Hagen Paul Pfeifer
f703129d34 tc: add new queue discipline: head drop fifo
This adds the required changes to gain access to
the head drop classfull queuing discipline named
pfifo_head_drop. In difference to pfifo or pfifo_fast
this queuing discipline will drop the first packet
in the case of queue congestion. As a result the queue
contain always the freshest packets.

To replace the current a root queueing discipline
for eth0:
$ tc qdisc replace dev eth0 root pfifo_head_drop

And show statistics:
$ tc -s qdisc show dev eth0

Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
2010-03-03 16:15:44 -08:00
Florian Westphal
8d8de1139c tc: remove stale code
remove unused #define and "ok" statements.

Signed-off-by: Florian Westphal <fwestphal@astaro.com>
2010-01-21 10:13:01 -08:00
Florian Westphal
ddf216c863 tc: red, gred, tbf: more helpful error messages
$ tc qdisc add dev eth1 root tbf
RTNETLINK answers: Invalid argument

$ tc qdisc add dev eth1 root red
RTNETLINK answers: Invalid argument

with patch:
$ tc qdisc add dev eth1 root red
Required parameter (min, max, burst, limit, avpkt) is missing

$ tc qdisc add dev eth1 root tbf
Usage: ... tbf limit BYTES burst BYTES[/BYTES] rate KBPS ...

Signed-off-by: Florian Westphal <fw@strlen.de>
2010-01-21 10:12:57 -08:00
Mike Frysinger
73152614bc tc: respect LDFLAGS for %.so targets
Since there aren't any targets that currently use this pattern rule, this
is more of a proactive fix.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-21 10:05:39 -08:00
Jamal Hadi Salim
e04dd30a38 skbedit: Add support to mark packets
This adds support for setting the skb mark.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
2009-12-26 11:12:43 -08:00
Stephen Hemminger
985f4578c6 Fix warning about strtod() return value 2009-12-26 10:20:50 -08:00
Andreas Henriksson
a36ceb85d7 Add new (iptables 1.4.5 compatible) tc/ipt/xt module.
Add a new cleaned up m_xt.c based on m_xt_old.c
The new m_xt.c has been updated to use the new names and new api
that xtables exposes in iptables 1.4.5.
All the old internal api cruft has also been dropped.

Additionally, a configure script test is added to check for
the new xtables api and set the TC_CONFIG_XT flag in Config.
(tc/Makefile already handles this flag in previous commit.)

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2009-12-26 10:09:27 -08:00
Andreas Henriksson
80d689d055 Keep the old tc/ipt/xt module for compatibility.
Move the file and rename the configure flags.
The file is being kept around for iptables < 1.4.5 compatibility.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2009-12-26 10:09:26 -08:00
Patrick McHardy
c90308ffc7 f_fw: fix compat mode
The kernel takes a lack of options as indication that the fw classifier
should operate in compatibility mode, where marks are mapped directly to
classids.

Commit e22b42a (tc mask patch) broke this by adding an empty TCA_OPTIONS
attribute even if no handle is specified. Restore the old behaviour.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2009-12-01 16:20:01 -08:00
Stephen Hemminger
232642c28c Remove Changes: comments
Discourage developers from putting change log in comments
now that software has been under change control for 5 years.
2009-12-01 15:49:48 -08:00
Mike Frysinger
05b4f8492b tc: remove dlfcn.h from files that dont need it
A bunch of source files look like they're copy & pasted from other files,
and some include header files that they don't actually need.  Since dlfcn
has very specific usage (and is a pain on a static-only system), drop it
where it isn't really needed.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-11-13 14:14:07 -08:00
Mike Frysinger
f2e27cfb01 support static-only systems
The iptables code supports a "no shared libs" mode where it can be used
without requiring dlfcn related functionality.  This adds similar support
to iproute2 so that it can easily be used on systems like nommu Linux (but
obviously with a few limitations -- no dynamic plugins).

Rather than modify every location that uses dlfcn.h, I hooked the dlfcn.h
header with stub functions when shared library support is disabled.  Then
symbol lookup is done via a local static lookup table (which is generated
automatically at build time) so that internal symbols can be found.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-11-10 10:44:20 -08:00
Mike Frysinger
729cbe84b8 tc/q_atm.so: respect LDFLAGS
The q_atm.so target defines its own link target, but it doesn't respect the
$(LDFLAGS) variable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-08-06 14:50:08 -07:00
Stephen Hemminger
1558971d43 fix handling of GRED DPs args 2009-05-26 15:58:05 -07:00
Denys Fedoryshchenko
f4a8b23d39 Filter class output by classid
Sometimes while dividing bandwidth by classes it is useful to see how some
specific class doing things live.

Which my simple patch it is possible to do
watch -n1 "tc -s -d class show dev eth0.2022 classid 1:1520"
and to get live statistics, how packets queued or dropped, and how much
bandwidth used (if estimator defined) for specific class.

Signed-off-by: Denys Fedoryshchenko <denys@visp.net.lb>
2009-05-26 15:20:26 -07:00
Stephen Hemminger
ebde878097 Allow default DP of zero in gred
To emulate WRED behaviour, allow default DP of zero.
2009-05-26 15:15:01 -07:00
Stephen Hemminger
d13cee6d59 Add IPV6 match pretty print 2009-05-26 15:14:29 -07:00
Stephen Hemminger
b4d41f41b6 Add u32 extension to match on ether source/destination
Use existing u32 mechanism to match based on Ethernet header.
No need for protocol that already exists.
2009-04-15 15:39:34 -07:00
Thomas Graf
ff213c4bf2 cgroup support
Stephen,

iproute2 part of the cgroup classifier that has been included upstream
for a while. Please apply.
2009-04-13 13:38:33 -07:00
Stephen Hemminger
9fce67dd46 Remove goto chain
The selector logic is clearer with if / else if
2009-04-03 09:44:04 -07:00
Stephen Hemminger
52d6a85050 remove duplicate limits.h 2009-03-27 11:07:46 -07:00
Petr Jediný
10494d2724 Changing commandline help text to be more uniform... 2009-03-27 11:05:44 -07:00
Stephen Hemminger
44e50c8e78 Add missing limits.h
Need limits.h to get INT_MIN on Debian
2009-03-01 20:36:38 -08:00
Denys Fedoryschenko
a589dcda9c Fix memory leak in local options
This change was forgotten by Stephen in the last release

Signed-off-by: Denys Fedoryschenko <denys@visp.net.lb>
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
2009-02-19 09:04:06 -08:00
Jamal Hadi Salim
63c7d26f94 Breakage noticed when debian upgraded to xtables (iptables > 1.4.1)
Many thanks to Yevgeny Kosarzhevsky <yevg@pisem.net> for reporting
and a lot of testing

Thanks to Jan Engelhardt <jengelh@medozas.de> for a lot of advice
Thanks to Denys Fedoryschenko <denys@visp.net.lb> for some sample
code that he tried and thanks to Andreas Henriksson <andreas@fatal.se>
(who maintains iproute2 on debian) for the persistent followup.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
2009-02-19 09:02:13 -08:00
Stephen Hemminger
46a6573259 fix uninitialized memory in tc_skbedit
Original from: Alexander Duyck <alexander.h.duyck@intel.com>

A bug was found in which the memory for the tc_skbedit struct was being
used uninitialized to 0.  Alternative version of original fix
using initializer rather than memset.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2009-02-19 08:59:06 -08:00