OpenVZ Forum - RDF feed
type: channel
items: [PATCH netns-2.6.25 0/19] routing virtualization v2
items: [PATCH net-2.6.25 19/19] [NETNS] Enable routing configuration in non-initial namespace.
items: [PATCH net-2.6.25 1/19] [NETNS] Add netns parameter to fib_rules_(un)register.
items: [PATCH net-2.6.25 5/19] [IPV4] Check fib4_rules_init failure.
items: [PATCH net-2.6.25 18/19] [NETNS] Replace init_net with the correct context in fib_frontend.c
items: [PATCH net-2.6.25 11/19] [NETNS] Show routing information from correct namespace (fib_hash.c)
items: [PATCH net-2.6.25 2/19] [NETNS] Pass fib_rules_ops into default_pref method.
items: [PATCH net-2.6.25 15/19] [NETNS] Provide correct namespace for fibnl netlink socket.
items: [PATCH net-2.6.25 4/19] [NETNS] Add namespace to API for routing /proc entries creation.
items: [PATCH net-2.6.25 6/19] [NETNS] Refactor fib initialization so it can handle multiple namespaces.
items: [PATCH net-2.6.25 17/19] [NETNS] Pass namespace through ip_rt_ioctl.
items: [PATCH net-2.6.25 16/19] [NETNS] Correctly fill fib_config data.
items: [PATCH net-2.6.25 7/19] [IPV4] Unify access to the routing tables.
items: [PATCH net-2.6.25 13/19] [NETNS] Namespacing IPv4 fib rules.
items: [PATCH net-2.6.25 14/19] [NETNS] Place fib tables into netns.
items: [PATCH net-2.6.25 10/19] [NETNS] Add netns to nl_info structure.
items: [PATCH net-2.6.25 12/19] [NETNS] Show routing information from correct namespace (fib_trie.c)
items: [PATCH net-2.6.25 3/19] [NETNS] Namespacing in the generic fib rules code.
items: [PATCH net-2.6.25 9/19] [NETNS] Add netns parameter to inet_(dev_)add_type.
items: [PATCH net-2.6.25 8/19] [NETNS] Add netns parameter to fib_get_table/fib_new_table.
items: Re: [PATCH netns-2.6.25 0/19] routing virtualization v2

[PATCH netns-2.6.25 0/19] routing virtualization v2
type: item
description: Hi, Dave! This set adds namespace support for routing tables & rules manipulation in the different namespaces. So, one could create a namespace and setup IPv4 routing there how he wants. After this patch user will have the ability to configure and observe its own isolated set of routing rules/tables, but they all will be unused. I.e. routing decisions inside the network stack are still made based on the init_net's rules. The reason for doing so is to have something self-consistent and not too huge :) The sequence is the following: - viritualize generic FIB rules operations - change IPv4 FIB initialization sequence - virtualize FIB tables access After this, the 'ip' utility and the /proc interface will start working correctly inside a namespace, while the 'route' utility will not, because IP sockets currently cannot be created in non-init namespace. Changes from v1: - fixed spacing in the fib_rules.h - improved patch description by the suggestion of Daniel Lezcano
creator: den
date: 2008-01-09T17:57:37-00:00

