Bring back len and cap fields

This commit is contained in:
M. Mert Yildiran 2022-06-02 00:28:42 +03:00
parent 04935b21aa
commit f80556d21c
No known key found for this signature in database
GPG Key ID: D42ADB236521BF7A
6 changed files with 16 additions and 6 deletions

View File

@ -18,6 +18,8 @@ struct golang_read_write {
__u32 conn_addr;
bool is_request;
bool is_gzip_chunk;
__u32 len;
__u32 cap;
__u8 data[BUFFER_SIZE_READ_WRITE];
};
@ -56,6 +58,8 @@ static __always_inline int golang_crypto_tls_write_uprobe(struct pt_regs *ctx) {
b->conn_addr = ctx->rsi; // go.itab.*net.TCPConn,net.Conn address
b->is_request = true;
b->is_gzip_chunk = false;
b->len = ctx->rcx;
b->cap = ctx->rdi;
struct socket x = {
.pid = s->pid,
@ -103,6 +107,8 @@ static __always_inline int golang_crypto_tls_read_uprobe(struct pt_regs *ctx) {
b->conn_addr = ctx->rsi; // go.itab.*net.TCPConn,net.Conn address
b->is_request = false;
b->is_gzip_chunk = false;
b->len = ctx->rcx;
b->cap = ctx->rcx; // no cap info
void* stack_addr = (void*)ctx->rsp;
__u64 data_p;

View File

@ -185,12 +185,12 @@ func (p *tlsPoller) pollGolangReadWrite(rd *ringbuf.Reader, emitter api.Emitter,
go dissect(p.extension, connection.ClientReader, options)
go dissect(p.extension, connection.ServerReader, options)
request := make([]byte, len(b.Data[:]))
copy(request, b.Data[:])
request := make([]byte, len(b.Data[:b.Len]))
copy(request, b.Data[:b.Len])
connection.ClientReader.send(request)
} else {
response := make([]byte, len(b.Data[:]))
copy(response, b.Data[:])
response := make([]byte, len(b.Data[:b.Len]))
copy(response, b.Data[:b.Len])
connection.ServerReader.send(response)
}
}

View File

@ -19,8 +19,10 @@ type tlsTapperGolangReadWrite struct {
ConnAddr uint32
IsRequest bool
IsGzipChunk bool
Data [524288]uint8
_ [2]byte
Len uint32
Cap uint32
Data [524288]uint8
}
type tlsTapperTlsChunk struct {

Binary file not shown.

View File

@ -19,8 +19,10 @@ type tlsTapperGolangReadWrite struct {
ConnAddr uint32
IsRequest bool
IsGzipChunk bool
Data [524288]uint8
_ [2]byte
Len uint32
Cap uint32
Data [524288]uint8
}
type tlsTapperTlsChunk struct {

Binary file not shown.