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

Fix for embassy net dns entries not being extensible #2170

Merged
merged 3 commits into from
Nov 14, 2023
Merged

Fix for embassy net dns entries not being extensible #2170

merged 3 commits into from
Nov 14, 2023

Conversation

korken89
Copy link
Contributor

@korken89 korken89 commented Nov 10, 2023

Not sure if this is a good fix perse, but it allows for extending DNS setting in smoltcp up to 8 entries.
If this is not done these interfaces are hard linked to whatever the return of smoltcp is.

Other ways to achieve this is welcome. :)

Copy link
Member

@lulf lulf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about pub async fn query<const N: usize>(...) -> Result<Vec<IpAddress, N>>?

This also reminds me that heapless is here used in a public API, which we should try to avoid, but one thing at a time perhaps :)

@korken89
Copy link
Contributor Author

Hi @lulf

I tried that first but you get this error then:

error[E0308]: mismatched types
   --> src/lib.rs:592:9
    |
592 |         res
    |         ^^^ expected `N`, found `1`
    |
    = note: expected enum `Result<Vec<_, N>, dns::Error>`
               found enum `Result<Vec<_, 1>, _>`

For more information about this error, try `rustc --explain E0308`.

As this only can infer the N from external code, not internal that we get from smoltcp.

@nilfit
Copy link
Contributor

nilfit commented Nov 13, 2023

With smoltcp-rs/smoltcp#855, we can use smoltcp::config::DNS_MAX_RESULT_COUNT for the size instead of choosing a new hard-coded size. Then dependent crates can freely choose which smoltcp/dns-max-result-count-* to use.

@lulf lulf enabled auto-merge November 14, 2023 07:54
@lulf
Copy link
Member

lulf commented Nov 14, 2023

Thanks for the fix 🚀

@lulf lulf added this pull request to the merge queue Nov 14, 2023
Merged via the queue into embassy-rs:main with commit 7e5deae Nov 14, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants