From a551154b960854225902ddef304e3dc3eb190ba5 Mon Sep 17 00:00:00 2001 From: naiba Date: Sat, 23 Nov 2024 17:00:14 +0800 Subject: [PATCH] fix: nic config logic error --- pkg/monitor/nic/nic.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/monitor/nic/nic.go b/pkg/monitor/nic/nic.go index cf350c2..e03ba9b 100644 --- a/pkg/monitor/nic/nic.go +++ b/pkg/monitor/nic/nic.go @@ -28,13 +28,13 @@ func GetState(ctx context.Context) ([]uint64, error) { return nil, err } - allowList := excludeNetInterfaces - if m, ok := ctx.Value(NICKey).(map[string]bool); ok && len(m) > 0 { - allowList = m - } + allowList, _ := ctx.Value(NICKey).(map[string]bool) for _, v := range nc { - if !allowList[v.Name] { + if excludeNetInterfaces[v.Name] && !allowList[v.Name] { + continue + } + if len(allowList) > 0 && !allowList[v.Name] { continue } netInTransfer += v.BytesRecv