[PATCH net-2.6.25 19/19] [NETNS] Enable routing configuration in non-initial namespace.
type: item
description: I.e. remove the net != &init_net checks from the places, that now can handle other-than-init net 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> --- net/ipv4/fib_frontend.c | 16 ---------------- 1 files changed, 0 insertions(+), 16 deletions(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index a5c47fc..a5e2fb3 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -572,9 +572,6 @@ static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar struct fib_table *tb; int err; - if (net != &init_net) - return -EINVAL; - err = rtm_to_fib_config(net, skb, nlh, &cfg); if (err < 0) goto errout; @@ -597,9 +594,6 @@ static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar struct fib_table *tb; int err; - if (net != &init_net) - return -EINVAL; - err = rtm_to_fib_config(net, skb, nlh, &cfg); if (err < 0) goto errout; @@ -625,9 +619,6 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) struct hlist_head *head; int dumped = 0; - if (net != &init_net) - return 0; - if (nlmsg_len(cb->nlh) >= sizeof(struct rtmsg) && ((struct rtmsg *) nlmsg_data(cb->nlh))->rtm_flags & RTM_F_CLONED) return ip_rt_dump(skb, cb); @@ -931,9 +922,6 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo struct net_device *dev = ptr; struct in_device *in_dev = __in_dev_get_rtnl(dev); - if (dev->nd_net != &init_net) - return NOTIFY_DONE; - if (event == NETDEV_UNREGISTER) { fib_disable_ip(dev, 2); return NOTIFY_DONE; @@ -1013,10 +1001,6 @@ static int __net_init fib_net_init(struct net *net) { int error; - error = 0; - if (net != &init_net) - goto out; - error = ip_fib_net_init(net); if (error < 0) goto out; -- 1.5.3.rc5
creator: den
date: 2008-01-09T17:59:00-00:00

[PATCH net-2.6.25 1/19] [NETNS] Add netns parameter to fib_rules_(un)register.
type: item
description: The patch extends the different fib rules API in order to pass the network namespace pointer. That will allow to access the different tables from a namespace relative object. As usual, the pointer to the init_net variable is passed as parameter so we don't break the network. 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> --- include/net/fib_rules.h | 4 ++-- net/core/fib_rules.c | 4 ++-- net/decnet/dn_rules.c | 4 ++-- net/ipv4/fib_rules.c | 2 +- net/ipv6/fib6_rules.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 2364db1..af62345 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h @@ -101,8 +101,8 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) return frh->table; } -extern int fib_rules_register(struct fib_rules_ops *); -extern int fib_rules_unregister(struct fib_rules_ops *); +extern int fib_rules_register(struct net *, struct fib_rules_ops *); +extern int fib_rules_unregister(struct net *, struct fib_rules_ops *); extern void fib_rules_cleanup_ops(struct fib_rules_ops *); extern int fib_rules_lookup(struct fib_rules_ops *, diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index fcbf41c..ada9c81 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -74,7 +74,7 @@ static void flush_route_cache(struct fib_rules_ops *ops) ops->flush_cache(); } -int fib_rules_register(struct fib_rules_ops *ops) +int fib_rules_register(struct net *net, struct fib_rules_ops *ops) { int err = -EEXIST; struct fib_rules_ops *o; @@ -113,7 +113,7 @@ void fib_rules_cleanup_ops(struct fib_rules_ops *ops) } EXPORT_SYMBOL_GPL(fib_rules_cleanup_ops); -int fib_rules_unregister(struct fib_rules_ops *ops) +int fib_rules_unregister(struct net *net, struct fib_rules_ops *ops) { int err = 0; struct fib_rules_ops *o; diff --git a/net/decnet/dn_rules.c b/net/decnet/d…
creator: den
date: 2008-01-09T17:59:02-00:00

[PATCH net-2.6.25 5/19] [IPV4] Check fib4_rules_init failure.
type: item
description: This adds error paths into both versions of fib4_rules_init (with/without CONFIG_IP_MULTIPLE_TABLES) and returns error code to the caller. 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> --- include/net/ip_fib.h | 2 +- net/ipv4/fib_frontend.c | 18 +++++++++++++++--- net/ipv4/fib_rules.c | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index f74cbb2..cbff18d 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -186,7 +186,7 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result } #else /* CONFIG_IP_MULTIPLE_TABLES */ -extern void __init fib4_rules_init(void); +extern int __init fib4_rules_init(void); #ifdef CONFIG_NET_CLS_ROUTE extern u32 fib_rules_tclass(struct fib_result *res); diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index b03c4c6..82d0e00 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -59,12 +59,24 @@ struct fib_table *ip_fib_main_table; #define FIB_TABLE_HASHSZ 1 static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; -static void __init fib4_rules_init(void) +static int __init fib4_rules_init(void) { ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL); - hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]); + if (ip_fib_local_table == NULL) + return -ENOMEM; + ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN); + if (ip_fib_main_table == NULL) + goto fail; + + hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]); hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]); + return 0; + +fail: + kfree(ip_fib_local_table); + ip_fib_local_table = NULL; + return -ENOMEM; } #else @@ -941,7 +953,7 @@ void __init ip_fib_init(void) for (i = 0; i < FIB_TABLE_HASHSZ; i++) INIT_HLIST_HEAD(&fib_table_hash[i]); - fib4_rules_init(); + BUG_ON(fib4_rules_init()); register_netdev…
creator: den
date: 2008-01-09T17:59:05-00:00

[PATCH net-2.6.25 18/19] [NETNS] Replace init_net with the correct context in fib_frontend.c
type: item
description: 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> --- net/ipv4/fib_frontend.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index a5c47fc..a5e2fb3 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -597,7 +594,7 @@ static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar if (err < 0) goto errout; - tb = fib_new_table(&init_net, cfg.fc_table); + tb = fib_new_table(net, cfg.fc_table); if (tb == NULL) { err = -ENOBUFS; goto errout; @@ -794,7 +785,7 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa) fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim); /* Check, that this local address finally disappeared. */ - if (inet_addr_type(&init_net, ifa->ifa_local) != RTN_LOCAL) { + if (inet_addr_type(dev->nd_net, ifa->ifa_local) != RTN_LOCAL) { /* And the last, but not the least thing. We must flush stray FIB entries. @@ -802,7 +793,7 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa) for stray nexthop entries, then ignite fib_flush. */ if (fib_sync_down(ifa->ifa_local, NULL, 0)) - fib_flush(&init_net); + fib_flush(dev->nd_net); } } #undef LOCAL_OK @@ -894,7 +885,7 @@ static void nl_fib_lookup_exit(struct net *net) static void fib_disable_ip(struct net_device *dev, int force) { if (fib_sync_down(0, dev, force)) - fib_flush(&init_net); + fib_flush(dev->nd_net); rt_cache_flush(0); arp_ifdown(dev); } -- 1.5.3.rc5
creator: den
date: 2008-01-09T17:59:16-00:00

