Skip to contentSkip to conversation

couple of sctp fixes for 0ca50d12fe46

PATCH In review Marcelo Ricardo Leitner 3 participants 5 messages Sep 2, 2015 – Sep 3, 2015

Subsystems (3)
lore
Share & tools
lore

Marcelo Ricardo Leitner

author maintainer
#0 lore raw

cover couple of sctp fixes for 0ca50d12fe46

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(-)
Signature · 1 line
2.4.3
author maintainer
#1 lore raw

PATCH 1/2 sctp: fix dst leak

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")
---
 net/sctp/protocol.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/sctp/protocol.c +3 -1
index 4345790ad3266c353eeac5398593c2a9ce4effda..4abf94d4cce769371260b42d13c38dbe5776c809 100644
@@ -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;
Signature · 1 line
2.4.3
author maintainer
#2 lore raw

PATCH 2/2 sctp: add routing output fallback

In reply to Marcelo Ricardo Leitner

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")
---
 net/sctp/protocol.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
net/sctp/protocol.c +7 -1
index 4abf94d4cce769371260b42d13c38dbe5776c809..b7143337e4fa025fdb473732fdc064503e731dd4 100644
@@ -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;
 	}
Signature · 1 line
2.4.3
Acked-by on the v1 series
#3 lore raw
In reply to Marcelo Ricardo Leitner
Quoted 11 lines · Marcelo Ricardo Leitner

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.

Quoted 13 lines

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(-)
Signature · 1 line
2.4.3

for the series

Acked-by on the v1 series
#4 lore raw
In reply to Marcelo Ricardo Leitner
Quoted 11 lines · Marcelo Ricardo Leitner

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.

Quoted 9 lines

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

-vlad