Skip to content

Commit

Permalink
Merge pull request #69 from glazychev-art/update_vpp
Browse files Browse the repository at this point in the history
Update vpp version
  • Loading branch information
denis-tingaikin authored Feb 1, 2023
2 parents ebea337 + c35d426 commit ce24362
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ linters-settings:
goimports:
local-prefixes: github.com/networkservicemesh
gocyclo:
min-complexity: 20
min-complexity: 25
maligned:
suggest-new: true
dupl:
Expand Down
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=v23.02-rc0-189-g0359d19f2
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
10 changes: 9 additions & 1 deletion vppinit/acl.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022 Cisco and/or its affiliates.
// Copyright (c) 2020-2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -97,6 +97,7 @@ func ingressACLAddDelete() *acl.ACLAddReplace {
// Allow ingress ICMPv6 Router Advertisement Message
IsPermit: acl_types.ACL_ACTION_API_PERMIT,
SrcPrefix: ipv6zeroPrefix,
DstPrefix: ipv6zeroPrefix,
Proto: ip_types.IP_API_PROTO_ICMP6,
DstportOrIcmpcodeFirst: 134,
DstportOrIcmpcodeLast: 134,
Expand All @@ -105,17 +106,20 @@ func ingressACLAddDelete() *acl.ACLAddReplace {
// Allow ingress ICMPv6 Neighbor Advertisement Message
IsPermit: acl_types.ACL_ACTION_API_PERMIT,
SrcPrefix: ipv6zeroPrefix,
DstPrefix: ipv6zeroPrefix,
Proto: ip_types.IP_API_PROTO_ICMP6,
DstportOrIcmpcodeFirst: 136,
DstportOrIcmpcodeLast: 136,
},
{
IsPermit: acl_types.ACL_ACTION_API_DENY,
SrcPrefix: ipV4zeroPrefix,
DstPrefix: ipV4zeroPrefix,
},
{
IsPermit: acl_types.ACL_ACTION_API_DENY,
SrcPrefix: ipv6zeroPrefix,
DstPrefix: ipv6zeroPrefix,
},
},
}
Expand All @@ -130,6 +134,7 @@ func egressACLAddDelete() *acl.ACLAddReplace {
// Allow egress ICMPv6 Router Solicitation Message
IsPermit: acl_types.ACL_ACTION_API_PERMIT,
Proto: ip_types.IP_API_PROTO_ICMP6,
SrcPrefix: ipv6zeroPrefix,
DstPrefix: ipv6zeroPrefix,
SrcportOrIcmptypeFirst: 133,
SrcportOrIcmptypeLast: 133,
Expand All @@ -139,15 +144,18 @@ func egressACLAddDelete() *acl.ACLAddReplace {
IsPermit: acl_types.ACL_ACTION_API_PERMIT,
Proto: ip_types.IP_API_PROTO_ICMP6,
SrcPrefix: ipv6zeroPrefix,
DstPrefix: ipv6zeroPrefix,
SrcportOrIcmptypeFirst: 135,
SrcportOrIcmptypeLast: 135,
},
{
IsPermit: acl_types.ACL_ACTION_API_DENY,
SrcPrefix: ipV4zeroPrefix,
DstPrefix: ipV4zeroPrefix,
},
{
IsPermit: acl_types.ACL_ACTION_API_DENY,
SrcPrefix: ipv6zeroPrefix,
DstPrefix: ipv6zeroPrefix,
},
},
Expand Down
19 changes: 12 additions & 7 deletions vppinit/vppinit.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022 Cisco and/or its affiliates.
// Copyright (c) 2020-2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -64,6 +64,10 @@ func LinkToAfPacket(ctx context.Context, vppConn api.Connection, tunnelIP net.IP
return nil, err
}

if mtuErr := setMtu(ctx, vppConn, link, swIfIndex); err != nil {
return nil, mtuErr
}

if aclErr := denyAllACLToInterface(ctx, vppConn, swIfIndex); aclErr != nil {
return nil, aclErr
}
Expand Down Expand Up @@ -165,25 +169,26 @@ func LinkToAfPacket(ctx context.Context, vppConn api.Connection, tunnelIP net.IP
}

func createAfPacket(ctx context.Context, vppConn api.Connection, link netlink.Link) (interface_types.InterfaceIndex, error) {
afPacketCreate := &af_packet.AfPacketCreate{
afPacketCreate := &af_packet.AfPacketCreateV3{
Mode: af_packet.AF_PACKET_API_MODE_ETHERNET,
HwAddr: types.ToVppMacAddress(&link.Attrs().HardwareAddr),
HostIfName: link.Attrs().Name,
Flags: af_packet.AF_PACKET_API_FLAG_VERSION_2,
}
now := time.Now()
afPacketCreateRsp, err := af_packet.NewServiceClient(vppConn).AfPacketCreate(ctx, afPacketCreate)
afPacketCreateRsp, err := af_packet.NewServiceClient(vppConn).AfPacketCreateV3(ctx, afPacketCreate)
if err != nil {
return 0, err
}
log.FromContext(ctx).
WithField("swIfIndex", afPacketCreateRsp.SwIfIndex).
WithField("mode", afPacketCreate.Mode).
WithField("hwaddr", afPacketCreate.HwAddr).
WithField("hostIfName", afPacketCreate.HostIfName).
WithField("flags", afPacketCreate.Flags).
WithField("duration", time.Since(now)).
WithField("vppapi", "AfPacketCreate").Debug("completed")
WithField("vppapi", "AfPacketCreateV3").Debug("completed")

if err := setMtu(ctx, vppConn, link, afPacketCreateRsp.SwIfIndex); err != nil {
return 0, err
}
return afPacketCreateRsp.SwIfIndex, nil
}

Expand Down

0 comments on commit ce24362

Please sign in to comment.