[PATCH net-2.6.25 11/19] [NETNS] Show routing information from correct namespace (fib_hash.c)
type: item
description: This is the second part (for the CONFIG_IP_FIB_HASH case) of the patch #4, where we have created proc files in namespaces. Now we can dump correct info in them. 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> --- net/ipv4/fib_hash.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index fb61ca9..c9f1f73 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c @@ -782,6 +782,7 @@ struct fib_table *fib_hash_init(u32 id) #ifdef CONFIG_PROC_FS struct fib_iter_state { + struct seq_net_private p; struct fn_zone *zone; int bucket; struct hlist_head *hash_head; @@ -795,8 +796,11 @@ struct fib_iter_state { static struct fib_alias *fib_get_first(struct seq_file *seq) { struct fib_iter_state *iter = seq->private; - struct fib_table *main_table = fib_get_table(&init_net, RT_TABLE_MAIN); - struct fn_hash *table = (struct fn_hash *)main_table->tb_data; + struct fib_table *main_table; + struct fn_hash *table; + + main_table = fib_get_table(iter->p.net, RT_TABLE_MAIN); + table = (struct fn_hash *)main_table->tb_data; iter->bucket = 0; iter->hash_head = NULL; @@ -933,10 +937,11 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos) static void *fib_seq_start(struct seq_file *seq, loff_t *pos) __acquires(fib_hash_lock) { + struct fib_iter_state *iter = seq->private; void *v = NULL; read_lock(&fib_hash_lock); - if (fib_get_table(&init_net, RT_TABLE_MAIN)) + if (fib_get_table(iter->p.net, RT_TABLE_MAIN)) v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; return v; } @@ -1024,8 +1029,8 @@ static const struct seq_operations fib_seq_ops = { static int fib_seq_open(struct inode *inode, struct file *file) { - return seq_open_private(file, &fib_seq_ops, - sizeof(struct fib_iter_state)); + return seq_open_net(inode, file, &fib_seq_ops, + sizeof(struct fib_iter_state)); } static const struct fi…
creator: den
date: 2008-01-09T17:59:17-00:00

[PATCH net-2.6.25 2/19] [NETNS] Pass fib_rules_ops into default_pref method.
type: item
description: fib_rules_ops contains operations and the list of configured rules. ops will become per/namespace soon, so we need them to be known in the default_pref callback. 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> --- include/net/fib_rules.h | 2 +- net/core/fib_rules.c | 2 +- net/decnet/dn_rules.c | 2 +- net/ipv4/fib_rules.c | 2 +- net/ipv6/fib6_rules.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index af62345..14b8a71 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h @@ -56,7 +56,7 @@ struct fib_rules_ops int (*fill)(struct fib_rule *, struct sk_buff *, struct nlmsghdr *, struct fib_rule_hdr *); - u32 (*default_pref)(void); + u32 (*default_pref)(struct fib_rules_ops *ops); size_t (*nlmsg_payload)(struct fib_rule *); /* Called after modifications to the rules set, must flush diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index ada9c81..e12e9f5 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -285,7 +285,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) rule->table = frh_get_table(frh, tb); if (!rule->pref && ops->default_pref) - rule->pref = ops->default_pref(); + rule->pref = ops->default_pref(ops); err = -EINVAL; if (tb[FRA_GOTO]) { diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c index 0b5e2b9..c1fae23 100644 --- a/net/decnet/dn_rules.c +++ b/net/decnet/dn_rules.c @@ -212,7 +212,7 @@ nla_put_failure: return -ENOBUFS; } -static u32 dn_fib_rule_default_pref(void) +static u32 dn_fib_rule_default_pref(struct fib_rules_ops *ops) { struct list_head *pos; struct fib_rule *rule; diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index eac3f71..afe669d 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c @@ -245,7 +245,7 @@ nla_put_failure: return -ENOBUFS; } -static u32 fib4_rule_default_pref(void) +static …
creator: den
date: 2008-01-09T17:59:18-00:00

[PATCH net-2.6.25 15/19] [NETNS] Provide correct namespace for fibnl netlink socket.
type: item
description: This patch makes the netlink socket to be per namespace. That allows to have each namespace its own socket for routing queries. 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> --- include/net/netns/ipv4.h | 2 ++ net/ipv4/fib_frontend.c | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 629ec6c..031d761 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -9,6 +9,7 @@ struct ctl_table_header; struct ipv4_devconf; struct fib_rules_ops; struct hlist_head; +struct sock; struct netns_ipv4 { #ifdef CONFIG_SYSCTL @@ -18,5 +19,6 @@ struct netns_ipv4 { struct fib_rules_ops *rules_ops; #endif struct hlist_head *fib_table_hash; + struct sock *fibnl; }; #endif diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 7fe54a3..a5e8167 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -49,8 +49,6 @@ #define FFprint(a...) printk(KERN_DEBUG a) -static struct sock *fibnl; - #ifndef CONFIG_IP_MULTIPLE_TABLES static int __net_init fib4_rules_init(struct net *net) @@ -845,11 +843,13 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb ) static void nl_fib_input(struct sk_buff *skb) { + struct net *net; struct fib_result_nl *frn; struct nlmsghdr *nlh; struct fib_table *tb; u32 pid; + net = skb->sk->sk_net; nlh = nlmsg_hdr(skb); if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) @@ -861,28 +861,36 @@ static void nl_fib_input(struct sk_buff *skb) nlh = nlmsg_hdr(skb); frn = (struct fib_result_nl *) NLMSG_DATA(nlh); - tb = fib_get_table(&init_net, frn->tb_id_in); + tb = fib_get_table(net, frn->tb_id_in); nl_fib_lookup(frn, tb); pid = NETLINK_CB(skb).pid; /* pid of sending process */ NETLINK_CB(skb).pid = 0; /* from kernel */ NETLINK_CB(skb).dst_group = 0; /* unicast */…
creator: den
date: 2008-01-09T17:59:19-00:00

