document why we carry the DF flag in payload

This commit is contained in:
Matthias Radestock committed 2015-04-25 12:36:05 +01:00
1 parent d82f60f18b
commit ff49bb5125
1 file changed
+6
+6
View File
@@ -191,6 +191,12 @@ func NewNaClEncryptor(prefix []byte, conn *LocalConnection, df bool) *NaClEncryp
func (ne *NaClEncryptor) Bytes() []byte {
plaintext := ne.NonEncryptor.Bytes()
offsetFlags := ne.offset
// We carry the DF flag in the (unencrypted portion of the)
// payload, rather than just extracting it from the packet headers
// at the receiving end, since we do not trust routers not to mess
// with headers. As we have different decryptors for non-DF and
// DF, that would result in hard to track down packet drops due to
// crypto errors.
if ne.df {
offsetFlags |= (1 << 15)
}