-
Notifications
You must be signed in to change notification settings - Fork 175
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
Feature: nclient4 BSD/macOS support #534
base: master
Are you sure you want to change the base?
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
Force pushed commits with sign-offs. |
Ping! :) |
This PR adds back BSD/macOS support for nclient4, which was removed when the library switch from using the
raw
package for sending/receiving broadcast UDP packets, instead using thepacket
library (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
gopacket
library.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.gopacket
for constructing the frame from scratch instead of doing it byte by byte.