Feature: nclient4 BSD/macOS support#534
Open
vista- wants to merge 12 commits intoinsomniacslk:masterfrom
Open
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #534 +/- ##
==========================================
- Coverage 73.77% 73.65% -0.13%
==========================================
Files 81 83 +2
Lines 5122 5197 +75
==========================================
+ Hits 3779 3828 +49
- Misses 1200 1225 +25
- Partials 143 144 +1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: vista <vista@birb.network>
Signed-off-by: vista <vista@birb.network>
Signed-off-by: vista <vista@birb.network>
…et.go Signed-off-by: vista <vista@birb.network>
…rts Linux platforms) Signed-off-by: vista <vista@birb.network>
Signed-off-by: vista <vista@birb.network>
Signed-off-by: vista <vista@birb.network>
…some comments Signed-off-by: vista <vista@birb.network>
Signed-off-by: vista <vista@birb.network>
4fa4462 to
3191f87
Compare
Author
|
Force pushed commits with sign-offs. |
Author
|
Ping! :) |
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.
This PR adds back BSD/macOS support for nclient4, which was removed when the library switch from using the
rawpackage for sending/receiving broadcast UDP packets, instead using thepacketlibrary (which only supports Linux).The PR also solves the build-scoping issue described in #526
Due to lack of support for raw datagram sockets in BSD, additional functionality had to be added for constructing the raw Ethernet frame. VLAN tag support has also been added to the BSD/macOS-related nclient4 code, which can be utilised to send/receive tagged frames. This can be useful for testing IPoE-based access networks.
Tests have also been added for the Ethernet frame and VLAN tag processing, based on the
gopacketlibrary.There are two avenues of improving the code in the PR in the future (but I would prefer to avoid premature optimisation):
NewRawUDPConn. This can be inserted at the EtherType offset of the Ethernet frame when sending, and performing a simple byte comparison at the EtherType offset when receiving frames.gopacketfor constructing the frame from scratch instead of doing it byte by byte.