Skip to content

Improve zephyr's networking code#4839

Open
kr-t wants to merge 2 commits intobytecodealliance:mainfrom
kr-t:features/improve-zephyr
Open

Improve zephyr's networking code#4839
kr-t wants to merge 2 commits intobytecodealliance:mainfrom
kr-t:features/improve-zephyr

Conversation

@kr-t
Copy link
Contributor

@kr-t kr-t commented Feb 17, 2026

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.

kr-t added 2 commits February 17, 2026 13:02
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant