Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
X.organic
SRB2
Commits
8a6beee5
Commit
8a6beee5
authored
6 months ago
by
Lactozilla
Browse files
Options
Downloads
Plain Diff
Merge branch 'lift-ban-limits' into 'next'
Lift ban limits See merge request
STJr/SRB2!2502
parents
e6124eae
522b354b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/netcode/i_tcp.c
+13
-8
13 additions, 8 deletions
src/netcode/i_tcp.c
with
13 additions
and
8 deletions
src/netcode/i_tcp.c
+
13
−
8
View file @
8a6beee5
...
...
@@ -37,6 +37,7 @@
#endif
#include
"../doomdef.h"
#include
"../z_zone.h"
#ifdef USE_WINSOCK1
#include
<winsock.h>
...
...
@@ -124,8 +125,6 @@ typedef union
static
boolean
UPNP_support
=
true
;
#endif // HAVE_MINIUPNC
#define MAXBANS 100
#include
"../i_system.h"
#include
"i_net.h"
#include
"d_net.h"
...
...
@@ -173,8 +172,8 @@ static mysockaddr_t clientaddress[MAXNETNODES+1];
static
mysockaddr_t
broadcastaddress
[
MAXNETNODES
+
1
];
static
size_t
broadcastaddresses
=
0
;
static
boolean
nodeconnected
[
MAXNETNODES
+
1
];
static
mysockaddr_t
banned
[
MAXBANS
]
;
static
UINT8
bannedmask
[
MAXBANS
]
;
static
mysockaddr_t
*
banned
;
static
UINT8
*
bannedmask
;
static
size_t
numbans
=
0
;
static
boolean
SOCK_bannednode
[
MAXNETNODES
+
1
];
/// \note do we really need the +1?
...
...
@@ -1261,9 +1260,9 @@ static boolean SOCK_Ban(INT32 node)
{
if
(
node
>
MAXNETNODES
)
return
false
;
if
(
numbans
==
MAXBANS
)
return
false
;
banned
=
Z_Realloc
(
banned
,
sizeof
(
*
banned
)
*
(
numbans
+
1
),
PU_STATIC
,
NULL
);
bannedmask
=
Z_Realloc
(
bannedmask
,
sizeof
(
*
bannedmask
)
*
(
numbans
+
1
),
PU_STATIC
,
NULL
);
M_Memcpy
(
&
banned
[
numbans
],
&
clientaddress
[
node
],
sizeof
(
mysockaddr_t
));
if
(
banned
[
numbans
].
any
.
sa_family
==
AF_INET
)
{
...
...
@@ -1286,7 +1285,7 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
struct
my_addrinfo
*
ai
,
*
runp
,
hints
;
int
gaie
;
if
(
numbans
==
MAXBANS
||
!
address
)
if
(
!
address
)
return
false
;
memset
(
&
hints
,
0x00
,
sizeof
(
hints
));
...
...
@@ -1301,8 +1300,10 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
runp
=
ai
;
while
(
runp
!=
NULL
&&
numbans
!=
MAXBANS
)
while
(
runp
!=
NULL
)
{
banned
=
Z_Realloc
(
banned
,
sizeof
(
*
banned
)
*
(
numbans
+
1
),
PU_STATIC
,
NULL
);
bannedmask
=
Z_Realloc
(
bannedmask
,
sizeof
(
*
bannedmask
)
*
(
numbans
+
1
),
PU_STATIC
,
NULL
);
memcpy
(
&
banned
[
numbans
],
runp
->
ai_addr
,
runp
->
ai_addrlen
);
if
(
mask
)
...
...
@@ -1332,6 +1333,10 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
static
void
SOCK_ClearBans
(
void
)
{
numbans
=
0
;
Z_Free
(
banned
);
banned
=
NULL
;
Z_Free
(
bannedmask
);
bannedmask
=
NULL
;
}
boolean
I_InitTcpNetwork
(
void
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment