]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Add route cacheing fix fwd from DaveM
authorChris Wright <chrisw@osdl.org>
Wed, 21 Sep 2005 06:49:57 +0000 (23:49 -0700)
committerChris Wright <chrisw@osdl.org>
Wed, 21 Sep 2005 06:49:57 +0000 (23:49 -0700)
queue/check-connect-status-for-IPv6-UDP-socket.patch [new file with mode: 0644]
queue/series

diff --git a/queue/check-connect-status-for-IPv6-UDP-socket.patch b/queue/check-connect-status-for-IPv6-UDP-socket.patch
new file mode 100644 (file)
index 0000000..2e24d5e
--- /dev/null
@@ -0,0 +1,71 @@
+From stable-bounces@linux.kernel.org  Sun Sep 18 00:30:56 2005
+Date: Sun, 18 Sep 2005 00:30:50 -0700 (PDT)
+To: stable@kernel.org
+From: "David S. Miller" <davem@davemloft.net>
+Cc: 
+Subject: [stable] Fw: [PATCH] check connect(2) status for IPv6 UDP socket
+
+From: Mitsuru KANDA <mk@linux-ipv6.org>
+
+I think we should cache the per-socket route(dst_entry) only when the
+IPv6 UDP socket is connect(2)'ed.
+(which is same as IPv4 UDP send behavior)
+
+Signed-off-by: Mitsuru KANDA <mk@linux-ipv6.org>
+Signed-off-by: Chris Wright <chrisw@osdl.org>
+---
+ net/ipv6/udp.c |   10 ++++++++--
+ 1 files changed, 8 insertions(+), 2 deletions(-)
+
+Index: linux-2.6.13.y/net/ipv6/udp.c
+===================================================================
+--- linux-2.6.13.y.orig/net/ipv6/udp.c
++++ linux-2.6.13.y/net/ipv6/udp.c
+@@ -638,6 +638,7 @@ static int udpv6_sendmsg(struct kiocb *i
+       int hlimit = -1;
+       int corkreq = up->corkflag || msg->msg_flags&MSG_MORE;
+       int err;
++      int connected = 0;
+       /* destination address check */
+       if (sin6) {
+@@ -747,6 +748,7 @@ do_udp_sendmsg:
+               fl->fl_ip_dport = inet->dport;
+               daddr = &np->daddr;
+               fl->fl6_flowlabel = np->flow_label;
++              connected = 1;
+       }
+       if (!fl->oif)
+@@ -769,6 +771,7 @@ do_udp_sendmsg:
+               }
+               if (!(opt->opt_nflen|opt->opt_flen))
+                       opt = NULL;
++              connected = 0;
+       }
+       if (opt == NULL)
+               opt = np->opt;
+@@ -787,10 +790,13 @@ do_udp_sendmsg:
+               ipv6_addr_copy(&final, &fl->fl6_dst);
+               ipv6_addr_copy(&fl->fl6_dst, rt0->addr);
+               final_p = &final;
++              connected = 0;
+       }
+-      if (!fl->oif && ipv6_addr_is_multicast(&fl->fl6_dst))
++      if (!fl->oif && ipv6_addr_is_multicast(&fl->fl6_dst)) {
+               fl->oif = np->mcast_oif;
++              connected = 0;
++      }
+       err = ip6_dst_lookup(sk, &dst, fl);
+       if (err)
+@@ -841,7 +847,7 @@ do_append_data:
+       else if (!corkreq)
+               err = udp_v6_push_pending_frames(sk, up);
+-      if (dst)
++      if (dst&&connected)
+               ip6_dst_store(sk, dst,
+                             ipv6_addr_equal(&fl->fl6_dst, &np->daddr) ?
+                             &np->daddr : NULL);
index 9a513edd755be0ce23d779825e2e622575de9aef..0afc3a697ea8cb50334dca0ad1629e267170dc48 100644 (file)
@@ -4,3 +4,4 @@ ipv6-fix-per-socket-multicast-filtering.patch
 ipvs-ip_vs_ftp-breaks-connections.patch
 missing-acct-mm-calls-in-compat_do_execve.patch
 uml-fix-x86_64-page-leak.patch
+check-connect-status-for-IPv6-UDP-socket.patch