Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ext/sockets: Additional refactorings to
socket_set_option()
#17186New 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
ext/sockets: Additional refactorings to
socket_set_option()
#17186Changes from 6 commits
eb86bb4
64f819f
c00fc6f
7a904bb
476d01e
e13d106
9eaac69
d1b19e7
3e08a78
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that be
Z_STRLEN_P(arg4) >= sizeof(af.af_name)
(orZ_STRLEN_P(arg4)+1 > sizeof(af.af_name)
) to account for the null byte?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like here, it would be nice to have more explanations of why you feel we need to replace strlcpy with memcpy.
1/ It is easier to fall into overflows with memcpy as per Arnaud/my comments.
2/ If you want to check truncations, strlcpy return value can help in this.
3/ If this is performance gain and since those changes are mainly about FreeBSD parts, let's say we create a bunch of sockets and we set bbr tcp stack for each so how much of a difference it makes in practice (related buffers are respectively 32 and 16 larges) ? Albeit freebsd's memcpy finally caught up a lot in term of optimisations (highlighting the case for size <= 32 bytes here) since the 14.x release serie. In comparison our strlcpy version is very straightforward but today's compilers are smarter.
Whether the changes are justified, I do not think it is very urgent we can see after Xmas days no rush :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
strlcpy()
is bad as I just replied to that other thread, we also need to do extra work to instrumentalize this on top of using a non standard C function.I don't mind adding a helper function if that's the concern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see ... in this case you still need to address arnaud and my comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll get round to it after the Xmas break :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IPPROTO_TCP
had been translated intoSOL_TCP
, also no need to check its existence it s unconditionally set looking at the stub.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my run of your new tests