[PATCH net-2.6.25 4/19] [NETNS] Add namespace to API for routing /proc entries creation.
type: item
description: This adds netns parameter to fib_proc_init/exit and replaces __init specifier with __net_init. After this, we will not yet have these proc files show info from the specific namespace - this will be done when these tables become namespaced. 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> --- include/net/ip_fib.h | 4 ++-- net/ipv4/af_inet.c | 4 ++-- net/ipv4/fib_hash.c | 8 ++++---- net/ipv4/fib_trie.c | 21 +++++++++++---------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index d70b9b4..f74cbb2 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -253,8 +253,8 @@ static inline void fib_res_put(struct fib_result *res) } #ifdef CONFIG_PROC_FS -extern int fib_proc_init(void); -extern void fib_proc_exit(void); +extern int __net_init fib_proc_init(struct net *net); +extern void __net_exit fib_proc_exit(struct net *net); #endif #endif /* _NET_FIB_H */ diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 03633b7..ea9fd3d 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1470,14 +1470,14 @@ static int __init ipv4_proc_init(void) goto out_tcp; if (udp4_proc_init()) goto out_udp; - if (fib_proc_init()) + if (fib_proc_init(&init_net)) goto out_fib; if (ip_misc_proc_init()) goto out_misc; out: return rc; out_misc: - fib_proc_exit(); + fib_proc_exit(&init_net); out_fib: udp4_proc_exit(); out_udp: diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 481de47..f5476e2 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c @@ -1038,15 +1038,15 @@ static const struct file_operations fib_seq_fops = { .release = seq_release_private, }; -int __init fib_proc_init(void) +int __net_init fib_proc_init(struct net *net) { - if (!proc_net_fops_create(&init_net, "route", S_IRUGO, &fib_seq_fops)) + if (!proc_net_fops_create(net, "route", S_IRUGO, &fib_seq_fops)) return -ENOMEM; return 0; } -void __ini…
creator: den
date: 2008-01-09T17:59:19-00:00

[PATCH net-2.6.25 6/19] [NETNS] Refactor fib initialization so it can handle multiple namespaces.
type: item
description: This patch makes the fib to be initialized as a subsystem for the network namespaces. The code does not handle several namespaces yet, so in case of a creation of a network namespace, the creation/initialization will not occur. 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> --- include/net/ip_fib.h | 3 +- net/ipv4/af_inet.c | 4 -- net/ipv4/fib_frontend.c | 86 ++++++++++++++++++++++++++++++++++++++++++---- net/ipv4/fib_hash.c | 6 +--- net/ipv4/fib_rules.c | 11 ++++-- net/ipv4/fib_trie.c | 6 +--- 6 files changed, 90 insertions(+), 26 deletions(-) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index cbff18d..338d3ed 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -186,7 +186,8 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result } #else /* CONFIG_IP_MULTIPLE_TABLES */ -extern int __init fib4_rules_init(void); +extern int __net_init fib4_rules_init(struct net *net); +extern void __net_exit fib4_rules_exit(struct net *net); #ifdef CONFIG_NET_CLS_ROUTE extern u32 fib_rules_tclass(struct fib_result *res); diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index ea9fd3d..19b557a 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1470,15 +1470,11 @@ static int __init ipv4_proc_init(void) goto out_tcp; if (udp4_proc_init()) goto out_udp; - if (fib_proc_init(&init_net)) - goto out_fib; if (ip_misc_proc_init()) goto out_misc; out: return rc; out_misc: - fib_proc_exit(&init_net); -out_fib: udp4_proc_exit(); out_udp: tcp4_proc_exit(); diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 82d0e00..714fff9 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -59,7 +59,7 @@ struct fib_table *ip_fib_main_table; #define FIB_TABLE_HASHSZ 1 static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; -static int __init fib4_rules_init(void) +static int __net_init fib4_rules_init(struct net *ne…
creator: den
date: 2008-01-09T17:59:21-00:00

