couple of sctp fixes for 0ca50d12fe46
Subsystems (3)
Marcelo Ricardo Leitner
maintainercover 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
Marcelo Ricardo Leitner
maintainerPATCH 1/2 sctp: fix dst leak
Commit 0ca50d12fe46 failed to release the reference to dst entries that it decided to skip.
--- net/sctp/protocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sctp/protocol.c +3 -1
@@ -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
Marcelo Ricardo Leitner
maintainerPATCH 2/2 sctp: add routing output fallback
In reply to Marcelo Ricardo LeitnerCommit 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.
--- net/sctp/protocol.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/sctp/protocol.c +7 -1
@@ -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
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 fallbacknet/sctp/protocol.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)Signature · 1 line
2.4.3
for the series
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 fallbacknet/sctp/protocol.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
For the series
-vlad