* [PATCH] net: tcp response should set oif only if it is L3 master
@ 2016-11-09 17:07 David Ahern
2016-11-10 1:40 ` Lorenzo Colitti
2016-11-10 3:32 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: David Ahern @ 2016-11-09 17:07 UTC (permalink / raw)
To: netdev; +Cc: lorenzo, David Ahern
Lorenzo noted an Android unit test failed due to e0d56fdd7342:
"The expectation in the test was that the RST replying to a SYN sent to a
closed port should be generated with oif=0. In other words it should not
prefer the interface where the SYN came in on, but instead should follow
whatever the routing table says it should do."
Revert the change to ip_send_unicast_reply and tcp_v6_send_response such
that the oif in the flow is set to the skb_iif only if skb_iif is an L3
master.
Fixes: e0d56fdd7342 ("net: l3mdev: remove redundant calls")
Reported-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
net/ipv4/ip_output.c | 3 ++-
net/ipv6/tcp_ipv6.c | 8 ++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 03e7f7310423..7cf627b0b248 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1579,7 +1579,8 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
}
oif = arg->bound_dev_if;
- oif = oif ? : skb->skb_iif;
+ if (!oif && netif_index_is_l3_master(net, skb->skb_iif))
+ oif = skb->skb_iif;
flowi4_init_output(&fl4, oif,
IP4_REPLY_MARK(net, skb->mark),
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 5a27ab4eab39..6ca23c2e76f7 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -818,8 +818,12 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
fl6.flowi6_proto = IPPROTO_TCP;
if (rt6_need_strict(&fl6.daddr) && !oif)
fl6.flowi6_oif = tcp_v6_iif(skb);
- else
- fl6.flowi6_oif = oif ? : skb->skb_iif;
+ else {
+ if (!oif && netif_index_is_l3_master(net, skb->skb_iif))
+ oif = skb->skb_iif;
+
+ fl6.flowi6_oif = oif;
+ }
fl6.flowi6_mark = IP6_REPLY_MARK(net, skb->mark);
fl6.fl6_dport = t1->dest;
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] net: tcp response should set oif only if it is L3 master
2016-11-09 17:07 [PATCH] net: tcp response should set oif only if it is L3 master David Ahern
@ 2016-11-10 1:40 ` Lorenzo Colitti
2016-11-10 3:32 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Colitti @ 2016-11-10 1:40 UTC (permalink / raw)
To: David Ahern; +Cc: netdev@vger.kernel.org
On Thu, Nov 10, 2016 at 2:07 AM, David Ahern <dsa@cumulusnetworks.com> wrote:
> Revert the change to ip_send_unicast_reply and tcp_v6_send_response such
> that the oif in the flow is set to the skb_iif only if skb_iif is an L3
> master.
This fixes the IPv4 and IPv6 tests, thanks!
Tested-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: Lorenzo Colitti <lorenzo@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: tcp response should set oif only if it is L3 master
2016-11-09 17:07 [PATCH] net: tcp response should set oif only if it is L3 master David Ahern
2016-11-10 1:40 ` Lorenzo Colitti
@ 2016-11-10 3:32 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-11-10 3:32 UTC (permalink / raw)
To: dsa; +Cc: netdev, lorenzo
From: David Ahern <dsa@cumulusnetworks.com>
Date: Wed, 9 Nov 2016 09:07:26 -0800
> Lorenzo noted an Android unit test failed due to e0d56fdd7342:
> "The expectation in the test was that the RST replying to a SYN sent to a
> closed port should be generated with oif=0. In other words it should not
> prefer the interface where the SYN came in on, but instead should follow
> whatever the routing table says it should do."
>
> Revert the change to ip_send_unicast_reply and tcp_v6_send_response such
> that the oif in the flow is set to the skb_iif only if skb_iif is an L3
> master.
>
> Fixes: e0d56fdd7342 ("net: l3mdev: remove redundant calls")
> Reported-by: Lorenzo Colitti <lorenzo@google.com>
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Applied, thanks David.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-10 3:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-09 17:07 [PATCH] net: tcp response should set oif only if it is L3 master David Ahern
2016-11-10 1:40 ` Lorenzo Colitti
2016-11-10 3:32 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox