Skip to content

Commit 9b51313

Browse files
committed
Fix some code with weird magic numbers
1 parent a7c2838 commit 9b51313

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/asset/ignition/bootstrap/common.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ func (a *Common) getTemplateData(dependencies asset.Parents, bootstrapInPlace bo
303303
platformFirstAPIVIP := firstAPIVIP(&installConfig.Config.Platform)
304304
APIIntVIPonIPv6 := utilsnet.IsIPv6String(platformFirstAPIVIP)
305305

306-
networkStack := 0
306+
var hasIPv4, hasIPv6 bool
307307
for _, snet := range installConfig.Config.ServiceNetwork {
308-
if snet.IP.To4() != nil {
309-
networkStack |= 1
308+
if utilsnet.IsIPv4(snet.IP) {
309+
hasIPv4 = true
310310
} else {
311-
networkStack |= 2
311+
hasIPv6 = true
312312
}
313313
}
314314

@@ -342,7 +342,7 @@ func (a *Common) getTemplateData(dependencies asset.Parents, bootstrapInPlace bo
342342
ClusterProfile: clusterProfile,
343343
BootstrapInPlace: bootstrapInPlaceConfig,
344344
UseIPv6ForNodeIP: APIIntVIPonIPv6,
345-
UseDualForNodeIP: networkStack == 3,
345+
UseDualForNodeIP: hasIPv4 && hasIPv6,
346346
IsFCOS: installConfig.Config.IsFCOS(),
347347
IsSCOS: installConfig.Config.IsSCOS(),
348348
IsOKD: installConfig.Config.IsOKD(),

0 commit comments

Comments
 (0)