[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180611183516.GA2729@outlook.office365.com>
Date: Mon, 11 Jun 2018 11:35:17 -0700
From: Andrei Vagin <avagin@...tuozzo.com>
To: Maciej Żenczykowski <zenczykowski@...il.com>
Cc: "David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Linux NetDev <netdev@...r.kernel.org>,
Pavel Emelyanov <xemul@...tuozzo.com>
Subject: Re: net: do not allow changing SO_REUSEADDR/SO_REUSEPORT on bound
sockets
Cc: Pavel
On Fri, Jun 08, 2018 at 03:07:30AM -0700, Maciej Żenczykowski wrote:
> I think we probably need to make sk->sk_reuse back into a boolean.
> (ie. eliminate SK_FORCE_REUSE)
>
> Then add a new tcp/udp sk->ignore_bind_conflicts boolean setting...
> (ie. not just for tcp, but sol_socket) [or perhaps SO_REPAIR,
> sk->repair or something]
>
> What I'm not certain of is exactly what sorts of conflicts it should ignore...
> all? probably not, still seems utterly wrong to allow creation of 2 connected
> tcp sockets with identical 5-tuples.
It is required when we are restoring i_b_c sockets on a server side. In
this cases, they all have the same source address of a listening socket.
To restore these sockets, we need to be able to create a listening socket
and all i_b_c sockets and bind them all to the same source address.
BTW: Here is an example of how tcp_repair works:
https://github.com/avagin/tcp-repair/blob/master/tcp-constructor.c
>
> Would it only ignore conflicts against other i_b_c sockets?
> ie. set it on all sockets as we're repairing, then clear it on them
> all once we're done?
TCP_REPAIR (which is set SK_FORCE_REUSE) is used to restore only i_b_c
sockets. SK_FORCE_REUSE is needed to ignore bind conflicts for repaired
sockets. It ignores conflicts agains other i_b_c and listen sockets.
The current idea is that CRIU will restore listening sockets first, and
them it will restore i_b_c sockets.
Pls, take a look at the attached patch.
>
> and ignore all the fast caching when checking conflicts for an i_b_c socket?
>
> For CRIU is it safe to assume we're restoring an entire namespace into
> a new namespace?
No. It isn't. CRIU can restore processes in an existing network namespace.
>
> Could we perhaps instead allow a new namespace to ignore bind conflicts until
> we flip it into enforcing mode?
No, we could not
View attachment "0001-net-split-sk_reuse-into-sk_reuse-and-sk_force_reuse.patch" of type "text/plain" (4035 bytes)
Powered by blists - more mailing lists