-
Notifications
You must be signed in to change notification settings - Fork 20
RDKB-62352 : Observed telemetry2_0 crash #247
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: develop
Are you sure you want to change the base?
Changes from all commits
3a0a7a2
13c9f3d
fa28348
a5e4202
6657cfe
26176b5
9d1e4ed
6573670
d9e649e
af9d118
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,9 @@ | |
| #include <sys/wait.h> | ||
| #include <curl/curl.h> | ||
| #include <signal.h> | ||
| #ifdef LIBRDKCERTSEL_BUILD | ||
| #include <openssl/crypto.h> | ||
| #endif | ||
|
|
||
| #include "curlinterface.h" | ||
| #include "reportprofiles.h" | ||
|
|
@@ -277,6 +280,11 @@ static void curlCertSelectorInit() | |
| #endif | ||
| if (state_red_enable && curlRcvryCertSelector == NULL ) | ||
| { | ||
| if(curlCertSelector != NULL) | ||
| { | ||
| rdkcertselector_free(&curlCertSelector); | ||
| curlCertSelector = NULL; | ||
| } | ||
| curlRcvryCertSelector = rdkcertselector_new( NULL, NULL, "RCVRY" ); | ||
| if (curlRcvryCertSelector == NULL) | ||
| { | ||
|
|
@@ -319,6 +327,7 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid) | |
| rdkcertselectorStatus_t curlGetCertStatus; | ||
| char *pCertURI = NULL; | ||
| bool state_red_enable = false; | ||
| char *pEngine = NULL; | ||
| #endif | ||
| char *pCertFile = NULL; | ||
| char *pCertPC = NULL; | ||
|
|
@@ -440,6 +449,12 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid) | |
| */ | ||
| if(childPid == 0) | ||
| { | ||
| #ifdef LIBRDKCERTSEL_BUILD | ||
| if(OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) != 1) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem to be the right thing to do.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. curl_easy_init directly will not initialize OPENSSL_init_crypto. |
||
| { | ||
| fprintf(stderr, "T2:OPENSSL_init_crypto failed\n"); // avoiding T2 logger in the child. | ||
| } | ||
| #endif | ||
| curl = curl_easy_init(); | ||
| if(curl) | ||
| { | ||
|
|
@@ -455,6 +470,28 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid) | |
| goto child_cleanReturn; | ||
| } | ||
| #ifdef LIBRDKCERTSEL_BUILD | ||
| pEngine = rdkcertselector_getEngine(thisCertSel); | ||
| if(pEngine != NULL ) | ||
| { | ||
| code = curl_easy_setopt(curl, CURLOPT_SSLENGINE, pEngine); | ||
| if(code != CURLE_OK) | ||
| { | ||
| childCurlResponse.lineNumber = __LINE__; | ||
| curl_easy_cleanup(curl); | ||
| goto child_cleanReturn; | ||
|
Comment on lines
+477
to
+481
|
||
| } | ||
| } | ||
| else | ||
| { | ||
| code = curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L); | ||
| if(code != CURLE_OK ) | ||
| { | ||
|
Comment on lines
+473
to
+488
|
||
| childCurlResponse.lineNumber = __LINE__; | ||
| curl_easy_cleanup(curl); | ||
| goto child_cleanReturn; | ||
|
Comment on lines
+487
to
+491
|
||
| } | ||
| } | ||
|
Comment on lines
452
to
493
|
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copilot noticed that there were no tests added for the new code paths. can we add unit tests?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the OpenSSL engine logic is not part of the core telemetry functionality, the telemetry unit test NOT handles the curl request. Based on my understanding, this scenario should be covered under L2/L3 testing rather than as a unit or core telemetry test |
||
| do | ||
| { | ||
| pCertFile = 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.
We shouldn't be using openssl api's directly. The libcurl apis should be the only interface.
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.
Shibu, at one point we were hashing the passcode so we could see if it changed (without exposing it). We may want to keep this in here until we have resolved the problem with the passcode.