diff --git a/go.mod b/go.mod index d044c62..baeac5d 100644 --- a/go.mod +++ b/go.mod @@ -11,8 +11,8 @@ require ( github.com/networkservicemesh/sdk v0.5.1-0.20240820090035-6fad31a9f0aa github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.4 - github.com/vishvananda/netlink v1.2.1-beta.2.0.20220630165224-c591ada0fb2b - github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 + github.com/vishvananda/netlink v1.3.0 + github.com/vishvananda/netns v0.0.4 go.uber.org/goleak v1.3.0 golang.org/x/sys v0.18.0 google.golang.org/grpc v1.60.1 diff --git a/go.sum b/go.sum index a94ac46..4a00049 100644 --- a/go.sum +++ b/go.sum @@ -63,11 +63,10 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/vishvananda/netlink v1.2.1-beta.2.0.20220630165224-c591ada0fb2b h1:CyMWBGvc1ZOvUBxW51DVTSIIAeJWWJJs+Ko3ouM/AVI= -github.com/vishvananda/netlink v1.2.1-beta.2.0.20220630165224-c591ada0fb2b/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= -github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= -github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 h1:gga7acRE695APm9hlsSMoOoE65U4/TcqNj90mc69Rlg= -github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= +github.com/vishvananda/netlink v1.3.0 h1:X7l42GfcV4S6E4vHTsw48qbrV+9PVojNfIhZcwQdrZk= +github.com/vishvananda/netlink v1.3.0/go.mod h1:i6NetklAujEcC6fK0JPjT8qSwWyO0HLn4UKG+hGqeJs= +github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8= +github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.43.0 h1:tFUz2BE6ucxU9PuPCwzbfDeQjMznIySJ4/73a3FSPUs= @@ -101,10 +100,10 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/pkg/kernel/networkservice/connectioncontextkernel/client.go b/pkg/kernel/networkservice/connectioncontextkernel/client.go index e5deadc..7b67781 100644 --- a/pkg/kernel/networkservice/connectioncontextkernel/client.go +++ b/pkg/kernel/networkservice/connectioncontextkernel/client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023 Cisco and/or its affiliates. +// Copyright (c) 2020-2024 Cisco and/or its affiliates. // // Copyright (c) 2021-2023 Nordix Foundation. // diff --git a/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddress/common.go b/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddress/common.go index 7e80b1d..051f87e 100644 --- a/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddress/common.go +++ b/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddress/common.go @@ -1,6 +1,6 @@ // Copyright (c) 2021-2022 Nordix Foundation. // -// Copyright (c) 2020-2023 Cisco and/or its affiliates. +// Copyright (c) 2020-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -103,10 +103,7 @@ func create(ctx context.Context, conn *networkservice.Connection, isClient bool) } // Add new IP addresses - if err := addNewIPAddrs(ctx, netlinkHandle, l, toAdd); err != nil { - return err - } - return nil + return addNewIPAddrs(ctx, netlinkHandle, l, toAdd) } return nil } diff --git a/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/common.go b/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/common.go index f11a1a9..ba9af27 100644 --- a/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/common.go +++ b/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/common.go @@ -46,22 +46,18 @@ func create(ctx context.Context, conn *networkservice.Connection, isClient bool) toCheck := make([]*net.IPNet, len(ipNets)) copy(toCheck, ipNets) - log.FromContext(ctx).Infof("mechanism.GetNetNSURL: %v", mechanism.GetNetNSURL()) netlinkHandle, err := link.GetNetlinkHandle(mechanism.GetNetNSURL()) if err != nil { return err } defer netlinkHandle.Close() - log.FromContext(ctx).Infof("mechanism.GetInterfaceName: %v", mechanism.GetInterfaceName()) ifName := mechanism.GetInterfaceName() l, err := netlinkHandle.LinkByName(ifName) if err != nil { return errors.Wrapf(err, "failed to find link %s", ifName) } - log.FromContext(ctx).Infof("ifaceName: %v", ifName) - return checkIPNets(ctx, netlinkHandle, l, toCheck) } return nil @@ -70,7 +66,6 @@ func create(ctx context.Context, conn *networkservice.Connection, isClient bool) func checkIPNets(ctx context.Context, netlinkHandle *netlink.Handle, l netlink.Link, ipNets []*net.IPNet) error { now := time.Now() - log.FromContext(ctx).Infof("current") current := make(map[string]struct{}) for _, ipNet := range ipNets { current[ipNet.String()] = struct{}{} @@ -78,7 +73,6 @@ func checkIPNets(ctx context.Context, netlinkHandle *netlink.Handle, l netlink.L for { time.Sleep(time.Millisecond * 500) - log.FromContext(ctx).Infof("current len: %v", len(current)) if len(current) == 0 { return nil } @@ -86,17 +80,12 @@ func checkIPNets(ctx context.Context, netlinkHandle *netlink.Handle, l netlink.L case <-ctx.Done(): return errors.Wrapf(ctx.Err(), "timeout waiting for update to add ip addresses %s to %s (type: %s)", ipNets, l.Attrs().Name, l.Type()) default: - log.FromContext(ctx).Infof("addrlist") addrs, err := netlinkHandle.AddrList(l, netlink.FAMILY_ALL) if err != nil { return errors.Wrapf(err, "failed to get ip addresses for %s", l.Attrs().Name) } - log.FromContext(ctx).Infof("got addrs: %v", addrs) for _, addr := range addrs { - log.FromContext(ctx).Infof("checking addr: %v", addr) - log.FromContext(ctx).Infof("current: %v", current) addrString := addr.IPNet.String() - log.FromContext(ctx).Infof("addrString: %v", addrString) if _, ok := current[addrString]; ok { delete(current, addrString) log.FromContext(ctx). diff --git a/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/doc.go b/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/doc.go index 5d160eb..de2a1b1 100644 --- a/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/doc.go +++ b/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/doc.go @@ -1,6 +1,4 @@ -// Copyright (c) 2020-2022 Cisco and/or its affiliates. -// -// Copyright (c) 2021-2022 Nordix Foundation. +// Copyright (c) 2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // diff --git a/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/server.go b/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/server.go index 03429de..1308556 100644 --- a/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/server.go +++ b/pkg/kernel/networkservice/connectioncontextkernel/ipcontext/ipaddresscheck/server.go @@ -1,8 +1,4 @@ -// Copyright (c) 2020-2022 Cisco and/or its affiliates. -// -// Copyright (c) 2021-2022 Nordix Foundation. -// -// Copyright (c) 2021-2022 Doc.ai and/or its affiliates. +// Copyright (c) 2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -32,7 +28,6 @@ import ( "github.com/networkservicemesh/api/pkg/api/networkservice" "github.com/networkservicemesh/sdk/pkg/networkservice/core/next" "github.com/networkservicemesh/sdk/pkg/networkservice/utils/metadata" - "github.com/networkservicemesh/sdk/pkg/tools/log" "github.com/networkservicemesh/sdk/pkg/tools/postpone" ) @@ -72,8 +67,6 @@ func (i *ipaddressCheckServer) Request(ctx context.Context, request *networkserv return nil, err } - log.FromContext(ctx).Infof("BACK") - if err := create(ctx, conn, metadata.IsClient(i)); err != nil { closeCtx, cancelClose := postponeCtxFunc() defer cancelClose() diff --git a/pkg/kernel/networkservice/connectioncontextkernel/server.go b/pkg/kernel/networkservice/connectioncontextkernel/server.go index b89e467..cf0e569 100644 --- a/pkg/kernel/networkservice/connectioncontextkernel/server.go +++ b/pkg/kernel/networkservice/connectioncontextkernel/server.go @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023 Cisco and/or its affiliates. +// Copyright (c) 2020-2024 Cisco and/or its affiliates. // // Copyright (c) 2021-2023 Nordix Foundation. //