[PATCH net-2.6.25 17/19] [NETNS] Pass namespace through ip_rt_ioctl.
type: item
description: ... up to rtentry_to_fib_config 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> --- include/net/route.h | 2 +- net/ipv4/af_inet.c | 2 +- net/ipv4/fib_frontend.c | 8 ++++---- net/ipv4/ipconfig.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/net/route.h b/include/net/route.h index b777000..5847e6f 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -120,7 +120,7 @@ extern void ip_rt_send_redirect(struct sk_buff *skb); extern unsigned inet_addr_type(struct net *net, __be32 addr); extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); extern void ip_rt_multicast_event(struct in_device *); -extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); +extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); extern void ip_rt_get_source(u8 *src, struct rtable *rt); extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 6fac905..f0968a1 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -793,7 +793,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case SIOCADDRT: case SIOCDELRT: case SIOCRTMSG: - err = ip_rt_ioctl(cmd, (void __user *)arg); + err = ip_rt_ioctl(sk->sk_net, cmd, (void __user *)arg); break; case SIOCDARP: case SIOCGARP: diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index cecb660..a5c47fc 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -437,7 +437,7 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt, * Handle IP routing ioctl calls. These are used to manipulate the routing tables */ -int ip_rt_ioctl(unsigned int cmd, void __user *arg) +int ip_rt_ioctl(struct net *net, unsigned int cmd, void __user *arg) { struct fib_config cfg; struct rtentry rt; @@ -453,18 +453,18 @@ int ip_rt_ioctl(unsign…
creator: den
date: 2008-01-09T17:59:21-00:00

[PATCH net-2.6.25 16/19] [NETNS] Correctly fill fib_config data.
type: item
description: 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> --- net/ipv4/fib_frontend.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index abe9f43..cecb660 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -305,14 +305,14 @@ static int put_rtax(struct nlattr *mx, int len, int type, u32 value) return len + nla_total_size(4); } -static int rtentry_to_fib_config(int cmd, struct rtentry *rt, +static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt, struct fib_config *cfg) { __be32 addr; int plen; memset(cfg, 0, sizeof(*cfg)); - cfg->fc_nlinfo.nl_net = &init_net; + cfg->fc_nlinfo.nl_net = net; if (rt->rt_dst.sa_family != AF_INET) return -EAFNOSUPPORT; @@ -373,7 +373,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, colon = strchr(devname, ':'); if (colon) *colon = 0; - dev = __dev_get_by_name(&init_net, devname); + dev = __dev_get_by_name(net, devname); if (!dev) return -ENODEV; cfg->fc_oif = dev->ifindex; @@ -396,7 +396,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, if (rt->rt_gateway.sa_family == AF_INET && addr) { cfg->fc_gw = addr; if (rt->rt_flags & RTF_GATEWAY && - inet_addr_type(&init_net, addr) == RTN_UNICAST) + inet_addr_type(net, addr) == RTN_UNICAST) cfg->fc_scope = RT_SCOPE_UNIVERSE; } @@ -453,7 +453,7 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg) return -EFAULT; rtnl_lock(); - err = rtentry_to_fib_config(cmd, &rt, &cfg); + err = rtentry_to_fib_config(&init_net, cmd, &rt, &cfg); if (err == 0) { struct fib_table *tb; @@ -494,8 +494,8 @@ const struct nla_policy rtm_ipv4_policy[RTA_MAX+1] = { [RTA_FLOW] = { .type = NLA_U32 }, }; -static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh, - struct fib_config *cfg) +static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,…
creator: den
date: 2008-01-09T17:59:22-00:00

[PATCH net-2.6.25 7/19] [IPV4] Unify access to the routing tables.
type: item
description: Replace the direct pointers to local and main tables with calls to fib_get_table() with appropriate argument. This doesn't introduce additional dereferences, but makes the access to fib tables uniform in any (CONFIG_IP_MULTIPLE_TABLES) case. 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> --- include/net/ip_fib.h | 39 ++++++++++++++++++++++++++++----------- net/ipv4/fib_frontend.c | 29 ++++++++++++----------------- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 338d3ed..06e6a33 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -120,16 +120,22 @@ struct fib_result_nl { int err; }; +extern struct hlist_head fib_table_hash[]; + #ifdef CONFIG_IP_ROUTE_MULTIPATH #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) #define FIB_RES_RESET(res) ((res).nh_sel = 0) +#define FIB_TABLE_HASHSZ 2 + #else /* CONFIG_IP_ROUTE_MULTIPATH */ #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) #define FIB_RES_RESET(res) +#define FIB_TABLE_HASHSZ 256 + #endif /* CONFIG_IP_ROUTE_MULTIPATH */ #define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) @@ -156,14 +162,17 @@ struct fib_table { #ifndef CONFIG_IP_MULTIPLE_TABLES -extern struct fib_table *ip_fib_local_table; -extern struct fib_table *ip_fib_main_table; +#define TABLE_LOCAL_INDEX 0 +#define TABLE_MAIN_INDEX 1 static inline struct fib_table *fib_get_table(u32 id) { - if (id != RT_TABLE_LOCAL) - return ip_fib_main_table; - return ip_fib_local_table; + struct hlist_head *ptr; + + ptr = id == RT_TABLE_LOCAL ? + &fib_table_hash[TABLE_LOCAL_INDEX] : + &fib_table_hash[TABLE_MAIN_INDEX]; + return hlist_entry(ptr->first, struct fib_table, tb_hlist); } static inline struct fib_table *fib_new_table(u32 id) @@ -173,16 +182,24 @@ static inline struct fib_table *fib_new_table(u32 id) static inline int fib_lookup(const struct flowi *flp, struct fib_re…
creator: den
date: 2008-01-09T17:59:23-00:00

