Skip to content

Commit

Permalink
Add latest IPv6 fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Glazychev <artem.glazychev@xored.com>
  • Loading branch information
glazychev-art committed Nov 8, 2022
1 parent da674bd commit 748824c
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,7 @@ issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
- path: vppinit/vppinit.go
linters:
- gocyclo
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VPP_VERSION=v22.06-rc0-147-g1c5485ab8
ARG VPP_VERSION=v22.06-rc0-150-gd38fa55fa
FROM ghcr.io/edwarnicke/govpp/vpp:${VPP_VERSION} as go
COPY --from=golang:1.18.2-buster /usr/local/go/ /go
ENV PATH ${PATH}:/go/bin
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ go 1.18
require (
git.fd.io/govpp.git v0.3.6-0.20210927044411-385ccc0d8ba9
github.com/antonfisher/nested-logrus-formatter v1.3.1
github.com/edwarnicke/govpp v0.0.0-20220509171552-731995b8f574
github.com/edwarnicke/govpp v0.0.0-20221023154218-ef9a6adf6930
github.com/edwarnicke/grpcfd v1.1.2
github.com/edwarnicke/vpphelper v0.0.0-20210225052320-b4f1f1aff45d
github.com/google/uuid v1.2.0
github.com/google/uuid v1.3.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/networkservicemesh/api v1.4.1-0.20220711153918-a59689088578
github.com/networkservicemesh/sdk v0.5.1-0.20221013082556-9ae27f8b63af
github.com/networkservicemesh/sdk v0.5.1-0.20221031083615-fac60b46dace
github.com/networkservicemesh/sdk-kernel v0.0.0-20221013082925-354d38e71cde
github.com/networkservicemesh/sdk-vpp v0.0.0-20221013083414-db9c967a253d
github.com/pkg/errors v0.9.1
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/edwarnicke/exechelper v1.0.2 h1:dD49Ui2U0FBFxxhalnKw6vLS0P0TkgnXBRvKL/xmC5w=
github.com/edwarnicke/exechelper v1.0.2/go.mod h1:/T271jtNX/ND4De6pa2aRy2+8sNtyCDB1A2pp4M+fUs=
github.com/edwarnicke/govpp v0.0.0-20220509171552-731995b8f574 h1:2lYhLBDjflBOPJLd/42txk9QlSkVep6p1vKzlvkCKOI=
github.com/edwarnicke/govpp v0.0.0-20220509171552-731995b8f574/go.mod h1:kHDnxA+SSNFeMEHz7xvhub1zvx4mOTRlWWRCay2n5NM=
github.com/edwarnicke/govpp v0.0.0-20221023154218-ef9a6adf6930 h1:/gS3gW7jV6ljzWcnHGxu1Yn1guxtwq8IuwJpK5TUl1w=
github.com/edwarnicke/govpp v0.0.0-20221023154218-ef9a6adf6930/go.mod h1:kHDnxA+SSNFeMEHz7xvhub1zvx4mOTRlWWRCay2n5NM=
github.com/edwarnicke/grpcfd v1.1.2 h1:2b8kCABQ1+JjSKGDoHadqSW7whCeTXMqtyo6jmB5B8k=
github.com/edwarnicke/grpcfd v1.1.2/go.mod h1:rHihB9YvNMixz8rS+ZbwosI2kj65VLkeyYAI2M+/cGA=
github.com/edwarnicke/log v1.0.0 h1:T6uRNCmR99GTt/CpRr2Gz8eGW8fm0HMThDNGdNxPaGk=
Expand Down Expand Up @@ -180,8 +180,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
Expand Down Expand Up @@ -217,8 +217,8 @@ github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA=
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc=
github.com/networkservicemesh/api v1.4.1-0.20220711153918-a59689088578 h1:2MZD6SGFULqTgMKA8BFy7F+ldRErAyxsWht7oCwCVRM=
github.com/networkservicemesh/api v1.4.1-0.20220711153918-a59689088578/go.mod h1:hOF2844BSstH1311oDMDgqqXS+kdc77htZNPRKl9mf8=
github.com/networkservicemesh/sdk v0.5.1-0.20221013082556-9ae27f8b63af h1:6X3VF4J+jWYWYsQ+Nnx/B0dSFWh79X8SmoaOeEiucuI=
github.com/networkservicemesh/sdk v0.5.1-0.20221013082556-9ae27f8b63af/go.mod h1:YnWv4wspKOtfFsc7kC5tfs7n95Snj3C0MRCal7yytVE=
github.com/networkservicemesh/sdk v0.5.1-0.20221031083615-fac60b46dace h1:ct4bWeeEScl+OkLmWtttmWSjxK7r6itZ438l9rPESto=
github.com/networkservicemesh/sdk v0.5.1-0.20221031083615-fac60b46dace/go.mod h1:YnWv4wspKOtfFsc7kC5tfs7n95Snj3C0MRCal7yytVE=
github.com/networkservicemesh/sdk-kernel v0.0.0-20221013082925-354d38e71cde h1:uCpQ4qqDs/RE30uKUR2pWQITNgOuSjNO5uEez0uteEU=
github.com/networkservicemesh/sdk-kernel v0.0.0-20221013082925-354d38e71cde/go.mod h1:bcTM2B6ehXCJLl8Mg5DLQgt+xM2Xolf9P9BVQKDv0IA=
github.com/networkservicemesh/sdk-vpp v0.0.0-20221013083414-db9c967a253d h1:sIVWteQt7n0d6yKE27a3hnMgdlwNm048YoSRJY2wlu4=
Expand Down
1 change: 1 addition & 0 deletions internal/imports/imports_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func main() {
tlsServerConfig := tlsconfig.MTLSServerConfig(source, source, tlsconfig.AuthorizeAny())
tlsServerConfig.MinVersion = tls.VersionTLS12

listenOn := &(url.URL{Scheme: "tcp", Host: config.TunnelIP.String() + ":"})
listenOn := &(url.URL{Scheme: "tcp", Host: net.JoinHostPort(config.TunnelIP.String(), "")})
server := createVl3Endpoint(
ctx,
config,
Expand Down
40 changes: 40 additions & 0 deletions vppinit/vppinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/edwarnicke/govpp/binapi/interface_types"
"github.com/edwarnicke/govpp/binapi/ip"
"github.com/edwarnicke/govpp/binapi/ip_neighbor"
"github.com/edwarnicke/govpp/binapi/vlib"
"github.com/pkg/errors"
"github.com/vishvananda/netlink"

Expand Down Expand Up @@ -69,6 +70,14 @@ func LinkToAfPacket(ctx context.Context, vppConn api.Connection, tunnelIP net.IP
return nil, aclErr
}

// Disable Router Advertisement on IPv6 tunnels
if tunnelIP.To4() == nil {
err = disableIPv6RA(ctx, vppConn, link)
if err != nil {
return nil, err
}
}

now := time.Now()
_, err = interfaces.NewServiceClient(vppConn).SwInterfaceSetFlags(ctx, &interfaces.SwInterfaceSetFlags{
SwIfIndex: swIfIndex,
Expand Down Expand Up @@ -311,3 +320,34 @@ func linkByIP(ctx context.Context, ipaddress net.IP) (netlink.Link, error) {
}
return nil, nil
}

func disableIPv6RA(ctx context.Context, vppConn api.Connection, link netlink.Link) error {
cmds := []string{
fmt.Sprintf("enable ip6 interface host-%s", link.Attrs().Name),
fmt.Sprintf("ip6 nd host-%s ra-cease ra-suppress", link.Attrs().Name),
}
for _, cmd := range cmds {
now := time.Now()
var reply, err = vlib.NewServiceClient(vppConn).CliInband(ctx, &vlib.CliInband{
Cmd: cmd,
})

if err != nil {
log.FromContext(ctx).
WithField("interface", fmt.Sprintf("host-%s", link.Attrs().Name)).
WithField("duration", time.Since(now)).
WithField("cmd", cmd).
WithField("vppapi", "CliInband").Error(err)
return err
}

log.FromContext(ctx).
WithField("interface", fmt.Sprintf("host-%s", link.Attrs().Name)).
WithField("cmd", cmd).
WithField("reply", reply.Reply).
WithField("duration", time.Since(now)).
WithField("vppapi", "CliInband").Debug("completed")
}

return nil
}

0 comments on commit 748824c

Please sign in to comment.