* [patch 03/11][NETNS][IPV6] ip6_fib - make fib6_clean_all per namespace
From: Daniel Lezcano @ 2008-01-25 16:50 UTC (permalink / raw)
To: davem; +Cc: benjamin.thery, netdev, den
In-Reply-To: <20080125165008.317745745@localhost.localdomain>
[-- Attachment #1: ip6-fib-make-fib6_clean_all-per-namespace.patch --]
[-- Type: text/plain, Size: 5624 bytes --]
The function fib6_clean_all takes the network namespace
as parameter. That allows to flush the routes related to
a specific network namespace.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
---
include/net/ip6_fib.h | 3 ++-
include/net/ip6_route.h | 2 +-
net/ipv6/addrconf.c | 3 ++-
net/ipv6/ip6_fib.c | 7 ++++---
net/ipv6/route.c | 28 ++++++++++++++++++++--------
5 files changed, 29 insertions(+), 14 deletions(-)
Index: net-2.6.25/include/net/ip6_fib.h
===================================================================
--- net-2.6.25.orig/include/net/ip6_fib.h
+++ net-2.6.25/include/net/ip6_fib.h
@@ -208,7 +208,8 @@ struct fib6_node *fib6_locate(struct fi
struct in6_addr *daddr, int dst_len,
struct in6_addr *saddr, int src_len);
-extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg),
+extern void fib6_clean_all(struct net *net,
+ int (*func)(struct rt6_info *, void *arg),
int prune, void *arg);
extern int fib6_add(struct fib6_node *root,
Index: net-2.6.25/net/ipv6/ip6_fib.c
===================================================================
--- net-2.6.25.orig/net/ipv6/ip6_fib.c
+++ net-2.6.25/net/ipv6/ip6_fib.c
@@ -1350,7 +1350,7 @@ static void fib6_clean_tree(struct fib6_
fib6_walk(&c.w);
}
-void fib6_clean_all(int (*func)(struct rt6_info *, void *arg),
+void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
int prune, void *arg)
{
struct fib6_table *table;
@@ -1360,7 +1360,7 @@ void fib6_clean_all(int (*func)(struct r
rcu_read_lock();
for (h = 0; h < FIB_TABLE_HASHSZ; h++) {
- head = &init_net.ipv6.fib_table_hash[h];
+ head = &net->ipv6.fib_table_hash[h];
hlist_for_each_entry_rcu(table, node, head, tb6_hlist) {
write_lock_bh(&table->tb6_lock);
fib6_clean_tree(&table->tb6_root, func, prune, arg);
@@ -1450,7 +1450,8 @@ void fib6_run_gc(unsigned long dummy)
gc_args.more = 0;
ndisc_dst_gc(&gc_args.more);
- fib6_clean_all(fib6_age, 0, NULL);
+
+ fib6_clean_all(&init_net, fib6_age, 0, NULL);
if (gc_args.more)
mod_timer(&ip6_fib_timer, jiffies +
Index: net-2.6.25/net/ipv6/route.c
===================================================================
--- net-2.6.25.orig/net/ipv6/route.c
+++ net-2.6.25/net/ipv6/route.c
@@ -1867,9 +1867,9 @@ static int fib6_ifdown(struct rt6_info *
return 0;
}
-void rt6_ifdown(struct net_device *dev)
+void rt6_ifdown(struct net *net, struct net_device *dev)
{
- fib6_clean_all(fib6_ifdown, 0, dev);
+ fib6_clean_all(net, fib6_ifdown, 0, dev);
}
struct rt6_mtu_change_arg
@@ -1925,7 +1925,7 @@ void rt6_mtu_change(struct net_device *d
.mtu = mtu,
};
- fib6_clean_all(rt6_mtu_change_route, 0, &arg);
+ fib6_clean_all(dev->nd_net, rt6_mtu_change_route, 0, &arg);
}
static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
@@ -2313,13 +2313,25 @@ static int rt6_info_route(struct rt6_inf
static int ipv6_route_show(struct seq_file *m, void *v)
{
- fib6_clean_all(rt6_info_route, 0, m);
+ struct net *net = (struct net *)m->private;
+ fib6_clean_all(net, rt6_info_route, 0, m);
return 0;
}
static int ipv6_route_open(struct inode *inode, struct file *file)
{
- return single_open(file, ipv6_route_show, NULL);
+ struct net *net = get_proc_net(inode);
+ if (!net)
+ return -ENXIO;
+ return single_open(file, ipv6_route_show, net);
+}
+
+static int ipv6_route_release(struct inode *inode, struct file *file)
+{
+ struct seq_file *seq = file->private_data;
+ struct net *net = seq->private;
+ put_net(net);
+ return single_release(inode, file);
}
static const struct file_operations ipv6_route_proc_fops = {
@@ -2327,7 +2339,7 @@ static const struct file_operations ipv6
.open = ipv6_route_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = single_release,
+ .release = ipv6_route_release,
};
static int rt6_stats_seq_show(struct seq_file *seq, void *v)
@@ -2551,7 +2563,7 @@ xfrm6_init:
out_proc_init:
ipv6_route_proc_fini(&init_net);
out_fib6_init:
- rt6_ifdown(NULL);
+ rt6_ifdown(&init_net, NULL);
fib6_gc_cleanup();
out_kmem_cache:
kmem_cache_destroy(ip6_dst_ops.kmem_cachep);
@@ -2563,7 +2575,7 @@ void ip6_route_cleanup(void)
fib6_rules_cleanup();
ipv6_route_proc_fini(&init_net);
xfrm6_fini();
- rt6_ifdown(NULL);
+ rt6_ifdown(&init_net, NULL);
fib6_gc_cleanup();
kmem_cache_destroy(ip6_dst_ops.kmem_cachep);
}
Index: net-2.6.25/include/net/ip6_route.h
===================================================================
--- net-2.6.25.orig/include/net/ip6_route.h
+++ net-2.6.25/include/net/ip6_route.h
@@ -123,7 +123,7 @@ struct rt6_rtnl_dump_arg
};
extern int rt6_dump_route(struct rt6_info *rt, void *p_arg);
-extern void rt6_ifdown(struct net_device *dev);
+extern void rt6_ifdown(struct net *net, struct net_device *dev);
extern void rt6_mtu_change(struct net_device *dev, unsigned mtu);
extern rwlock_t rt6_lock;
Index: net-2.6.25/net/ipv6/addrconf.c
===================================================================
--- net-2.6.25.orig/net/ipv6/addrconf.c
+++ net-2.6.25/net/ipv6/addrconf.c
@@ -2430,6 +2430,7 @@ static int addrconf_ifdown(struct net_de
{
struct inet6_dev *idev;
struct inet6_ifaddr *ifa, **bifa;
+ struct net *net = dev->nd_net;
int i;
ASSERT_RTNL();
@@ -2437,7 +2438,7 @@ static int addrconf_ifdown(struct net_de
if (dev == init_net.loopback_dev && how == 1)
how = 0;
- rt6_ifdown(dev);
+ rt6_ifdown(net, dev);
neigh_ifdown(&nd_tbl, dev);
idev = __in6_dev_get(dev);
--
^ permalink raw reply
* [patch 02/11][NETNS][IPV6] ip6_fib - make the tables per namespace
From: Daniel Lezcano @ 2008-01-25 16:50 UTC (permalink / raw)
To: davem; +Cc: benjamin.thery, netdev, den
In-Reply-To: <20080125165008.317745745@localhost.localdomain>
[-- Attachment #1: ip6-fib-per-network-namespace.patch --]
[-- Type: text/plain, Size: 14465 bytes --]
The fib table for ipv6 are moved to the network namespace structure.
All references to them are made relatively to the network namespace.
All external calls to the ip6_fib functions taking the network namespace
parameter are made using the init_net variable, so the ip6_fib engine is
ready for the namespaces but the callers not yet.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
---
include/net/ip6_fib.h | 9 +-
include/net/netns/ipv6.h | 6 +
net/ipv6/fib6_rules.c | 8 +-
net/ipv6/ip6_fib.c | 161 +++++++++++++++++++++++++++--------------------
net/ipv6/route.c | 22 +++---
5 files changed, 120 insertions(+), 86 deletions(-)
Index: net-2.6.25/include/net/ip6_fib.h
===================================================================
--- net-2.6.25.orig/include/net/ip6_fib.h
+++ net-2.6.25/include/net/ip6_fib.h
@@ -194,10 +194,11 @@ typedef struct rt6_info *(*pol_lookup_t)
* exported functions
*/
-extern struct fib6_table * fib6_get_table(u32 id);
-extern struct fib6_table * fib6_new_table(u32 id);
-extern struct dst_entry * fib6_rule_lookup(struct flowi *fl, int flags,
- pol_lookup_t lookup);
+extern struct fib6_table *fib6_get_table(struct net *net, u32 id);
+extern struct fib6_table *fib6_new_table(struct net *net, u32 id);
+extern struct dst_entry *fib6_rule_lookup(struct net *net,
+ struct flowi *fl, int flags,
+ pol_lookup_t lookup);
extern struct fib6_node *fib6_lookup(struct fib6_node *root,
struct in6_addr *daddr,
Index: net-2.6.25/include/net/netns/ipv6.h
===================================================================
--- net-2.6.25.orig/include/net/netns/ipv6.h
+++ net-2.6.25/include/net/netns/ipv6.h
@@ -31,5 +31,11 @@ struct netns_ipv6 {
struct ipv6_devconf *devconf_all;
struct ipv6_devconf *devconf_dflt;
struct netns_frags frags;
+
+ struct hlist_head *fib_table_hash;
+ struct fib6_table *fib6_main_tbl;
+#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+ struct fib6_table *fib6_local_tbl;
+#endif
};
#endif
Index: net-2.6.25/net/ipv6/fib6_rules.c
===================================================================
--- net-2.6.25.orig/net/ipv6/fib6_rules.c
+++ net-2.6.25/net/ipv6/fib6_rules.c
@@ -31,8 +31,8 @@ struct fib6_rule
static struct fib_rules_ops fib6_rules_ops;
-struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags,
- pol_lookup_t lookup)
+struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
+ int flags, pol_lookup_t lookup)
{
struct fib_lookup_arg arg = {
.lookup_ptr = lookup,
@@ -71,7 +71,7 @@ static int fib6_rule_action(struct fib_r
goto discard_pkt;
}
- table = fib6_get_table(rule->table);
+ table = fib6_get_table(&init_net, rule->table);
if (table)
rt = lookup(table, flp, flags);
@@ -151,7 +151,7 @@ static int fib6_rule_configure(struct fi
if (rule->table == RT6_TABLE_UNSPEC)
goto errout;
- if (fib6_new_table(rule->table) == NULL) {
+ if (fib6_new_table(&init_net, rule->table) == NULL) {
err = -ENOBUFS;
goto errout;
}
Index: net-2.6.25/net/ipv6/ip6_fib.c
===================================================================
--- net-2.6.25.orig/net/ipv6/ip6_fib.c
+++ net-2.6.25/net/ipv6/ip6_fib.c
@@ -166,16 +166,13 @@ static __inline__ void rt6_release(struc
dst_free(&rt->u.dst);
}
-static struct fib6_table *fib6_main_tbl;
-
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
#define FIB_TABLE_HASHSZ 256
#else
#define FIB_TABLE_HASHSZ 1
#endif
-static struct hlist_head *fib_table_hash;
-static void fib6_link_table(struct fib6_table *tb)
+static void fib6_link_table(struct net *net, struct fib6_table *tb)
{
unsigned int h;
@@ -191,13 +188,11 @@ static void fib6_link_table(struct fib6_
* No protection necessary, this is the only list mutatation
* operation, tables never disappear once they exist.
*/
- hlist_add_head_rcu(&tb->tb6_hlist, &fib_table_hash[h]);
+ hlist_add_head_rcu(&tb->tb6_hlist, &net->ipv6.fib_table_hash[h]);
}
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
-static struct fib6_table *fib6_local_tbl;
-
static struct fib6_table *fib6_alloc_table(u32 id)
{
struct fib6_table *table;
@@ -212,26 +207,27 @@ static struct fib6_table *fib6_alloc_tab
return table;
}
-struct fib6_table *fib6_new_table(u32 id)
+struct fib6_table *fib6_new_table(struct net *net, u32 id)
{
struct fib6_table *tb;
if (id == 0)
id = RT6_TABLE_MAIN;
- tb = fib6_get_table(id);
+ tb = fib6_get_table(net, id);
if (tb)
return tb;
tb = fib6_alloc_table(id);
if (tb != NULL)
- fib6_link_table(tb);
+ fib6_link_table(net, tb);
return tb;
}
-struct fib6_table *fib6_get_table(u32 id)
+struct fib6_table *fib6_get_table(struct net *net, u32 id)
{
struct fib6_table *tb;
+ struct hlist_head *head;
struct hlist_node *node;
unsigned int h;
@@ -239,7 +235,8 @@ struct fib6_table *fib6_get_table(u32 id
id = RT6_TABLE_MAIN;
h = id & (FIB_TABLE_HASHSZ - 1);
rcu_read_lock();
- hlist_for_each_entry_rcu(tb, node, &fib_table_hash[h], tb6_hlist) {
+ head = &net->ipv6.fib_table_hash[h];
+ hlist_for_each_entry_rcu(tb, node, head, tb6_hlist) {
if (tb->tb6_id == id) {
rcu_read_unlock();
return tb;
@@ -250,33 +247,32 @@ struct fib6_table *fib6_get_table(u32 id
return NULL;
}
-static void __init fib6_tables_init(void)
+static void fib6_tables_init(struct net *net)
{
- fib6_link_table(fib6_main_tbl);
- fib6_link_table(fib6_local_tbl);
+ fib6_link_table(net, net->ipv6.fib6_main_tbl);
+ fib6_link_table(net, net->ipv6.fib6_local_tbl);
}
-
#else
-struct fib6_table *fib6_new_table(u32 id)
+struct fib6_table *fib6_new_table(struct net *net, u32 id)
{
- return fib6_get_table(id);
+ return fib6_get_table(net, id);
}
-struct fib6_table *fib6_get_table(u32 id)
+struct fib6_table *fib6_get_table(struct net *net, u32 id)
{
- return fib6_main_tbl;
+ return net->ipv6.fib6_main_tbl;
}
-struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags,
- pol_lookup_t lookup)
+struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
+ int flags, pol_lookup_t lookup)
{
- return (struct dst_entry *) lookup(fib6_main_tbl, fl, flags);
+ return (struct dst_entry *) lookup(net->ipv6.fib6_main_tbl, fl, flags);
}
-static void __init fib6_tables_init(void)
+static void fib6_tables_init(struct net *net)
{
- fib6_link_table(fib6_main_tbl);
+ fib6_link_table(net, net->ipv6.fib6_main_tbl);
}
#endif
@@ -357,11 +353,9 @@ static int inet6_dump_fib(struct sk_buff
struct fib6_walker_t *w;
struct fib6_table *tb;
struct hlist_node *node;
+ struct hlist_head *head;
int res = 0;
- if (net != &init_net)
- return 0;
-
s_h = cb->args[0];
s_e = cb->args[1];
@@ -390,7 +384,8 @@ static int inet6_dump_fib(struct sk_buff
for (h = s_h; h < FIB_TABLE_HASHSZ; h++, s_e = 0) {
e = 0;
- hlist_for_each_entry(tb, node, &fib_table_hash[h], tb6_hlist) {
+ head = &net->ipv6.fib_table_hash[h];
+ hlist_for_each_entry(tb, node, head, tb6_hlist) {
if (e < s_e)
goto next;
res = fib6_dump_table(tb, skb, cb);
@@ -1360,12 +1355,13 @@ void fib6_clean_all(int (*func)(struct r
{
struct fib6_table *table;
struct hlist_node *node;
+ struct hlist_head *head;
unsigned int h;
rcu_read_lock();
for (h = 0; h < FIB_TABLE_HASHSZ; h++) {
- hlist_for_each_entry_rcu(table, node, &fib_table_hash[h],
- tb6_hlist) {
+ head = &init_net.ipv6.fib_table_hash[h];
+ hlist_for_each_entry_rcu(table, node, head, tb6_hlist) {
write_lock_bh(&table->tb6_lock);
fib6_clean_tree(&table->tb6_root, func, prune, arg);
write_unlock_bh(&table->tb6_lock);
@@ -1466,55 +1462,88 @@ void fib6_run_gc(unsigned long dummy)
spin_unlock_bh(&fib6_gc_lock);
}
-int __init fib6_init(void)
+static int fib6_net_init(struct net *net)
{
- int ret = -ENOMEM;
- fib6_node_kmem = kmem_cache_create("fib6_nodes",
- sizeof(struct fib6_node),
- 0, SLAB_HWCACHE_ALIGN,
- NULL);
- if (!fib6_node_kmem)
- goto out;
+ int ret;
- fib_table_hash = kzalloc(sizeof(*fib_table_hash)*FIB_TABLE_HASHSZ,
- GFP_KERNEL);
- if (!fib_table_hash)
- goto out_kmem_cache_create;
+ ret = -ENOMEM;
+ net->ipv6.fib_table_hash =
+ kzalloc(sizeof(*net->ipv6.fib_table_hash)*FIB_TABLE_HASHSZ,
+ GFP_KERNEL);
+ if (!net->ipv6.fib_table_hash)
+ goto out;
- fib6_main_tbl = kzalloc(sizeof(*fib6_main_tbl), GFP_KERNEL);
- if (!fib6_main_tbl)
+ net->ipv6.fib6_main_tbl = kzalloc(sizeof(*net->ipv6.fib6_main_tbl),
+ GFP_KERNEL);
+ if (!net->ipv6.fib6_main_tbl)
goto out_fib_table_hash;
- fib6_main_tbl->tb6_id = RT6_TABLE_MAIN;
- fib6_main_tbl->tb6_root.leaf = &ip6_null_entry;
- fib6_main_tbl->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+ net->ipv6.fib6_main_tbl->tb6_id = RT6_TABLE_MAIN;
+ net->ipv6.fib6_main_tbl->tb6_root.leaf = &ip6_null_entry;
+ net->ipv6.fib6_main_tbl->tb6_root.fn_flags =
+ RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
- fib6_local_tbl = kzalloc(sizeof(*fib6_local_tbl), GFP_KERNEL);
- if (!fib6_local_tbl)
+ net->ipv6.fib6_local_tbl = kzalloc(sizeof(*net->ipv6.fib6_local_tbl),
+ GFP_KERNEL);
+ if (!net->ipv6.fib6_local_tbl)
goto out_fib6_main_tbl;
-
- fib6_local_tbl->tb6_id = RT6_TABLE_LOCAL;
- fib6_local_tbl->tb6_root.leaf = &ip6_null_entry;
- fib6_local_tbl->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+ net->ipv6.fib6_local_tbl->tb6_id = RT6_TABLE_LOCAL;
+ net->ipv6.fib6_local_tbl->tb6_root.leaf = &ip6_null_entry;
+ net->ipv6.fib6_local_tbl->tb6_root.fn_flags =
+ RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
#endif
+ fib6_tables_init(net);
- fib6_tables_init();
-
- ret = __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
- if (ret)
- goto out_fib6_local_tbl;
+ ret = 0;
out:
return ret;
-out_fib6_local_tbl:
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
- kfree(fib6_local_tbl);
out_fib6_main_tbl:
+ kfree(net->ipv6.fib6_main_tbl);
#endif
- kfree(fib6_main_tbl);
out_fib_table_hash:
- kfree(fib_table_hash);
+ kfree(net->ipv6.fib_table_hash);
+ goto out;
+ }
+
+static void fib6_net_exit(struct net *net)
+{
+#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+ kfree(net->ipv6.fib6_local_tbl);
+#endif
+ kfree(net->ipv6.fib6_main_tbl);
+ kfree(net->ipv6.fib_table_hash);
+}
+
+static struct pernet_operations fib6_net_ops = {
+ .init = fib6_net_init,
+ .exit = fib6_net_exit,
+};
+
+int __init fib6_init(void)
+{
+ int ret = -ENOMEM;
+ fib6_node_kmem = kmem_cache_create("fib6_nodes",
+ sizeof(struct fib6_node),
+ 0, SLAB_HWCACHE_ALIGN,
+ NULL);
+ if (!fib6_node_kmem)
+ goto out;
+
+ ret = register_pernet_subsys(&fib6_net_ops);
+ if (ret)
+ goto out_kmem_cache_create;
+
+ ret = __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
+ if (ret)
+ goto out_unregister_subsys;
+out:
+ return ret;
+
+out_unregister_subsys:
+ unregister_pernet_subsys(&fib6_net_ops);
out_kmem_cache_create:
kmem_cache_destroy(fib6_node_kmem);
goto out;
@@ -1523,10 +1552,6 @@ out_kmem_cache_create:
void fib6_gc_cleanup(void)
{
del_timer(&ip6_fib_timer);
-#ifdef CONFIG_IPV6_MULTIPLE_TABLES
- kfree(fib6_local_tbl);
-#endif
- kfree(fib6_main_tbl);
- kfree(fib_table_hash);
+ unregister_pernet_subsys(&fib6_net_ops);
kmem_cache_destroy(fib6_node_kmem);
}
Index: net-2.6.25/net/ipv6/route.c
===================================================================
--- net-2.6.25.orig/net/ipv6/route.c
+++ net-2.6.25/net/ipv6/route.c
@@ -569,7 +569,7 @@ struct rt6_info *rt6_lookup(struct in6_a
flags |= RT6_LOOKUP_F_HAS_SADDR;
}
- dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_lookup);
+ dst = fib6_rule_lookup(&init_net, &fl, flags, ip6_pol_route_lookup);
if (dst->error == 0)
return (struct rt6_info *) dst;
@@ -756,7 +756,7 @@ void ip6_route_input(struct sk_buff *skb
if (rt6_need_strict(&iph->daddr))
flags |= RT6_LOOKUP_F_IFACE;
- skb->dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_input);
+ skb->dst = fib6_rule_lookup(&init_net, &fl, flags, ip6_pol_route_input);
}
static struct rt6_info *ip6_pol_route_output(struct fib6_table *table,
@@ -775,7 +775,7 @@ struct dst_entry * ip6_route_output(stru
if (!ipv6_addr_any(&fl->fl6_src))
flags |= RT6_LOOKUP_F_HAS_SADDR;
- return fib6_rule_lookup(fl, flags, ip6_pol_route_output);
+ return fib6_rule_lookup(&init_net, fl, flags, ip6_pol_route_output);
}
EXPORT_SYMBOL(ip6_route_output);
@@ -1068,7 +1068,7 @@ int ip6_route_add(struct fib6_config *cf
if (cfg->fc_metric == 0)
cfg->fc_metric = IP6_RT_PRIO_USER;
- table = fib6_new_table(cfg->fc_table);
+ table = fib6_new_table(&init_net, cfg->fc_table);
if (table == NULL) {
err = -ENOBUFS;
goto out;
@@ -1274,7 +1274,7 @@ static int ip6_route_del(struct fib6_con
struct rt6_info *rt;
int err = -ESRCH;
- table = fib6_get_table(cfg->fc_table);
+ table = fib6_get_table(&init_net, cfg->fc_table);
if (table == NULL)
return err;
@@ -1389,7 +1389,9 @@ static struct rt6_info *ip6_route_redire
if (rt6_need_strict(dest))
flags |= RT6_LOOKUP_F_IFACE;
- return (struct rt6_info *)fib6_rule_lookup((struct flowi *)&rdfl, flags, __ip6_route_redirect);
+ return (struct rt6_info *)fib6_rule_lookup(&init_net,
+ (struct flowi *)&rdfl,
+ flags, __ip6_route_redirect);
}
void rt6_redirect(struct in6_addr *dest, struct in6_addr *src,
@@ -1588,7 +1590,7 @@ static struct rt6_info *rt6_get_route_in
struct rt6_info *rt = NULL;
struct fib6_table *table;
- table = fib6_get_table(RT6_TABLE_INFO);
+ table = fib6_get_table(&init_net, RT6_TABLE_INFO);
if (table == NULL)
return NULL;
@@ -1643,7 +1645,7 @@ struct rt6_info *rt6_get_dflt_router(str
struct rt6_info *rt;
struct fib6_table *table;
- table = fib6_get_table(RT6_TABLE_DFLT);
+ table = fib6_get_table(&init_net, RT6_TABLE_DFLT);
if (table == NULL)
return NULL;
@@ -1687,7 +1689,7 @@ void rt6_purge_dflt_routers(void)
struct fib6_table *table;
/* NOTE: Keep consistent with rt6_get_dflt_router */
- table = fib6_get_table(RT6_TABLE_DFLT);
+ table = fib6_get_table(&init_net, RT6_TABLE_DFLT);
if (table == NULL)
return;
@@ -1848,7 +1850,7 @@ struct rt6_info *addrconf_dst_alloc(stru
ipv6_addr_copy(&rt->rt6i_dst.addr, addr);
rt->rt6i_dst.plen = 128;
- rt->rt6i_table = fib6_get_table(RT6_TABLE_LOCAL);
+ rt->rt6i_table = fib6_get_table(&init_net, RT6_TABLE_LOCAL);
atomic_set(&rt->u.dst.__refcnt, 1);
--
^ permalink raw reply
* [patch 01/11][NETNS][IPV6] ip6_fib - dynamically allocate the tables
From: Daniel Lezcano @ 2008-01-25 16:50 UTC (permalink / raw)
To: davem; +Cc: benjamin.thery, netdev, den
In-Reply-To: <20080125165008.317745745@localhost.localdomain>
[-- Attachment #1: ip6-fib-dynamic-allocation.patch --]
[-- Type: text/plain, Size: 4135 bytes --]
This patch changes the fib6 tables to be dynamically allocated.
That provides the ability to make several instances of them when
a new network namespace is created.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
---
net/ipv6/ip6_fib.c | 71 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 48 insertions(+), 23 deletions(-)
Index: net-2.6.25/net/ipv6/ip6_fib.c
===================================================================
--- net-2.6.25.orig/net/ipv6/ip6_fib.c
+++ net-2.6.25/net/ipv6/ip6_fib.c
@@ -166,20 +166,14 @@ static __inline__ void rt6_release(struc
dst_free(&rt->u.dst);
}
-static struct fib6_table fib6_main_tbl = {
- .tb6_id = RT6_TABLE_MAIN,
- .tb6_root = {
- .leaf = &ip6_null_entry,
- .fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO,
- },
-};
+static struct fib6_table *fib6_main_tbl;
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
#define FIB_TABLE_HASHSZ 256
#else
#define FIB_TABLE_HASHSZ 1
#endif
-static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ];
+static struct hlist_head *fib_table_hash;
static void fib6_link_table(struct fib6_table *tb)
{
@@ -201,13 +195,8 @@ static void fib6_link_table(struct fib6_
}
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
-static struct fib6_table fib6_local_tbl = {
- .tb6_id = RT6_TABLE_LOCAL,
- .tb6_root = {
- .leaf = &ip6_null_entry,
- .fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO,
- },
-};
+
+static struct fib6_table *fib6_local_tbl;
static struct fib6_table *fib6_alloc_table(u32 id)
{
@@ -263,8 +252,8 @@ struct fib6_table *fib6_get_table(u32 id
static void __init fib6_tables_init(void)
{
- fib6_link_table(&fib6_main_tbl);
- fib6_link_table(&fib6_local_tbl);
+ fib6_link_table(fib6_main_tbl);
+ fib6_link_table(fib6_local_tbl);
}
#else
@@ -276,18 +265,18 @@ struct fib6_table *fib6_new_table(u32 id
struct fib6_table *fib6_get_table(u32 id)
{
- return &fib6_main_tbl;
+ return fib6_main_tbl;
}
struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags,
pol_lookup_t lookup)
{
- return (struct dst_entry *) lookup(&fib6_main_tbl, fl, flags);
+ return (struct dst_entry *) lookup(fib6_main_tbl, fl, flags);
}
static void __init fib6_tables_init(void)
{
- fib6_link_table(&fib6_main_tbl);
+ fib6_link_table(fib6_main_tbl);
}
#endif
@@ -1479,22 +1468,53 @@ void fib6_run_gc(unsigned long dummy)
int __init fib6_init(void)
{
- int ret;
+ int ret = -ENOMEM;
fib6_node_kmem = kmem_cache_create("fib6_nodes",
sizeof(struct fib6_node),
0, SLAB_HWCACHE_ALIGN,
NULL);
if (!fib6_node_kmem)
- return -ENOMEM;
+ goto out;
+
+ fib_table_hash = kzalloc(sizeof(*fib_table_hash)*FIB_TABLE_HASHSZ,
+ GFP_KERNEL);
+ if (!fib_table_hash)
+ goto out_kmem_cache_create;
+
+ fib6_main_tbl = kzalloc(sizeof(*fib6_main_tbl), GFP_KERNEL);
+ if (!fib6_main_tbl)
+ goto out_fib_table_hash;
+
+ fib6_main_tbl->tb6_id = RT6_TABLE_MAIN;
+ fib6_main_tbl->tb6_root.leaf = &ip6_null_entry;
+ fib6_main_tbl->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+
+#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+ fib6_local_tbl = kzalloc(sizeof(*fib6_local_tbl), GFP_KERNEL);
+ if (!fib6_local_tbl)
+ goto out_fib6_main_tbl;
+
+ fib6_local_tbl->tb6_id = RT6_TABLE_LOCAL;
+ fib6_local_tbl->tb6_root.leaf = &ip6_null_entry;
+ fib6_local_tbl->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+#endif
fib6_tables_init();
ret = __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
if (ret)
- goto out_kmem_cache_create;
+ goto out_fib6_local_tbl;
out:
return ret;
+out_fib6_local_tbl:
+#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+ kfree(fib6_local_tbl);
+out_fib6_main_tbl:
+#endif
+ kfree(fib6_main_tbl);
+out_fib_table_hash:
+ kfree(fib_table_hash);
out_kmem_cache_create:
kmem_cache_destroy(fib6_node_kmem);
goto out;
@@ -1503,5 +1523,10 @@ out_kmem_cache_create:
void fib6_gc_cleanup(void)
{
del_timer(&ip6_fib_timer);
+#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+ kfree(fib6_local_tbl);
+#endif
+ kfree(fib6_main_tbl);
+ kfree(fib_table_hash);
kmem_cache_destroy(fib6_node_kmem);
}
--
^ permalink raw reply
* [patch 00/11][NETNS][IPV6] make a subset of the routing per namespace
From: Daniel Lezcano @ 2008-01-25 16:50 UTC (permalink / raw)
To: davem; +Cc: benjamin.thery, netdev, den
This patchset makes a subset of the routing to be per
namespace. It takes into account fib tables, garbage
collecting timer, fib rules and route statistics.
The routing per namespace is not complete with this
patchset, so there are some interactions between the init
network namespace and other namespaces, but nothing
critical.
This patchset will be followed by another one which
will complete the routing per namespace. I just don't want
to flood netdev@ with a huge patchset.
--
^ permalink raw reply
* Re: [Lksctp-developers] [PATCH] SCTP: Fix kernel panic while received AUTH chunk with BAD shared key identifier
From: Vlad Yasevich @ 2008-01-25 16:46 UTC (permalink / raw)
To: Neil Horman; +Cc: Wei Yongjun, netdev, lksctp-developers
In-Reply-To: <20080124121608.GA20633@hmsreliant.think-freely.org>
Neil Horman wrote:
> On Tue, Jan 22, 2008 at 05:29:20PM +0900, Wei Yongjun wrote:
>>
>> This patch fix this problem.
>>
>> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
>>
>> --- a/net/sctp/auth.c 2008-01-21 00:03:25.000000000 -0500
>> +++ b/net/sctp/auth.c 2008-01-21 21:31:47.000000000 -0500
>> @@ -420,15 +420,15 @@ struct sctp_shared_key *sctp_auth_get_sh
>> const struct sctp_association *asoc,
>> __u16 key_id)
>> {
>> - struct sctp_shared_key *key = NULL;
>> + struct sctp_shared_key *key;
>>
>> /* First search associations set of endpoint pair shared keys */
>> key_for_each(key, &asoc->endpoint_shared_keys) {
>> if (key->key_id == key_id)
>> - break;
>> + return key;
>> }
>>
>> - return key;
>> + return NULL;
>> }
>>
>> /*
>>
>
> FWIW, Ack from me. The assignment of NULL to key can safely be removed, since
> key_for_each (which is just list_for_each_entry under the covers does an initial
> assignment to key anyway).
>
> If the endpoint_shared_keys list is empty, or if the key_id being requested does
> not exist, the function as it currently stands returns the actuall list_head (in
> this case endpoint_shared_keys. Since that list_head isn't surrounded by an
> actuall data structure, the last iteration through list_for_each_entry will do a
> container_of on key, and we wind up returning a bogus pointer, instead of NULL,
> as we should. Wei's patch corrects that.
>
> Regards
> Neil
>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
>
Yep, the patch is correct.
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
-vlad
^ permalink raw reply
* [PATCH 3/3] netns netfilter: create per-netns /proc/net/*_tables_*
From: Alexey Dobriyan @ 2008-01-25 16:45 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netdev, netfilter-devel, devel
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
---
include/linux/netfilter/x_tables.h | 4 ++--
net/ipv4/netfilter/arp_tables.c | 21 ++++++++++++++++++---
net/ipv4/netfilter/ip_tables.c | 21 ++++++++++++++++++---
net/ipv6/netfilter/ip6_tables.c | 22 +++++++++++++++++++---
net/netfilter/x_tables.c | 20 ++++++++++----------
5 files changed, 67 insertions(+), 21 deletions(-)
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -357,8 +357,8 @@ extern struct xt_table *xt_find_table_lock(struct net *net, int af,
const char *name);
extern void xt_table_unlock(struct xt_table *t);
-extern int xt_proto_init(int af);
-extern void xt_proto_fini(int af);
+extern int xt_proto_init(struct net *net, int af);
+extern void xt_proto_fini(struct net *net, int af);
extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
extern void xt_free_table_info(struct xt_table_info *info);
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -1822,11 +1822,26 @@ static struct nf_sockopt_ops arpt_sockopts = {
.owner = THIS_MODULE,
};
+static int __net_init arp_tables_net_init(struct net *net)
+{
+ return xt_proto_init(net, NF_ARP);
+}
+
+static void __net_exit arp_tables_net_exit(struct net *net)
+{
+ xt_proto_fini(net, NF_ARP);
+}
+
+static struct pernet_operations arp_tables_net_ops = {
+ .init = arp_tables_net_init,
+ .exit = arp_tables_net_exit,
+};
+
static int __init arp_tables_init(void)
{
int ret;
- ret = xt_proto_init(NF_ARP);
+ ret = register_pernet_subsys(&arp_tables_net_ops);
if (ret < 0)
goto err1;
@@ -1851,7 +1866,7 @@ err4:
err3:
xt_unregister_target(&arpt_standard_target);
err2:
- xt_proto_fini(NF_ARP);
+ unregister_pernet_subsys(&arp_tables_net_ops);
err1:
return ret;
}
@@ -1861,7 +1876,7 @@ static void __exit arp_tables_fini(void)
nf_unregister_sockopt(&arpt_sockopts);
xt_unregister_target(&arpt_error_target);
xt_unregister_target(&arpt_standard_target);
- xt_proto_fini(NF_ARP);
+ unregister_pernet_subsys(&arp_tables_net_ops);
}
EXPORT_SYMBOL(arpt_register_table);
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -2211,11 +2211,26 @@ static struct xt_match icmp_matchstruct __read_mostly = {
.family = AF_INET,
};
+static int __net_init ip_tables_net_init(struct net *net)
+{
+ return xt_proto_init(net, AF_INET);
+}
+
+static void __net_exit ip_tables_net_exit(struct net *net)
+{
+ xt_proto_fini(net, AF_INET);
+}
+
+static struct pernet_operations ip_tables_net_ops = {
+ .init = ip_tables_net_init,
+ .exit = ip_tables_net_exit,
+};
+
static int __init ip_tables_init(void)
{
int ret;
- ret = xt_proto_init(AF_INET);
+ ret = register_pernet_subsys(&ip_tables_net_ops);
if (ret < 0)
goto err1;
@@ -2245,7 +2260,7 @@ err4:
err3:
xt_unregister_target(&ipt_standard_target);
err2:
- xt_proto_fini(AF_INET);
+ unregister_pernet_subsys(&ip_tables_net_ops);
err1:
return ret;
}
@@ -2258,7 +2273,7 @@ static void __exit ip_tables_fini(void)
xt_unregister_target(&ipt_error_target);
xt_unregister_target(&ipt_standard_target);
- xt_proto_fini(AF_INET);
+ unregister_pernet_subsys(&ip_tables_net_ops);
}
EXPORT_SYMBOL(ipt_register_table);
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -2235,11 +2235,26 @@ static struct xt_match icmp6_matchstruct __read_mostly = {
.family = AF_INET6,
};
+static int __net_init ip6_tables_net_init(struct net *net)
+{
+ return xt_proto_init(net, AF_INET6);
+}
+
+static void __net_exit ip6_tables_net_exit(struct net *net)
+{
+ xt_proto_fini(net, AF_INET6);
+}
+
+static struct pernet_operations ip6_tables_net_ops = {
+ .init = ip6_tables_net_init,
+ .exit = ip6_tables_net_exit,
+};
+
static int __init ip6_tables_init(void)
{
int ret;
- ret = xt_proto_init(AF_INET6);
+ ret = register_pernet_subsys(&ip6_tables_net_ops);
if (ret < 0)
goto err1;
@@ -2269,7 +2284,7 @@ err4:
err3:
xt_unregister_target(&ip6t_standard_target);
err2:
- xt_proto_fini(AF_INET6);
+ unregister_pernet_subsys(&ip6_tables_net_ops);
err1:
return ret;
}
@@ -2281,7 +2296,8 @@ static void __exit ip6_tables_fini(void)
xt_unregister_match(&icmp6_matchstruct);
xt_unregister_target(&ip6t_error_target);
xt_unregister_target(&ip6t_standard_target);
- xt_proto_fini(AF_INET6);
+
+ unregister_pernet_subsys(&ip6_tables_net_ops);
}
/*
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -928,7 +928,7 @@ static const struct file_operations xt_target_ops = {
#endif /* CONFIG_PROC_FS */
-int xt_proto_init(int af)
+int xt_proto_init(struct net *net, int af)
{
#ifdef CONFIG_PROC_FS
char buf[XT_FUNCTION_MAXNAMELEN];
@@ -942,7 +942,7 @@ int xt_proto_init(int af)
#ifdef CONFIG_PROC_FS
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TABLES, sizeof(buf));
- proc = proc_net_fops_create(&init_net, buf, 0440, &xt_table_ops);
+ proc = proc_net_fops_create(net, buf, 0440, &xt_table_ops);
if (!proc)
goto out;
proc->data = (void *)(unsigned long)af;
@@ -950,14 +950,14 @@ int xt_proto_init(int af)
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_MATCHES, sizeof(buf));
- proc = proc_net_fops_create(&init_net, buf, 0440, &xt_match_ops);
+ proc = proc_net_fops_create(net, buf, 0440, &xt_match_ops);
if (!proc)
goto out_remove_tables;
proc->data = (void *)(unsigned long)af;
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TARGETS, sizeof(buf));
- proc = proc_net_fops_create(&init_net, buf, 0440, &xt_target_ops);
+ proc = proc_net_fops_create(net, buf, 0440, &xt_target_ops);
if (!proc)
goto out_remove_matches;
proc->data = (void *)(unsigned long)af;
@@ -969,34 +969,34 @@ int xt_proto_init(int af)
out_remove_matches:
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_MATCHES, sizeof(buf));
- proc_net_remove(&init_net, buf);
+ proc_net_remove(net, buf);
out_remove_tables:
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TABLES, sizeof(buf));
- proc_net_remove(&init_net, buf);
+ proc_net_remove(net, buf);
out:
return -1;
#endif
}
EXPORT_SYMBOL_GPL(xt_proto_init);
-void xt_proto_fini(int af)
+void xt_proto_fini(struct net *net, int af)
{
#ifdef CONFIG_PROC_FS
char buf[XT_FUNCTION_MAXNAMELEN];
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TABLES, sizeof(buf));
- proc_net_remove(&init_net, buf);
+ proc_net_remove(net, buf);
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TARGETS, sizeof(buf));
- proc_net_remove(&init_net, buf);
+ proc_net_remove(net, buf);
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_MATCHES, sizeof(buf));
- proc_net_remove(&init_net, buf);
+ proc_net_remove(net, buf);
#endif /*CONFIG_PROC_FS*/
}
EXPORT_SYMBOL_GPL(xt_proto_fini);
^ permalink raw reply
* [PATCH 2/3] netns netfilter: netns propagation for /proc/net/*_tables_names
From: Alexey Dobriyan @ 2008-01-25 16:44 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netdev, netfilter-devel, devel
Propagate netns together with AF down to ->start/->next/->stop
iterators. Choose table based on netns and AF for showing.
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
---
net/netfilter/x_tables.c | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -726,27 +726,33 @@ void *xt_unregister_table(struct xt_table *table)
EXPORT_SYMBOL_GPL(xt_unregister_table);
#ifdef CONFIG_PROC_FS
+struct xt_names_priv {
+ struct seq_net_private p;
+ int af;
+};
static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos)
{
- struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
- u_int16_t af = (unsigned long)pde->data;
+ struct xt_names_priv *priv = seq->private;
+ struct net *net = priv->p.net;
+ int af = priv->af;
mutex_lock(&xt[af].mutex);
- return seq_list_start(&init_net.xt.tables[af], *pos);
+ return seq_list_start(&net->xt.tables[af], *pos);
}
static void *xt_table_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
- struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
- u_int16_t af = (unsigned long)pde->data;
+ struct xt_names_priv *priv = seq->private;
+ struct net *net = priv->p.net;
+ int af = priv->af;
- return seq_list_next(v, &init_net.xt.tables[af], pos);
+ return seq_list_next(v, &net->xt.tables[af], pos);
}
static void xt_table_seq_stop(struct seq_file *seq, void *v)
{
- struct proc_dir_entry *pde = seq->private;
- u_int16_t af = (unsigned long)pde->data;
+ struct xt_names_priv *priv = seq->private;
+ int af = priv->af;
mutex_unlock(&xt[af].mutex);
}
@@ -771,12 +777,13 @@ static const struct seq_operations xt_table_seq_ops = {
static int xt_table_open(struct inode *inode, struct file *file)
{
int ret;
+ struct xt_names_priv *priv;
- ret = seq_open(file, &xt_table_seq_ops);
+ ret = seq_open_net(inode, file, &xt_table_seq_ops,
+ sizeof(struct xt_names_priv));
if (!ret) {
- struct seq_file *seq = file->private_data;
-
- seq->private = PDE(inode);
+ priv = ((struct seq_file *)file->private_data)->private;
+ priv->af = (unsigned long)PDE(inode)->data;
}
return ret;
}
^ permalink raw reply
* [PATCH 1/3] netns netfilter: semi-rewrite of /proc/net/foo_tables_*
From: Alexey Dobriyan @ 2008-01-25 16:43 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netdev, netfilter-devel, devel
Argh, there are many small but still wrong things with /proc/net/*_tables_*
so I decided to do overhaul simultaneously making it more suitable for
per-netns /proc/net/*_tables_* implementation.
Fix
a) xt_get_idx() duplicating now standard seq_list_start/seq_list_next
iterators
b) tables/matches/targets list was chosen again and again on every ->next
c) multiple useless "af >= NPROTO" checks -- we simple don't supply invalid
AFs there and registration function should BUG_ON instead.
Regardless, the one in ->next() is the most useless -- ->next doesn't
run at all if ->start fails.
d) Don't use mutex_lock_interruptible() -- it can fail and ->stop is
executed even if ->start failed, so unlock without lock is possible.
As side effect, streamline code by splitting xt_tgt_ops into xt_target_ops,
xt_matches_ops, xt_tables_ops.
xt_tables_ops hooks will be changed by per-netns code. Code of
xt_matches_ops, xt_target_ops is identical except the list chosen for
iterating, but I think consolidating code for two files not worth it
given "<< 16" hacks needed for it.
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
---
net/netfilter/x_tables.c | 224 ++++++++++++++++++++++++++++++-----------------
1 file changed, 145 insertions(+), 79 deletions(-)
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -726,124 +726,190 @@ void *xt_unregister_table(struct xt_table *table)
EXPORT_SYMBOL_GPL(xt_unregister_table);
#ifdef CONFIG_PROC_FS
-static struct list_head *xt_get_idx(struct list_head *list, struct seq_file *seq, loff_t pos)
+static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos)
{
- struct list_head *head = list->next;
+ struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
+ u_int16_t af = (unsigned long)pde->data;
- if (!head || list_empty(list))
- return NULL;
+ mutex_lock(&xt[af].mutex);
+ return seq_list_start(&init_net.xt.tables[af], *pos);
+}
- while (pos && (head = head->next)) {
- if (head == list)
- return NULL;
- pos--;
- }
- return pos ? NULL : head;
-}
-
-static struct list_head *type2list(u_int16_t af, u_int16_t type)
-{
- struct list_head *list;
-
- switch (type) {
- case TARGET:
- list = &xt[af].target;
- break;
- case MATCH:
- list = &xt[af].match;
- break;
- case TABLE:
- list = &init_net.xt.tables[af];
- break;
- default:
- list = NULL;
- break;
- }
+static void *xt_table_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
+ u_int16_t af = (unsigned long)pde->data;
- return list;
+ return seq_list_next(v, &init_net.xt.tables[af], pos);
}
-static void *xt_tgt_seq_start(struct seq_file *seq, loff_t *pos)
+static void xt_table_seq_stop(struct seq_file *seq, void *v)
{
- struct proc_dir_entry *pde = (struct proc_dir_entry *) seq->private;
- u_int16_t af = (unsigned long)pde->data & 0xffff;
- u_int16_t type = (unsigned long)pde->data >> 16;
- struct list_head *list;
+ struct proc_dir_entry *pde = seq->private;
+ u_int16_t af = (unsigned long)pde->data;
- if (af >= NPROTO)
- return NULL;
+ mutex_unlock(&xt[af].mutex);
+}
- list = type2list(af, type);
- if (!list)
- return NULL;
+static int xt_table_seq_show(struct seq_file *seq, void *v)
+{
+ struct xt_table *table = list_entry(v, struct xt_table, list);
- if (mutex_lock_interruptible(&xt[af].mutex) != 0)
- return NULL;
+ if (strlen(table->name))
+ return seq_printf(seq, "%s\n", table->name);
+ else
+ return 0;
+}
+
+static const struct seq_operations xt_table_seq_ops = {
+ .start = xt_table_seq_start,
+ .next = xt_table_seq_next,
+ .stop = xt_table_seq_stop,
+ .show = xt_table_seq_show,
+};
+
+static int xt_table_open(struct inode *inode, struct file *file)
+{
+ int ret;
+
+ ret = seq_open(file, &xt_table_seq_ops);
+ if (!ret) {
+ struct seq_file *seq = file->private_data;
- return xt_get_idx(list, seq, *pos);
+ seq->private = PDE(inode);
+ }
+ return ret;
}
-static void *xt_tgt_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+static const struct file_operations xt_table_ops = {
+ .owner = THIS_MODULE,
+ .open = xt_table_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
+static void *xt_match_seq_start(struct seq_file *seq, loff_t *pos)
{
- struct proc_dir_entry *pde = seq->private;
- u_int16_t af = (unsigned long)pde->data & 0xffff;
- u_int16_t type = (unsigned long)pde->data >> 16;
- struct list_head *list;
+ struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
+ u_int16_t af = (unsigned long)pde->data;
- if (af >= NPROTO)
- return NULL;
+ mutex_lock(&xt[af].mutex);
+ return seq_list_start(&xt[af].match, *pos);
+}
- list = type2list(af, type);
- if (!list)
- return NULL;
+static void *xt_match_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
+ u_int16_t af = (unsigned long)pde->data;
- (*pos)++;
- return xt_get_idx(list, seq, *pos);
+ return seq_list_next(v, &xt[af].match, pos);
}
-static void xt_tgt_seq_stop(struct seq_file *seq, void *v)
+static void xt_match_seq_stop(struct seq_file *seq, void *v)
{
struct proc_dir_entry *pde = seq->private;
- u_int16_t af = (unsigned long)pde->data & 0xffff;
+ u_int16_t af = (unsigned long)pde->data;
mutex_unlock(&xt[af].mutex);
}
-static int xt_name_seq_show(struct seq_file *seq, void *v)
+static int xt_match_seq_show(struct seq_file *seq, void *v)
{
- char *name = (char *)v + sizeof(struct list_head);
+ struct xt_match *match = list_entry(v, struct xt_match, list);
- if (strlen(name))
- return seq_printf(seq, "%s\n", name);
+ if (strlen(match->name))
+ return seq_printf(seq, "%s\n", match->name);
else
return 0;
}
-static const struct seq_operations xt_tgt_seq_ops = {
- .start = xt_tgt_seq_start,
- .next = xt_tgt_seq_next,
- .stop = xt_tgt_seq_stop,
- .show = xt_name_seq_show,
+static const struct seq_operations xt_match_seq_ops = {
+ .start = xt_match_seq_start,
+ .next = xt_match_seq_next,
+ .stop = xt_match_seq_stop,
+ .show = xt_match_seq_show,
};
-static int xt_tgt_open(struct inode *inode, struct file *file)
+static int xt_match_open(struct inode *inode, struct file *file)
{
int ret;
- ret = seq_open(file, &xt_tgt_seq_ops);
+ ret = seq_open(file, &xt_match_seq_ops);
if (!ret) {
struct seq_file *seq = file->private_data;
- struct proc_dir_entry *pde = PDE(inode);
- seq->private = pde;
+ seq->private = PDE(inode);
}
+ return ret;
+}
+
+static const struct file_operations xt_match_ops = {
+ .owner = THIS_MODULE,
+ .open = xt_match_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
+static void *xt_target_seq_start(struct seq_file *seq, loff_t *pos)
+{
+ struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
+ u_int16_t af = (unsigned long)pde->data;
+
+ mutex_lock(&xt[af].mutex);
+ return seq_list_start(&xt[af].target, *pos);
+}
+
+static void *xt_target_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
+ u_int16_t af = (unsigned long)pde->data;
+
+ return seq_list_next(v, &xt[af].target, pos);
+}
+
+static void xt_target_seq_stop(struct seq_file *seq, void *v)
+{
+ struct proc_dir_entry *pde = seq->private;
+ u_int16_t af = (unsigned long)pde->data;
+
+ mutex_unlock(&xt[af].mutex);
+}
+
+static int xt_target_seq_show(struct seq_file *seq, void *v)
+{
+ struct xt_target *target = list_entry(v, struct xt_target, list);
+
+ if (strlen(target->name))
+ return seq_printf(seq, "%s\n", target->name);
+ else
+ return 0;
+}
+
+static const struct seq_operations xt_target_seq_ops = {
+ .start = xt_target_seq_start,
+ .next = xt_target_seq_next,
+ .stop = xt_target_seq_stop,
+ .show = xt_target_seq_show,
+};
+
+static int xt_target_open(struct inode *inode, struct file *file)
+{
+ int ret;
+ ret = seq_open(file, &xt_target_seq_ops);
+ if (!ret) {
+ struct seq_file *seq = file->private_data;
+
+ seq->private = PDE(inode);
+ }
return ret;
}
-static const struct file_operations xt_file_ops = {
+static const struct file_operations xt_target_ops = {
.owner = THIS_MODULE,
- .open = xt_tgt_open,
+ .open = xt_target_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
@@ -869,25 +935,25 @@ int xt_proto_init(int af)
#ifdef CONFIG_PROC_FS
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TABLES, sizeof(buf));
- proc = proc_net_fops_create(&init_net, buf, 0440, &xt_file_ops);
+ proc = proc_net_fops_create(&init_net, buf, 0440, &xt_table_ops);
if (!proc)
goto out;
- proc->data = (void *) ((unsigned long) af | (TABLE << 16));
+ proc->data = (void *)(unsigned long)af;
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_MATCHES, sizeof(buf));
- proc = proc_net_fops_create(&init_net, buf, 0440, &xt_file_ops);
+ proc = proc_net_fops_create(&init_net, buf, 0440, &xt_match_ops);
if (!proc)
goto out_remove_tables;
- proc->data = (void *) ((unsigned long) af | (MATCH << 16));
+ proc->data = (void *)(unsigned long)af;
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TARGETS, sizeof(buf));
- proc = proc_net_fops_create(&init_net, buf, 0440, &xt_file_ops);
+ proc = proc_net_fops_create(&init_net, buf, 0440, &xt_target_ops);
if (!proc)
goto out_remove_matches;
- proc->data = (void *) ((unsigned long) af | (TARGET << 16));
+ proc->data = (void *)(unsigned long)af;
#endif
return 0;
^ permalink raw reply
* Re: [PATCH] SCTP: Fix kernel panic while received AUTH chunk while enabled auth
From: Vlad Yasevich @ 2008-01-25 16:41 UTC (permalink / raw)
To: Wei Yongjun; +Cc: netdev, lksctp-developers
In-Reply-To: <4794C51B.8040904@cn.fujitsu.com>
Sorry for the delay. Was on vacation without net access.
Wei Yongjun wrote:
>
>
> This patch fix this probleam to treat AUTH chunk as unknow chunk if peer
> has initialized with no auth capable.
>
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
>
> --- a/net/sctp/sm_statefuns.c 2008-01-21 00:03:25.000000000 -0500
> +++ b/net/sctp/sm_statefuns.c 2008-01-21 05:14:08.000000000 -0500
> @@ -3785,6 +3785,10 @@ sctp_disposition_t sctp_sf_eat_auth(cons
> struct sctp_chunk *err_chunk;
> sctp_ierror_t error;
>
> + /* Make sure that the peer has AUTH capable */
> + if (!asoc->peer.auth_capable)
> + return sctp_sf_unk_chunk(ep, asoc, type, arg, commands);
> +
> if (!sctp_vtag_verify(chunk, asoc)) {
> sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG,
> SCTP_NULL());
>
>
>
^ permalink raw reply
* Re: [PATCH 1/5] netns netfilter: per-netns ip6tables
From: Alexey Dobriyan @ 2008-01-25 16:39 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netdev, netfilter-devel, devel
In-Reply-To: <4798CBF1.205@trash.net>
On Thu, Jan 24, 2008 at 06:33:37PM +0100, Patrick McHardy wrote:
> Alexey Dobriyan wrote:
> >* Propagate netns from userspace down to xt_find_table_lock()
> >* Register ip6 tables in netns (modules still use init_net)
> >
> >Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
> >---
> >
> > include/linux/netfilter_ipv6/ip6_tables.h | 3 +
> > net/ipv6/netfilter/ip6_tables.c | 50
> > +++++++++++++++---------------
> > net/ipv6/netfilter/ip6table_filter.c | 2 -
> > net/ipv6/netfilter/ip6table_mangle.c | 2 -
> > net/ipv6/netfilter/ip6table_raw.c | 2 -
> > 5 files changed, 31 insertions(+), 28 deletions(-)
>
> This adds checkpatch warnings:
>
> WARNING: line over 80 characters
> #96: FILE: net/ipv6/netfilter/ip6_tables.c:1361:
> +do_add_counters(struct net *net, void __user *user, unsigned int len,
> int compat)
>
> WARNING: line over 80 characters
> #229: FILE: net/ipv6/netfilter/ip6table_filter.c:135:
> + packet_filter = ip6t_register_table(&init_net, &__packet_filter,
> &initial_table.repl);
>
> WARNING: line over 80 characters
> #242: FILE: net/ipv6/netfilter/ip6table_mangle.c:167:
> + packet_mangler = ip6t_register_table(&init_net,
> &__packet_mangler, &initial_table.repl);
>
> WARNING: line over 80 characters
> #255: FILE: net/ipv6/netfilter/ip6table_raw.c:80:
> + packet_raw = ip6t_register_table(&init_net, &__packet_raw,
> &initial_table.repl);
>
> ERROR: Missing Signed-off-by: line(s)
Well, SOB line definitely was present.
> total: 1 errors, 4 warnings, 214 lines checked
>
> I'll fix them up, lets hope that it doesn't cause clashes
> with the following patches.
OK. It was quantum coding style violation. :-)
^ permalink raw reply
* Re: [Bugme-new] [Bug 9811] New: Loopback address to eth0 interface changes scope permanently
From: Bjørn Mork @ 2008-01-25 16:34 UTC (permalink / raw)
To: netdev; +Cc: bugme-daemon
In-Reply-To: <20080125025016.f6b08754.akpm@linux-foundation.org>
>> Latest working kernel version: none
>> Earliest failing kernel version: 2.6.18 (verified, but most likely "any")
Looks like this was introduced in 2.1.68, which makes it a 10 year old
bug :-)
http://www.linuxhq.com/kernel/v2.1/68/net/ipv4/devinet.c
Bjørn
--
You sound like a real wimp
^ permalink raw reply
* Re: [PATCH 3/7 net-2.6.25] [IPV4]: Prohibit assignment of 0.0.0.0 as interface address.
From: Stephen Hemminger @ 2008-01-25 16:34 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: netdev
In-Reply-To: <1201269123-20378-3-git-send-email-den@openvz.org>
On Fri, 25 Jan 2008 16:51:59 +0300
"Denis V. Lunev" <den@openvz.org> wrote:
> I could hardly imagine why sombady needs to assign 0.0.0.0 as an interface
> address or interface destination address. The kernel will behave in a strage
> way in several places if this is possible, as ifa_local != 0 is considered
> as initialized/non-initialized state of the ifa.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
>
This is used as a way to bring device up in lots of existing documentation.
So please don't change.
--
Stephen Hemminger <stephen.hemminger@vyatta.com>
^ permalink raw reply
* Re: [patch net-2.6.25][IPV4][FIB] fix fib_proc compilation error
From: Stephen Hemminger @ 2008-01-25 16:32 UTC (permalink / raw)
To: Daniel Lezcano; +Cc: netdev
In-Reply-To: <4799E489.90008@fr.ibm.com>
Nevermind, Patch looks fine for 2.6.25, it wasn't needed for 2.6.24
Sorry, need more coffee...
--
Stephen Hemminger <stephen.hemminger@vyatta.com>
^ permalink raw reply
* Re: [PATCH] [NET]: Remove PowerPC code from fec.c
From: Frans Pop @ 2008-01-25 16:31 UTC (permalink / raw)
To: Jochen Friedrich
Cc: galak, geert, gerg, jgarzik, linux-kernel, linux-m68k,
linuxppc-dev, netdev, scottwood, vitb
In-Reply-To: <479A087F.5010305@scram.de>
On Friday 25 January 2008, Jochen Friedrich wrote:
> > Jochen Friedrich wrote:
> >> +++ b/drivers/net/fec.c
> >> @@ -23,6 +23,9 @@
> >> *
> >> * Bug fixes and cleanup by Philippe De Muyter (phdm@macqel.be)
> >> * Copyright (c) 2004-2006 Macq Electronique SA.
> >> + *
> >> + * This driver is now only used on ColdFire processors. Remove conditional
> >> + * Powerpc code.
> >> */
> >
> > This comment makes sense for a changelog, but IMO it makes no sense at
> > all to add it to the file.
>
> I just added it to clarify this code is now only used on m68knommu
> (Coldfire). The comments on top are mailny about MPC860T CPUs (PowerPC),
> however the driver is no longer used for these CPUs.
>
> Maybe the wording should be changed to:
>
> This driver is now only used on ColdFire (m68knommu) processors.
> Conditional PowerPC code has been removed.
Yes, that certainly makes more sense, although IMHO the second sentence is
still somewhat redundant. (My problem was mainly with the second sentence.
I should have made that more clear, sorry.)
^ permalink raw reply
* Re: [patch net-2.6.25][IPV4][FIB] fix fib_proc compilation error
From: Stephen Hemminger @ 2008-01-25 16:30 UTC (permalink / raw)
To: Daniel Lezcano; +Cc: netdev
In-Reply-To: <4799E489.90008@fr.ibm.com>
EBOGUSWHITESPACE
> +static inline void fib_proc_exit(struct net *net)
> +{
> + return ;
> +}
> #endif
Whole patch is unnecessary, since the fib_proc_init is gone in the tree
going into 2.6.25
^ permalink raw reply
* Re: [PATCH] TCP:Fix a bug in strategy_allowed_congestion_control
From: Stephen Hemminger @ 2008-01-25 16:25 UTC (permalink / raw)
To: shanwei; +Cc: davem, netdev, Sam Jansen
In-Reply-To: <47998B55.1030305@cn.fujitsu.com>
On Fri, 25 Jan 2008 15:10:13 +0800
shanwei <shanwei@cn.fujitsu.com> wrote:
> hi all:
>
> In strategy_allowed_congestion_control of the 2.6.24 kernel,
> when sysctl_string return 1 on success,it should call
> tcp_set_allowed_congestion_control to set the allowed congestion
> control.But, it don't.
> the sysctl_string return 1 on success, otherwise return negative,
> never return 0.The patch fix the problem.
>
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
>
> diff -Nuarp linux-2.6.24/net/ipv4/sysctl_net_ipv4.c linux-2.6.24-new/net/ipv4/sysctl_net_ipv4.c
> --- linux-2.6.24/net/ipv4/sysctl_net_ipv4.c 2008-01-25 06:58:37.000000000 +0800
> +++ linux-2.6.24-new/net/ipv4/sysctl_net_ipv4.c 2008-01-25 12:23:20.000000000 +0800
> @@ -248,7 +248,7 @@ static int strategy_allowed_congestion_c
>
> tcp_get_available_congestion_control(tbl.data, tbl.maxlen);
> ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
> - if (ret == 0 && newval && newlen)
> + if (ret == 1 && newval && newlen)
> ret = tcp_set_allowed_congestion_control(tbl.data);
> kfree(tbl.data);
>
>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
This parallels previous fix by Sam Jansen.
^ permalink raw reply
* Re: [PATCH] fib_trie: rescan if key is lost during dump
From: Stephen Hemminger @ 2008-01-25 16:13 UTC (permalink / raw)
To: Jarek Poplawski; +Cc: David Miller, kaber, netdev
In-Reply-To: <20080125082300.GA2257@ff.dom.local>
On Fri, 25 Jan 2008 09:23:00 +0100
Jarek Poplawski <jarkao2@gmail.com> wrote:
> On 24-01-2008 22:51, Stephen Hemminger wrote:
> > Normally during a dump the key of the last dumped entry is used for
> > continuation, but since lock is dropped it might be lost. In that case
> > fallback to the old counter based N^2 behaviour. This means the dump will end up
> > skipping some routes which matches what FIB_HASH does.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> ...
> > @@ -1918,35 +1931,37 @@ static int fn_trie_dump(struct fib_table
> > struct leaf *l;
> > struct trie *t = (struct trie *) tb->tb_data;
> > t_key key = cb->args[2];
> > + int count = cb->args[3];
> >
> > rcu_read_lock();
>
> Sorry, but I lost the point: is rtnl held or not held here at the moment?
> If held, how this rcu_read_lock can help? Maybe some additional comment
> in the code?
>
> Thanks,
> Jarek P.
There are two different issues, (therefore two different patches).
1. How to handle multipart resume when the key was deleted during the
period the lock was dropped.
That is what this patch addresses.
2. RCU is unnecessary here because of use of RTNL. I am going to defer
on this till after #1. That patch is much less important.
--
Stephen Hemminger <stephen.hemminger@vyatta.com>
^ permalink raw reply
* ipcomp regression in 2.6.24?
From: Beschorner Daniel @ 2008-01-25 15:57 UTC (permalink / raw)
To: netdev
With 2.6.24 IPSEC/ESP tunnels to older kernels establish fine, data
flows in both directions, but no data comes out of the tunnel.
Needed to disable ipcomp.
Daniel
^ permalink raw reply
* Re: [PATCH] [NET]: Remove PowerPC code from fec.c
From: Jochen Friedrich @ 2008-01-25 16:04 UTC (permalink / raw)
To: Frans Pop
Cc: galak, geert, gerg, jgarzik, linux-kernel, linux-m68k,
linuxppc-dev, netdev, scottwood, vitb
In-Reply-To: <E1JIQpQ-0006Xj-RR@faramir.fjphome.nl>
Hi Frans,
> Jochen Friedrich wrote:
>> +++ b/drivers/net/fec.c
>> @@ -23,6 +23,9 @@
>> *
>> * Bug fixes and cleanup by Philippe De Muyter (phdm@macqel.be)
>> * Copyright (c) 2004-2006 Macq Electronique SA.
>> + *
>> + * This driver is now only used on ColdFire processors. Remove conditional
>> + * Powerpc code.
>> */
>
> This comment makes sense for a changelog, but IMO it makes no sense at all
> to add it to the file.
I just added it to clarify this code is now only used on m68knommu (Coldfire).
The comments on top are mailny about MPC860T CPUs (PowerPC), however the driver is no
longer used for these CPUs.
Maybe the wording should be changed to:
This driver is now only used on ColdFire (m68knommu) processors. Conditional
PowerPC code has been removed.
Thanks,
Jochen
^ permalink raw reply
* Re: [PATCH for-2.6.25] [POWERPC] Rename commproc to cpm1 and cpm2_common.c to cpm2.c
From: Kumar Gala @ 2008-01-25 15:56 UTC (permalink / raw)
To: Jochen Friedrich
Cc: Vitaly Bordug, Garzik, Jeff, Scott Wood, netdev@vger.kernel.org,
Kernel, Linux, linuxppc-dev list
In-Reply-To: <4799F2CE.309@scram.de>
On Fri, 25 Jan 2008, Jochen Friedrich wrote:
> Rename commproc.[ch] to cpm1.[ch] to be more consistent with cpm2. Also
> rename cpm2_common.c to cpm2.c as suggested by Scott Wood. Adjust the
> includes accordingly.
>
> Signed-off-by: Jochen Friedrich <jochen@scram.de>
> ---
> arch/powerpc/platforms/8xx/ep88xc.c | 1 +
> arch/powerpc/platforms/8xx/mpc86xads_setup.c | 2 +-
> arch/powerpc/platforms/8xx/mpc885ads_setup.c | 2 +-
> arch/powerpc/sysdev/Makefile | 4 ++--
> arch/powerpc/sysdev/{commproc.c => cpm1.c} | 4 ++--
> arch/powerpc/sysdev/{cpm2_common.c => cpm2.c} | 3 +--
> arch/powerpc/sysdev/micropatch.c | 2 +-
> arch/ppc/8260_io/enet.c | 2 +-
> arch/ppc/8xx_io/commproc.c | 2 +-
> arch/ppc/8xx_io/enet.c | 6 +++---
> arch/ppc/8xx_io/fec.c | 2 +-
> arch/ppc/8xx_io/micropatch.c | 2 +-
> arch/ppc/boot/simple/iic.c | 2 +-
> arch/ppc/boot/simple/m8xx_tty.c | 2 +-
> arch/ppc/kernel/ppc_ksyms.c | 2 +-
> arch/ppc/platforms/mpc866ads_setup.c | 2 +-
> arch/ppc/platforms/mpc885ads_setup.c | 2 +-
> arch/ppc/syslib/mpc8xx_devices.c | 2 +-
> arch/ppc/xmon/start_8xx.c | 2 +-
> drivers/net/fec_8xx/fec_8xx-netta.c | 2 +-
> drivers/net/fec_8xx/fec_main.c | 2 +-
> drivers/net/fec_8xx/fec_mii.c | 2 +-
> drivers/net/fs_enet/fs_enet.h | 2 +-
> drivers/net/fs_enet/mac-fec.c | 2 +-
> drivers/net/fs_enet/mac-scc.c | 2 +-
> drivers/serial/cpm_uart/cpm_uart_cpm1.h | 2 +-
> include/asm-powerpc/{commproc.h => cpm1.h} | 8 ++++----
> include/asm-ppc/{commproc.h => cpm1.h} | 8 ++++----
> 28 files changed, 38 insertions(+), 38 deletions(-)
> rename arch/powerpc/sysdev/{commproc.c => cpm1.c} (99%)
> rename arch/powerpc/sysdev/{cpm2_common.c => cpm2.c} (99%)
> rename include/asm-powerpc/{commproc.h => cpm1.h} (99%)
> rename include/asm-ppc/{commproc.h => cpm1.h} (99%)
>
applied.
- k
^ permalink raw reply
* Re: [PATCH] [NET]: Remove PowerPC code from fec.c
From: Frans Pop @ 2008-01-25 15:50 UTC (permalink / raw)
To: Jochen Friedrich
Cc: galak, geert, gerg, jgarzik, linux-kernel, linux-m68k,
linuxppc-dev, netdev, scottwood, vitb
In-Reply-To: <4799F349.9090102@scram.de>
Jochen Friedrich wrote:
> +++ b/drivers/net/fec.c
> @@ -23,6 +23,9 @@
> *
> * Bug fixes and cleanup by Philippe De Muyter (phdm@macqel.be)
> * Copyright (c) 2004-2006 Macq Electronique SA.
> + *
> + * This driver is now only used on ColdFire processors. Remove conditional
> + * Powerpc code.
> */
This comment makes sense for a changelog, but IMO it makes no sense at all
to add it to the file.
Cheers,
FJP
^ permalink raw reply
* Re: [PATCH 3/7 net-2.6.25] [IPV4]: Prohibit assignment of 0.0.0.0 as interface address.
From: Daniel Lezcano @ 2008-01-25 15:12 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: davem, Denis V. Lunev, netdev, devel, containers
In-Reply-To: <4799FC69.9030809@sw.ru>
Denis V. Lunev wrote:
> Daniel Lezcano wrote:
>> Denis V. Lunev wrote:
>>> Daniel Lezcano wrote:
>>>> Denis V. Lunev wrote:
>>>>> I could hardly imagine why sombady needs to assign 0.0.0.0 as an
>>>>> interface
>>>>> address or interface destination address. The kernel will behave in a
>>>>> strage
>>>>> way in several places if this is possible, as ifa_local != 0 is
>>>>> considered
>>>>> as initialized/non-initialized state of the ifa.
>>>> AFAICS, we should be able to set at an interface address to 0.0.0.0, in
>>>> order to remove an IP address from an interface and keep this one up.
>>>> I see two trivial cases:
>>>> * remove the ipv4 on an interface but continue to use it through ipv6
>>>> * move ipv4 address from the interface to an attached bridge
>>> For this case there is an IOCTL/netlink "remove IP address".
>> And I forgot to mention the general broadcast.
>> This is need for the dhcp protocol. If you are not able to set your
>> interface to 0.0.0.0, you will be not able to send a 255.255.255.255
>> broadcast message to have your IP address.
>>
>
> OK. Dave, pls disregard this patch. I suspect that others in the set
> should not intersect with this one.
>
> To summarize the discussion:
> there is the only reason for this assignment: old IOCTL interface does
> not have a way to remove IP address except this, though netlink has a
> method for it that's why I am a little bit confused :)
>
> This is handled in the __inet_insert_ifa: ifa is just removed there and,
> correctly, ifa with 0.0.0.0 address can't exists in the kernel.
Yes, my last statement is false.
^ permalink raw reply
* Re: [PATCH 3/7 net-2.6.25] [IPV4]: Prohibit assignment of 0.0.0.0 as interface address.
From: Denis V. Lunev @ 2008-01-25 15:12 UTC (permalink / raw)
To: Daniel Lezcano, davem; +Cc: Denis V. Lunev, netdev, devel, containers
In-Reply-To: <4799F6A5.7040703@fr.ibm.com>
Daniel Lezcano wrote:
> Denis V. Lunev wrote:
>> Daniel Lezcano wrote:
>>> Denis V. Lunev wrote:
>>>> I could hardly imagine why sombady needs to assign 0.0.0.0 as an
>>>> interface
>>>> address or interface destination address. The kernel will behave in a
>>>> strage
>>>> way in several places if this is possible, as ifa_local != 0 is
>>>> considered
>>>> as initialized/non-initialized state of the ifa.
>>> AFAICS, we should be able to set at an interface address to 0.0.0.0, in
>>> order to remove an IP address from an interface and keep this one up.
>>> I see two trivial cases:
>>> * remove the ipv4 on an interface but continue to use it through ipv6
>>> * move ipv4 address from the interface to an attached bridge
>>
>> For this case there is an IOCTL/netlink "remove IP address".
>
> And I forgot to mention the general broadcast.
> This is need for the dhcp protocol. If you are not able to set your
> interface to 0.0.0.0, you will be not able to send a 255.255.255.255
> broadcast message to have your IP address.
>
OK. Dave, pls disregard this patch. I suspect that others in the set
should not intersect with this one.
To summarize the discussion:
there is the only reason for this assignment: old IOCTL interface does
not have a way to remove IP address except this, though netlink has a
method for it that's why I am a little bit confused :)
This is handled in the __inet_insert_ifa: ifa is just removed there and,
correctly, ifa with 0.0.0.0 address can't exists in the kernel.
Sorry :)
^ permalink raw reply
* Re: [PATCH 3/7 net-2.6.25] [IPV4]: Prohibit assignment of 0.0.0.0 as interface address.
From: Daniel Lezcano @ 2008-01-25 14:48 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: Denis V. Lunev, davem, netdev, devel, containers
In-Reply-To: <4799EE8C.60407@sw.ru>
Denis V. Lunev wrote:
> Daniel Lezcano wrote:
>> Denis V. Lunev wrote:
>>> I could hardly imagine why sombady needs to assign 0.0.0.0 as an
>>> interface
>>> address or interface destination address. The kernel will behave in a
>>> strage
>>> way in several places if this is possible, as ifa_local != 0 is
>>> considered
>>> as initialized/non-initialized state of the ifa.
>> AFAICS, we should be able to set at an interface address to 0.0.0.0, in
>> order to remove an IP address from an interface and keep this one up.
>> I see two trivial cases:
>> * remove the ipv4 on an interface but continue to use it through ipv6
>> * move ipv4 address from the interface to an attached bridge
>
> For this case there is an IOCTL/netlink "remove IP address".
And I forgot to mention the general broadcast.
This is need for the dhcp protocol. If you are not able to set your
interface to 0.0.0.0, you will be not able to send a 255.255.255.255
broadcast message to have your IP address.
^ permalink raw reply
* Re: [PATCH] [NET]: Remove PowerPC code from fec.c
From: Geert Uytterhoeven @ 2008-01-25 14:46 UTC (permalink / raw)
To: Jochen Friedrich
Cc: Garzik, Jeff, Vitaly Bordug, Scott Wood, Kumar Gala,
Kernel, Linux, netdev@vger.kernel.org, linuxppc-dev list,
linux-m68k, Greg Ungerer, uClinux list
In-Reply-To: <4799F349.9090102@scram.de>
On Fri, 25 Jan 2008, Jochen Friedrich wrote:
> fec.c is only used on M68k Coldfire CPUs. Remove leftover
> PowerPC code from this driver.
As per MAINTAINERS, m68knommu is handled by:
UCLINUX (AND M68KNOMMU)
P: Greg Ungerer
M: gerg@uclinux.org
L: uclinux-dev@uclinux.org (subscribers-only)
I already forwarded a copy of your email to Greg.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox