Commit c2de5154 authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji

[IPV4,IPV6] set idev/rt6i_idev to loopback instead of NULL, to omit checking if it is non-NULL.

(Based on hint by David S. Miller <davem@redhat.com>)
Signed-off-by: default avatarHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
parent caab50f0
...@@ -1342,9 +1342,12 @@ static void ipv4_dst_ifdown(struct dst_entry *dst, int how) ...@@ -1342,9 +1342,12 @@ static void ipv4_dst_ifdown(struct dst_entry *dst, int how)
{ {
struct rtable *rt = (struct rtable *) dst; struct rtable *rt = (struct rtable *) dst;
struct in_device *idev = rt->idev; struct in_device *idev = rt->idev;
if (idev) { if (idev && idev->dev != &loopback_dev) {
rt->idev = NULL; struct in_device *loopback_idev = in_dev_get(&loopback_dev);
in_dev_put(idev); if (loopback_idev) {
rt->idev = loopback_idev;
in_dev_put(idev);
}
} }
} }
......
...@@ -155,7 +155,16 @@ static void ip6_dst_destroy(struct dst_entry *dst) ...@@ -155,7 +155,16 @@ static void ip6_dst_destroy(struct dst_entry *dst)
static void ip6_dst_ifdown(struct dst_entry *dst, int how) static void ip6_dst_ifdown(struct dst_entry *dst, int how)
{ {
ip6_dst_destroy(dst); struct rt6_info *rt = (struct rt6_info *)dst;
struct inet6_dev *idev = rt->rt6i_idev;
if (idev != NULL && idev->dev != &loopback_dev) {
struct inet6_dev *loopback_idev = in6_dev_get(&loopback_dev);
if (loopback_idev != NULL) {
rt->rt6i_idev = loopback_idev;
in6_dev_put(idev);
}
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment