Skip to content

Commit 5fcd677

Browse files
authored
Bugfix bpf programs have Trace level inited to trace (#89)
* Fix LogLevel default inited to Trace * Bugfix failing ssl uprobes shoudn't cause ebpfdiscovery process exit
1 parent d942671 commit 5fcd677

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

libebpfdiscovery/src/DiscoveryBpf.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void DiscoveryBpf::attachOpenSSLProbes() {
162162
auto isAttached =
163163
std::any_of(libNames.begin(), libNames.end(), [this](const auto& libName) { return tryAttachOpenSSLProbesToLibName(libName); });
164164
if (!isAttached) {
165-
throw std::runtime_error("Couldn't attach OpenSSL probes to any of the libraries");
165+
LOG_ERROR("Couldn't attach OpenSSL probes to any of the libraries");
166166
}
167167
}
168168

libebpfdiscoveryshared/headers/ebpfdiscoveryshared/Types.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ struct DiscoveryGlobalState {
221221
*/
222222

223223
enum DiscoveryLogLevel {
224-
DISCOVERY_LOG_LEVEL_TRACE,
225-
DISCOVERY_LOG_LEVEL_DEBUG,
226-
DISCOVERY_LOG_LEVEL_OFF,
224+
DISCOVERY_LOG_LEVEL_TRACE = 1,
225+
DISCOVERY_LOG_LEVEL_DEBUG = 2,
226+
DISCOVERY_LOG_LEVEL_OFF = 3,
227227
};
228228

229229
struct DiscoveryConfig {

libebpfdiscoveryskel/src/Log.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ __attribute__((always_inline)) inline static int sendDiscoveryLogEvent(struct pt
4242
__attribute__((always_inline)) inline static enum DiscoveryLogLevel getDiscoveryLogLevel() {
4343
const struct DiscoveryConfig* configPtr = getDiscoveryConfig();
4444
if (configPtr == NULL) {
45-
return 0;
45+
return DISCOVERY_LOG_LEVEL_OFF;
4646
}
47-
return configPtr->logLevel;
47+
return (configPtr->logLevel > 0) ? configPtr->logLevel : DISCOVERY_LOG_LEVEL_OFF;
4848
}
4949

5050
__attribute__((always_inline)) inline static int discoveryLog(

0 commit comments

Comments
 (0)