@@ -63,7 +63,7 @@ func (netConfig *BridgeUDNConfiguration) setOfPatchPort() error {
6363}
6464
6565type BridgeConfiguration struct {
66- Mutex sync.Mutex
66+ mutex sync.Mutex
6767
6868 // variables that are only set on creation and never changed
6969 // don't require mutex lock to read
@@ -234,8 +234,8 @@ func (b *BridgeConfiguration) GetGatewayIface() string {
234234
235235// UpdateInterfaceIPAddresses sets and returns the bridge's current ips
236236func (b * BridgeConfiguration ) UpdateInterfaceIPAddresses (node * corev1.Node ) ([]* net.IPNet , error ) {
237- b .Mutex .Lock ()
238- defer b .Mutex .Unlock ()
237+ b .mutex .Lock ()
238+ defer b .mutex .Unlock ()
239239 ifAddrs , err := nodeutil .GetNetworkInterfaceIPAddresses (b .GetGatewayIface ())
240240 if err != nil {
241241 return nil , err
@@ -265,8 +265,8 @@ func (b *BridgeConfiguration) UpdateInterfaceIPAddresses(node *corev1.Node) ([]*
265265// GetPortConfigurations returns a slice of Network port configurations along with the
266266// uplinkName and physical port's ofport value
267267func (b * BridgeConfiguration ) GetPortConfigurations () ([]* BridgeUDNConfiguration , string , string ) {
268- b .Mutex .Lock ()
269- defer b .Mutex .Unlock ()
268+ b .mutex .Lock ()
269+ defer b .mutex .Unlock ()
270270 var netConfigs []* BridgeUDNConfiguration
271271 for _ , netConfig := range b .netConfig {
272272 netConfigs = append (netConfigs , netConfig .ShallowCopy ())
@@ -280,8 +280,8 @@ func (b *BridgeConfiguration) AddNetworkConfig(
280280 nodeSubnets []* net.IPNet ,
281281 masqCTMark , pktMark uint ,
282282 v6MasqIPs , v4MasqIPs * udn.MasqueradeIPs ) error {
283- b .Mutex .Lock ()
284- defer b .Mutex .Unlock ()
283+ b .mutex .Lock ()
284+ defer b .mutex .Unlock ()
285285
286286 netName := nInfo .GetNetworkName ()
287287 patchPort := nInfo .GetNetworkScopedPatchPortName (b .bridgeName , b .nodeName )
@@ -309,15 +309,15 @@ func (b *BridgeConfiguration) AddNetworkConfig(
309309
310310// DelNetworkConfig deletes the provided netInfo from the bridge configuration cache
311311func (b * BridgeConfiguration ) DelNetworkConfig (nInfo util.NetInfo ) {
312- b .Mutex .Lock ()
313- defer b .Mutex .Unlock ()
312+ b .mutex .Lock ()
313+ defer b .mutex .Unlock ()
314314
315315 delete (b .netConfig , nInfo .GetNetworkName ())
316316}
317317
318318func (b * BridgeConfiguration ) GetNetworkConfig (networkName string ) * BridgeUDNConfiguration {
319- b .Mutex .Lock ()
320- defer b .Mutex .Unlock ()
319+ b .mutex .Lock ()
320+ defer b .mutex .Unlock ()
321321 return b .netConfig [networkName ]
322322}
323323
@@ -327,8 +327,8 @@ func (b *BridgeConfiguration) GetNetworkConfig(networkName string) *BridgeUDNCon
327327// NOTE: if the network configuration can't be found or if the network is not patched by OVN
328328// yet this returns nil.
329329func (b * BridgeConfiguration ) GetActiveNetworkBridgeConfigCopy (networkName string ) * BridgeUDNConfiguration {
330- b .Mutex .Lock ()
331- defer b .Mutex .Unlock ()
330+ b .mutex .Lock ()
331+ defer b .mutex .Unlock ()
332332
333333 if netConfig , found := b .netConfig [networkName ]; found && netConfig .OfPortPatch != "" {
334334 return netConfig .ShallowCopy ()
@@ -337,8 +337,8 @@ func (b *BridgeConfiguration) GetActiveNetworkBridgeConfigCopy(networkName strin
337337}
338338
339339func (b * BridgeConfiguration ) PatchedNetConfigs () []* BridgeUDNConfiguration {
340- b .Mutex .Lock ()
341- defer b .Mutex .Unlock ()
340+ b .mutex .Lock ()
341+ defer b .mutex .Unlock ()
342342 result := make ([]* BridgeUDNConfiguration , 0 , len (b .netConfig ))
343343 for _ , netConfig := range b .netConfig {
344344 if netConfig .OfPortPatch == "" {
@@ -352,8 +352,8 @@ func (b *BridgeConfiguration) PatchedNetConfigs() []*BridgeUDNConfiguration {
352352// IsGatewayReady checks if patch ports of every netConfig are present.
353353// used by gateway on newGateway readyFunc
354354func (b * BridgeConfiguration ) IsGatewayReady () bool {
355- b .Mutex .Lock ()
356- defer b .Mutex .Unlock ()
355+ b .mutex .Lock ()
356+ defer b .mutex .Unlock ()
357357 for _ , netConfig := range b .netConfig {
358358 ready := gatewayReady (netConfig .PatchPort )
359359 if ! ready {
@@ -364,8 +364,8 @@ func (b *BridgeConfiguration) IsGatewayReady() bool {
364364}
365365
366366func (b * BridgeConfiguration ) SetOfPorts () error {
367- b .Mutex .Lock ()
368- defer b .Mutex .Unlock ()
367+ b .mutex .Lock ()
368+ defer b .mutex .Unlock ()
369369 // Get ofport of patchPort
370370 for _ , netConfig := range b .netConfig {
371371 if err := netConfig .setOfPatchPort (); err != nil {
@@ -412,8 +412,8 @@ func (b *BridgeConfiguration) SetOfPorts() error {
412412}
413413
414414func (b * BridgeConfiguration ) GetIPs () []* net.IPNet {
415- b .Mutex .Lock ()
416- defer b .Mutex .Unlock ()
415+ b .mutex .Lock ()
416+ defer b .mutex .Unlock ()
417417 return b .ips
418418}
419419
@@ -426,20 +426,20 @@ func (b *BridgeConfiguration) GetUplinkName() string {
426426}
427427
428428func (b * BridgeConfiguration ) GetMAC () net.HardwareAddr {
429- b .Mutex .Lock ()
430- defer b .Mutex .Unlock ()
429+ b .mutex .Lock ()
430+ defer b .mutex .Unlock ()
431431 return b .macAddress
432432}
433433
434434func (b * BridgeConfiguration ) SetMAC (macAddr net.HardwareAddr ) {
435- b .Mutex .Lock ()
436- defer b .Mutex .Unlock ()
435+ b .mutex .Lock ()
436+ defer b .mutex .Unlock ()
437437 b .macAddress = macAddr
438438}
439439
440440func (b * BridgeConfiguration ) SetNetworkOfPatchPort (netName string ) error {
441- b .Mutex .Lock ()
442- defer b .Mutex .Unlock ()
441+ b .mutex .Lock ()
442+ defer b .mutex .Unlock ()
443443
444444 netConfig , found := b .netConfig [netName ]
445445 if ! found {
@@ -453,20 +453,20 @@ func (b *BridgeConfiguration) GetInterfaceID() string {
453453}
454454
455455func (b * BridgeConfiguration ) GetOfPortHost () string {
456- b .Mutex .Lock ()
457- defer b .Mutex .Unlock ()
456+ b .mutex .Lock ()
457+ defer b .mutex .Unlock ()
458458 return b .ofPortHost
459459}
460460
461461func (b * BridgeConfiguration ) GetEIPMarkIPs () * egressip.MarkIPsCache {
462- b .Mutex .Lock ()
463- defer b .Mutex .Unlock ()
462+ b .mutex .Lock ()
463+ defer b .mutex .Unlock ()
464464 return b .eipMarkIPs
465465}
466466
467467func (b * BridgeConfiguration ) SetEIPMarkIPs (eipMarkIPs * egressip.MarkIPsCache ) {
468- b .Mutex .Lock ()
469- defer b .Mutex .Unlock ()
468+ b .mutex .Lock ()
469+ defer b .mutex .Unlock ()
470470 b .eipMarkIPs = eipMarkIPs
471471}
472472
0 commit comments