diff --git a/pkg/daemon/config/config.go b/pkg/daemon/config/config.go index f8c7a3b9..3504f634 100644 --- a/pkg/daemon/config/config.go +++ b/pkg/daemon/config/config.go @@ -94,6 +94,8 @@ type Configuration struct { NeighGCThresh1 int NeighGCThresh2 int NeighGCThresh3 int + + EnableVlanArpEnhancement bool } // ParseFlags will parse cmd args then init kubeClient and configuration @@ -117,6 +119,7 @@ func ParseFlags() (*Configuration, error) { argNeighGCThresh2 = pflag.Int("neigh-gc-thresh2", DefaultNeighGCThresh2, "Value to set net.ipv4/ipv6.neigh.default.gc_thresh2") argNeighGCThresh3 = pflag.Int("neigh-gc-thresh3", DefaultNeighGCThresh3, "Value to set net.ipv4/ipv6.neigh.default.gc_thresh3") argExtraNodeLocalVxlanIPCidrs = pflag.String("extra-node-local-vxlan-ip-cidrs", "", "Cidrs to select node extra local vxlan ip, e.g., \"192.168.10.0/24,10.2.3.0/24\"") + argEnableVlanArpEnhancement = pflag.Bool("enable-vlan-arp-enhancement", false, "Whether enable arp source enhancement in a vlan environment") ) // mute info log for ipset lib @@ -163,6 +166,7 @@ func ParseFlags() (*Configuration, error) { NeighGCThresh2: *argNeighGCThresh2, NeighGCThresh3: *argNeighGCThresh3, VxlanExpiredNeighCachesClearInterval: *argVxlanExpiredNeighCachesClearInterval, + EnableVlanArpEnhancement: *argEnableVlanArpEnhancement, } if *argPreferVlanInterfaces == "" { diff --git a/pkg/daemon/controller/ipinstance.go b/pkg/daemon/controller/ipinstance.go index 5b827bcc..59431489 100644 --- a/pkg/daemon/controller/ipinstance.go +++ b/pkg/daemon/controller/ipinstance.go @@ -203,8 +203,10 @@ func (c *Controller) reconcileIPInfo() error { } } - if err := c.addrV4Manager.SyncAddresses(c.getIPInstanceByAddress); err != nil { - return fmt.Errorf("sync ipv4 addresses failed: %v", err) + if c.config.EnableVlanArpEnhancement { + if err := c.addrV4Manager.SyncAddresses(c.getIPInstanceByAddress); err != nil { + return fmt.Errorf("sync ipv4 addresses failed: %v", err) + } } return nil