From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Yurij M. Plotnikov" <Yurij.Plotnikov@oktetlabs.ru>,
David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: Connect hangs for a while before returns -1 with ECONNREFUSED on 3.2 for loopback
Date: Sat, 04 Feb 2012 13:26:42 +0100 [thread overview]
Message-ID: <1328358402.2731.11.camel@edumazet-laptop> (raw)
In-Reply-To: <1328282126.2157.27.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
Le vendredi 03 février 2012 à 16:15 +0100, Eric Dumazet a écrit :
> We omit to send RST packet in tcp_v4_send_reset()
>
> because of this test :
>
> if (skb_rtable(skb)->rt_type != RTN_LOCAL)
> return
>
> At this point rt_type is RTN_UNICAST
>
>
Here is the fix, thanks again !
[PATCH] ipv4: fix a route regression
commit 813b3b5db83 (ipv4: Use caller's on-stack flowi as-is in output
route lookups.) added a regression.
Some callers of ip_route_output_slow() assumed their flow argument was
constant.
ip_route_output_slow() must leave with original content of various
fields.
Thanks to Yurij M. Plotnikov for providing a bug report including a
program to reproduce the problem.
Reported-by: Yurij M. Plotnikov <Yurij.Plotnikov@oktetlabs.ru>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/ipv4/route.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index bcacf54..0f63240 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2633,19 +2633,15 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
unsigned int flags = 0;
struct fib_result res;
struct rtable *rth;
- __be32 orig_daddr;
- __be32 orig_saddr;
- int orig_oif;
+ __be32 orig_daddr = fl4->daddr;
+ __be32 orig_saddr = fl4->saddr;
+ int orig_oif = fl4->flowi4_oif;
res.fi = NULL;
#ifdef CONFIG_IP_MULTIPLE_TABLES
res.r = NULL;
#endif
- orig_daddr = fl4->daddr;
- orig_saddr = fl4->saddr;
- orig_oif = fl4->flowi4_oif;
-
fl4->flowi4_iif = net->loopback_dev->ifindex;
fl4->flowi4_tos = tos & IPTOS_RT_MASK;
fl4->flowi4_scope = ((tos & RTO_ONLINK) ?
@@ -2816,6 +2812,9 @@ make_route:
out:
rcu_read_unlock();
+ fl4->flowi4_oif = orig_oif;
+ fl4->daddr = orig_daddr;
+ fl4->saddr = orig_saddr;
return rth;
}
next prev parent reply other threads:[~2012-02-04 12:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-03 6:25 Connect hangs for a while before returns -1 with ECONNREFUSED on 3.2 for loopback Yurij M. Plotnikov
2012-02-03 14:38 ` Eric Dumazet
2012-02-03 15:15 ` Eric Dumazet
2012-02-04 12:26 ` Eric Dumazet [this message]
2012-02-04 15:48 ` Julian Anastasov
2012-02-04 16:58 ` Eric Dumazet
2012-02-04 17:39 ` Julian Anastasov
2012-02-04 19:43 ` Eric Dumazet
2012-02-04 20:51 ` Julian Anastasov
2012-02-04 21:26 ` Eric Dumazet
2012-02-04 20:39 ` David Miller
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=1328358402.2731.11.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=Yurij.Plotnikov@oktetlabs.ru \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.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