]> err.no Git - linux-2.6/commitdiff
[NETNS]: Process FIB rule action in the context of the namespace.
authorDenis V. Lunev <den@openvz.org>
Mon, 21 Jan 2008 00:47:09 +0000 (16:47 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:08:14 +0000 (15:08 -0800)
Save namespace context on the fib rule at the rule creation time and
call routing lookup in the correct namespace.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/fib_rules.h
net/core/fib_rules.c
net/ipv4/fib_rules.c

index 7f9f4aec8fc889c54a6efce4bc04a167448d2cae..34349f9f4331a1d81e22d65a848511f446eea226 100644 (file)
@@ -22,6 +22,7 @@ struct fib_rule
        u32                     target;
        struct fib_rule *       ctarget;
        struct rcu_head         rcu;
+       struct net *            fr_net;
 };
 
 struct fib_lookup_arg
index 3cd4f13413f64f4d92b9a972362442bcbfe29ac2..42ccaf5b85097f43842a9e394dbc082795e80b30 100644 (file)
@@ -29,6 +29,7 @@ int fib_default_rule_add(struct fib_rules_ops *ops,
        r->pref = pref;
        r->table = table;
        r->flags = flags;
+       r->fr_net = ops->fro_net;
 
        /* The lock is not required here, the list in unreacheable
         * at the moment this function is called */
@@ -242,6 +243,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
                err = -ENOMEM;
                goto errout;
        }
+       rule->fr_net = net;
 
        if (tb[FRA_PRIORITY])
                rule->pref = nla_get_u32(tb[FRA_PRIORITY]);
index 3b7affd5cb3bed1bef3925d0e49ecc4b57fa4d2a..d2001f1c28a271accb227e330d87027b755f6001 100644 (file)
@@ -91,7 +91,7 @@ static int fib4_rule_action(struct fib_rule *rule, struct flowi *flp,
                goto errout;
        }
 
-       if ((tbl = fib_get_table(&init_net, rule->table)) == NULL)
+       if ((tbl = fib_get_table(rule->fr_net, rule->table)) == NULL)
                goto errout;
 
        err = tbl->tb_lookup(tbl, flp, (struct fib_result *) arg->result);