Skip to contentSkip to conversation

Patch "sctp: full support for ipv6 ip_nonlocal_bind & IP_FREEBIND" has been added to the 4.13-stable tree

PATCH [email protected] 1 participant 1 message Nov 15, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

sctp: full support for ipv6 ip_nonlocal_bind & IP_FREEBIND

to the 4.13-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
sctp-full-support-for-ipv6-ip_nonlocal_bind-ip_freebind.patch
and it can be found in the queue-4.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Nov 15 17:25:34 CET 2017

From: Laszlo Toth <[email protected]>
Date: Mon, 23 Oct 2017 19:19:33 +0200
Subject: sctp: full support for ipv6 ip_nonlocal_bind & IP_FREEBIND

From: Laszlo Toth <[email protected]>

[ Upstream commit b71d21c274eff20a9db8158882b545b141b73ab8 ]

Commit 9b9742022888 ("sctp: support ipv6 nonlocal bind") introduced support for the above options as v4 sctp did, so patched sctp_v6_available().

In the v4 implementation it's enough, because sctp_inet_bind_verify() just returns with sctp_v4_available(). However sctp_inet6_bind_verify() has an extra check before that for link-local scope_id, which won't respect the above options.

Added the checks before calling ipv6_chk_addr(), but not before the validation of scope_id.

before (w/ both options):
./v6test fe80::10 sctp
bind failed, errno: 99 (Cannot assign requested address) ./v6test fe80::10 tcp
bind success, errno: 0 (Success)

after (w/ both options):
./v6test fe80::10 sctp
bind success, errno: 0 (Success)

---
 net/sctp/ipv6.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/sctp/ipv6.c +4 -2
@@ -882,8 +882,10 @@ static int sctp_inet6_bind_verify(struct
 			net = sock_net(&opt->inet.sk);
 			rcu_read_lock();
 			dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id);
-			if (!dev ||
-			    !ipv6_chk_addr(net, &addr->v6.sin6_addr, dev, 0)) {
+			if (!dev || !(opt->inet.freebind ||
+				      net->ipv6.sysctl.ip_nonlocal_bind ||
+				      ipv6_chk_addr(net, &addr->v6.sin6_addr,
+						    dev, 0))) {
 				rcu_read_unlock();
 				return 0;
 			}

Patches currently in stable-queue which might be from [email protected] are

queue-4.13/sctp-full-support-for-ipv6-ip_nonlocal_bind-ip_freebind.patch