Browse Source

Merge pull request #1152 from vincentmli/vli-dev

Make VXLAN device learning attribute configurable
Rajat Chopra 5 năm trước cách đây
mục cha
commit
fab9f2022b
2 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 2 1
      backend/vxlan/device.go
  2. 3 1
      backend/vxlan/vxlan.go

+ 2 - 1
backend/vxlan/device.go

@@ -35,6 +35,7 @@ type vxlanDeviceAttrs struct {
 	vtepAddr  net.IP
 	vtepPort  int
 	gbp       bool
+	learning  bool
 }
 
 type vxlanDevice struct {
@@ -51,7 +52,7 @@ func newVXLANDevice(devAttrs *vxlanDeviceAttrs) (*vxlanDevice, error) {
 		VtepDevIndex: devAttrs.vtepIndex,
 		SrcAddr:      devAttrs.vtepAddr,
 		Port:         devAttrs.vtepPort,
-		Learning:     false,
+		Learning:     devAttrs.learning,
 		GBP:          devAttrs.gbp,
 	}
 

+ 3 - 1
backend/vxlan/vxlan.go

@@ -107,6 +107,7 @@ func (be *VXLANBackend) RegisterNetwork(ctx context.Context, wg sync.WaitGroup,
 		VNI           int
 		Port          int
 		GBP           bool
+		Learning      bool
 		DirectRouting bool
 	}{
 		VNI: defaultVNI,
@@ -117,7 +118,7 @@ func (be *VXLANBackend) RegisterNetwork(ctx context.Context, wg sync.WaitGroup,
 			return nil, fmt.Errorf("error decoding VXLAN backend config: %v", err)
 		}
 	}
-	log.Infof("VXLAN config: VNI=%d Port=%d GBP=%v DirectRouting=%v", cfg.VNI, cfg.Port, cfg.GBP, cfg.DirectRouting)
+	log.Infof("VXLAN config: VNI=%d Port=%d GBP=%v Learning=%v DirectRouting=%v", cfg.VNI, cfg.Port, cfg.GBP, cfg.Learning, cfg.DirectRouting)
 
 	devAttrs := vxlanDeviceAttrs{
 		vni:       uint32(cfg.VNI),
@@ -126,6 +127,7 @@ func (be *VXLANBackend) RegisterNetwork(ctx context.Context, wg sync.WaitGroup,
 		vtepAddr:  be.extIface.IfaceAddr,
 		vtepPort:  cfg.Port,
 		gbp:       cfg.GBP,
+		learning:  cfg.Learning,
 	}
 
 	dev, err := newVXLANDevice(&devAttrs)