From: Aaron Jones <me@aaronmdjones.net>
To: wireguard@lists.zx2c4.com
Subject: Re: [PATCH] Respect WG protocol reserved bytes
Date: Wed, 17 Mar 2021 12:35:56 +0000 [thread overview]
Message-ID: <f5126d40-4ea7-193a-93dd-ab816af3bb7e@aaronmdjones.net> (raw)
In-Reply-To: <9C811F88-FD21-47D0-B3FE-A14FD5BC1816@wandera.com>
[-- Attachment #1.1: Type: text/plain, Size: 886 bytes --]
On 17/03/2021 07:55, Laura Zelenku wrote:
> Packet that respects WG protocol contains Type on first byte followed by
> three reserved bytes. Because wireguard-go implementation uses element
> pools it is required to make sure that reserved bytes are cleared for
> outgoing traffic (can get dirty by "bad" clients). Clearing reserved
> bytes is also for backwards compatibility.
Encoding the message type as a little-endian 32-bit integer already
takes care of setting the reserved bytes to zero; e.g. for a packet of
message type 1 (handshake initiation), its little-endian 32-bit encoding
is the following sequence of bytes: [ 0x01 0x00 0x00 0x00 ].
This is also the approach used for checking message types on the
receiving end, so packets whose reserved bytes are non-zero are already
discarded as being those of unknown types of message.
Regards,
Aaron Jones
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-03-17 12:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 7:55 [PATCH] Respect WG protocol reserved bytes Laura Zelenku
2021-03-17 12:35 ` Aaron Jones [this message]
2021-03-17 12:53 ` Laura Zelenku
2021-03-17 13:10 ` Jason A. Donenfeld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f5126d40-4ea7-193a-93dd-ab816af3bb7e@aaronmdjones.net \
--to=me@aaronmdjones.net \
--cc=wireguard@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).