Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix health-check listener monitor to accommodate the default 0.0.0.0 address #2

Closed
uhppoted opened this issue Jul 24, 2022 · 6 comments
Assignees

Comments

@uhppoted
Copy link
Owner

uhppoted commented Jul 24, 2022

Ref. uhppoted/uhppoted#14

The health check listener address monitor checks the device listener address against the configured system listener address which fails when the configured listener address is set to the default ALL address (0.0.0.0):

		if !expected.IP.Equal(address.IP) || (expected.Port != address.Port) {
                   ...
               }

(cf. healthcheck.go:L385)

With the default 0.0.0.0 address, the 'expected' health address check should match against at least:

  • 127.0.0.1
  • the public IPv4 address
  • (optionally) a configured address

Notes

  1. Ideally the health check should verify that the IP address to which the system event listener is bound is reachable via the controller's configured listener address.
twystd pushed a commit that referenced this issue Jul 26, 2022
twystd pushed a commit to uhppoted/uhppoted-mqtt that referenced this issue Jul 26, 2022
@uhppoted
Copy link
Owner Author

Reworked health check to match controller listen address against all IPv4 addresses exposed by the installed network interfaces when the listen address is INADDR_ANY (0.0.0.0). Provisionally excludes the loopback address (127.0.0.1) on the grounds that the loopback address is probably only used by simulated devices.

Tested on MacOS and Ubuntu 22.04LTS.

twystd pushed a commit to uhppoted/uhppoted-rest that referenced this issue Jul 26, 2022
@uhppoted
Copy link
Owner Author

uhppoted commented Aug 1, 2022

Fixed in release v0.8.1

@uhppoted uhppoted closed this as completed Aug 1, 2022
@uhppoted
Copy link
Owner Author

uhppoted commented Aug 3, 2022

Ref. uhppoted/uhppoted#14 (reply in thread)

netip.AddrFromSlice is prefixing an IPv4 address with :ffff::

2022/08/03 10:14:19 WARN  UTC0311-L0x 201020304  incorrect listener address/port: 192.168.1.100:60001
>>>>>>>> [192.168.1.100:60001]
>>>>>>>> DEBUG true ::ffff:192.168.1.100 60001
2022/08/03 10:14:19 WARN  UTC0311-L0x 303986753  incorrect listener address/port: 192.168.1.100:60001
```

Explicitly convert address to an IPv4 address before checking.

@twystd
Copy link
Collaborator

twystd commented Aug 3, 2022

May possibly be related to changes in the netip package:

@twystd
Copy link
Collaborator

twystd commented Aug 3, 2022

Explicitly converted IP addresses to IPv4 addresses in the health check. Pending confirmation and release (and unit test).

@uhppoted
Copy link
Owner Author

Closing - release in v0.8.2

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

No branches or pull requests

2 participants