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,10 +1342,13 @@ static void ipv4_dst_ifdown(struct dst_entry *dst, int how)
{
struct rtable *rt = (struct rtable *) dst;
struct in_device *idev = rt->idev;
if (idev) {
rt->idev = NULL;
if (idev && idev->dev != &loopback_dev) {
struct in_device *loopback_idev = in_dev_get(&loopback_dev);
if (loopback_idev) {
rt->idev = loopback_idev;
in_dev_put(idev);
}
}
}
static void ipv4_link_failure(struct sk_buff *skb)
......
......@@ -155,7 +155,16 @@ static void ip6_dst_destroy(struct dst_entry *dst)
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