Skip to content

Commit

Permalink
fix exit on error (#4080)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian authored and bobz965 committed May 24, 2024
1 parent 74ef597 commit 241710e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/util/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ func genRandomIP(cidr string, isIPv6 bool) string {
}
add, err := rand.Int(rand.Reader, new(big.Int).Lsh(big.NewInt(1), uint(hostBits)-1))
if err != nil {
LogFatalAndExit(err, "failed to generate random ip")
klog.Errorf("failed to generate random big int with bits %d: %v", hostBits, err)
return ""
}
t := big.NewInt(0).Add(IP2BigInt(ip), add)
return fmt.Sprintf("%s/%d", BigInt2Ip(t), netMask)
Expand Down

0 comments on commit 241710e

Please sign in to comment.