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

Branching never executes one branch (IDFGH-14306) #15097

Closed
3 tasks done
safocl opened this issue Dec 26, 2024 · 6 comments
Closed
3 tasks done

Branching never executes one branch (IDFGH-14306) #15097

safocl opened this issue Dec 26, 2024 · 6 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally

Comments

@safocl
Copy link

safocl commented Dec 26, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

In code

if (wpa_sm_get_bssid(sm, sm->bssid) < 0) {

the true branch will never start -- wpa_sm_get_bssid function always return 0:

upd list of similar code:

if (wpa_sm_get_bssid(sm, bssid) < 0) {

@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 26, 2024
@github-actions github-actions bot changed the title Branching never executes one branch Branching never executes one branch (IDFGH-14306) Dec 26, 2024
@safocl
Copy link
Author

safocl commented Dec 26, 2024

* Returns: 0 on success, -1 on failure
this line means that the return is invalid.

@safocl
Copy link
Author

safocl commented Dec 26, 2024

https://w1.fi/wpa_supplicant/devel/wpa__i_8h_source.html contain the implementation of wpa_sm_get_bssid function:

169 static inline int wpa_sm_get_bssid(struct [wpa_sm](https://w1.fi/wpa_supplicant/devel/structwpa__sm.html) *sm, u8 *bssid)
170 {
171         WPA_ASSERT(sm->ctx->get_bssid);
172         return sm->ctx->get_bssid(sm->ctx->ctx, bssid);
173 }

is this what should be in place of the existing code?

@nopnop2002
Copy link

nopnop2002 commented Dec 26, 2024

memcpy() function returns a pointer to dest.
So this comment is incorrect.

* Returns: 0 on success, -1 on failure

wpa_sm_get_bssid() always returns 0.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Opened Issue is new labels Jan 21, 2025
@safocl
Copy link
Author

safocl commented Jan 23, 2025

22897aa left dangerous code that now runs a non-existent (#ifndef ESP_SUPPLICANT).

if (wpa_sm_get_bssid(sm, sm->bssid) < 0) {

@kapilkedawat
Copy link
Collaborator

@safocl ESP_SUPPLICANT is always defined for esp-idf supplicant, code was left intentionally.

@safocl
Copy link
Author

safocl commented Jan 23, 2025

@safocl ESP_SUPPLICANT is always defined for esp-idf supplicant, code was left intentionally.

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants