2005-09-30 02:25:00

by Chris Wright

[permalink] [raw]
Subject: [PATCH 07/10] [PATCH] check connect(2) status for IPv6 UDP socket

-stable review patch. If anyone has any objections, please let us know.
------------------

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 <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
---
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);

--


2005-09-30 06:25:08

by Chuck Wolber

[permalink] [raw]
Subject: Re: [PATCH 07/10] [PATCH] check connect(2) status for IPv6 UDP socket

On Thu, 29 Sep 2005, Chris Wright wrote:

> -stable review patch. If anyone has any objections, please let us know.
> ------------------
>
> 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 <[email protected]>
> Signed-off-by: Chris Wright <[email protected]>
> ---

%< Snip %<


Does this really qualify as a necessary bug fix?

..Chuck..


--
http://www.quantumlinux.com
Quantum Linux Laboratories, LLC.
ACCELERATING Business with Open Technology

"The measure of the restoration lies in the extent to which we apply
social values more noble than mere monetary profit." - FDR

2005-09-30 07:10:33

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 07/10] [PATCH] check connect(2) status for IPv6 UDP socket

From: Chuck Wolber <[email protected]>
Date: Thu, 29 Sep 2005 23:25:14 -0700 (PDT)

> Does this really qualify as a necessary bug fix?

Yes. Without this unconnected ipv6 UDP sockets end up using the wrong
route or IPSEC path.

Subject: Re: [PATCH 07/10] [PATCH] check connect(2) status for IPv6 UDP socket


Sorry for log silence, I was on a business trip in last week.

I recreate a patch (of course, which have been tested) ASAP.

At Fri, 30 Sep 2005 00:10:25 -0700 (PDT),
"David S. Miller" <[email protected]> wrote:
>
> From: Chuck Wolber <[email protected]>
> Date: Thu, 29 Sep 2005 23:25:14 -0700 (PDT)
>
> > Does this really qualify as a necessary bug fix?
>
> Yes. Without this unconnected ipv6 UDP sockets end up using the wrong
> route or IPSEC path.

2005-10-05 19:01:48

by Chris Wright

[permalink] [raw]
Subject: Re: [PATCH 07/10] [PATCH] check connect(2) status for IPv6 UDP socket

* Mitsuru KANDA / 神田 充 ([email protected]) wrote:
> Sorry for log silence, I was on a business trip in last week.
>
> I recreate a patch (of course, which have been tested) ASAP.

BTW, we dropped this one, since it had possible leak in it. I'll let
you and DaveM decide when the updated one is ready for -stable.

thanks,
-chris

2005-10-05 19:06:04

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 07/10] [PATCH] check connect(2) status for IPv6 UDP socket

From: Chris Wright <[email protected]>
Date: Wed, 5 Oct 2005 12:00:59 -0700

> * Mitsuru KANDA ([email protected]) wrote:
> > Sorry for log silence, I was on a business trip in last week.
> >
> > I recreate a patch (of course, which have been tested) ASAP.
>
> BTW, we dropped this one, since it had possible leak in it. I'll let
> you and DaveM decide when the updated one is ready for -stable.

Will do, thanks Chris.