-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Darwin: Fix error handling in GetMACAddressFromInterfaces #32658
Darwin: Fix error handling in GetMACAddressFromInterfaces #32658
Conversation
Correctly return CHIP_ERROR_NOT_FOUND when there is no active, primary interface to get the MAC address from. Also tidy up management of IOKit objects. (Use of IOObjectGetRetainCount is completely wrong here.)
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.
Thank you; this is a definite improvement on what we have right now.
One thing to consider as a followup: what this will do is that if we return error the caller will generate a random "mac address" to use as the hostname. And it will be a different one each time this is called.
Maybe what we should do is just have a static buffer in here that we randomly generate ourselves, once per process lifetime, in the case when we don't find an actual MAC address. That said, if we randomly roll our MAC addresses on some schedule we might want to roll that one too, not have it be just process-lifetime.
Anyway, all that is followup fodder.
Fast-tracking Darwin-only change. |
PR #32658: Size comparison from 03531f7 to 1c7c7ad Decreases (2 builds for efr32)
Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, stm32, telink)
|
Correctly return CHIP_ERROR_NOT_FOUND when there is no active, primary interface to get the MAC address from.
Also tidy up management of IOKit objects. (Use of IOObjectGetRetainCount is completely wrong here.)
Fixes #29556