===================================================================
@@ -108,9 +108,22 @@ static int masq_inet_event(struct notifi
unsigned long event,
void *ptr)
{
- struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
+ struct in_ifaddr *ifa = ptr;
+ struct net_device *dev = ifa->ifa_dev->dev;
struct netdev_notifier_info info;
+ if (event == NETDEV_DOWN) {
+ /*
+ * When we meet dead device which is
+ * being released with dozeon of addresses
+ * assigned -- we can optimize calls
+ * to conntrack cleanups and do it only
+ * once.
+ */
+ if (ifa->ifa_dev->dead && ifa->ifa_next)
+ return NOTIFY_DONE;
+ }
+
netdev_notifier_info_init(&info, dev);
return masq_device_event(this, event, &info);
}