Skip to content

Commit

Permalink
add mac address to tap in annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
hedibouattour committed Jan 13, 2025
1 parent f5a7afb commit 2e44c03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions calico-vpp-agent/cni/pod_interface/tuntap.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ func (i *TunTapPodInterfaceDriver) CreateInterface(podSpec *storage.LocalPodSpec
HostMtu: i.computePodMtu(podSpec.Mtu, i.felixConfig, i.ipipEncapRefCounts > 0, i.vxlanEncapRefCounts > 0),
}

if podSpec.IfSpec.Mac != "" {
i.log.Debugf("mac address specified for interface %s in vpp: '%s'", podSpec.InterfaceName, podSpec.IfSpec.Mac)
mac, err := net.ParseMAC("02:00:00:00:00:02")
if err != nil {
return err
}
tun.HardwareAddr = mac
}
if *podSpec.IfSpec.IsL3 {
tun.Flags |= types.TapFlagTun
}
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 = 9 // Used to ensure compatibility wen we reload data
CniServerStateFileVersion = 10 // 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

0 comments on commit 2e44c03

Please sign in to comment.