Waterfall/BungeeCord-Patches/0020-Add-a-property-to-accept-invalid-ping-packets.patch
Shane Freeder 097888c72a
Updated Upstream (BungeeCord)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

BungeeCord Changes:
78ca16df Minecraft 1.19.1 support
adc32d5a #3367: Add linux aarch64 native epoll support
12e45148 #3355,#3357: Fix possible NPE's in LoginEvent & PreLoginEvent
2022-07-27 19:35:10 +01:00

34 lines
1.3 KiB
Diff

From 23174941bfb0c6555ef478b0043823b1ba60594e Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Sun, 7 Feb 2016 00:01:19 -0700
Subject: [PATCH] Add a property to accept invalid ping packets
This is disabled by default, as I don't wanna accept invalid packets
You can enable it by setting '-Dwaterfall.acceptInvalidPackets=true' at the command line
Fixes #23
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index 562afbaa..fd03d152 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -300,10 +300,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
thisState = State.PING;
}
+ private static final boolean ACCEPT_INVALID_PACKETS = Boolean.parseBoolean(System.getProperty("waterfall.acceptInvalidPackets", "false"));
+
@Override
public void handle(PingPacket ping) throws Exception
{
- Preconditions.checkState( thisState == State.PING, "Not expecting PING" );
+ if (!ACCEPT_INVALID_PACKETS) {
+ Preconditions.checkState(thisState == State.PING, "Not expecting PING");
+ }
unsafe.sendPacket( ping );
disconnect( "" );
}
--
2.37.1