Skip to content

[-] compare virtual IP addresses instead of matching text - #427

Open
pashagolub wants to merge 1 commit into
masterfrom
fix/vip-address-detection
Open

pashagolub wants to merge 1 commit into
masterfrom
fix/vip-address-detection

Conversation

@pashagolub

Copy link
Copy Markdown
Collaborator
  • queryAddress() compared the addresses of the interface with the CIDR of the virtual IP using strings.Contains(), so an interface carrying 127.0.0.1/8 answered that 27.0.0.1/8 was assigned to it. A false positive means the manager believes the address is already up and never configures it, and the node silently never takes the virtual IP. Parse both sides and compare the address and the prefix length.

  • getMask() returned the nil mask of net.CIDRMask() for an out of range value, and netmaskSize() panicked on it later - with the manager already running. "--netmask=-1" is the documented default and was enough to reach that with an IPv6 address. The mask is validated now and a bad one is reported when the manager is created. For IPv4 a value of zero or less keeps selecting the default mask of the address class.

  • --netmask is an int flag now, so a value that is not a number is rejected while the flags are parsed instead of being coerced silently.

  • an IPv6 virtual IP no longer produces an ARP packet with a 16 byte address in its 4 byte address fields. ARP is IPv4 only, the IPv6 equivalent is an unsolicited neighbour advertisement which is not implemented, so the missing announcement is logged instead. Assigning the address itself is unaffected.

* queryAddress() compared the addresses of the interface with the CIDR of the
  virtual IP using strings.Contains(), so an interface carrying 127.0.0.1/8
  answered that 27.0.0.1/8 was assigned to it. A false positive means the
  manager believes the address is already up and never configures it, and the
  node silently never takes the virtual IP. Parse both sides and compare the
  address and the prefix length.

* getMask() returned the nil mask of net.CIDRMask() for an out of range value,
  and netmaskSize() panicked on it later - with the manager already running.
  "--netmask=-1" is the documented default and was enough to reach that with
  an IPv6 address. The mask is validated now and a bad one is reported when
  the manager is created. For IPv4 a value of zero or less keeps selecting the
  default mask of the address class.

* --netmask is an int flag now, so a value that is not a number is rejected
  while the flags are parsed instead of being coerced silently.

* an IPv6 virtual IP no longer produces an ARP packet with a 16 byte address
  in its 4 byte address fields. ARP is IPv4 only, the IPv6 equivalent is an
  unsolicited neighbour advertisement which is not implemented, so the missing
  announcement is logged instead. Assigning the address itself is unaffected.
@pashagolub
pashagolub force-pushed the fix/vip-address-detection branch from 9a6d043 to c46ea59 Compare September 14, 2026 15:37
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 92.084% (-0.07%) from 92.15% — fix/vip-address-detection into master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants