Open vista- opened 2 months ago
Attention: Patch coverage is 80.23952%
with 33 lines
in your changes missing coverage. Please review.
Project coverage is 73.65%. Comparing base (
bf3278a
) to head (4fa4462
).:exclamation: Current head 4fa4462 differs from pull request most recent head 64fb84e
Please upload reports for the commit 64fb84e to get more accurate results.
Files | Patch % | Lines |
---|---|---|
dhcpv4/nclient4/udp.go | 56.09% | 12 Missing and 6 partials :warning: |
dhcpv4/nclient4/conn_linux.go | 64.28% | 13 Missing and 2 partials :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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 https://github.com/insomniacslk/dhcp/issues/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.