[PATCH net-2.6.25 13/19] [NETNS] Namespacing IPv4 fib rules.
type: item
description: The final trick for rules: place fib4_rules_ops into struct net and modify initialization path for this. 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> --- include/net/netns/ipv4.h | 5 +++++ net/ipv4/fib_rules.c | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index e06d7cf..299f8c6 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -4,14 +4,19 @@ #ifndef __NETNS_IPV4_H__ #define __NETNS_IPV4_H__ + struct ctl_table_header; struct ipv4_devconf; +struct fib_rules_ops; struct netns_ipv4 { #ifdef CONFIG_SYSCTL struct ctl_table_header *forw_hdr; #endif struct ipv4_devconf *devconf_all; struct ipv4_devconf *devconf_dflt; +#ifdef CONFIG_IP_MULTIPLE_TABLES + struct fib_rules_ops *rules_ops; +#endif }; #endif diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 49819fe..72232ab 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c @@ -32,8 +32,6 @@ #include <net/ip_fib.h> #include <net/fib_rules.h> -static struct fib_rules_ops fib4_rules_ops; - struct fib4_rule { struct fib_rule common; @@ -63,7 +61,7 @@ int fib_lookup(struct flowi *flp, struct fib_result *res) }; int err; - err = fib_rules_lookup(&fib4_rules_ops, flp, 0, &arg); + err = fib_rules_lookup(init_net.ipv4.rules_ops, flp, 0, &arg); res->r = arg.rule; return err; @@ -149,6 +147,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb, struct nlmsghdr *nlh, struct fib_rule_hdr *frh, struct nlattr **tb) { + struct net *net = skb->sk->sk_net; int err = -EINVAL; struct fib4_rule *rule4 = (struct fib4_rule *) rule; @@ -159,7 +158,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb, if (rule->action == FR_ACT_TO_TBL) { struct fib_table *table; - table = fib_empty_table(&init_net); + table = fib_empty_table(net); if (table ==…
creator: den
date: 2008-01-09T18:01:02-00:00

[PATCH net-2.6.25 14/19] [NETNS] Place fib tables into netns.
type: item
description: The preparatory work has been done. All we need is to substitute fib_table_hash with net->ipv4.fib_table_hash. Netns context is available when required. 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> --- include/net/ip_fib.h | 6 ++---- include/net/netns/ipv4.h | 2 ++ net/ipv4/fib_frontend.c | 36 ++++++++++++++++++++++++------------ 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 1faad1f..ddb4c20 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -120,8 +120,6 @@ struct fib_result_nl { int err; }; -extern struct hlist_head fib_table_hash[]; - #ifdef CONFIG_IP_ROUTE_MULTIPATH #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) @@ -169,9 +167,9 @@ static inline struct fib_table *fib_get_table(struct net *net, u32 id) { struct hlist_head *ptr; - ptr = id == RT_TABLE_LOCAL ? - &fib_table_hash[TABLE_LOCAL_INDEX] : - &fib_table_hash[TABLE_MAIN_INDEX]; + ptr = id == RT_TABLE_LOCAL ? + &net->ipv4.fib_table_hash[TABLE_LOCAL_INDEX] : + &net->ipv4.fib_table_hash[TABLE_MAIN_INDEX]; return hlist_entry(ptr->first, struct fib_table, tb_hlist); } diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 299f8c6..629ec6c 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -8,6 +8,7 @@ struct ctl_table_header; struct ipv4_devconf; struct fib_rules_ops; +struct hlist_head; struct netns_ipv4 { #ifdef CONFIG_SYSCTL @@ -16,5 +17,6 @@ struct netns_ipv4 { #ifdef CONFIG_IP_MULTIPLE_TABLES struct fib_rules_ops *rules_ops; #endif + struct hlist_head *fib_table_hash; }; #endif diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 08414eb..2e150ae 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -50,7 +50,6 @@ #define FFprint(a...) printk(KERN_DEBUG a) static struct sock *fibnl; -struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; #ifndef CONFIG_IP_…
creator: den
date: 2008-01-09T18:01:05-00:00

