Beispiel #1
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket(void)
{
    const char * s;
    const char * c;

    MSG_BeginReading(&net_message);
    MSG_ReadLong(&net_message); // skip the -1 marker

    s = MSG_ReadStringLine(&net_message);

    Cmd_TokenizeString(s, false);

    c = Cmd_Argv(0);
    Com_DPrintf("Packet %s : %s\n", NET_AdrToString(net_from), c);

    if (!strcmp(c, "ping"))
        SVC_Ping();
    else if (!strcmp(c, "ack"))
        SVC_Ack();
    else if (!strcmp(c, "status"))
        SVC_Status();
    else if (!strcmp(c, "info"))
        SVC_Info();
    else if (!strcmp(c, "getchallenge"))
        SVC_GetChallenge();
    else if (!strcmp(c, "connect"))
        SVC_DirectConnect();
    else if (!strcmp(c, "rcon"))
        SVC_RemoteCommand();
    else
        Com_Printf("bad connectionless packet from %s:\n%s\n", NET_AdrToString(net_from), s);
}
Beispiel #2
0
/*
 * =================
 * SV_ConnectionlessPacket
 *
 * A connectionless packet has four leading 0xff
 * characters to distinguish it from a game channel.
 * Clients that are in the game can still send
 * connectionless packets.
 * =================
 */
void SV_ConnectionlessPacket(void)
{
    char *s;
    char *c;

    // r1ch fix: make sure we never talk to ourselves
//	if (NET_IsLocalAddress (net_from.ip[0] == 127) && !NET_IsLocalHost(net_from) && ShortSwap(net_from.port) == server_port)

/*	if ( (net_from.ip[0] == 127) && (net_from.type != NA_LOOPBACK) && (ShortSwap(net_from.port) == server_port) )
 *      {
 *              Com_DPrintf ("dropped %d byte connectionless packet from self! (spoofing attack?)\n", net_message.cursize);
 *              return;
 *      }*/

    MSG_BeginReading(&net_message);
    MSG_ReadLong(&net_message);                 // skip the -1 marker

    s = MSG_ReadStringLine(&net_message);

    Cmd_TokenizeString(s, false);

    c = Cmd_Argv(0);
    Com_DPrintf("Packet %s : %s\n", NET_AdrToString(net_from), c);

    if (!strcmp(c, "ping"))
    {
        SVC_Ping();
    }
    else if (!strcmp(c, "ack"))
    {
        SVC_Ack();
    }
    else if (!strcmp(c, "status"))
    {
        SVC_Status();
    }
    else if (!strcmp(c, "info"))
    {
        SVC_Info();
    }
    else if (!strcmp(c, "getchallenge"))
    {
        SVC_GetChallenge();
    }
    else if (!strcmp(c, "connect"))
    {
        SVC_DirectConnect();
    }
    else if (!strcmp(c, "rcon"))
    {
        SVC_RemoteCommand();
    }
    else
    {
        Com_Printf("bad connectionless packet from %s:\n%s\n"
                   , NET_AdrToString(net_from), s);
    }
}
Beispiel #3
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket (void)
{
    char	*s;
    char	*c;
    int s_token = 0;
    // r1ch fix: make sure we never talk to ourselves
//	if (NET_IsLocalAddress (net_from.ip[0] == 127) && !NET_IsLocalHost(net_from) && ShortSwap(net_from.port) == server_port)
    /*	if ( (net_from.ip[0] == 127) && (net_from.type != NA_LOOPBACK) && (ShortSwap(net_from.port) == server_port) )
    	{
    		Com_DPrintf ("dropped %d byte connectionless packet from self! (spoofing attack?)\n", net_message.cursize);
    		return;
    	}*/

    MSG_BeginReading (&net_message);
    MSG_ReadLong (&net_message);		// skip the -1 marker

    s = MSG_ReadStringLine (&net_message);

    Cmd_TokenizeString (s, false);

    c = Cmd_Argv(0);
    Com_DPrintf ("Packet %s : %s\n", NET_AdrToString(net_from), c);

    if ((s_token = Q_STLookup(&packet_stable, c)) != -1) {
        if (s_token == s_ping)
            SVC_Ping ();
        else if (s_token == s_ack)
            SVC_Ack ();
        else if (s_token == s_status)
            SVC_Status ();
        else if (s_token == s_info)
            SVC_Info ();
        else if (s_token == s_getchallenge)
            SVC_GetChallenge ();
        else if (s_token == s_connect)
            SVC_DirectConnect ();
        else if (s_token == s_rcon)
            SVC_RemoteCommand ();
    } else
        Com_Printf ("bad connectionless packet from %s:\n%s\n"
                    , NET_AdrToString (net_from), s);
}