aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_frontend.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_frontend.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_frontend.c')
-rw-r--r--net/ipv4/fib_frontend.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 9ff1e6669ef2..7718823711e3 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -78,14 +78,14 @@ fail:
78} 78}
79#else 79#else
80 80
81struct fib_table *fib_new_table(u32 id) 81struct fib_table *fib_new_table(struct net *net, u32 id)
82{ 82{
83 struct fib_table *tb; 83 struct fib_table *tb;
84 unsigned int h; 84 unsigned int h;
85 85
86 if (id == 0) 86 if (id == 0)
87 id = RT_TABLE_MAIN; 87 id = RT_TABLE_MAIN;
88 tb = fib_get_table(id); 88 tb = fib_get_table(net, id);
89 if (tb) 89 if (tb)
90 return tb; 90 return tb;
91 tb = fib_hash_init(id); 91 tb = fib_hash_init(id);
@@ -96,7 +96,7 @@ struct fib_table *fib_new_table(u32 id)
96 return tb; 96 return tb;
97} 97}
98 98
99struct fib_table *fib_get_table(u32 id) 99struct fib_table *fib_get_table(struct net *net, u32 id)
100{ 100{
101 struct fib_table *tb; 101 struct fib_table *tb;
102 struct hlist_node *node; 102 struct hlist_node *node;
@@ -148,7 +148,7 @@ struct net_device * ip_dev_find(__be32 addr)
148 res.r = NULL; 148 res.r = NULL;
149#endif 149#endif
150 150
151 local_table = fib_get_table(RT_TABLE_LOCAL); 151 local_table = fib_get_table(&init_net, RT_TABLE_LOCAL);
152 if (!local_table || local_table->tb_lookup(local_table, &fl, &res)) 152 if (!local_table || local_table->tb_lookup(local_table, &fl, &res))
153 return NULL; 153 return NULL;
154 if (res.type != RTN_LOCAL) 154 if (res.type != RTN_LOCAL)
@@ -183,7 +183,7 @@ static inline unsigned __inet_dev_addr_type(const struct net_device *dev,
183 res.r = NULL; 183 res.r = NULL;
184#endif 184#endif
185 185
186 local_table = fib_get_table(RT_TABLE_LOCAL); 186 local_table = fib_get_table(&init_net, RT_TABLE_LOCAL);
187 if (local_table) { 187 if (local_table) {
188 ret = RTN_UNICAST; 188 ret = RTN_UNICAST;
189 if (!local_table->tb_lookup(local_table, &fl, &res)) { 189 if (!local_table->tb_lookup(local_table, &fl, &res)) {
@@ -453,13 +453,13 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg)
453 struct fib_table *tb; 453 struct fib_table *tb;
454 454
455 if (cmd == SIOCDELRT) { 455 if (cmd == SIOCDELRT) {
456 tb = fib_get_table(cfg.fc_table); 456 tb = fib_get_table(&init_net, cfg.fc_table);
457 if (tb) 457 if (tb)
458 err = tb->tb_delete(tb, &cfg); 458 err = tb->tb_delete(tb, &cfg);
459 else 459 else
460 err = -ESRCH; 460 err = -ESRCH;
461 } else { 461 } else {
462 tb = fib_new_table(cfg.fc_table); 462 tb = fib_new_table(&init_net, cfg.fc_table);
463 if (tb) 463 if (tb)
464 err = tb->tb_insert(tb, &cfg); 464 err = tb->tb_insert(tb, &cfg);
465 else 465 else
@@ -573,7 +573,7 @@ static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar
573 if (err < 0) 573 if (err < 0)
574 goto errout; 574 goto errout;
575 575
576 tb = fib_get_table(cfg.fc_table); 576 tb = fib_get_table(net, cfg.fc_table);
577 if (tb == NULL) { 577 if (tb == NULL) {
578 err = -ESRCH; 578 err = -ESRCH;
579 goto errout; 579 goto errout;
@@ -598,7 +598,7 @@ static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar
598 if (err < 0) 598 if (err < 0)
599 goto errout; 599 goto errout;
600 600
601 tb = fib_new_table(cfg.fc_table); 601 tb = fib_new_table(&init_net, cfg.fc_table);
602 if (tb == NULL) { 602 if (tb == NULL) {
603 err = -ENOBUFS; 603 err = -ENOBUFS;
604 goto errout; 604 goto errout;
@@ -671,9 +671,9 @@ static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifad
671 }; 671 };
672 672
673 if (type == RTN_UNICAST) 673 if (type == RTN_UNICAST)
674 tb = fib_new_table(RT_TABLE_MAIN); 674 tb = fib_new_table(&init_net, RT_TABLE_MAIN);
675 else 675 else
676 tb = fib_new_table(RT_TABLE_LOCAL); 676 tb = fib_new_table(&init_net, RT_TABLE_LOCAL);
677 677
678 if (tb == NULL) 678 if (tb == NULL)
679 return; 679 return;
@@ -848,7 +848,7 @@ static void nl_fib_input(struct sk_buff *skb)
848 nlh = nlmsg_hdr(skb); 848 nlh = nlmsg_hdr(skb);
849 849
850 frn = (struct fib_result_nl *) NLMSG_DATA(nlh); 850 frn = (struct fib_result_nl *) NLMSG_DATA(nlh);
851 tb = fib_get_table(frn->tb_id_in); 851 tb = fib_get_table(&init_net, frn->tb_id_in);
852 852
853 nl_fib_lookup(frn, tb); 853 nl_fib_lookup(frn, tb);
854 854