Improve zephyr's networking code#4839
Open
kr-t wants to merge 2 commits intobytecodealliance:mainfrom
Open
Conversation
In multiple places, setsockopt is used when getsockopt shall be used, and vice-versa. Additionally, pointer isn't checked correctly in two places, this commit fixes those as well. Per man(7), most socket-level options utilize an int argument for optval. Use those for ttl. Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>
Some of the optvals are implemented by zephyr, some are missing. Call the appropriate function and let set the retval based on that. Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I am submitting this PR as two separate commits;
is intended to fix multiple get/set sockopt functions, where the wrong one is used (get instead of set, and set instead of get). I believe this is necessary to fix, otherwise it just won't work correclty.
Here I propose instead of failing the function right away, we let Zephyr decide whether it's implemented in its internals or not. With newer Zephyr versions, more and more of this optvals are getting implemented. I recommend that we call the abstract os_socket_(set/get)booloption and if it returns with errno, than we just return that. I just did few of these out of all, but if this solution is accepted, we can turn all of these with the next PRs.
Ultimately tho, with the POSIX support of Zephyr, we just need to be aiming to use common/posix code for most zephyr operations as well.
P.S. I am open to further cleanup, or make two separate PRs, but this seemed to me the most appropriate way to do this right now.