Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constant parameter notice #591

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/event_processor/base_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (be *BaseEvent) StringHex() string {
var prefix, connInfo string
switch AttachType(be.DataType) {
case ProbeEntry:
connInfo = fmt.Sprintf("Recived %d bytes", be.DataLen)
connInfo = fmt.Sprintf("Received %d bytes", be.DataLen)
case ProbeRet:
connInfo = fmt.Sprintf("Send %d bytes", be.DataLen)
default:
Expand All @@ -156,7 +156,7 @@ func (be *BaseEvent) String() string {
var connInfo string
switch AttachType(be.DataType) {
case ProbeEntry:
connInfo = fmt.Sprintf("Recived %dbytes", be.DataLen)
connInfo = fmt.Sprintf("Received %dbytes", be.DataLen)
case ProbeRet:
connInfo = fmt.Sprintf("Send %d bytes", be.DataLen)
default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/event_processor/iworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (ew *eventWorker) Run() {
ew.processor.delWorkerByUUID(ew)

/*
When returned from delWorkerByUUID(), there are two possiblities:
When returned from delWorkerByUUID(), there are two possibilities:
1) no routine can touch it.
2) one routine can still touch ew because getWorkerByUUID()
*happen before* delWorkerByUUID()
Expand Down
6 changes: 4 additions & 2 deletions pkg/event_processor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ func TestEventProcessor_Serve(t *testing.T) {
var err error
err = ep.Serve()
if err != nil {
log.Fatalf(err.Error())
//log.Fatalf(err.Error())
t.Error(err)
return
}
}()
content, err := os.ReadFile(testFile)
if err != nil {
//Do something
log.Fatalf("open file error: %s, file:%s", err.Error(), testFile)
t.Fatalf("open file error: %s, file:%s", err.Error(), testFile)
}
lines := strings.Split(string(content), "\n")

Expand Down
1 change: 1 addition & 0 deletions user/module/imodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func (m *Module) Init(ctx context.Context, logger *zerolog.Logger, conf config.I
if kv < kernel.VersionCode(5, 2, 0) {
m.isKernelLess5_2 = true
}
m.logger.Warn().Str("kernel", kv.String()).Msg("Kernel version is less than 5.2, Process filtering parameters do not take effect such as pid/uid.")
}

logger.Info().Int("Pid", os.Getpid()).Str("Kernel Info", kv.String()).Send()
Expand Down
8 changes: 4 additions & 4 deletions user/module/probe_openssl_lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ func (m *MOpenSSLProbe) detectOpenssl(soPath string) error {
break
}

// Substracting OpenSslVersionLen from totalReadCount,
// Subtracting OpenSslVersionLen from totalReadCount,
// to cover the edge-case in which openssl version string
// could be split into two buffers. Substraction will,
// could be split into two buffers. Subtraction will,
// makes sure that last 30 bytes of previous buffer are considered.
totalReadCount += readCount - OpenSslVersionLen

Expand All @@ -212,8 +212,8 @@ func (m *MOpenSSLProbe) detectOpenssl(soPath string) error {

}

f.Close()
buf = nil
_ = f.Close()
//buf = buf[:0]

var bpfFile string
var found bool
Expand Down
2 changes: 1 addition & 1 deletion user/module/probe_pcap.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (t *MTCProbe) writePid(tcEvent *event.TcSkbEvent) (error, []byte) {

oldEthLayer := ethPacket.Layers()[0].(*layers.Ethernet)

// subtract oldethelayer from the begining of ethpacket
// subtract oldethelayer from the beginning of ethpacket
restOfLayers := ethPacket.Layers()[1:]
remainder := []byte{}
for _, layer := range restOfLayers {
Expand Down
Loading