Skip to content

Commit

Permalink
Fix for MTU change: get L3 mtu instead of linkMTU (#555)
Browse files Browse the repository at this point in the history
Issue: networkservicemesh/cmd-forwarder#557
Related PR: #554

The L3 MTU is set based on link L2 mtu and should not modified.

Signed-off-by: Laszlo Kiraly <[email protected]>
  • Loading branch information
ljkiraly authored Apr 12, 2022
1 parent dc652f0 commit 19f2f16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/networkservice/mechanisms/vlan/mtu/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (m *mtuClient) Request(ctx context.Context, request *networkservice.Network
if mechanism := vlan.ToMechanism(conn.GetMechanism()); mechanism != nil {
localMtu, loaded := m.mtu.Load(swIfIndex)
if !loaded {
localMtu, err = getMTU(ctx, m.vppConn, swIfIndex)
localMtu, err = getL3MTU(ctx, m.vppConn, swIfIndex)
if err != nil {
closeCtx, cancelClose := postponeCtxFunc()
defer cancelClose()
Expand Down
6 changes: 4 additions & 2 deletions pkg/networkservice/mechanisms/vlan/mtu/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ import (
"github.com/networkservicemesh/sdk/pkg/tools/log"
)

func getMTU(ctx context.Context, vppConn api.Connection, swIfIndex interface_types.InterfaceIndex) (uint32, error) {
const l3MtuIndex = 0

func getL3MTU(ctx context.Context, vppConn api.Connection, swIfIndex interface_types.InterfaceIndex) (uint32, error) {
now := time.Now()
dc, err := interfaces.NewServiceClient(vppConn).SwInterfaceDump(ctx, &interfaces.SwInterfaceDump{
SwIfIndex: swIfIndex,
Expand All @@ -47,5 +49,5 @@ func getMTU(ctx context.Context, vppConn api.Connection, swIfIndex interface_typ
WithField("details.LinkMtu", details.LinkMtu).
WithField("duration", time.Since(now)).
WithField("vppapi", "SwInterfaceDump").Debug("completed")
return uint32(details.LinkMtu), nil
return details.Mtu[l3MtuIndex], nil
}

0 comments on commit 19f2f16

Please sign in to comment.