Why sending the message length(4 Byte) in a separate message when using TCP connection to send Kerberos packet

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why sending the message length(4 Byte) in a separate message when using TCP connection to send Kerberos packet

Sherry Yanmeng Tang (yanmtang)
Hi experts,

When kerberos are working on the tcp connection, it always send the message length of kerberos in one tcp message, and then send the following kerberos packet in another one or more messages.
I wonder why not send the message length of the kerberos together with the real message body. Eg, even the packet is only 287 Bytes(tcp payload length), we need to send the 4 Bytes first, then send 283 Bytes.

We saw this behavior at
src/lib/krb5/os/sendto_kdc.c:652

Thanks, guys!

BR
Sherry
________________________________________________
Kerberos mailing list           [hidden email]
https://mailman.mit.edu/mailman/listinfo/kerberos
Reply | Threaded
Open this post in threaded view
|

Re: Why sending the message length(4 Byte) in a separate message when using TCP connection to send Kerberos packet

Greg Hudson
On 08/30/2016 10:40 PM, Sherry Yanmeng Tang (yanmtang) wrote:
> When kerberos are working on the tcp connection, it always send the message length of kerberos in one tcp message, and then send the following kerberos packet in another one or more messages.
> I wonder why not send the message length of the kerberos together with the real message body. Eg, even the packet is only 287 Bytes(tcp payload length), we need to send the 4 Bytes first, then send 283 Bytes.

We do send the length and message together, using
writev()(sendto_kdc.c:1099).  The code you pointed to at line 652 is
just setting up the iovs for a later call to writev().
________________________________________________
Kerberos mailing list           [hidden email]
https://mailman.mit.edu/mailman/listinfo/kerberos