Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41604
b: refs/heads/master
c: 3dfbcc4
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Graf authored and David S. Miller committed Dec 3, 2006
1 parent 06a03a1 commit 83dc907
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f6c9557e8206757c91b5737bb8dbd5b1ae3a773
refs/heads/master: 3dfbcc411e461db51a1ac1aa1c6ebe2c5a0275a0
1 change: 1 addition & 0 deletions trunk/include/linux/fib_rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/* rule is permanent, and cannot be deleted */
#define FIB_RULE_PERMANENT 1
#define FIB_RULE_INVERT 2

struct fib_rule_hdr
{
Expand Down
24 changes: 17 additions & 7 deletions trunk/net/core/fib_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@ int fib_rules_unregister(struct fib_rules_ops *ops)

EXPORT_SYMBOL_GPL(fib_rules_unregister);

static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
struct flowi *fl, int flags)
{
int ret = 0;

if (rule->ifindex && (rule->ifindex != fl->iif))
goto out;

if ((rule->mark ^ fl->mark) & rule->mark_mask)
goto out;

ret = ops->match(rule, fl, flags);
out:
return (rule->flags & FIB_RULE_INVERT) ? !ret : ret;
}

int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
int flags, struct fib_lookup_arg *arg)
{
Expand All @@ -116,13 +132,7 @@ int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
rcu_read_lock();

list_for_each_entry_rcu(rule, ops->rules_list, list) {
if (rule->ifindex && (rule->ifindex != fl->iif))
continue;

if ((rule->mark ^ fl->mark) & rule->mark_mask)
continue;

if (!ops->match(rule, fl, flags))
if (!fib_rule_match(rule, ops, fl, flags))
continue;

err = ops->action(rule, fl, flags, arg);
Expand Down

0 comments on commit 83dc907

Please sign in to comment.