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

[core] Added restrictions on pktseq/msgno fields in srt_sendmsg2 call #1879

Merged

Conversation

ethouris
Copy link
Collaborator

Fixes #1810

@ethouris ethouris requested a review from maxsharabayko March 22, 2021 13:59
@ethouris ethouris added [API] Area: Changes in SRT library API [core] Area: Changes in SRT library core labels Mar 22, 2021
@ethouris ethouris added this to the v1.4.3 milestone Mar 22, 2021
Copy link
Collaborator

@maxsharabayko maxsharabayko left a comment

Choose a reason for hiding this comment

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

The API behavior is changed by this PR.
Previously both pktseq and msgno were ignored. This behavior is also described in the docs, although you have to know where to look.

   int32_t pktseq;       // sequence number of the first packet in received message (unused for sending)
   int32_t msgno;        // message number (output value for both sending and receiving)

With this change API expects the user to provide the default values for pktseq and msgno, returning the error otherwise. Whether it is good or bad - hard to say.

Potentially to remain more or less close to the existing behavior (SRT v1.4.2 and prior) the default values could be set in the beginning, instead of validating those values are default-initialized. Then if sending succeeds, the actual values are set to msgno and pktseq. In case of sending error default values are returned.

srtcore/api.cpp Outdated Show resolved Hide resolved
@ethouris
Copy link
Collaborator Author

So maybe another proposal: these fields will be forcefully set to default values. This way, whatever you set there, will be effectively ignored.

@maxsharabayko maxsharabayko merged commit 22d5736 into Haivision:master Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[API] Area: Changes in SRT library API [core] Area: Changes in SRT library core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] CUDT::sendmsg2(..)` does not report an error on wrong MSG_CTRL.pktseq
2 participants