Skip to content

Commit 537906d

Browse files
committed
docs: clarify packet length baseline
1 parent 95a1d6f commit 537906d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

russh/src/cipher/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,13 @@ pub(crate) async fn read<R: AsyncRead + Unpin>(
311311
pub(crate) const PACKET_LENGTH_LEN: usize = 4;
312312

313313
const MINIMUM_PACKET_LEN: usize = 16;
314+
// Keep the transport limit aligned with the 256 KiB channel packet baseline.
314315
const MAXIMUM_PACKET_LEN_BASELINE: usize = 256 * 1024;
315316
const CHANNEL_DATA_PACKET_OVERHEAD: usize = 1 + 4 + 4;
316317
const CHANNEL_EXTENDED_DATA_PACKET_OVERHEAD: usize = CHANNEL_DATA_PACKET_OVERHEAD + 4;
317318
const PADDING_LENGTH_LEN: usize = 1;
319+
// SSH requires at least four bytes of padding; with 16-byte blocks, that means
320+
// a full-size channel packet can need up to 19 bytes of transport padding.
318321
const MAXIMUM_PADDING_LEN: usize = 19;
319322
const MAXIMUM_PACKET_LEN_HEADROOM: usize =
320323
PADDING_LENGTH_LEN + CHANNEL_EXTENDED_DATA_PACKET_OVERHEAD + MAXIMUM_PADDING_LEN;

0 commit comments

Comments
 (0)