diff --git a/pkg/kernel/tools/heal/liveness_check.go b/pkg/kernel/tools/heal/liveness_check.go index 58efa5e5..72d4a00f 100644 --- a/pkg/kernel/tools/heal/liveness_check.go +++ b/pkg/kernel/tools/heal/liveness_check.go @@ -24,6 +24,7 @@ import ( "time" "github.com/networkservicemesh/api/pkg/api/networkservice" + "github.com/networkservicemesh/api/pkg/api/networkservice/mechanisms/kernel" "github.com/networkservicemesh/sdk/pkg/tools/log" "github.com/tatsushid/go-fastping" ) @@ -32,9 +33,14 @@ const ( defaultTimeout = 200 * time.Millisecond ) -// NewKernelLivenessCheck is an implementation of heal.LivenessCheck. It sends ICMP +// KernelLivenessCheck is an implementation of heal.LivenessCheck. It sends ICMP // ping and checks reply. Returns false if didn't get reply. -func NewKernelLivenessCheck(deadlineCtx context.Context, conn *networkservice.Connection) bool { +func KernelLivenessCheck(deadlineCtx context.Context, conn *networkservice.Connection) bool { + if mechanism := conn.GetMechanism().GetType(); mechanism != kernel.MECHANISM { + log.FromContext(deadlineCtx).Warnf("ping is not supported for mechanism %v", mechanism) + return true + } + p := fastping.NewPinger() deadline, ok := deadlineCtx.Deadline() if !ok {