diff options
author | Patrick McHardy <kaber@trash.net> | 2009-12-02 20:25:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-03 15:14:37 -0500 |
commit | 5adef1809147a9c39119ffd5a13a1ca4fe23a411 (patch) | |
tree | 82c3e969fbe2cb5b227db38dcb7ad18f30b5ae96 /net/core | |
parent | 1b038a5e60c7812f19818e8a5df96d029e49c38f (diff) |
net 04/05: fib_rules: allow to delete local rule
commit d124356ce314fff22a047ea334379d5105b2d834
Author: Patrick McHardy <kaber@trash.net>
Date: Thu Dec 3 12:16:35 2009 +0100
net: fib_rules: allow to delete local rule
Allow to delete the local rule and recreate it with a higher priority. This
can be used to force packets with a local destination out on the wire instead
of routing them to loopback. Additionally this patch allows to recreate rules
with a priority of 0.
Combined with the previous patch to allow oif classification, a socket can
be bound to the desired interface and packets routed to the wire like this:
# move local rule to lower priority
ip rule add pref 1000 lookup local
ip rule del pref 0
# route packets of sockets bound to eth0 to the wire independant
# of the destination address
ip rule add pref 100 oif eth0 lookup 100
ip route add default dev eth0 table 100
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/fib_rules.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index d1a70ad4b544..ef0e7d9e664b 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -287,7 +287,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
287 | rule->flags = frh->flags; | 287 | rule->flags = frh->flags; |
288 | rule->table = frh_get_table(frh, tb); | 288 | rule->table = frh_get_table(frh, tb); |
289 | 289 | ||
290 | if (!rule->pref && ops->default_pref) | 290 | if (!tb[FRA_PRIORITY] && ops->default_pref) |
291 | rule->pref = ops->default_pref(ops); | 291 | rule->pref = ops->default_pref(ops); |
292 | 292 | ||
293 | err = -EINVAL; | 293 | err = -EINVAL; |