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

examples/network/sta2eth: Add comment explaining MIN_DHCP_PACKET_SIZE (IDFGH-12443) #13461

Open
owenthewizard opened this issue Mar 24, 2024 · 1 comment
Assignees
Labels
Status: Opened Issue is new Type: Feature Request Feature request for IDF

Comments

@owenthewizard
Copy link

Is your feature request related to a problem?

I'm not sure how the value if MIN_DHCP_PACKET_SIZE was decided. In addition, it seems to be used when dealing with the size of an Ethernet frame, not a DHCP/UDP/IP packet.
AFAIK the minimum DHCP packet size is 236 bytes. I assume that the 285 bytes figure is adding the UDP/IP packet and Ethernet frame overhead. However, it would be nice to have a comment confirming this.

Describe the solution you'd like.

Add a comment, for example:

/**                                                                             
 * The minimum size of a DHCP packet is 236 bytes.                
 * This includes the DHCP header and the minimum-sized DHCP message, which is a DHCPDISCOVER or
 * DHCPREQUEST message with no options.
 */                                                                             
#define MIN_DHCP_PACKET_SIZE (236)

Describe alternatives you've considered.

No response

Additional context.

No response

@owenthewizard owenthewizard added the Type: Feature Request Feature request for IDF label Mar 24, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Mar 24, 2024
@github-actions github-actions bot changed the title examples/network/sta2eth: Add comment explaining MIN_DHCP_PACKET_SIZE examples/network/sta2eth: Add comment explaining MIN_DHCP_PACKET_SIZE (IDFGH-12443) Mar 24, 2024
@david-cermak
Copy link
Collaborator

david-cermak commented Nov 15, 2024

Thank you for bringing this up! That's correct, the minimum DHCP packet size is 236 bytes, and the MIN_DHCP_PACKET_SIZE value indeed accounts for the additional overhead from the UDP, IP, and Ethernet headers.
Adding a comment as you suggested would certainly clarify things.

I'll make the necessary changes soon. At the moment, I'm also working on extending this example to support an additional (so-called) "wired" interface (besides Ethernet and USB) and to introduce support for WiFi softAP. Alongside this, I'll be renaming "wired" to something else, so that "sta2ap" option fits into the picture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

4 participants