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

checksum: re-evaluate library #4262

Closed
shitz opened this issue Sep 29, 2022 · 0 comments · Fixed by #4311
Closed

checksum: re-evaluate library #4262

shitz opened this issue Sep 29, 2022 · 0 comments · Fixed by #4311

Comments

@shitz
Copy link
Contributor

shitz commented Sep 29, 2022

The util.Checksum code uses unsafe pointer:

src16 := (*[1 << 16]uint16)(unsafe.Pointer(&src[0]))[:length2:length2]

We should re-evaluate if it is truly faster compared to an implementation like:
https://github.com/google/gopacket/blob/403ca653c45d1cde891a99c417c2b4b7fe93dce7/layers/tcpip.go#L52
And if it is really worth using it.

The layers approach does not pass the pseudo headers across package boundaries. My guess is that this means less allocations as the pseudo header will be put on the stack.

matzf added a commit that referenced this issue Feb 9, 2023
The pkg/private/common, util and xtest packages have rather fuzzy scope,
and have accumulated a bit of cruft and unused or outdated
functionality. Clean this up a bit:

* pkg/private/common: 
    * remove unused constants
    * remove outdated error handling helpers and replace remaining use
    * remove NativeOrder and IsBigEndian: No longer needed.
      Native byte order is not often needed, but will eventually show up
      in standard library anyway (golang/go#57237).
* pkg/private/util:
    * remove unused helper functionality
    * remove Checksum: only used to compute reference value in slayers
      test cases. Use a simpler, non-optimized implementation for this.
      Closes #4262.
    * move RunsInDocker to private/env
    * move ASList to tools/integration
* pkg/private/xtest: 
    * remove unused helpers
    * remove unused Callback and MockCallback
    * replace FailOnErr with require.NoError
    * replace AssertErrorsIs with assert.ErrorIs


There are still more things to clean up in `pkg/private`, in future PRs,
in particular: 
* `common.ErrMsg` should be integrated in `serrors`
* `common.IFIDType` should be removed or renamed and moved somewhere
  more appropriate
* Merge the remainder of `util` and `common` 
* Clean up  `LinkType` and `RevInfo` from `pkg/private/ctrl`
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 a pull request may close this issue.

1 participant