insomniacslk / dhcp

DHCPv6 and DHCPv4 packet library, client and server written in Go
BSD 3-Clause "New" or "Revised" License
685 stars 168 forks source link

fix misleading listen address in documentation #516

Closed ForestJohnson closed 1 month ago

ForestJohnson commented 9 months ago

A DHCP server should probably always listen on 0.0.0.0 when we're working on it in development and testing.

Why?

I believe normal DHCP requests are sent as broadcasts to 255.255.255.255... I believe when its broadcasted, every single UDP packet regardless of where it ends up, will have 255.255.255.255 as the destination address. And since 255.255.255.255 != 127.0.0.1, the UDP listener will ignore it.

We can tell our UDP listener to listen on 255.255.255.255 but then it will ONLY receive these "normal" DHCP broadcast packets. If someone tries to send a datagram to it directly (on a specific IP like 127.0.0.1, 192.168.69.1 etc) it wont be received.

So i think 0.0.0.0 is appropriate here, considering that it's already being told to listen on a specific interface.

pmazzini commented 7 months ago

Please sign the commit. More details in: https://github.com/insomniacslk/dhcp/pull/516/checks?check_run_id=19055434699

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 73.06%. Comparing base (c728f5d) to head (91af758). Report is 8 commits behind head on master.

:exclamation: Current head 91af758 differs from pull request most recent head af24f57

Please upload reports for the commit af24f57 to get more accurate results.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #516 +/- ## ========================================== - Coverage 73.35% 73.06% -0.29% ========================================== Files 81 89 +8 Lines 5104 5491 +387 ========================================== + Hits 3744 4012 +268 - Misses 1217 1324 +107 - Partials 143 155 +12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.