[PATCH net-2.6.25 10/19] [NETNS] Add netns to nl_info structure.
type: item
description: nl_info is used to track the end-user destination of routing change notification. This is a natural object to hold a namespace on. Place it there and utilize the context in the appropriate places. 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> --- include/net/netlink.h | 1 + net/ipv4/fib_frontend.c | 5 +++++ net/ipv4/fib_semantics.c | 16 ++++++++++------ net/ipv6/ip6_fib.c | 4 +++- net/ipv6/route.c | 8 ++++++-- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/include/net/netlink.h b/include/net/netlink.h index db4b935..87cf0bc 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -217,6 +217,7 @@ struct nla_policy { */ struct nl_info { struct nlmsghdr *nlh; + struct net *nl_net; u32 pid; }; diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 312a728..08414eb 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -310,6 +310,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, int plen; memset(cfg, 0, sizeof(*cfg)); + cfg->fc_nlinfo.nl_net = &init_net; if (rt->rt_dst.sa_family != AF_INET) return -EAFNOSUPPORT; @@ -516,6 +517,7 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh, cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid; cfg->fc_nlinfo.nlh = nlh; + cfg->fc_nlinfo.nl_net = &init_net; if (cfg->fc_type > RTN_MAX) { err = -EINVAL; @@ -670,6 +672,9 @@ static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifad .fc_prefsrc = ifa->ifa_local, .fc_oif = ifa->ifa_dev->dev->ifindex, .fc_nlflags = NLM_F_CREATE | NLM_F_APPEND, + .fc_nlinfo = { + .nl_net = &init_net, + }, }; if (type == RTN_UNICAST) diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index c1263e2..0de6102 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -320,11 +320,11 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, kfree_skb(skb); goto errout; } - err = …
creator: den
date: 2008-01-09T18:01:06-00:00

[PATCH net-2.6.25 12/19] [NETNS] Show routing information from correct namespace (fib_trie.c)
type: item
description: This is the second part (for the CONFIG_IP_FIB_TRIE case) of the patch #4, where we have created proc files in namespaces. Now we can dump correct info in them. 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> --- net/ipv4/fib_trie.c | 44 ++++++++++++++++++++++++++++++++------------ 1 files changed, 32 insertions(+), 12 deletions(-) diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 9526758..708faa9 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1992,6 +1992,7 @@ struct fib_table *fib_hash_init(u32 id) #ifdef CONFIG_PROC_FS /* Depth first Trie walk iterator */ struct fib_trie_iter { + struct seq_net_private p; struct trie *trie_local, *trie_main; struct tnode *tnode; struct trie *trie; @@ -2159,17 +2160,18 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat) static int fib_triestat_seq_show(struct seq_file *seq, void *v) { + struct net *net = (struct net *)seq->private; struct trie *trie_local, *trie_main; struct trie_stat *stat; struct fib_table *tb; trie_local = NULL; - tb = fib_get_table(&init_net, RT_TABLE_LOCAL); + tb = fib_get_table(net, RT_TABLE_LOCAL); if (tb) trie_local = (struct trie *) tb->tb_data; trie_main = NULL; - tb = fib_get_table(&init_net, RT_TABLE_MAIN); + tb = fib_get_table(net, RT_TABLE_MAIN); if (tb) trie_main = (struct trie *) tb->tb_data; @@ -2199,7 +2201,25 @@ static int fib_triestat_seq_show(struct seq_file *seq, void *v) static int fib_triestat_seq_open(struct inode *inode, struct file *file) { - return single_open(file, fib_triestat_seq_show, NULL); + int err; + struct net *net; + + net = get_proc_net(inode); + if (net == NULL) + return -ENXIO; + err = single_open(file, fib_triestat_seq_show, net); + if (err < 0) { + put_net(net); + return err; + } + return 0; +} + +static int fib_triestat_seq_release(struct inode *ino, struct file *f) +{ + struct seq_file *seq = f->private_data; + put_net(seq-…
creator: den
date: 2008-01-09T18:01:07-00:00

