1. 23 1月, 2008 1 次提交
  2. 13 11月, 2007 1 次提交
  3. 07 11月, 2007 1 次提交
    • J
      [NETNS]: Fix compiler error in net_namespace.c · 45a19b0a
      Johann Felix Soden 提交于
      Because net_free is called by copy_net_ns before its declaration, the
      compiler gives an error. This patch puts net_free before copy_net_ns
      to fix this.
      
      The compiler error:
      net/core/net_namespace.c: In function 'copy_net_ns':
      net/core/net_namespace.c:97: error: implicit declaration of function 'net_free'
      net/core/net_namespace.c: At top level:
      net/core/net_namespace.c:104: warning: conflicting types for 'net_free'
      net/core/net_namespace.c:104: error: static declaration of 'net_free' follows non-static declaration
      net/core/net_namespace.c:97: error: previous implicit declaration of 'net_free' was here
      
      The error was introduced by the '[NET]: Hide the dead code in the
      net_namespace.c' patch (6a1a3b9f).
      Signed-off-by: NJohann Felix Soden <johfel@users.sourceforge.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      45a19b0a
  4. 01 11月, 2007 4 次提交
  5. 31 10月, 2007 1 次提交
    • D
      [NETNS]: fix net released by rcu callback · 310928d9
      Daniel Lezcano 提交于
      When a network namespace reference is held by a network subsystem,
      and when this reference is decremented in a rcu update callback, we
      must ensure that there is no more outstanding rcu update before
      trying to free the network namespace.
      
      In the normal case, the rcu_barrier is called when the network namespace
      is exiting in the cleanup_net function.
      
      But when a network namespace creation fails, and the subsystems are
      undone (like the cleanup), the rcu_barrier is missing.
      
      This patch adds the missing rcu_barrier.
      Signed-off-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      310928d9
  6. 11 10月, 2007 6 次提交
    • P
      [NETNS]: Don't memset() netns to zero manually · 32f0c4cb
      Pavel Emelyanov 提交于
      The newly created net namespace is set to 0 with memset()
      in setup_net(). The setup_net() is also called for the
      init_net_ns(), which is zeroed naturally as a global var.
      
      So remove this memset and allocate new nets with the
      kmem_cache_zalloc().
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      32f0c4cb
    • E
      [NETNS]: Simplify the network namespace list locking rules. · f4618d39
      Eric W. Biederman 提交于
      Denis V. Lunev <den@sw.ru> noticed that the locking rules
      for the network namespace list are over complicated and broken.
      
      In particular the current register_netdev_notifier currently
      does not take any lock making the for_each_net iteration racy
      with network namespace creation and destruction. Oops.
      
      The fact that we need to use for_each_net in rtnl_unlock() when
      the rtnetlink support becomes per network namespace makes designing
      the proper locking tricky.  In addition we need to be able to call
      rtnl_lock() and rtnl_unlock() when we have the net_mutex held.
      
      After thinking about it and looking at the alternatives carefully
      it looks like the simplest and most maintainable solution is
      to remove net_list_mutex altogether, and to use the rtnl_mutex instead.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f4618d39
    • E
      [NET]: Add network namespace clone & unshare support. · 9dd776b6
      Eric W. Biederman 提交于
      This patch allows you to create a new network namespace
      using sys_clone, or sys_unshare.
      
      As the network namespace is still experimental and under development
      clone and unshare support is only made available when CONFIG_NET_NS is
      selected at compile time.
      
      As this patch introduces network namespace support into code paths
      that exist when the CONFIG_NET is not selected there are a few
      additions made to net_namespace.h to allow a few more functions
      to be used when the networking stack is not compiled in.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9dd776b6
    • P
      [NETNS]: Cleanup list walking in setup_net and cleanup_net · 768f3591
      Pavel Emelyanov 提交于
      I proposed introducing a list_for_each_entry_continue_reverse macro
      to be used in setup_net() when unrolling the failed ->init callback.
      
      Here is the macro and some more cleanup in the setup_net() itself
      to remove one variable from the stack :) The same thing is for the
      cleanup_net() - the existing list_for_each_entry_reverse() is used.
      
      Minor, but the code looks nicer.
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Acked-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      768f3591
    • D
      [NET]: #if 0 out net_alloc() for now. · 678aa8e4
      David S. Miller 提交于
      We will undo this once it is actually used.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      678aa8e4
    • E
      [NET]: Basic network namespace infrastructure. · 5f256bec
      Eric W. Biederman 提交于
      This is the basic infrastructure needed to support network
      namespaces.  This infrastructure is:
      - Registration functions to support initializing per network
        namespace data when a network namespaces is created or destroyed.
      
      - struct net.  The network namespace data structure.
        This structure will grow as variables are made per network
        namespace but this is the minimal starting point.
      
      - Functions to grab a reference to the network namespace.
        I provide both get/put functions that keep a network namespace
        from being freed.  And hold/release functions serve as weak references
        and will warn if their count is not zero when the data structure
        is freed.  Useful for dealing with more complicated data structures
        like the ipv4 route cache.
      
      - A list of all of the network namespaces so we can iterate over them.
      
      - A slab for the network namespace data structure allowing leaks
        to be spotted.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5f256bec