Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added and updated handshake description #351

Merged
merged 12 commits into from May 2, 2019

Conversation

ethouris
Copy link
Collaborator

No description provided.

@rndi rndi requested a review from stevomatthews April 18, 2018 15:41
@stevomatthews
Copy link
Collaborator

stevomatthews commented May 28, 2018

I went through the entire document and made significant changes to hopefully improve readability. Note that there are several questions, indicated by ???, that will have to be resolved before final release of this document.
handshake.md.zip

Copy link
Collaborator

@stevomatthews stevomatthews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1| Message Type | Message Extended Type |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the bar should be directly under the "6", not the "7".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and the less significant digit bar should be also better aligned.

The **Extension Flags** subfield in the `Type` field in a conclusion handshake
message contains one of these flags:

- `HS_EXT_HSREQ`: defines SRT characteristic data; always present
- `HS_EXT_KMREQ`: if using encryption, defines encryption block
- `HS_EXT_CONFIG`: informs about having extra configuration data attached

The extension block has the following structure:
The above schema shows the HSv5 packet structure that can be split into
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above schema shows the HSv5 packet structure, which can be split into

3. The KMREQ extension

Note that extensions are added only in certain situations (as described
above with the handshake process), so sometimes there are no extensions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above), so sometimes there are no extensions

Note that extensions are added only in certain situations (as described
above with the handshake process), so sometimes there are no extensions
at all. When extensions are added, the HSREQ extension is always present.
The KMREQ extension is added only if the encryption is requested (the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The KMREQ extension is added only if encryption is requested (the

above with the handshake process), so sometimes there are no extensions
at all. When extensions are added, the HSREQ extension is always present.
The KMREQ extension is added only if the encryption is requested (the
passphrase is set by `SRTO_PASSPHRASE` socket option). There might be
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passphrase is set by the SRTO_PASSPHRASE socket option). There might also be

at all. When extensions are added, the HSREQ extension is always present.
The KMREQ extension is added only if the encryption is requested (the
passphrase is set by `SRTO_PASSPHRASE` socket option). There might be
also other extensions following.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other extensions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant is that the other extensions may appear after HSREQ and KMREQ, not just that they can be present.

when the payload was retransmitted.
2. **Retransmission** flag (1 bit). Controlled by `SRT_OPT_REXMITFLG`, this flag
is 0 when a packet is sent the first time, and 1 when it is retransmitted (i.e.
requested in a loss report). When the incoming packet is belated (one with a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requested in a loss report). When the incoming packet is late (has a

is 0 when a packet is sent the first time, and 1 when it is retransmitted (i.e.
requested in a loss report). When the incoming packet is belated (one with a
sequence number older than the newest received so far), this flag allows the
Receiver to distinguish between a retransmitted packet and reordered packet.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Receiver to distinguish between a retransmitted packet and a reordered packet.

sequence number older than the newest received so far), this flag allows the
Receiver to distinguish between a retransmitted packet and reordered packet.
This is used by the "reorder tolerance" feature described in the API
documentation under "SRTO_LOSSMAXTTL").
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation under "SRTO_LOSSMAXTTL".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it also to:

documentation under SRTO_LOSSMAXTTL socket option.

- If both have declared encryption, but have set different passwords,
the Responder will send a KMRSP block with `SRT_KM_S_BADSECRET` value.
the Responder will send a `KMRSP` block with an `SRT_KM_S_BADSECRET` value.
The transmission in both direction will be "scrambled" (encrypted and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transmission in both directions will be "scrambled" (encrypted and

direction (forward KMX) is updated. HSv4 relies only on these messages, so
there's no difference between initial and refreshed KM exchange. In HSv5 the
initial KM exchange is done within the handshake in both directions, and then
the key refresh process is started by the sender and it updates the key for one
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the key refresh process is started by the Sender and it updates the key for one

which the socket was bound. If the cookies are identical (for any reason), the
connection will not be made until new, unique cookies are generated (after a
delay of up to one minute). In the case of an application "connecting to itself",
the cookies will always be identical, and so the connection will never be made).
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superfluous closed parenthesis.

between connected parties) over this connection, it may switch to the `Connected`
state just as if it had received a `URQ_AGREEMENT` message.

4. If the the Initiator is already switched to the `Connected` state it will not
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the twice


1. The Handshake data part (up to "Peer IP Address" field)
2. The HSREQ extension
3. The KMREQ extension
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to mark somehow this breakdown on the schema.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declares the `SRTO_TLPKTDROP` flag of the party. This is important
because both parties must cooperate in this process. In HSv5, if both
directions are TSBPD, both use this setting. This flag must always be
set in live mode.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not true that this flag must be always set in live mode, although this is default and most recommended.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change last sentence (lines 1181-1182) to:
"While it is not always necessary to set this flag to live mode, it is the default and most recommended setting."


- If the Initiator declares encryption, but the Responder does not, then
the Responder responds with `SRT_KM_S_NOSECRET` status. This means
that the Responder will not be
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid confusion here, I'd say it explicitly that it's a string that a Caller can pass to a Listener (it's actually passed from an Initiator to a Responder in general, but in Rendezvous connections this feature doesn't make sense).

@ethouris ethouris added this to the v.1.3.3 milestone Jan 18, 2019
@ethouris
Copy link
Collaborator Author

ethouris commented May 2, 2019

I'm kinda confused. The comments show text that is completely irrelevant to the cited document parts. Is this document now considered fixed?

@maxsharabayko maxsharabayko added the [docs] Area: Improvements or additions to documentation label May 2, 2019
@rndi rndi merged commit 3d159f0 into Haivision:master May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[docs] Area: Improvements or additions to documentation Priority: High
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants