wine/dlls/winsock/socket.c: Force SO_REUSEADDR on before bind()/Ignore SO_DONTROUTE

Martin Wilck Martin.Wilck at Fujitsu-Siemens.com
Mon Dec 9 08:44:14 CST 2002


Am Mon, 2002-12-09 um 14.57 schrieb Christoph Frick:

> > I'd like to know what remote addresses exactly the apps call bind() for,
> > and in what order. Perhaps there are subtle differences in the way
> > EADDRINUSE and SO_REUSEADDR are handled.
> 
> I can basically describe you what this games do network-wise and/or i can
> provide you with traces (with and without patch) - what do you prefer? What i
> can not do is testing in windows.

Run with -debugmsg trace+winsock. You may also need to set
DEBUG_SOCKADDR to 1 (look for it close to the top of socket.c),
and recompile and reinstall the winsock DLL. Oh, and given the
"NetTrans" thing below, run with "trace+reg", too.
 
> > However the patch implements the first behavior (ignore) whereas 
> > the Windows TCP/IP transport behaves as the second (later calls to
> > getsockopt() refelect the SO_DONTROUTE settings, which seems to have no
> > further effect).
> 
> So closer to windows would be store and ignore. In general i wonder, if
> windows does this always or if this depends somehow on the "device" the socket
> is finally bound to - or in other words: is always the same code on windows in
> charge or could it be that this might be implemened e.g. by a NIC driver.

It is the "Service provider" which in this case is Microsoft TCP/IP
(think of it as one of the "protocols" Windows allows you to install in
the Network settings). Other service providers are IPX, NetBEUI, or
Appletalk. Since TCP/IP is pretty important nowadays, if Microsoft
TCP/IP ignores SO_DONTROUTE (actually, it seems to ignore the
MSG_DONTROUTE flag to send(), too!) it is probably ignored almost
everywhere in the MS world.

Wine's Winsock implementation is not (yet) modular - it doesn't use
service providers.

> Why i ask: please see my mail to wine-devel from 2002-10-25; the game also
> checks the .../NetTrans/... settings.

I am not sure what these are for. They seem to be Win95/98 specific - my
Win2k box doesn't have them. It appears that for Win9x there should be
one System/Services/Class/NetTrans/000x entry for each installed
transport service provider.

> Maybe here is something missing that
> tell the game to set SO_DONTROUTE. Wine does not set them automatically like
> other hardware/driver related stuff. I really can not imagine, why a game
> should set this option explicit when it connects to an server (the ip/name is
> entered manually in this case, so the game should expect the host not in the
> same network).

Well, browsing through MSDN, the reason may be past trouble with PCs
with several network interfaces, where the game wanted to connect
through a dial-up connection rather than through a LAN (or vice-versa).
In any case it can't be much more than a hack some games were using to
work around some obscure Win9x networking limitation.

Martin

-- 
Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at Fujitsu-Siemens.com
D-33106 Paderborn           http://www.fujitsu-siemens.com/primergy








More information about the wine-devel mailing list