Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopback registration

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric W. Biederman
Date: Monday, November 12, 2007 - 9:59 am

"Denis V. Lunev" <den@sw.ru> writes:


Oh.  Speaking of.  One way to catch this kind of thing during debugging
is to instrument dev_put and dev_hold to add a print statement.  Something
like:

/**
 *	dev_put - release reference to device
 *	@dev: network device
 *
 * Release reference to device to allow it to be freed.
 */
static inline void __dev_put(struct net_device *dev, char *file, char *func, int line)
{
        if (dev->flags & IFF_LOOPBACK)
        	printk("%s: %s.%s.%d\n", __func__, file, file, line);
	atomic_dec(&dev->refcnt);
}

#define dev_put(DEV) __dev_put(DEV, __FILE__, __func__, __LINE__)

/**
 *	dev_hold - get reference to device
 *	@dev: network device
 *
 * Hold reference to device to keep it from being freed.
 */
static inline void __dev_hold(struct net_device *dev, char *file, char *func, int line)
{
        if (dev->flags & IFF_LOOPBACK)
        	printk("%s: %s.%s.%d\n", __func__, file, file, line);
	atomic_inc(&dev->refcnt);
}

#define dev_hold(DEV) __dev_hold(DEV, __FILE__, __func__, __LINE__)

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopbac ..., Eric W. Biederman, (Mon Nov 12, 9:40 am)
Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopbac ..., Eric W. Biederman, (Mon Nov 12, 9:51 am)
Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopbac ..., Eric W. Biederman, (Mon Nov 12, 9:59 am)
Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopbac ..., Eric W. Biederman, (Mon Nov 12, 12:50 pm)
Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopbac ..., YOSHIFUJI Hideaki / , (Mon Nov 12, 6:52 pm)
Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopbac ..., Eric W. Biederman, (Tue Nov 13, 5:59 am)
Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopbac ..., Eric W. Biederman, (Tue Nov 13, 6:11 am)