[PATCH net-2.6.25 3/19] [NETNS] Namespacing in the generic fib rules code.
type: item
description: Move static rules_ops & rules_mod_lock to the struct net, register the pernet subsys to init them and enjoy the fact that the core rules infrastructure works in the namespace. Real IPv4 fib rules virtualization requires fib tables support in the namespace and will be done seriously later in the patchset. 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> --- include/net/net_namespace.h | 4 ++ net/core/fib_rules.c | 91 +++++++++++++++++++++++++----------------- 2 files changed, 58 insertions(+), 37 deletions(-) diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index d04ddf2..a5055fa 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -39,6 +39,10 @@ struct net { struct hlist_head *dev_name_head; struct hlist_head *dev_index_head; + /* core fib_rules */ + struct list_head rules_ops; + spinlock_t rules_mod_lock; + struct sock *rtnl; /* rtnetlink socket */ /* core sysctls */ diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index e12e9f5..c5f78fe 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -15,9 +15,6 @@ #include <net/sock.h> #include <net/fib_rules.h> -static LIST_HEAD(rules_ops); -static DEFINE_SPINLOCK(rules_mod_lock); - int fib_default_rule_add(struct fib_rules_ops *ops, u32 pref, u32 table, u32 flags) { @@ -40,16 +37,17 @@ int fib_default_rule_add(struct fib_rules_ops *ops, } EXPORT_SYMBOL(fib_default_rule_add); -static void notify_rule_change(int event, struct fib_rule *rule, +static void notify_rule_change(struct net *net, int event, + struct fib_rule *rule, struct fib_rules_ops *ops, struct nlmsghdr *nlh, u32 pid); -static struct fib_rules_ops *lookup_rules_ops(int family) +static struct fib_rules_ops *lookup_rules_ops(struct net *net, int family) { struct fib_rules_ops *ops; rcu_read_lock(); - list_for_each_entry_rcu(ops, &rules_ops, list) { + list_for_each_entry_rcu(ops, &net->rules_ops, list) {…
creator: den
date: 2008-01-09T18:01:15-00:00

[PATCH net-2.6.25 9/19] [NETNS] Add netns parameter to inet_(dev_)add_type.
type: item
description: The patch extends the inet_addr_type and inet_dev_addr_type with the network namespace pointer. That allows to access the different tables relatively to the network namespace. The modification of the signature function is reported in all the callers of the inet_addr_type using the pointer to the well known init_net. Acked-by: Benjamin Thery <benjamin.thery@bull.net> Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/s390/net/qeth_main.c | 2 +- include/net/route.h | 4 ++-- net/atm/clip.c | 2 +- net/ipv4/af_inet.c | 2 +- net/ipv4/arp.c | 12 ++++++------ net/ipv4/fib_frontend.c | 18 ++++++++++-------- net/ipv4/fib_semantics.c | 4 ++-- net/ipv4/icmp.c | 4 ++-- net/ipv4/ip_options.c | 4 ++-- net/ipv4/ipvs/ip_vs_core.c | 2 +- net/ipv4/ipvs/ip_vs_ctl.c | 4 ++-- net/ipv4/netfilter.c | 2 +- net/ipv4/netfilter/ipt_addrtype.c | 2 +- net/ipv4/raw.c | 2 +- net/ipv4/route.c | 2 +- net/ipv6/af_inet6.c | 2 +- net/sctp/protocol.c | 2 +- 17 files changed, 36 insertions(+), 34 deletions(-) diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index ff999ff..f1866a2 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -8340,7 +8340,7 @@ qeth_arp_constructor(struct neighbour *neigh) neigh->parms = neigh_parms_clone(parms); rcu_read_unlock(); - neigh->type = inet_addr_type(*(__be32 *) neigh->primary_key); + neigh->type = inet_addr_type(&init_net, *(__be32 *) neigh->primary_key); neigh->nud_state = NUD_NOARP; neigh->ops = arp_direct_ops; neigh->output = neigh->ops->queue_xmit; diff --git a/include/net/route.h b/include/net/route.h index 76b08c1..b777000 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -117,8 +117,8 @@ extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, stru extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); extern void ip_rt_send_redirect(struct sk_buff *skb); -extern unsigned inet_addr_type(__b…
creator: den
date: 2008-01-09T18:01:20-00:00

[PATCH net-2.6.25 8/19] [NETNS] Add netns parameter to fib_get_table/fib_new_table.
type: item
description: 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> --- include/net/ip_fib.h | 16 ++++++++-------- net/ipv4/fib_frontend.c | 24 ++++++++++++------------ net/ipv4/fib_hash.c | 4 ++-- net/ipv4/fib_rules.c | 12 ++++++------ net/ipv4/fib_trie.c | 8 ++++---- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 249af66..dfb95d7 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -165,7 +165,7 @@ struct fib_table { #define TABLE_LOCAL_INDEX 0 #define TABLE_MAIN_INDEX 1 -static inline struct fib_table *fib_get_table(u32 id) +static inline struct fib_table *fib_get_table(struct net *net, u32 id) { struct hlist_head *ptr; @@ -175,20 +175,20 @@ static inline struct fib_table *fib_get_table(u32 id) return hlist_entry(ptr->first, struct fib_table, tb_hlist); } -static inline struct fib_table *fib_new_table(u32 id) +static inline struct fib_table *fib_new_table(struct net *net, u32 id) { - return fib_get_table(id); + return fib_get_table(net, id); } static inline int fib_lookup(const struct flowi *flp, struct fib_result *res) { struct fib_table *table; - table = fib_get_table(RT_TABLE_LOCAL); + table = fib_get_table(&init_net, RT_TABLE_LOCAL); if (!table->tb_lookup(table, flp, res)) return 0; - table = fib_get_table(RT_TABLE_MAIN); + table = fib_get_table(&init_net, RT_TABLE_MAIN); if (!table->tb_lookup(table, flp, res)) return 0; return -ENETUNREACH; @@ -197,7 +197,7 @@ static inline int fib_lookup(const struct flowi *flp, struct fib_result *res) static inline void fib_select_default(const struct flowi *flp, struct fib_result *res) { - struct fib_table *table = fib_get_table(RT_TABLE_MAIN); + struct fib_table *table = fib_get_table(&init_n…
creator: den
date: 2008-01-09T18:02:28-00:00

Re: [PATCH netns-2.6.25 0/19] routing virtualization v2
type: item
description: From: "Denis V. Lunev" <den@openvz.org> Date: Wed, 09 Jan 2008 21:03:03 +0300 > This set adds namespace support for routing tables & rules > manipulation in the different namespaces. So, one could create a > namespace and setup IPv4 routing there how he wants. All 19 patches applied, thanks Denis.
creator: davem
date: 2008-01-10T11:38:12-00:00