aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_rules.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-10 06:24:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:01:27 -0500
commit8ad4942cd5bdad4143f7aa1d1bd4f7b2526c19c5 (patch)
tree9fc1c79ae579e20063d577912ad4aeb1aef3ba6d /net/ipv4/fib_rules.c
parent93456b6d7753def8760b423ac6b986eb9d5a4a95 (diff)
[NETNS]: Add netns parameter to fib_get_table/fib_new_table.
This patch extends the fib_get_table and the fib_new_table functions with the network namespace pointer. That will allow to access the table relatively from the network namespace. Acked-by: Benjamin Thery <benjamin.thery@bull.net> Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_rules.c')
-rw-r--r--net/ipv4/fib_rules.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 1aae61c8ea6a..49819fe7e4c3 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -93,7 +93,7 @@ static int fib4_rule_action(struct fib_rule *rule, struct flowi *flp,
93 goto errout; 93 goto errout;
94 } 94 }
95 95
96 if ((tbl = fib_get_table(rule->table)) == NULL) 96 if ((tbl = fib_get_table(&init_net, rule->table)) == NULL)
97 goto errout; 97 goto errout;
98 98
99 err = tbl->tb_lookup(tbl, flp, (struct fib_result *) arg->result); 99 err = tbl->tb_lookup(tbl, flp, (struct fib_result *) arg->result);
@@ -109,7 +109,7 @@ void fib_select_default(const struct flowi *flp, struct fib_result *res)
109 if (res->r && res->r->action == FR_ACT_TO_TBL && 109 if (res->r && res->r->action == FR_ACT_TO_TBL &&
110 FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) { 110 FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) {
111 struct fib_table *tb; 111 struct fib_table *tb;
112 if ((tb = fib_get_table(res->r->table)) != NULL) 112 if ((tb = fib_get_table(&init_net, res->r->table)) != NULL)
113 tb->tb_select_default(tb, flp, res); 113 tb->tb_select_default(tb, flp, res);
114 } 114 }
115} 115}
@@ -130,13 +130,13 @@ static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
130 return 1; 130 return 1;
131} 131}
132 132
133static struct fib_table *fib_empty_table(void) 133static struct fib_table *fib_empty_table(struct net *net)
134{ 134{
135 u32 id; 135 u32 id;
136 136
137 for (id = 1; id <= RT_TABLE_MAX; id++) 137 for (id = 1; id <= RT_TABLE_MAX; id++)
138 if (fib_get_table(id) == NULL) 138 if (fib_get_table(net, id) == NULL)
139 return fib_new_table(id); 139 return fib_new_table(net, id);
140 return NULL; 140 return NULL;
141} 141}
142 142
@@ -159,7 +159,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
159 if (rule->action == FR_ACT_TO_TBL) { 159 if (rule->action == FR_ACT_TO_TBL) {
160 struct fib_table *table; 160 struct fib_table *table;
161 161
162 table = fib_empty_table(); 162 table = fib_empty_table(&init_net);
163 if (table == NULL) { 163 if (table == NULL) {
164 err = -ENOBUFS; 164 err = -ENOBUFS;
165 goto errout; 165 goto errout;