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

device: return generic error from Ipc{Get,Set}Operation. #17

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

danderson
Copy link
Contributor

This makes uapi.go's public API conform to Go style in terms
of error types.

Signed-off-by: David Anderson [email protected]

danderson and others added 11 commits March 30, 2020 20:10
All atomic access must be aligned to 64 bits, even on 32-bit
platforms. Go promises that the start of allocated structs is
aligned to 64 bits. So, place the atomically-accessed things
first in the struct so that they benefit from that alignment.

As a side bonus, it cleanly separates fields that are accessed
by atomic ops, and those that should be accessed under mu.

Also adds a test that will fail consistently on 32-bit platforms
if the struct ever changes again to violate the rules. This is
likely not needed because unaligned access crashes reliably,
but this will reliably fail even if tests accidentally pass due
to lucky alignment.

Signed-Off-By: David Anderson <[email protected]>
The sticky socket code stays in the device package for now,
as it reaches deeply into the peer list.

This is the first step in an effort to split some code out of
the very busy device package.

Signed-off-by: David Crawshaw <[email protected]>
Signed-off-by: Brad Fitzpatrick <[email protected]>
Signed-off-by: Brad Fitzpatrick <[email protected]>
Based on types and config parser from wireguard-windows.

Signed-off-by: David Crawshaw <[email protected]>
This code is useful to other packages writing tests.

Signed-off-by: David Crawshaw <[email protected]>
@danderson
Copy link
Contributor Author

cc @crawshaw replaces #7 with more complete coverage. I said in that PR I'd send a complementary change for just IpcGetOperation, but it ended up being easier to just fix both at once. I suggest merging this one and closing #7 ?

This makes uapi.go's public API conform to Go style in terms
of error types.

Signed-off-by: David Anderson <[email protected]>
@danderson danderson force-pushed the danderson/uapi-err-type branch from 65f1869 to 11705e6 Compare April 1, 2020 18:02
@crawshaw
Copy link
Collaborator

crawshaw commented Apr 2, 2020

LGTM

@crawshaw
Copy link
Collaborator

crawshaw commented Apr 2, 2020

Merged upstream. I can't close your PRs.

@danderson danderson closed this Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants