-
Notifications
You must be signed in to change notification settings - Fork 44
fix system library error messages #449
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: release/v1.35
Are you sure you want to change the base?
Conversation
2e96d27 to
bc51d65
Compare
previously, we'd log a lot of "unknown" error messages. this should fix that. Signed-off-by: Daniel Grimm <[email protected]>
bc51d65 to
dbd6bd8
Compare
jwendell
left a comment
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.
LGTM, but I'll let the expert (@tedjpoole) to chime in.
@dgn BTW, were we supposed to expect changes in envoy tests? I mean all passed but I thought that, with this change, we'd need to revert some of the changes we made in Envoy due to the differences in error strings...
tedjpoole
left a comment
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.
All good thanks, except some minor niggles. The only real functional change is ERR_reason_error_string() should return "unknown error" rather than a NULL if the reason code is unknown.
| // Handle system library errors like BoringSSL does | ||
| // For system errors, return strerror(errno) like BoringSSL does | ||
| if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) { | ||
| uint32_t reason = ERR_GET_REASON(packed_error); |
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.
| uint32_t reason = ERR_GET_REASON(packed_error); | |
| uint32_t reason = ossl_ERR_GET_REASON(packed_error); |
| extern "C" const char *ERR_lib_error_string(uint32_t packed_error) { | ||
| // Handle system library errors like BoringSSL does | ||
| // OpenSSL 3.x returns NULL for system errors, but BoringSSL returns "system library" | ||
| if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) { |
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.
| if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) { | |
| if (ossl_ERR_SYSTEM_ERROR(packed_error)) { |
| extern "C" const char *ERR_reason_error_string(uint32_t packed_error) { | ||
| // Handle system library errors like BoringSSL does | ||
| // For system errors, return strerror(errno) like BoringSSL does | ||
| if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) { |
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.
| if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) { | |
| if (ossl_ERR_SYSTEM_ERROR(packed_error)) { |
| if (reason > 0 && reason < 256) { | ||
| return strerror(reason); | ||
| } | ||
| return NULL; |
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.
| return NULL; | |
| return "unknown error"; |
Commit Message: previously, we'd log a lot of "unknown" error messages. this should fix that.
Additional Description:
Risk Level: low
Testing: included
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]