Commit Graph

18 Commits

Author SHA1 Message Date
wenxu
cb65a9cb81 iprule: Add tun_id filed in the selector
ip rule add from all iif gretap tun_id 2000 lookup 200

Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-12-31 22:13:13 -08:00
Roopa Prabhu
f686f76468 iprule: support for ip_proto, sport and dport match options
add support to match on ip_proto, sport and dport ranges.
For ip_proto, this patch currently enumerates, tcp, udp and sctp.
This list can be extended in the future.

example:
$ip rule add sport 666-777 dport 999 ip_proto tcp table 100
$ip rule show
0:      from all lookup local
32765:  from all ip_proto 6 sport 666-777 dport 999 lookup 100
32766:  from all lookup main
32767:  from all lookup default

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-03-08 10:08:18 -08:00
Donald Sharp
7c083da77c ip: Display ip rule protocol used
Modify 'ip rule' command to notice when the kernel passes
to us the originating protocol.

Add code to allow the `ip rule flush protocol XXX`
command to be accepted and properly handled.

Modify the documentation to reflect these code changes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-28 19:32:29 -08:00
Phil Sutter
843fc90068 man: ip-rule.8: Further clarify how to interpret priority value
Despite the past changes, users seemed to get confused by the seemingly
contradictory relation of priority value and actual rule priority.

Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-04-24 11:43:09 -07:00
Hangbin Liu
ca89c52143 ip rule: add selector support
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2016-10-09 19:25:59 -07:00
Phil Sutter
31a29009c5 iproute: fix documentation for ip rule scan order
Hi,

On Thu, Sep 08, 2016 at 11:59:55AM +0200, Michal Kubecek wrote:
> On Thu, Sep 01, 2016 at 09:04:54AM -0700, Stephen Hemminger wrote:
> > On Tue, 30 Aug 2016 17:32:52 -0700
> > Iskren Chernev <iskren@imo.im> wrote:
> >
> > > From 416f45b62f33017d19a9b14e7b0179807c993cbe Mon Sep 17 00:00:00 2001
> > > From: Iskren Chernev <iskren@imo.im>
> > > Date: Tue, 30 Aug 2016 17:08:54 -0700
> > > Subject: [PATCH bug-fix] iproute: fix documentation for ip rule scan order
> > >
> > > ---
> > >  man/man8/ip-rule.8 | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/man/man8/ip-rule.8 b/man/man8/ip-rule.8
> > > index 1774ae3..3508d80 100644
> > > --- a/man/man8/ip-rule.8
> > > +++ b/man/man8/ip-rule.8
> > > @@ -93,7 +93,7 @@ Each policy routing rule consists of a
> > >  .B selector
> > >  and an
> > >  .B action predicate.
> > > -The RPDB is scanned in order of decreasing priority. The selector
> > > +The RPDB is scanned in order of increasing priority. The selector
> > >  of each rule is applied to {source address, destination address,
> > > incoming
> > >  interface, tos, fwmark} and, if the selector matches the packet,
> > >  the action is performed. The action predicate may return with success.
> > > --
> > > 2.4.5
> >
> > Applied
>
> I'm sorry I didn't notice before but this just reverts the change done
> by commit 4957250166 ("iproute2: clarification of various man8 pages").
> IMHO the problem is that both versions are equally confusing as the word
> "priority" can be understood in two different senses.
>
> How about more explicit formulation, e.g.
>
>   ... in order of decreasing logical priority (i.e. increasing numeric
>   values).
>
> Would that be better?

Looks like the real issue is missing definition of priority. What about
this:
2016-09-20 09:08:56 -07:00
Iskren Chernev
4a564d914d iproute: fix documentation for ip rule scan order 2016-09-01 08:41:37 -07:00
Phil Sutter
0ce05841d5 doc, man: ip-rule: Remove incorrect statement about rule 0
The documentation is wrong here: it is indeed possible to remove policy
rule 0 and recreate it afterwards. Therefore remove these statements.

