Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
  • Loading branch information
Vladimir Popov committed Jul 26, 2021
1 parent 2c4f082 commit 3802c08
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,10 @@ func create(ctx context.Context, conn *networkservice.Connection, isClient bool)
return errors.Wrapf(err, "failed to set %s = 0", disableIPv6Filename)
}

nsHandle, err := nshandle.FromURL(mechanism.GetNetNSURL())
defer func() { _ = nsHandle.Close() }()
if err != nil {
return errors.Wrapf(err, "failed to retrieve nsHandle for %+v", mechanism)
}
ch := make(chan netlink.AddrUpdate)
done := make(chan struct{})
defer close(done)
if err := netlink.AddrSubscribeAt(nsHandle, ch, done); err != nil {
if err := netlink.AddrSubscribeAt(targetNetNS, ch, done); err != nil {
return errors.Wrapf(err, "failed to subscribe for interface address updates")
}
for _, ipNet := range ipNets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (

type ipNeighborsClient struct{}

// NewClient creates a new client chain element setting IP neighbors to kernel interface
func NewClient() networkservice.NetworkServiceClient {
return &ipNeighborsClient{}
}
Expand All @@ -44,7 +45,7 @@ func (i *ipNeighborsClient) Request(ctx context.Context, request *networkservice
return nil, err
}

if err := create(ctx, conn); err != nil {
if err := create(conn); err != nil {
closeCtx, cancelClose := closectx.New(ctx)
defer cancelClose()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Nordix Foundation.
// Copyright (c) 2021 Nordix Foundation.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -19,7 +19,6 @@
package ipneighbors

import (
"context"
"net"
"os"

Expand All @@ -31,7 +30,7 @@ import (
link "github.com/networkservicemesh/sdk-kernel/pkg/kernel"
)

func create(ctx context.Context, conn *networkservice.Connection) error {
func create(conn *networkservice.Connection) error {
if mechanism := kernel.ToMechanism(conn.GetMechanism()); mechanism != nil {
netlinkHandle, err := link.GetNetlinkHandle(mechanism.GetNetNSURL())
if err != nil {
Expand All @@ -53,7 +52,6 @@ func create(ctx context.Context, conn *networkservice.Connection) error {
if err := setIPNeighbors(conn.GetContext().GetIpContext().GetIpNeighbors(), l); err != nil {
return errors.WithStack(err)
}

}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
type ipNeighborsServer struct {
}

// NewServer creates a new server chain element setting IP neighbors to kernel interface
func NewServer() networkservice.NetworkServiceServer {
return &ipNeighborsServer{}
}
Expand All @@ -44,7 +45,7 @@ func (i *ipNeighborsServer) Request(ctx context.Context, request *networkservice
return nil, err
}

if err := create(ctx, conn); err != nil {
if err := create(conn); err != nil {
closeCtx, cancelClose := closectx.New(ctx)
defer cancelClose()

Expand Down

0 comments on commit 3802c08

Please sign in to comment.