linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: "David S. Miller" <davem@davemloft.net>
Cc: mirko.parthey@informatik.tu-chemnitz.de,
	linux-kernel@vger.kernel.org, netdev@oss.sgi.com,
	yoshfuji@linux-ipv6.org, shemminger@osdl.org
Subject: [IPSEC] Move dst->child loop from dst_ifdown to xfrm_dst_ifdown
Date: Tue, 8 Feb 2005 12:29:29 +1100	[thread overview]
Message-ID: <20050208012929.GA30659@gondor.apana.org.au> (raw)
In-Reply-To: <20050206065117.GC16057@gondor.apana.org.au>

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

On Sun, Feb 06, 2005 at 05:51:17PM +1100, herbert wrote:
> 
> The idea is to move the check into dst->ops->ifdown.  By definition
> ipv6_dst_ifdown will only see rt6_info entries.  So dst_dev_event
> will become

Here are the patches to do this.  Do they look sane?

This one moves the dst->child processing from dst_ifdown into
xfrm_dst_ifdown.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: dst-patch-1 --]
[-- Type: text/plain, Size: 2519 bytes --]

===== net/core/dst.c 1.26 vs edited =====
--- 1.26/net/core/dst.c	2005-02-06 14:23:59 +11:00
+++ edited/net/core/dst.c	2005-02-08 12:11:39 +11:00
@@ -220,31 +220,26 @@
  *
  * Commented and originally written by Alexey.
  */
-static void dst_ifdown(struct dst_entry *dst, int unregister)
+static inline void dst_ifdown(struct dst_entry *dst, int unregister)
 {
 	struct net_device *dev = dst->dev;
 
+	if (dst->ops->ifdown)
+		dst->ops->ifdown(dst, unregister);
+
 	if (!unregister) {
 		dst->input = dst_discard_in;
 		dst->output = dst_discard_out;
-	}
-
-	do {
-		if (unregister) {
-			dst->dev = &loopback_dev;
-			dev_hold(&loopback_dev);
+	} else {
+		dst->dev = &loopback_dev;
+		dev_hold(&loopback_dev);
+		dev_put(dev);
+		if (dst->neighbour && dst->neighbour->dev == dev) {
+			dst->neighbour->dev = &loopback_dev;
 			dev_put(dev);
-			if (dst->neighbour && dst->neighbour->dev == dev) {
-				dst->neighbour->dev = &loopback_dev;
-				dev_put(dev);
-				dev_hold(&loopback_dev);
-			}
+			dev_hold(&loopback_dev);
 		}
-
-		if (dst->ops->ifdown)
-			dst->ops->ifdown(dst, unregister);
-	} while ((dst = dst->child) && dst->flags & DST_NOHASH &&
-		 dst->dev == dev);
+	}
 }
 
 static int dst_dev_event(struct notifier_block *this, unsigned long event, void *ptr)
===== net/xfrm/xfrm_policy.c 1.63 vs edited =====
--- 1.63/net/xfrm/xfrm_policy.c	2005-01-19 07:08:19 +11:00
+++ edited/net/xfrm/xfrm_policy.c	2005-02-08 12:10:47 +11:00
@@ -1027,6 +1027,20 @@
 	dst->xfrm = NULL;
 }
 
+static void xfrm_dst_ifdown(struct dst_entry *dst, int unregister)
+{
+	struct net_device *dev = dst->dev;
+
+	if (!unregister)
+		return;
+
+	while ((dst = dst->child) && dst->xfrm && dst->dev == dev) {
+		dst->dev = &loopback_dev;
+		dev_hold(&loopback_dev);
+		dev_put(dev);
+	}
+}
+
 static void xfrm_link_failure(struct sk_buff *skb)
 {
 	/* Impossible. Such dst must be popped before reaches point of failure. */
@@ -1150,6 +1164,8 @@
 			dst_ops->check = xfrm_dst_check;
 		if (likely(dst_ops->destroy == NULL))
 			dst_ops->destroy = xfrm_dst_destroy;
+		if (likely(dst_ops->ifdown == NULL))
+			dst_ops->ifdown = xfrm_dst_ifdown;
 		if (likely(dst_ops->negative_advice == NULL))
 			dst_ops->negative_advice = xfrm_negative_advice;
 		if (likely(dst_ops->link_failure == NULL))
@@ -1181,6 +1197,7 @@
 			dst_ops->kmem_cachep = NULL;
 			dst_ops->check = NULL;
 			dst_ops->destroy = NULL;
+			dst_ops->ifdown = NULL;
 			dst_ops->negative_advice = NULL;
 			dst_ops->link_failure = NULL;
 			dst_ops->get_mss = NULL;

  reply	other threads:[~2005-02-08  1:31 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-31 16:22 PROBLEM: 2.6.11-rc2 hangs on bridge shutdown (br0) Mirko Parthey
2005-01-31 17:40 ` Matthias-Christian Ott
2005-02-01 17:36 ` Mirko Parthey
2005-02-02 16:08   ` Matthias-Christian Ott
2005-02-05 12:48     ` Matthias-Christian Ott
2005-02-05  5:24 ` Herbert Xu
2005-02-05  5:38   ` David S. Miller
2005-02-05  6:11     ` Herbert Xu
2005-02-05  6:13       ` David S. Miller
2005-02-05  6:46         ` Herbert Xu
2005-02-05 10:45           ` Herbert Xu
2005-02-06 11:41             ` Herbert Xu
2005-02-06 12:30               ` YOSHIFUJI Hideaki / 吉藤英明
2005-02-06 21:01                 ` Herbert Xu
2005-02-05 10:50           ` YOSHIFUJI Hideaki / 吉藤英明
2005-02-05 18:32             ` Herbert Xu
2005-02-06  4:02             ` David S. Miller
2005-02-06  5:01               ` YOSHIFUJI Hideaki / 吉藤英明
2005-02-06  4:10           ` David S. Miller
2005-02-06  4:37             ` YOSHIFUJI Hideaki / 吉藤英明
2005-02-06  5:04               ` David S. Miller
2005-02-06  5:31                 ` YOSHIFUJI Hideaki / 吉藤英明
2005-02-06  5:50                   ` YOSHIFUJI Hideaki / 吉藤英明
2005-02-06  7:00                     ` Herbert Xu
2005-02-06  6:53                   ` Herbert Xu
2005-02-06  6:52                 ` Herbert Xu
2005-02-06  6:51             ` Herbert Xu
2005-02-08  1:29               ` Herbert Xu [this message]
2005-02-08  1:31                 ` [IPSEC] Move dst->child loop from dst_ifdown to xfrm_dst_ifdown Herbert Xu
2005-02-15 22:53                   ` David S. Miller
2005-02-05 11:14       ` PROBLEM: 2.6.11-rc2 hangs on bridge shutdown (br0) Andre Tomt
2005-02-05 11:39         ` YOSHIFUJI Hideaki / 吉藤英明
     [not found]           ` <4204B27F.5040202@tomt.net>
2005-02-05 11:55             ` YOSHIFUJI Hideaki / 吉藤英明
2005-02-05 18:33           ` Herbert Xu
2005-02-06 10:55       ` Andre Tomt
2005-02-06 11:28         ` YOSHIFUJI Hideaki / 吉藤英明

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050208012929.GA30659@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirko.parthey@informatik.tu-chemnitz.de \
    --cc=netdev@oss.sgi.com \
    --cc=shemminger@osdl.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).