netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46
@ 2015-09-02 19:20 Marcelo Ricardo Leitner
  2015-09-02 19:20 ` [PATCH net 1/2] sctp: fix dst leak Marcelo Ricardo Leitner
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-09-02 19:20 UTC (permalink / raw)
  To: netdev; +Cc: linux-sctp, Neil Horman, Vlad Yasevich

These are two fixes for sctp after my patch on 0ca50d12fe46 ("sctp: fix
src address selection if using secondary addresses")

The first, fix a dst leak on those it decided to skip.

The second, adds the fallback on src selection that Vlad had asked
about. Unfortunatelly a lot of ipvs setups relies on the old behavior
and I don't see a better fix for it.

Please consider both to -stable tree.

Thanks!

Marcelo Ricardo Leitner (2):
  sctp: fix dst leak
  sctp: add routing output fallback

 net/sctp/protocol.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.4.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/2] sctp: fix dst leak
  2015-09-02 19:20 [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46 Marcelo Ricardo Leitner
@ 2015-09-02 19:20 ` Marcelo Ricardo Leitner
  2015-09-02 19:20 ` [PATCH net 2/2] sctp: add routing output fallback Marcelo Ricardo Leitner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-09-02 19:20 UTC (permalink / raw)
  To: netdev; +Cc: linux-sctp, Neil Horman, Vlad Yasevich

Commit 0ca50d12fe46 failed to release the reference to dst entries that
it decided to skip.

Fixes: 0ca50d12fe46 ("sctp: fix src address selection if using secondary addresses")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 net/sctp/protocol.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 4345790ad3266c353eeac5398593c2a9ce4effda..4abf94d4cce769371260b42d13c38dbe5776c809 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -511,8 +511,10 @@ static void sctp_v4_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
 		 */
 		odev = __ip_dev_find(sock_net(sk), laddr->a.v4.sin_addr.s_addr,
 				     false);
-		if (!odev || odev->ifindex != fl4->flowi4_oif)
+		if (!odev || odev->ifindex != fl4->flowi4_oif) {
+			dst_release(&rt->dst);
 			continue;
+		}
 
 		dst = &rt->dst;
 		break;
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/2] sctp: add routing output fallback
  2015-09-02 19:20 [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46 Marcelo Ricardo Leitner
  2015-09-02 19:20 ` [PATCH net 1/2] sctp: fix dst leak Marcelo Ricardo Leitner
@ 2015-09-02 19:20 ` Marcelo Ricardo Leitner
  2015-09-03 13:58 ` [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46 Neil Horman
  2015-09-03 14:37 ` Vlad Yasevich
  3 siblings, 0 replies; 5+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-09-02 19:20 UTC (permalink / raw)
  To: netdev; +Cc: linux-sctp, Neil Horman, Vlad Yasevich

Commit 0ca50d12fe46 added a restriction that the address must belong to
the output interface, so that sctp will use the right interface even
when using secondary addresses.

But it breaks IPVS setups, on which people is used to attach VIP
addresses to loopback interface on real servers. It's preferred to
attach to the interface actually in use, but it's a very common setup
and that used to work.

This patch then saves the first routing good result, even if it would be
going out through an interface that doesn't have that address. If no
better hit found, it's then used. This effectively restores the original
behavior if no better interface could be found.

Fixes: 0ca50d12fe46 ("sctp: fix src address selection if using secondary addresses")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 net/sctp/protocol.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 4abf94d4cce769371260b42d13c38dbe5776c809..b7143337e4fa025fdb473732fdc064503e731dd4 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -506,16 +506,22 @@ static void sctp_v4_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
 		if (IS_ERR(rt))
 			continue;
 
+		if (!dst)
+			dst = &rt->dst;
+
 		/* Ensure the src address belongs to the output
 		 * interface.
 		 */
 		odev = __ip_dev_find(sock_net(sk), laddr->a.v4.sin_addr.s_addr,
 				     false);
 		if (!odev || odev->ifindex != fl4->flowi4_oif) {
-			dst_release(&rt->dst);
+			if (&rt->dst != dst)
+				dst_release(&rt->dst);
 			continue;
 		}
 
+		if (dst != &rt->dst)
+			dst_release(dst);
 		dst = &rt->dst;
 		break;
 	}
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46
  2015-09-02 19:20 [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46 Marcelo Ricardo Leitner
  2015-09-02 19:20 ` [PATCH net 1/2] sctp: fix dst leak Marcelo Ricardo Leitner
  2015-09-02 19:20 ` [PATCH net 2/2] sctp: add routing output fallback Marcelo Ricardo Leitner
@ 2015-09-03 13:58 ` Neil Horman
  2015-09-03 14:37 ` Vlad Yasevich
  3 siblings, 0 replies; 5+ messages in thread
From: Neil Horman @ 2015-09-03 13:58 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner; +Cc: netdev, linux-sctp, Vlad Yasevich

On Wed, Sep 02, 2015 at 04:20:20PM -0300, Marcelo Ricardo Leitner wrote:
> These are two fixes for sctp after my patch on 0ca50d12fe46 ("sctp: fix
> src address selection if using secondary addresses")
> 
> The first, fix a dst leak on those it decided to skip.
> 
> The second, adds the fallback on src selection that Vlad had asked
> about. Unfortunatelly a lot of ipvs setups relies on the old behavior
> and I don't see a better fix for it.
> 
> Please consider both to -stable tree.
> 
> Thanks!
> 
> Marcelo Ricardo Leitner (2):
>   sctp: fix dst leak
>   sctp: add routing output fallback
> 
>  net/sctp/protocol.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> -- 
> 2.4.3
> 
> 

for the series
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46
  2015-09-02 19:20 [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46 Marcelo Ricardo Leitner
                   ` (2 preceding siblings ...)
  2015-09-03 13:58 ` [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46 Neil Horman
@ 2015-09-03 14:37 ` Vlad Yasevich
  3 siblings, 0 replies; 5+ messages in thread
From: Vlad Yasevich @ 2015-09-03 14:37 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner, netdev; +Cc: linux-sctp, Neil Horman

On 09/02/2015 03:20 PM, Marcelo Ricardo Leitner wrote:
> These are two fixes for sctp after my patch on 0ca50d12fe46 ("sctp: fix
> src address selection if using secondary addresses")
> 
> The first, fix a dst leak on those it decided to skip.
> 
> The second, adds the fallback on src selection that Vlad had asked
> about. Unfortunatelly a lot of ipvs setups relies on the old behavior
> and I don't see a better fix for it.
> 
> Please consider both to -stable tree.
> 
> Thanks!
> 
> Marcelo Ricardo Leitner (2):
>   sctp: fix dst leak
>   sctp: add routing output fallback
> 
>  net/sctp/protocol.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 

For the series

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-03 14:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-02 19:20 [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46 Marcelo Ricardo Leitner
2015-09-02 19:20 ` [PATCH net 1/2] sctp: fix dst leak Marcelo Ricardo Leitner
2015-09-02 19:20 ` [PATCH net 2/2] sctp: add routing output fallback Marcelo Ricardo Leitner
2015-09-03 13:58 ` [PATCH net 0/2] couple of sctp fixes for 0ca50d12fe46 Neil Horman
2015-09-03 14:37 ` Vlad Yasevich

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).