tmp: Debug prints

This commit is contained in:
Nimrod Gilboa Markevich 2022-07-10 15:18:07 +00:00
parent 281e7b1538
commit 8443090eed
4 changed files with 14 additions and 0 deletions

View File

@ -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;

View File

@ -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

View File

@ -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",
}

View File

@ -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,