-
Notifications
You must be signed in to change notification settings - Fork 7.3k
drivers: wifi: infineon: add .iface_status method #88718
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: main
Are you sure you want to change the base?
drivers: wifi: infineon: add .iface_status method #88718
Conversation
246a979
to
40a8960
Compare
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.
Minor nits about the coding style, you could see what the rest of the airoc_wifi.c
looks like and follow suit.
beff44c
to
f09fb8d
Compare
I changed all of these things according to your preferences. Looking at the Zephyr Coding Guidelines, I'm not sure that any of them are actually established rules, so perhaps that's why the automated checks didn't catch any of them. |
I think the twister failure is a problem on your side, not a problem with the code that I pushed. Can someone look into this and re-run the tests? |
Looked like some environmental issue, I've retriggered failed stage, tests are now running. |
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.
Pull Request Overview
This PR adds an .iface_status method to the Infineon WiFi driver so that the "wifi status" command on the network shell works as expected.
- Added the implementation of airoc_iface_status to report interface mode, state, SSID, channel, and other connection parameters.
- Updated the wifi_mgmt_ops structure to include the new .iface_status method.
- Introduced an additional header include for whd_wlioctl.h required by the new functionality.
Comments suppressed due to low confidence (1)
drivers/wifi/infineon/airoc_wifi.c:774
- The variable 'airoc_if' is referenced without a visible declaration in this diff. Verify that it is properly declared and initialized in an accessible scope before use.
if (airoc_if == NULL) {
strncpy(status->ssid, bss_info.SSID, bss_info.SSID_len); | ||
|
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.
Using strncpy without explicitly appending a null terminator risks leaving status->ssid unterminated. Consider ensuring the string is null-terminated (and that the destination buffer is large enough) after copying.
strncpy(status->ssid, bss_info.SSID, bss_info.SSID_len); | |
if (status->ssid_len < sizeof(status->ssid)) { | |
strncpy(status->ssid, bss_info.SSID, status->ssid_len); | |
status->ssid[status->ssid_len] = '\0'; // Ensure null-termination | |
} else { | |
LOG_ERR("SSID length exceeds buffer size"); | |
return -EINVAL; // Return an error if the buffer is too small | |
} |
Copilot uses AI. Check for mistakes.
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.
I think Copilot's advice is invalid in this particular case. The SSID is defined by zephyr to be a character string with a max length of 32 and an accompanying SSID_len field to specify the actual length. If I were to use one character of the ssid field as a null terminator, the maximum length would become 31.
The .iface_status method of the wifi_mgmt_ops API needs to be added so that the "wifi status" command on the network shell will work. Signed-off-by: Dave Rensberger <[email protected]>
f09fb8d
to
298f0a3
Compare
The .iface_status method of the wifi_mgmt_ops API needs to be added so that the "wifi status" command on the network shell will work.