Skip to content

Commit

Permalink
Bugfix bpf programs have Trace level inited to trace (#89)
Browse files Browse the repository at this point in the history
* Fix LogLevel default inited to Trace

* Bugfix failing ssl uprobes shoudn't cause ebpfdiscovery process exit
  • Loading branch information
pawsten authored May 27, 2024
1 parent d942671 commit 5fcd677
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libebpfdiscovery/src/DiscoveryBpf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void DiscoveryBpf::attachOpenSSLProbes() {
auto isAttached =
std::any_of(libNames.begin(), libNames.end(), [this](const auto& libName) { return tryAttachOpenSSLProbesToLibName(libName); });
if (!isAttached) {
throw std::runtime_error("Couldn't attach OpenSSL probes to any of the libraries");
LOG_ERROR("Couldn't attach OpenSSL probes to any of the libraries");
}
}

Expand Down
6 changes: 3 additions & 3 deletions libebpfdiscoveryshared/headers/ebpfdiscoveryshared/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ struct DiscoveryGlobalState {
*/

enum DiscoveryLogLevel {
DISCOVERY_LOG_LEVEL_TRACE,
DISCOVERY_LOG_LEVEL_DEBUG,
DISCOVERY_LOG_LEVEL_OFF,
DISCOVERY_LOG_LEVEL_TRACE = 1,
DISCOVERY_LOG_LEVEL_DEBUG = 2,
DISCOVERY_LOG_LEVEL_OFF = 3,
};

struct DiscoveryConfig {
Expand Down
4 changes: 2 additions & 2 deletions libebpfdiscoveryskel/src/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ __attribute__((always_inline)) inline static int sendDiscoveryLogEvent(struct pt
__attribute__((always_inline)) inline static enum DiscoveryLogLevel getDiscoveryLogLevel() {
const struct DiscoveryConfig* configPtr = getDiscoveryConfig();
if (configPtr == NULL) {
return 0;
return DISCOVERY_LOG_LEVEL_OFF;
}
return configPtr->logLevel;
return (configPtr->logLevel > 0) ? configPtr->logLevel : DISCOVERY_LOG_LEVEL_OFF;
}

__attribute__((always_inline)) inline static int discoveryLog(
Expand Down

0 comments on commit 5fcd677

Please sign in to comment.