cybertec-postgresql / vip-manager

Manages a virtual IP based on state kept in etcd or Consul
BSD 2-Clause "Simplified" License
207 stars 41 forks source link

getMask function has some problem #224

Closed zhongyibill closed 5 months ago

zhongyibill commented 5 months ago

func getMask(vip netip.Addr, mask int) net.IPMask { if mask > 0 || mask < 33 { return net.CIDRMask(mask, 32) } var ip net.IP = vip.AsSlice() return ip.DefaultMask() }

  1. The condition (mask > 0 || mask < 33) always is ture.
  2. Suppose I have a vip which is IPV6, the mask maybe greater than 32. The function ( net.CIDRMask(mask, 32)) will trigger an bug
pashagolub commented 5 months ago

fixed by #225