netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Naohiro Ooiwa <nooiwa@miraclelinux.com>
To: usagi-users@linux-ipv6.org, netdev@vger.kernel.org
Cc: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
Subject: [PATCH] raw: restore daddr_cache in raw kernel socket.
Date: Fri, 01 Aug 2008 19:00:20 +0900	[thread overview]
Message-ID: <4892DEB4.20203@miraclelinux.com> (raw)

Hi all,

I created a patch of RAW socket.

This patch adds ip6_sk_dst_lookup()/ip6_dst_store() in rawv6_sendmsg().
so that RAW socket can use "daddr_cache".

When RAW socket sent the packets to same destination,
it must reduce over-head.

Could you please check the following patch?

Regards,
Naohiro Ooiwa


Signed-off-by: Naohiro Ooiwa <nooiwa@miraclelinux.com>
---
 net/ipv6/raw.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 396f0ea..58c5e25 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -858,7 +858,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
 		fl.oif = np->mcast_oif;
 	security_sk_classify_flow(sk, &fl);

-	err = ip6_dst_lookup(sk, &dst, &fl);
+	err = ip6_sk_dst_lookup(sk, &dst, &fl);
 	if (err)
 		goto out;
 	if (final_p)
@@ -905,7 +905,17 @@ back_from_confirm:
 		release_sock(sk);
 	}
 done:
-	dst_release(dst);
+	if (dst)
+		ip6_dst_store(sk, dst,
+			      ipv6_addr_equal(&fl.fl6_dst, &np->daddr) ?
+			      &np->daddr : NULL,
+#ifdef CONFIG_IPV6_SUBTREES
+			      ipv6_addr_equal(&fl.fl6_src, &np->saddr) ?
+			      &np->saddr :
+#endif
+			      NULL);
+	else
+		dst_release(dst);
 out:
 	fl6_sock_release(flowlabel);
 	return err<0?err:len;
-- 



             reply	other threads:[~2008-08-01 10:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-01 10:00 Naohiro Ooiwa [this message]
2008-08-02  0:52 ` [PATCH] raw: restore daddr_cache in raw kernel socket Herbert Xu

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=4892DEB4.20203@miraclelinux.com \
    --to=nooiwa@miraclelinux.com \
    --cc=netdev@vger.kernel.org \
    --cc=usagi-users@linux-ipv6.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).