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 <zhangzujian.7@gmail.com>
  • Loading branch information
zhangzujian committed May 24, 2024
1 parent 6d7ed5d commit e0908bf
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 e0908bf

Please sign in to comment.