File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -311,10 +311,13 @@ pub(crate) async fn read<R: AsyncRead + Unpin>(
311311pub ( crate ) const PACKET_LENGTH_LEN : usize = 4 ;
312312
313313const MINIMUM_PACKET_LEN : usize = 16 ;
314+ // Keep the transport limit aligned with the 256 KiB channel packet baseline.
314315const MAXIMUM_PACKET_LEN_BASELINE : usize = 256 * 1024 ;
315316const CHANNEL_DATA_PACKET_OVERHEAD : usize = 1 + 4 + 4 ;
316317const CHANNEL_EXTENDED_DATA_PACKET_OVERHEAD : usize = CHANNEL_DATA_PACKET_OVERHEAD + 4 ;
317318const 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.
318321const MAXIMUM_PADDING_LEN : usize = 19 ;
319322const MAXIMUM_PACKET_LEN_HEADROOM : usize =
320323 PADDING_LENGTH_LEN + CHANNEL_EXTENDED_DATA_PACKET_OVERHEAD + MAXIMUM_PADDING_LEN ;
You can’t perform that action at this time.
0 commit comments