Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ping Response: Skip 2 bytes for message size #275

Closed
wants to merge 1 commit into from

Conversation

stevarino
Copy link
Contributor

Unsure if this is the right way as I can find no documentation on this, but should fix #274

@extremeheat
Copy link
Member

This is not correct fix, as server advertisement would also be incorrect (so we should fix inside server/advertisement). I believe the mechanics of this may have changed from a prior version

@stevarino
Copy link
Contributor Author

stevarino commented Sep 13, 2022

This function is upstream of server/advertisement, correct? Further server/advertisement receives a utf-8 string so we could not do a two-byte adjustment (easily) on that input.

The output of server/advertisement is where I discovered this issue, but we typically don't use the field this affects (header):

ServerAdvertisement {
  motd: 'BlahBlah',
  levelName: 'My World',
  playersOnline: '1',
  playersMax: '5',
  gamemode: 'Creative',
  serverId: '13124841751394787494',
  protocol: '554',
  version: '1.19.40.20',
  header: '\x00VMCPE'  # should be 'MCPE'
}

@stevarino
Copy link
Contributor Author

I guess the "correctest" fix would be to treat pong return value as a binary non-null-terminated string with two-byte length prepended and parse it accordingly, but the end result would be the same.

@extremeheat
Copy link
Member

Yeah, I don't think this is a problem (minecraft identifies the server with or without a length header) but it's possible this is something that should be handled at RakNet level. Since RakNet unconnected pong data is not necessarily a length-prefixed string (could be an integer or some other binary structure) we may want to return a Buffer that can be skipped 2 bytes inside bedrock-protocol for the actual string.

In RakNet, the pong data is just written as a non-length prefixed string
https://github.dev/extremeheat/fb-raknet/blob/9af9fb2d74c56c87d54071d7aac93cf0c28b110a/Source/RakPeer.cpp#L2285-L2286

@rom1504
Copy link
Member

rom1504 commented Sep 30, 2022

do you plan to finish this ?

@rom1504
Copy link
Member

rom1504 commented Mar 4, 2023

old

@rom1504 rom1504 closed this Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ping function (server advertisement) includes packet size in string header
3 participants