[refact](netdev): Expose netdev_set_dns and netdev_set_if#10128
Merged
Rbb666 merged 1 commit intoRT-Thread:masterfrom Jul 10, 2025
Merged
[refact](netdev): Expose netdev_set_dns and netdev_set_if#10128Rbb666 merged 1 commit intoRT-Thread:masterfrom
Rbb666 merged 1 commit intoRT-Thread:masterfrom
Conversation
Member
Member
|
感谢PR,请仅提交需要修改的代码。格式化代码可以另起一个PR提交。 |
3560e43 to
8e4fef1
Compare
supperthomas
approved these changes
Apr 1, 2025
b884c56 to
c1f63f9
Compare
Contributor
Author
May this patch be merged? |
| return; | ||
| } | ||
|
|
||
| inet_aton(dns_server, &dns_addr); |
There was a problem hiding this comment.
Consider verifying the return value of inet_aton to ensure that the DNS server address string is valid before calling netdev_set_dns_server.
Suggested change
| inet_aton(dns_server, &dns_addr); | |
| if (inet_aton(dns_server, &dns_addr) == 0) | |
| { | |
| rt_kprintf("invalid DNS server address: %s\n", dns_server); | |
| return; | |
| } |
[Descriptions]:
1. Make these functions public to avoid code duplication and allow direct usage by other components.
2. Fix ifdef's error note.
[Root Cause]:NA
[Side Effects]:NA
Contributor
Author
|
你好,请问该PR是否能够合入主线,麻烦帮忙review一下,如果不可以的话,也请告诉我哪里的设计和代码修改是有问题的,谢谢 |
Member
|
LGTM |
Rbb666
approved these changes
Jul 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

[Descriptions]:
1. Make these functions public to avoid code duplication and allow direct usage by other components.
2. Apply clang-format for consistent code style.
[Root Cause]:NA
[Side Effects]:NA
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
目前在开发应用代码时,netdev 接口目前需要多次函数调用(netdev_get_by_name, netdev_set_ipaddr等)来完整配置网络设置,这较为低效。因为 netdev_set_if 已经存在但属于静态函数,导致用户需要自己重新实现一个类似于netdev_set_if接口的流程去进行以太网配置。
改进此功能将允许通过单个函数调用直接配置以太网多项属性,从而简化网络配置代码并避免开发者去重复实现。
所以我认为将该函数接口从静态函数变为一个普通函数可能是更合适的,如果有什么理解不到位的地方欢迎大家指正。
你的解决方案是什么 (what is your solution)
Convert netdev_set_if and netdev_set_dns from static function to normal
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up