-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[refact](netdev): Expose netdev_set_dns and netdev_set_if #10128
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
base: master
Are you sure you want to change the base?
Conversation
感谢PR,请仅提交需要修改的代码。格式化代码可以另起一个PR提交。 |
3560e43
to
8e4fef1
Compare
[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
May this patch be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
return; | ||
} | ||
|
||
inet_aton(dns_server, &dns_addr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider verifying the return value of inet_aton to ensure that the DNS server address string is valid before calling netdev_set_dns_server.
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; | |
} |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
[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