[07/15] inet: raw -- Skip IP_FREEBIND for ipv6 SOCK_RAW sockets

Submitted by Cyrill Gorcunov on Sept. 13, 2018, 7:57 p.m.

Details

Message ID 20180913195758.30566-8-gorcunov@gmail.com
State Accepted
Series "net: Add support for raw inet sockets"
Headers show

Commit Message

Cyrill Gorcunov Sept. 13, 2018, 7:57 p.m.
From: Kirill Tkhai <ktkhai@virtuozzo.com>

IP_FREEBIND is not supported for SOCK_RAW ipv6 sockets.
See kernel rawv6_setsockopt() for the details.

For the rest of sockets, where they begin to support it:
the actual magic happens in do_ipv6_setsockopt(), and
IPV6_ADDRFORM optname changes sk->sk_prot to refer
to tcp_prot, udp_prot and udplite_prot, which contains
link to ip_setsockopt().

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/sk-inet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/sk-inet.c b/criu/sk-inet.c
index 0850350a3480..3a5fd8ff4e6f 100644
--- a/criu/sk-inet.c
+++ b/criu/sk-inet.c
@@ -833,7 +833,7 @@  int inet_bind(int sk, struct inet_sk_info *ii)
 	 * sockets could not be bound to them in this moment
 	 * without setting IP_FREEBIND.
 	 */
-	if (ii->ie->family == AF_INET6) {
+	if (ii->ie->family == AF_INET6 && ii->ie->type != SOCK_RAW) {
 		int yes = 1;
 
 		if (restore_opt(sk, SOL_IP, IP_FREEBIND, &yes))