Skip to content

Commit

Permalink
fix comparison with previous networks in SetupAndEnsureMasqRules
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasferrandiz committed Apr 17, 2024
1 parent b8261bf commit 2092b83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/trafficmngr/iptables/iptables.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (iptm *IPTablesManager) SetupAndEnsureMasqRules(ctx context.Context, flanne

if !flannelIPv4Net.Empty() {
// recycle iptables rules only when network configured or subnet leased is not equal to current one.
if prevNetwork != flannelIPv4Net && prevSubnet != currentlease.Subnet {
if !(flannelIPv4Net.Equal(prevNetwork) && prevSubnet.Equal(currentlease.Subnet)) {
log.Infof("Current network or subnet (%v, %v) is not equal to previous one (%v, %v), trying to recycle old iptables rules",
flannelIPv4Net, currentlease.Subnet, prevNetwork, prevSubnet)
newLease := &lease.Lease{
Expand All @@ -126,7 +126,7 @@ func (iptm *IPTablesManager) SetupAndEnsureMasqRules(ctx context.Context, flanne
}
if !flannelIPv6Net.Empty() {
// recycle iptables rules only when network configured or subnet leased is not equal to current one.
if prevIPv6Network != flannelIPv6Net && prevIPv6Subnet != currentlease.IPv6Subnet {
if !(flannelIPv6Net.Equal(prevIPv6Network) && prevIPv6Subnet.Equal(currentlease.IPv6Subnet)) {
log.Infof("Current network or subnet (%v, %v) is not equal to previous one (%v, %v), trying to recycle old iptables rules",
flannelIPv6Net, currentlease.IPv6Subnet, prevIPv6Network, prevIPv6Subnet)
newLease := &lease.Lease{
Expand Down

0 comments on commit 2092b83

Please sign in to comment.