Skip to content

Commit

Permalink
clarify cast
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 committed Sep 2, 2024
1 parent c5f6f5f commit bd4efa1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/controllers/loadbalancer/metallb.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ func (cfg *MetalLBConfig) computePeers(nodes []v1.Node) error {
if !ok {
return fmt.Errorf("node %q misses label: %s", n.GetName(), tag.MachineNetworkPrimaryASN)
}
asn, err := strconv.ParseInt(asnString, 10, 32)
asn, err := strconv.ParseInt(asnString, 10, 64)
if err != nil {
return fmt.Errorf("unable to parse valid integer from asn annotation: %w", err)
}

// we can safely cast the asn to a uint32 because its max value is defined as such
// see: https://en.wikipedia.org/wiki/Autonomous_system_(Internet)
peer, err := newPeer(n, uint32(asn)) // nolint:gosec
if err != nil {
klog.Warningf("skipping peer: %v", err)
Expand Down

0 comments on commit bd4efa1

Please sign in to comment.