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

fix cookie syn issues #2176

Merged
merged 13 commits into from
Oct 26, 2021
Merged

fix cookie syn issues #2176

merged 13 commits into from
Oct 26, 2021

Conversation

cg82616424
Copy link
Contributor

@cg82616424 cg82616424 commented Oct 25, 2021

SRT listener-caller handshake uses the cookie the following way:

  Caller          Listener

HS Ind Req ---> 
               
           <--- HS Ind Rsp (Create Cookie
		                    from current time)
		   
HS Conc Req
(Listener's --->
Cookie)

                 Validate Connection Request
				 - Generate a cookie from current time.
				 - Check cookie matches with the one in
				 HS Conc Req.
				 - If it does not match, generate a cookie
				   for a time a minute ago and check as well.

If the time on the listener side has increased since the previous HS induction response that much, that it results in a different cookie value, a caller may have sent an old cookie in the HS Conclusion Request.
In that case listener's new cookie and the cookie from HS Conclusion Request will mismatch.
To resolve this situation, listener must also check a cookie generated with the time from the past (1 minute ago) to chack if the previous cookie matches the one sent by the caller.

Hence the correction value -1 in the code.
However, the bake function actually subtracts the correction, which means one minute was wrongfully added instead.

cookie_val = bake(addr, cookie_val, -1); // SHOULD generate an earlier, distracted cookie

@maxsharabayko maxsharabayko added [core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior labels Oct 25, 2021
@maxsharabayko maxsharabayko added this to the v1.4.5 milestone Oct 25, 2021
@cg82616424
Copy link
Contributor Author

Hi guys,
I create a new pull request to fix this bug, plz review it, tkx

@maxsharabayko maxsharabayko merged commit f11b026 into Haivision:master Oct 26, 2021
@cg82616424
Copy link
Contributor Author

tks, :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants