diff --git a/tap/tlstapper/bpf/common.c b/tap/tlstapper/bpf/common.c index a4dad45a6..02b79c026 100644 --- a/tap/tlstapper/bpf/common.c +++ b/tap/tlstapper/bpf/common.c @@ -18,9 +18,12 @@ static __always_inline int add_address_to_chunk(struct pt_regs *ctx, struct tls_ struct fd_info *fdinfo = bpf_map_lookup_elem(&file_descriptor_to_ipv4, &key); + log_error(ctx, LOG_DEBUG, 0, 0, 0); if (fdinfo == NULL) { + log_error(ctx, LOG_DEBUG, 1, 0, 0); return 0; } + log_error(ctx, LOG_DEBUG, 2, 0, 0); int err; diff --git a/tap/tlstapper/bpf/include/logger_messages.h b/tap/tlstapper/bpf/include/logger_messages.h index 27c66c229..ac1b0495e 100644 --- a/tap/tlstapper/bpf/include/logger_messages.h +++ b/tap/tlstapper/bpf/include/logger_messages.h @@ -31,6 +31,7 @@ Copyright (C) UP9 Inc. #define LOG_ERROR_READING_SOCKET_SADDR (19) #define LOG_ERROR_READING_SOCKET_DPORT (20) #define LOG_ERROR_READING_SOCKET_SPORT (21) +#define LOG_DEBUG (22) // Sometimes we have the same error, happening from different locations. // in order to be able to distinct between them in the log, we add an diff --git a/tap/tlstapper/bpf_logger_messages.go b/tap/tlstapper/bpf_logger_messages.go index bd1f6b878..c2aa1aff3 100644 --- a/tap/tlstapper/bpf_logger_messages.go +++ b/tap/tlstapper/bpf_logger_messages.go @@ -25,4 +25,5 @@ var bpfLogMessages = []string{ /*0019*/ "[%d] Unable to read socket saddr [err: %d]", /*0019*/ "[%d] Unable to read socket dport [err: %d]", /*0021*/ "[%d] Unable to read socket sport [err: %d]", + /*0022*/ "DEBUGBPF %d %d %d", } diff --git a/tap/tlstapper/chunk.go b/tap/tlstapper/chunk.go index 225dd2890..e153d5244 100644 --- a/tap/tlstapper/chunk.go +++ b/tap/tlstapper/chunk.go @@ -5,6 +5,7 @@ import ( "net" "unsafe" + "github.com/up9inc/mizu/logger" "github.com/up9inc/mizu/tap/api" ) @@ -86,6 +87,14 @@ func (c *tlsTapperTlsChunk) getAddressPair() (addressPair, bool) { full = false } + mode := 0 + if full { + mode = 1 + } else { + mode = 0 + } + logger.Log.Infof("getAddressPair %d %s:%d > %s:%d", mode, srcIp, srcPort, dstIp, dstPort) + return addressPair{ srcIp: srcIp, srcPort: srcPort,