Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mac address to memif spec in annotations #711

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions calico-vpp-agent/cni/pod_interface/memif.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package pod_interface

import (
"fmt"
"net"

"github.com/containernetworking/plugins/pkg/ns"
"github.com/pkg/errors"
Expand Down Expand Up @@ -83,6 +84,12 @@ func (i *MemifPodInterfaceDriver) CreateInterface(podSpec *storage.LocalPodSpec,
}
if *usedIfSpec.IsL3 {
memif.Mode = types.MemifModeIP
} else if podSpec.NetworkName == "" && podSpec.PBLMemifSpec.Mac != "" {
pblMac, err := net.ParseMAC(podSpec.PBLMemifSpec.Mac)
if err != nil {
return err
}
memif.MacAddress = pblMac
}

err = i.vpp.CreateMemif(memif)
Expand Down
2 changes: 1 addition & 1 deletion calico-vpp-agent/cni/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
)

const (
CniServerStateFileVersion = 8 // Used to ensure compatibility wen we reload data
CniServerStateFileVersion = 9 // Used to ensure compatibility wen we reload data
MaxApiTagLen = 63 /* No more than 64 characters in API tags */
VrfTagHashLen = 8 /* how many hash charatecters (b64) of the name in tag prefix (useful when trucated) */
)
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ type InterfaceSpec struct {
IsL3 *bool `json:"isl3"`
/* "interrupt" "adaptive" or "polling" mode */
RxMode types.RxMode `json:"rxMode"`
Mac string `json:"mac"`
}

func (i *InterfaceSpec) GetIsL3(isMemif bool) bool {
Expand Down
Loading