/* Description: Handle network device events, although at present all we care about is a network device going away. In the case of a device going away we clear any related entries from the unlabeled connection hash table.  */
static int netlbl_unlhsh_netdev_handler(struct notifier_block *this, unsigned long event, void *ptr)
/* Description: Handle network device events, although at present all we care about is a network device going away. In the case of a device going away we clear any related entries from the unlabeled connection hash table.  */
static int netlbl_unlhsh_netdev_handler(struct notifier_block *this, unsigned long event, void *ptr)
{
	struct net_device *dev = ptr;
	struct netlbl_unlhsh_iface *iface = NULL;
	if (!net_eq(dev_net(dev), &init_net))
		return NOTIFY_DONE;
	if (event == NETDEV_DOWN) {
		spin_lock(&netlbl_unlhsh_lock);
		iface = netlbl_unlhsh_search_iface(dev->ifindex);
		if (iface != NULL && iface->valid) {
			iface->valid = 0;
			list_del_rcu(&iface->list);
		} else
			iface = NULL;
		spin_unlock(&netlbl_unlhsh_lock);
	}
	if (iface != NULL)
		call_rcu(&iface->rcu, netlbl_unlhsh_free_iface);
	return NOTIFY_DONE;
}