Svante Signell, le mar. 29 janv. 2019 18:37:02 +0100, a ecrit: > On Sat, 2016-01-09 at 00:37 +0100, Samuel Thibault wrote: > > Svante Signell, on Fri 08 Jan 2016 21:59:56 +0100, wrote: > > > > Yes. And SO_REUSEADDR won't help there :) > > > > > > Samuel, this is exactly what the SO_REUSEADDR in pflocal should do: > > > > Except no Unix makes it do that. > > Well, it works for GNU/Linux.
No, it doesn't actually. The function returns 0, but GNU/Linux doesn't actually do anything, one actually has to unlink the old socket by hand to be able to reuse the path. > > > Unlink the old socket and create a new one with the same name. (I > > > wonder how GNU/Linux is implementing this?) > > > > It doesn't. > > How is it implemented then? I need to find a good testcase for this. It just doesn't implement it. See for instance (in Python to make it simpler): #!/usr/bin/python3 import socket s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind("/tmp/foo") s.close() Try to run that twice on Linux, it'll fail. Really, SO_REUSEADDR on local sockets doesn't make sense, it should just not be called on local sockets. Samuel