Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132134
b: refs/heads/master
c: 17edde5
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Mar 3, 2009
1 parent 2766cd1 commit 388dc6c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2f20d2e667ab1ca44cde5fb361386dff5bb6081d
refs/heads/master: 17edde520927070a6bf14a6a75027c0b843443e5
27 changes: 17 additions & 10 deletions trunk/include/net/net_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ extern struct list_head net_namespace_list;
#ifdef CONFIG_NET_NS
extern void __put_net(struct net *net);

static inline int net_alive(struct net *net)
{
return net && atomic_read(&net->count);
}

static inline struct net *get_net(struct net *net)
{
atomic_inc(&net->count);
Expand Down Expand Up @@ -145,11 +140,6 @@ int net_eq(const struct net *net1, const struct net *net2)
}
#else

static inline int net_alive(struct net *net)
{
return 1;
}

static inline struct net *get_net(struct net *net)
{
return net;
Expand Down Expand Up @@ -234,6 +224,23 @@ struct pernet_operations {
void (*exit)(struct net *net);
};

/*
* Use these carefully. If you implement a network device and it
* needs per network namespace operations use device pernet operations,
* otherwise use pernet subsys operations.
*
* This is critically important. Most of the network code cleanup
* runs with the assumption that dev_remove_pack has been called so no
* new packets will arrive during and after the cleanup functions have
* been called. dev_remove_pack is not per namespace so instead the
* guarantee of no more packets arriving in a network namespace is
* provided by ensuring that all network devices and all sockets have
* left the network namespace before the cleanup methods are called.
*
* For the longest time the ipv4 icmp code was registered as a pernet
* device which caused kernel oops, and panics during network
* namespace cleanup. So please don't get this wrong.
*/
extern int register_pernet_subsys(struct pernet_operations *);
extern void unregister_pernet_subsys(struct pernet_operations *);
extern int register_pernet_gen_subsys(int *id, struct pernet_operations *);
Expand Down
6 changes: 0 additions & 6 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2267,12 +2267,6 @@ int netif_receive_skb(struct sk_buff *skb)

rcu_read_lock();

/* Don't receive packets in an exiting network namespace */
if (!net_alive(dev_net(skb->dev))) {
kfree_skb(skb);
goto out;
}

#ifdef CONFIG_NET_CLS_ACT
if (skb->tc_verd & TC_NCLS) {
skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
Expand Down
3 changes: 0 additions & 3 deletions trunk/net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ static void cleanup_net(struct work_struct *work)
struct pernet_operations *ops;
struct net *net;

/* Be very certain incoming network packets will not find us */
rcu_barrier();

net = container_of(work, struct net, work);

mutex_lock(&net_mutex);
Expand Down

0 comments on commit 388dc6c

Please sign in to comment.