Skip to content

Commit

Permalink
fix(nsc): don't modify netmask during flag setup
Browse files Browse the repository at this point in the history
There is absolutely no reason that we should ever assume netmasks, and
even if we did, we shouldn't modify them as a side-effect of a
completely different operation. No idea was this was ever coded this
way. Netmask is now set upstream to the appropriate mask for the IP
family.
  • Loading branch information
aauren committed Sep 23, 2023
1 parent 859658a commit b03f3b7
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions pkg/controllers/proxy/network_services_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1421,11 +1421,9 @@ func ipvsDestinationString(d *ipvs.Destination) string {
func ipvsSetPersistence(svc *ipvs.Service, p bool, timeout int32) {
if p {
svc.Flags |= ipvsPersistentFlagHex
svc.Netmask |= 0xFFFFFFFF
svc.Timeout = uint32(timeout)
} else {
svc.Flags &^= ipvsPersistentFlagHex
svc.Netmask &^= 0xFFFFFFFF
svc.Timeout = 0
}
}
Expand All @@ -1448,13 +1446,6 @@ func ipvsSetSchedFlags(svc *ipvs.Service, s schedFlags) {
} else {
svc.Flags &^= ipvsSched3FlagHex
}

/* Keep netmask which is set by ipvsSetPersistence() before */
if (svc.Netmask&0xFFFFFFFF != 0) || (s.flag1 || s.flag2 || s.flag3) {
svc.Netmask |= 0xFFFFFFFF
} else {
svc.Netmask &^= 0xFFFFFFFF
}
}

/* Compare service scheduler flags with ipvs service */
Expand Down

0 comments on commit b03f3b7

Please sign in to comment.