On Tue, Feb 08, 2005 at 12:29:29PM +1100, herbert wrote:
> 
> This one moves the dst->child processing from dst_ifdown into
> xfrm_dst_ifdown.

This patch adds a net_device argument to ifdown.  After all,
it's a bit silly to notify someone of an ifdown event without
telling them what which device it was for :)

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
===== include/net/dst.h 1.25 vs edited =====
--- 1.25/include/net/dst.h      2005-02-06 14:23:59 +11:00
+++ edited/include/net/dst.h    2005-02-08 12:14:10 +11:00
@@ -89,7 +89,8 @@
        int                     (*gc)(void);
        struct dst_entry *      (*check)(struct dst_entry *, __u32 cookie);
        void                    (*destroy)(struct dst_entry *);
-       void                    (*ifdown)(struct dst_entry *, int how);
+       void                    (*ifdown)(struct dst_entry *,
+                                         struct net_device *dev, int how);
        struct dst_entry *      (*negative_advice)(struct dst_entry *);
        void                    (*link_failure)(struct sk_buff *);
        void                    (*update_pmtu)(struct dst_entry *dst, u32 mtu);
===== net/core/dst.c 1.27 vs edited =====
--- 1.27/net/core/dst.c 2005-02-08 12:12:21 +11:00
+++ edited/net/core/dst.c       2005-02-08 12:15:03 +11:00
@@ -220,12 +220,14 @@
  *
  * Commented and originally written by Alexey.
  */
-static inline void dst_ifdown(struct dst_entry *dst, int unregister)
+static inline void dst_ifdown(struct dst_entry *dst, struct net_device *dev,
+                             int unregister)
 {
-       struct net_device *dev = dst->dev;
-
        if (dst->ops->ifdown)
-               dst->ops->ifdown(dst, unregister);
+               dst->ops->ifdown(dst, dev, unregister);
+
+       if (dev != dst->dev)
+               return;
 
        if (!unregister) {
                dst->input = dst_discard_in;
@@ -252,8 +254,7 @@
        case NETDEV_DOWN:
                spin_lock_bh(&dst_lock);
                for (dst = dst_garbage_list; dst; dst = dst->next) {
-                       if (dst->dev == dev)
-                               dst_ifdown(dst, event != NETDEV_DOWN);
+                       dst_ifdown(dst, dev, event != NETDEV_DOWN);
                }
                spin_unlock_bh(&dst_lock);
                break;
===== net/ipv4/route.c 1.101 vs edited =====
--- 1.101/net/ipv4/route.c      2005-02-03 07:43:48 +11:00
+++ edited/net/ipv4/route.c     2005-02-08 12:14:11 +11:00
@@ -138,7 +138,8 @@
 
 static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie);
 static void             ipv4_dst_destroy(struct dst_entry *dst);
-static void             ipv4_dst_ifdown(struct dst_entry *dst, int how);
+static void             ipv4_dst_ifdown(struct dst_entry *dst,
+                                        struct net_device *dev, int how);
 static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
 static void             ipv4_link_failure(struct sk_buff *skb);
 static void             ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu);
@@ -1342,11 +1343,12 @@
        }
 }
 
-static void ipv4_dst_ifdown(struct dst_entry *dst, int how)
+static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
+                           int how)
 {
        struct rtable *rt = (struct rtable *) dst;
        struct in_device *idev = rt->idev;
-       if (idev && idev->dev != &loopback_dev) {
+       if (dev != &loopback_dev && idev && idev->dev == dev) {
                struct in_device *loopback_idev = in_dev_get(&loopback_dev);
                if (loopback_idev) {
                        rt->idev = loopback_idev;
===== net/ipv6/route.c 1.105 vs edited =====
--- 1.105/net/ipv6/route.c      2005-01-15 19:44:48 +11:00
+++ edited/net/ipv6/route.c     2005-02-08 12:14:11 +11:00
@@ -84,7 +84,8 @@
 static struct dst_entry        *ip6_dst_check(struct dst_entry *dst, u32 
cookie);
 static struct dst_entry *ip6_negative_advice(struct dst_entry *);
 static void            ip6_dst_destroy(struct dst_entry *);
-static void            ip6_dst_ifdown(struct dst_entry *, int how);
+static void            ip6_dst_ifdown(struct dst_entry *,
+                                      struct net_device *dev, int how);
 static int              ip6_dst_gc(void);
 
 static int             ip6_pkt_discard(struct sk_buff *skb);
@@ -153,12 +154,13 @@
        }       
 }
 
-static void ip6_dst_ifdown(struct dst_entry *dst, int how)
+static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
+                          int how)
 {
        struct rt6_info *rt = (struct rt6_info *)dst;
        struct inet6_dev *idev = rt->rt6i_idev;
 
-       if (idev != NULL && idev->dev != &loopback_dev) {
+       if (dev != &loopback_dev && idev != NULL && idev->dev == dev) {
                struct inet6_dev *loopback_idev = in6_dev_get(&loopback_dev);
                if (loopback_idev != NULL) {
                        rt->rt6i_idev = loopback_idev;
===== net/xfrm/xfrm_policy.c 1.64 vs edited =====
--- 1.64/net/xfrm/xfrm_policy.c 2005-02-08 12:12:21 +11:00
+++ edited/net/xfrm/xfrm_policy.c       2005-02-08 12:15:35 +11:00
@@ -1027,10 +1027,9 @@
        dst->xfrm = NULL;
 }
 
-static void xfrm_dst_ifdown(struct dst_entry *dst, int unregister)
+static void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
+                           int unregister)
 {
-       struct net_device *dev = dst->dev;
-
        if (!unregister)
                return;
 

Reply via email to