From 6591f16a9e03914049dc71cc772e52e42e6fc615 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 28 Mar 2003 13:27:15 +0000 Subject: [PATCH] Thanks to faded (of the tenebrae team) for provoking me to recite a lengthy explanation of NAT nightmares, and realize this very simple fix for NQ server support of clients behind NAT routers (send first message from the player socket instead of the accept socket) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2870 d7cf8633-e32d-0410-b094-e92efae38249 --- net_dgrm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/net_dgrm.c b/net_dgrm.c index b71f7f2a..fde128c0 100644 --- a/net_dgrm.c +++ b/net_dgrm.c @@ -1015,7 +1015,12 @@ static qsocket_t *_Datagram_CheckNewConnections (void) dfunc.GetSocketAddr(s->socket, &newaddr); MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr)); *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); - dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); + // LordHavoc: send from s->socket instead of acceptsock, this + // way routers usually identify the connection correctly + // (thanks to faded for provoking me to recite a lengthy + // explanation of NAT nightmares, and realize this easy + // workaround for quake) + dfunc.Write (s->socket, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); return NULL; } @@ -1072,7 +1077,11 @@ static qsocket_t *_Datagram_CheckNewConnections (void) dfunc.GetSocketAddr(newsock, &newaddr); MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr)); *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); - dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); + // LordHavoc: send from sock->socket instead of acceptsock, this way routers + // usually identify the connection correctly (thanks to faded for provoking + // me to recite a lengthy explanation of NAT nightmares, and realize this + // easy workaround for quake) + dfunc.Write (sock->socket, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); return sock; -- 2.39.2