Signed-off-by: Phil Sutter <phil@nwl.cc>
2016-03-04 15:27:52 -08:00
Phil Sutter
582b0fc6cb man: ip-rule.8: Review synopsis section
Clarify that 'ip rule' defaults to action 'list', that 'flush' and
'save' actions don't accept additional parameters, add missing 'not' and
'goto' keywords and finally fix fonts used in 'fwmark' and 'realms'
parameters.

Signed-off-by: Phil Sutter <phil@nwl.cc>
2016-03-02 11:23:52 -08:00
Stephen Hemminger
5699275b42 man8: scrub trailing whitespace
Remove extraneous whitespace
2015-11-23 15:41:37 -08:00
Kirill Tkhai
2f4e171f7d Add ip rule save/restore
This patch adds save and restore commands to "ip rule"
similar the same is made in commit f4ff11e3e2 for "ip route".

The feature is useful in checkpoint/restore for container
migration, also it may be helpful in some normal situations.

Signed-off-by: Kirill Tkhai <ktkhai@odin.com>
2015-10-22 23:35:57 -07:00
Phil Sutter
ccaf6eb5cc ip-rule: neither prohibit nor reject or unreachable flags exist
This has been inconsistent since the beginning of Git and seems to be
merely a documentation leftover, therefore just remove it from help
output and man page.

Signed-off-by: Phil Sutter <phil@nwl.cc>
2015-10-18 21:57:01 -07:00
Pavel Šimerda
a89d5329d4 docs: make spacing consistent
Result of the following command:

    sed -ri 's/\.  /. /g' man/*/*

Signed-Off-By: Pavel Šimerda <psimerda@redhat.com>
2015-04-07 08:41:36 -07:00
Stefan Tomanek
b1d0525f9c ip rule: add route suppression options
When configuring a system with multiple network uplinks and default routes, it
is often convenient to reference a routing table multiple times - but reject
its routing decision if certain constraints are not met by it.

Consider this setup:

$ ip route add table secuplink default via 10.42.23.1

$ ip rule add pref 100            table main suppress_prefixlength 0
$ ip rule add pref 150 fwmark 0xA table secuplink

With this setup, packets marked 0xA will be processed by the additional routing
table "secuplink", but only if no suitable route in the main routing table can
be found. By suppressing entries with a prefixlength of 0 (or less), the
default route (/0) of the table "main" is hidden to packets processed by rule
100; packets traveling to destinations via more specific routes are processed
as usual.

It is also possible to suppress a routing entry if a device belonging to
a specific interface group is to be used:

$ ip rule add pref 150 table main suppress_group 1

Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
2013-08-04 11:54:15 -07:00
esr@thyrsus.com
1284fd3a81 ip-rule.8: Fix presentational use of .SS. 2013-07-12 08:33:09 -07:00
Kees van Reeuwijk
4957250166 iproute2: clarification of various man8 pages
Rephrasing for clarity.

Note that in ip-rule.8 I rephrased a sentence to "The RPDB is scanned
in order of decreasing priority." The original version talked about
*in*creasing priority, but from the context that didn't make sense.

Signed-off-by: Kees van Reeuwijk <reeuwijk@few.vu.nl>
2013-02-11 09:22:06 -08:00
Stephen Hemminger
aab2702d33 Fix man page whatis entry errors
lintian says:
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man7/tc-hfsc.7.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-address.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-addrlabel.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-link.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-maddress.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-monitor.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-mroute.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-neighbour.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-netns.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-ntable.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-route.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-rule.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-tunnel.8.gz
W: iproute: manpage-has-bad-whatis-entry usr/share/man/man8/ip-xfrm.8.gz
2012-01-10 10:47:28 -08:00
Stephen Hemminger
2a9721f1c4 Split up ip man page
The man page for ip command had grown too large to be readable.
Break it up into separate pages.
2011-12-22 10:34:03 -08:00