Skip to content

Commit

Permalink
Fixed IPv6 0 initialization
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
  • Loading branch information
rbrtbnfgl committed May 10, 2024
1 parent 6d18ae7 commit 99ae629
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"errors"
"flag"
"fmt"
"math/big"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -502,10 +503,10 @@ func ReadCIDRFromSubnetFile(path string, CIDRKey string) ip.IP4Net {
prevCIDRs := ReadCIDRsFromSubnetFile(path, CIDRKey)
if len(prevCIDRs) == 0 {
log.Warningf("no subnet found for key: %s in file: %s", CIDRKey, path)
return ip.IP4Net{}
return ip.IP4Net{0, 0}

Check failure on line 506 in main.go

View workflow job for this annotation

GitHub Actions / lint

composites: github.com/flannel-io/flannel/pkg/ip.IP4Net struct literal uses unkeyed fields (govet)
} else if len(prevCIDRs) > 1 {
log.Errorf("error reading subnet: more than 1 entry found for key: %s in file %s: ", CIDRKey, path)
return ip.IP4Net{}
return ip.IP4Net{0, 0}

Check failure on line 509 in main.go

View workflow job for this annotation

GitHub Actions / lint

composites: github.com/flannel-io/flannel/pkg/ip.IP4Net struct literal uses unkeyed fields (govet)
} else {
return prevCIDRs[0]
}
Expand Down Expand Up @@ -537,10 +538,10 @@ func ReadIP6CIDRFromSubnetFile(path string, CIDRKey string) ip.IP6Net {
prevCIDRs := ReadIP6CIDRsFromSubnetFile(path, CIDRKey)
if len(prevCIDRs) == 0 {
log.Warningf("no subnet found for key: %s in file: %s", CIDRKey, path)
return ip.IP6Net{}
return ip.IP6Net{(*ip.IP6)(big.NewInt(0)), 0}

Check failure on line 541 in main.go

View workflow job for this annotation

GitHub Actions / lint

composites: github.com/flannel-io/flannel/pkg/ip.IP6Net struct literal uses unkeyed fields (govet)
} else if len(prevCIDRs) > 1 {
log.Errorf("error reading subnet: more than 1 entry found for key: %s in file %s: ", CIDRKey, path)
return ip.IP6Net{}
return ip.IP6Net{(*ip.IP6)(big.NewInt(0)), 0}

Check failure on line 544 in main.go

View workflow job for this annotation

GitHub Actions / lint

composites: github.com/flannel-io/flannel/pkg/ip.IP6Net struct literal uses unkeyed fields (govet)
} else {
return prevCIDRs[0]
}
Expand Down

0 comments on commit 99ae629

Please sign in to comment.