X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fnet%2Fipv4%2Fnetfilter%2Fnf_nat_masquerade_ipv4.c;fp=kernel%2Fnet%2Fipv4%2Fnetfilter%2Fnf_nat_masquerade_ipv4.c;h=ea91058b5f6f4245a84179f81a8641756f60efff;hb=52f993b8e89487ec9ee15a7fb4979e0f09a45b27;hp=c6eb42100e9a7d78a6a5c27434e42e3282b3af74;hpb=c189ccac5702322ed843fe17057035b7222a59b6;p=kvmfornfv.git diff --git a/kernel/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c b/kernel/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c index c6eb42100..ea91058b5 100644 --- a/kernel/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c +++ b/kernel/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c @@ -108,10 +108,18 @@ static int masq_inet_event(struct notifier_block *this, unsigned long event, void *ptr) { - struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev; + struct in_device *idev = ((struct in_ifaddr *)ptr)->ifa_dev; struct netdev_notifier_info info; - netdev_notifier_info_init(&info, dev); + /* The masq_dev_notifier will catch the case of the device going + * down. So if the inetdev is dead and being destroyed we have + * no work to do. Otherwise this is an individual address removal + * and we have to perform the flush. + */ + if (idev->dead) + return NOTIFY_DONE; + + netdev_notifier_info_init(&info, idev->dev); return masq_device_event(this, event, &info); }