-
Notifications
You must be signed in to change notification settings - Fork 3
Fix setsockopt incompatible pointer type error on Windows with GCC 14+ #4
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
base: devx-1.4.0
Are you sure you want to change the base?
Fix setsockopt incompatible pointer type error on Windows with GCC 14+ #4
Conversation
Add some padding after non-ASCII comment
add `make docker-release` command & update dockerfile
regarding zerotier#2361
Fix build error under certain character sets in Windows
When building via `make core` to make libzerotiercore.a, you can't link unless OSUtils.cpp is also built & linked.
Move osutils/OSUtils.o into CORE_OBJS
Lower ZT_MIN_PHYSMTU
Build fix for OpenBSD - See ticket zerotier#2397
Bumps [rustls](https://github.com/rustls/rustls) from 0.23.15 to 0.23.18. - [Release notes](https://github.com/rustls/rustls/releases) - [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md) - [Commits](rustls/rustls@v/0.23.15...v/0.23.18) --- updated-dependencies: - dependency-name: rustls dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]>
…bits/rustls-0.23.18 Bump rustls from 0.23.15 to 0.23.18 in /rustybits
update rust dependencies
V1.16 kitchen sink branch, 1.16 ready.
Dev main merge
… into update-readme
…build Fix debian controller build
Drastically shortened main readme and linked out to build notes instead. Clarified licensing info to just match license.txt.
… into update-readme
Shorten/clean README.md. Split README into a few separate, including BUILD. Correctly references licensing information.
_enabled is set to true by setUpPostDecodeReceiveThreads(), so disabled until then, but the constructor wasn't initializing it. _concurrency is not being used before being set but for safety's sake, ensure it has a starting value as well. Also, remove the vestigial _rxThreadCount, which is no longer used.
Ensure members in PacketMultiplexer are initialized
StephenCWills
left a 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.
Looks good, but it feels like we should be sending this upstream.
51288c3 to
eb56c9f
Compare
|
Rebased onto the |
Agreed, going to file a PR there too. |
…C 14+
GCC 14+ treats -Wincompatible-pointer-types as an error by default.
On Windows, setsockopt() expects const char* for the option value, and
socket timeouts (SO_RCVTIMEO/SO_SNDTIMEO) use DWORD (milliseconds)
instead of struct timeval.
This was also a latent bug: the original code passed a struct timeval
(8 bytes: {tv_sec=3, tv_usec=0}) but Windows expects a DWORD (4 bytes)
containing milliseconds. Windows would read only the first 4 bytes
(value 3) as 3 milliseconds instead of the intended 3 seconds.
eb56c9f to
0ca24aa
Compare
|
Upstream PR: zerotier#2542 |
Are we good to merge here or should I finish resolving the conflicts? |
|
It's not possible to merge without resolving conflicts. Also, if these new commits are from upstream, we should probably consider creating a separate PR or even rebasing our commits on a new branch instead of pulling them into this PR. Lastly, I noticed you opened a PR with https://github.com/zerotier/ZeroTierOne, but they've actually pulled in miniupnpc from https://github.com/miniupnp/miniupnp. It looks like that project is still active as of three months ago so you might want to also submit your fix there. |
|
Let's wait a bit to get feedback from upstream. |
Summary
GCC 14+ treats
-Wincompatible-pointer-typesas an error by default. On Windows,setsockopt()expectsconst char*for the option value, and socket timeouts (SO_RCVTIMEO/SO_SNDTIMEO) useDWORD(milliseconds) instead ofstruct timeval.This PR fixes the miniupnpc
connecthostport.cto use the correct types on Windows:DWORDinstead ofstruct timevalfor the timeout variable(const char *)when callingsetsockopt()Note: This was a latent bug
The original code was actually broken on Windows, not just a type mismatch. The code passed a
struct timeval(8 bytes:{tv_sec=3, tv_usec=0}) but Windows expects aDWORD(4 bytes) containing milliseconds.Windows would read only the first 4 bytes (value
3) as 3 milliseconds instead of the intended 3 seconds. The code appeared to work because connections usually succeeded before the tiny 3ms timeout kicked in, and older GCC versions only warned about the pointer type mismatch rather than erroring.Test plan