提交 51314a17 编写于 作者: D Denis V. Lunev 提交者: David S. Miller

[NETNS]: Process FIB rule action in the context of the namespace.

Save namespace context on the fib rule at the rule creation time and
call routing lookup in the correct namespace.
Signed-off-by: NDenis V. Lunev <den@openvz.org>
Acked-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9e3a5487
...@@ -22,6 +22,7 @@ struct fib_rule ...@@ -22,6 +22,7 @@ struct fib_rule
u32 target; u32 target;
struct fib_rule * ctarget; struct fib_rule * ctarget;
struct rcu_head rcu; struct rcu_head rcu;
struct net * fr_net;
}; };
struct fib_lookup_arg struct fib_lookup_arg
......
...@@ -29,6 +29,7 @@ int fib_default_rule_add(struct fib_rules_ops *ops, ...@@ -29,6 +29,7 @@ int fib_default_rule_add(struct fib_rules_ops *ops,
r->pref = pref; r->pref = pref;
r->table = table; r->table = table;
r->flags = flags; r->flags = flags;
r->fr_net = ops->fro_net;
/* The lock is not required here, the list in unreacheable /* The lock is not required here, the list in unreacheable
* at the moment this function is called */ * 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) ...@@ -242,6 +243,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
err = -ENOMEM; err = -ENOMEM;
goto errout; goto errout;
} }
rule->fr_net = net;
if (tb[FRA_PRIORITY]) if (tb[FRA_PRIORITY])
rule->pref = nla_get_u32(tb[FRA_PRIORITY]); rule->pref = nla_get_u32(tb[FRA_PRIORITY]);
......
...@@ -91,7 +91,7 @@ static int fib4_rule_action(struct fib_rule *rule, struct flowi *flp, ...@@ -91,7 +91,7 @@ static int fib4_rule_action(struct fib_rule *rule, struct flowi *flp,
goto errout; 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; goto errout;
err = tbl->tb_lookup(tbl, flp, (struct fib_result *) arg->result); err = tbl->tb_lookup(tbl, flp, (struct fib_result *) arg->result);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册