PrismarineJS / PrismarineJS/node-minecraft-protocol

Cannot join server if handshake packet contains 0xfe

Open
#685 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

non-vanilla
Dominant language
JavaScript
Stars
1.4k
Forks
290
Avg merge
4d 8h
Merged PRs (30d)
7

Description

This problem is related to the processing of legacy server list ping packet. As written in framing.js

if (this.recognizeLegacyPing && this.buffer[0] === LEGACY_PING_PACKET_ID) {

and client.js

this.splitter.recognizeLegacyPing = state === states.HANDSHAKING

A packet starting with 0xfe would be regarded as legacy ping packet. However, my situation is that this 0xfe is not legacy ping packet id, but part of the varint indicating the packet length, so the handshake packet is ignored and player just get timed out. Because i was running this server behind a BungeeCord proxy with ip forwarding turned on, the handshake packet could be lengthy, thus may cause the above problem. My temporary workaround is just changing the corresponding line in framing.js to

if (false && this.buffer[0] === LEGACY_PING_PACKET_ID) {

and it worked. Is there any less hacky way to fix this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in framing.js and client.js, tracing how recognizeLegacyPing is enabled during handshaking and how the first byte is interpreted. Reproduce the lengthy handshake case behind BungeeCord with IP forwarding, then verify that a handshake whose length varint begins with 0xfe is processed normally without breaking legacy server-list ping handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.