@@ -1203,7 +1203,7 @@ func GetAdvertisedNetworkSubnetsDropACLdbIDs() *libovsdbops.DbObjectIDs {
12031203 })
12041204}
12051205
1206- func GetAdvertisedNetworkSubnetsAcceptACLdbIDs (networkName string ) * libovsdbops.DbObjectIDs {
1206+ func GetAdvertisedNetworkSubnetsPassACLdbIDs (networkName string ) * libovsdbops.DbObjectIDs {
12071207 return libovsdbops .NewDbObjectIDs (libovsdbops .ACLAdvertisedNetwork , advertisedNetworkIsolationACLID ,
12081208 map [libovsdbops.ExternalIDKey ]string {
12091209 libovsdbops .ObjectNameKey : networkName ,
@@ -1232,7 +1232,7 @@ func BuildAdvertisedNetworkSubnetsDropACL(advertisedNetworkSubnetsAddressSet add
12321232}
12331233
12341234func (bnc * BaseNetworkController ) addAdvertisedNetworkIsolation (nodeName string ) error {
1235- var acceptMatches , cidrs []string
1235+ var passMatches , cidrs []string
12361236 var ops []ovsdb.Operation
12371237
12381238 addrSet , err := bnc .addressSetFactory .GetAddressSet (GetAdvertisedNetworkSubnetsAddressSetDBIDs ())
@@ -1245,7 +1245,7 @@ func (bnc *BaseNetworkController) addAdvertisedNetworkIsolation(nodeName string)
12451245 if utilnet .IsIPv6CIDR (subnet .CIDR ) {
12461246 ipPrefix = "ip6"
12471247 }
1248- acceptMatches = append (acceptMatches , fmt .Sprintf ("(%s.src == %s && %s.dst == %s)" , ipPrefix , subnet .CIDR , ipPrefix , subnet .CIDR ))
1248+ passMatches = append (passMatches , fmt .Sprintf ("(%s.src == %s && %s.dst == %s)" , ipPrefix , subnet .CIDR , ipPrefix , subnet .CIDR ))
12491249 cidrs = append (cidrs , subnet .CIDR .String ())
12501250
12511251 }
@@ -1256,23 +1256,23 @@ func (bnc *BaseNetworkController) addAdvertisedNetworkIsolation(nodeName string)
12561256 }
12571257 ops = append (ops , addrOps ... )
12581258
1259- if len (acceptMatches ) > 0 {
1260- acceptACL := libovsdbutil .BuildACL (
1261- GetAdvertisedNetworkSubnetsAcceptACLdbIDs (bnc .GetNetworkName ()),
1262- types .AdvertisedNetworkAllowPriority ,
1263- strings .Join (acceptMatches , " || " ),
1259+ if len (passMatches ) > 0 {
1260+ passACL := libovsdbutil .BuildACL (
1261+ GetAdvertisedNetworkSubnetsPassACLdbIDs (bnc .GetNetworkName ()),
1262+ types .AdvertisedNetworkPassPriority ,
1263+ strings .Join (passMatches , " || " ),
12641264 nbdb .ACLActionPass ,
12651265 nil ,
12661266 libovsdbutil .LportEgress )
1267- acceptACL .Tier = types .PrimaryACLTier
1267+ passACL .Tier = types .PrimaryACLTier
12681268
1269- ops , err = libovsdbops .CreateOrUpdateACLsOps (bnc .nbClient , ops , nil , acceptACL )
1269+ ops , err = libovsdbops .CreateOrUpdateACLsOps (bnc .nbClient , ops , nil , passACL )
12701270 if err != nil {
1271- return fmt .Errorf ("failed to create or update network isolation accept ACL %s for network %s: %w" , GetAdvertisedNetworkSubnetsAcceptACLdbIDs (bnc .GetNetworkName ()), bnc .GetNetworkName (), err )
1271+ return fmt .Errorf ("failed to create or update network isolation pass ACL %s for network %s: %w" , GetAdvertisedNetworkSubnetsPassACLdbIDs (bnc .GetNetworkName ()), bnc .GetNetworkName (), err )
12721272 }
1273- ops , err = libovsdbops .AddACLsToLogicalSwitchOps (bnc .nbClient , ops , bnc .GetNetworkScopedSwitchName (nodeName ), acceptACL )
1273+ ops , err = libovsdbops .AddACLsToLogicalSwitchOps (bnc .nbClient , ops , bnc .GetNetworkScopedSwitchName (nodeName ), passACL )
12741274 if err != nil {
1275- return fmt .Errorf ("failed to add network isolation accept ACL to switch %s for network %s: %w" , bnc .GetNetworkScopedSwitchName (nodeName ), bnc .GetNetworkName (), err )
1275+ return fmt .Errorf ("failed to add network isolation pass ACL to switch %s for network %s: %w" , bnc .GetNetworkScopedSwitchName (nodeName ), bnc .GetNetworkName (), err )
12761276 }
12771277 }
12781278
@@ -1307,11 +1307,11 @@ func (bnc *BaseNetworkController) deleteAdvertisedNetworkIsolation(nodeName stri
13071307 return err
13081308 }
13091309
1310- acceptACLIDs := GetAdvertisedNetworkSubnetsAcceptACLdbIDs (bnc .GetNetworkName ())
1311- acceptACLPredicate := libovsdbops .GetPredicate [* nbdb.ACL ](acceptACLIDs , nil )
1312- acceptACLs , err := libovsdbops .FindACLsWithPredicate (bnc .nbClient , acceptACLPredicate )
1310+ passACLIDs := GetAdvertisedNetworkSubnetsPassACLdbIDs (bnc .GetNetworkName ())
1311+ passACLPredicate := libovsdbops .GetPredicate [* nbdb.ACL ](passACLIDs , nil )
1312+ passACLs , err := libovsdbops .FindACLsWithPredicate (bnc .nbClient , passACLPredicate )
13131313 if err != nil {
1314- return fmt .Errorf ("unable to find the allow ACL for advertised network %s: %w" , bnc .GetNetworkName (), err )
1314+ return fmt .Errorf ("unable to find the pass ACL for advertised network %s: %w" , bnc .GetNetworkName (), err )
13151315 }
13161316
13171317 dropACLIDs := GetAdvertisedNetworkSubnetsDropACLdbIDs ()
@@ -1323,7 +1323,7 @@ func (bnc *BaseNetworkController) deleteAdvertisedNetworkIsolation(nodeName stri
13231323
13241324 // ACLs referenced by the switch will be deleted by db if there are no other references
13251325 p := func (sw * nbdb.LogicalSwitch ) bool { return sw .Name == bnc .GetNetworkScopedSwitchName (nodeName ) }
1326- err = libovsdbops .RemoveACLsFromLogicalSwitchesWithPredicate (bnc .nbClient , p , append (acceptACLs , dropACLs ... )... )
1326+ err = libovsdbops .RemoveACLsFromLogicalSwitchesWithPredicate (bnc .nbClient , p , append (passACLs , dropACLs ... )... )
13271327 if err != nil {
13281328 return fmt .Errorf ("failed to remove network isolation ACLs from the %s switch for network %s: %w" , bnc .GetNetworkScopedSwitchName (nodeName ), bnc .GetNetworkName (), err )
13291329 }
0 commit comments