1. 06 11月, 2008 3 次提交
    • E
      net: Don't leak packets when a netns is going down · 0a36b345
      Eric W. Biederman 提交于
      I have been tracking for a while a case where when the
      network namespace exits the cleanup gets stck in an
      endless precessess of:
      
      unregister_netdevice: waiting for lo to become free. Usage count = 3
      unregister_netdevice: waiting for lo to become free. Usage count = 3
      unregister_netdevice: waiting for lo to become free. Usage count = 3
      unregister_netdevice: waiting for lo to become free. Usage count = 3
      unregister_netdevice: waiting for lo to become free. Usage count = 3
      unregister_netdevice: waiting for lo to become free. Usage count = 3
      unregister_netdevice: waiting for lo to become free. Usage count = 3
      
      It turns out that if you listen on a multicast address an unsubscribe
      packet is sent when the network device goes down.   If you shutdown
      the network namespace without carefully cleaning up this can trigger
      the unsubscribe packet to be sent over the loopback interface while
      the network namespace is going down.
      
      All of which is fine except when we drop the packet and forget to
      free it leaking the skb and the dst entry attached to.  As it
      turns out the dst entry hold a reference to the idev which holds
      the dev and keeps everything from being cleaned up.  Yuck!
      
      By fixing my earlier thinko and add the needed kfree_skb and everything
      cleans up beautifully. 
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0a36b345
    • E
      net: Guaranetee the proper ordering of the loopback device. · ae33bc40
      Eric W. Biederman 提交于
      I was recently hunting a bug that occurred in network namespace
      cleanup.  In looking at the code it became apparrent that we have
      and will continue to have cases where if we have anything going
      on in a network namespace there will be assumptions that the
      loopback device is present.   Things like sending igmp unsubscribe
      messages when we bring down network devices invokes the routing
      code which assumes that at least the loopback driver is present.
      
      Therefore to avoid magic initcall ordering hackery that is hard
      to follow and hard to get right insert a call to register the
      loopback device directly from net_dev_init().    This guarantes
      that the loopback device is the first device registered and
      the last network device to go away.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ae33bc40
    • E
      netns: Delete virtual interfaces during namespace cleanup · d0c082ce
      Eric W. Biederman 提交于
      When physical devices are inside of network namespace and that
      network namespace terminates we can not make them go away.  We
      have to keep them and moving them to the initial network namespace
      is the best we can do.
      
      For virtual devices left in a network namespace that is exiting
      we have no need to preserve them and we now have the infrastructure
      that allows us to delete them.  So delete virtual devices when we
      exit a network namespace.  Keeping the necessary user space clean up
      after a network namespace exits much more tractable.
      Acked-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
      Acked-by: NPavel Emelyanov <xemul@openvz.org>
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d0c082ce
  2. 05 11月, 2008 7 次提交
  3. 04 11月, 2008 25 次提交
  4. 03 11月, 2008 5 次提交