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

Enable support for DHCP option 15 (domain name) #972

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

korken89
Copy link
Contributor

@korken89 korken89 commented Aug 9, 2024

This makes smoltcp work in industrial networks with Windows DHCPs as they do not support option 119.

I'm not sure if the result should be directly tied into the dns socket, but the IPs for DNS servers are manually supplied so I follow the same pattern here and assume that users will build the FQDN before doing a DNS request.

Feedback welcome!

@korken89
Copy link
Contributor Author

korken89 commented Aug 9, 2024

I see clippy is a bit angry with the size of the domain name and the impact it has.
Should I move the max size into gen_config.py and set a default that is smaller than the maximum to make clippy happy?
E.g. a domain name size of 64 is probably enough for almost everything in my experience.

@korken89
Copy link
Contributor Author

korken89 commented Aug 9, 2024

I added it in my latest commit. Also realized I was doing wrong in DhcpRepr and moved to use a reference there instead of an owned String.

@korken89 korken89 force-pushed the dhcp-option-15 branch 3 times, most recently from 619dcdb to 9778985 Compare August 11, 2024 07:54
Copy link

codecov bot commented Aug 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.29%. Comparing base (6a3f926) to head (9778985).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #972      +/-   ##
==========================================
+ Coverage   79.18%   79.29%   +0.10%     
==========================================
  Files          81       81              
  Lines       26885    26944      +59     
==========================================
+ Hits        21289    21365      +76     
+ Misses       5596     5579      -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@korken89 korken89 force-pushed the dhcp-option-15 branch 3 times, most recently from 5d908a7 to ad63a7f Compare August 11, 2024 11:40
@korken89
Copy link
Contributor Author

This PR builds on top of #974 to make no_std apps build

@korken89
Copy link
Contributor Author

Also, here is an example of it working from a network I'm testing this PR on

image

@Dirbaio
Copy link
Member

Dirbaio commented Aug 11, 2024

the original design of DHCP was to provide the raw bytes in Config::packet, so the user can parse the options they're interested in from there. The reason for this is I think adding explicit fields in Repr and Config for every single option a user might want is not going to scale, there's a lot of them.

@korken89
Copy link
Contributor Author

Hi @Dirbaio , I fully agree on the idea of having special options being handled outside as it is designed.
In the PR I was working on for embassy-net I started that path, but changed direction to add it here.

The motivation is that without domain name the DNS implementation is only working on non-FQDN networks or with manual FQDN lookups, and the only discrepancy was networks with domain name and automatically forming non-FQDN -> FQDN.

To me this warranted the direct inclusion in smoltcp instead of a special external handling as it's so fundamental to lookup.
The line-in-the-sand I formed for myself while working on this was that vendor extensions were candidates for direct inclusion in smoltcp and anything else should be handled in the aforementioned API.
If this is not the case I can make a PR to document where the line goes between smoltcp inclusion and not. 🚀

@korken89
Copy link
Contributor Author

Another idea is to feature gate this so people do not pay for it unless they need it.
That would alleviate the scaling issue. What are your thoughts @Dirbaio ?

@korken89
Copy link
Contributor Author

I made it optional in my last commit just to show what I mean. I can drop the commit if it's considered as not needed.

korken89 and others added 2 commits August 20, 2024 19:13
This makes `smoltcp` work in industrial networks
with Windows DHCPs as they do not support option
119.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants