[Bug] Method ‎Hosts.UnmarshalYAML does not add CIDR notation #729

Closed
opened 2025-12-29 02:23:00 +01:00 by adam · 1 comment
Owner

Originally created by @Hypnotist1148 on GitHub (Jun 14, 2024).

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The ‎Hosts.UnmarshalJSON function checks if there is a / in the IP Address and adds the CIDR /32 if needed. the YAML equivalent (‎Hosts.UnmarshalYAML) on the other hand does not.

Expected Behavior

The ‎Hosts.UnmarshalYAML method should add the CIDR notation the the end of the IP if there is none existing.

Steps To Reproduce

  1. Use the YAML config
  2. Add a host (for example myhost) to the hosts object and use the IP 10.0.0.10
  3. You will get an error that the netip.ParsePrefix method failed to parse the IP.
  4. Now you add the CIDR /32 at the end and watch it work.

Environment

- Client OS: Arch
- Server OS: Debian 12
- Docker Image: scratch (upstream)
- Headscale version: 0.23.0-alpha12
- Tailscale version: 1.66.4 (067defc641850791142cc83a44dadae29709344a-dirty)

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Anything else?

The mentioned methods can be found in the policy package on lines 64 and 93, or via this link.

Originally created by @Hypnotist1148 on GitHub (Jun 14, 2024). ### Is this a support request? - [X] This is not a support request ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current Behavior The ‎`Hosts.UnmarshalJSON` function checks if there is a `/` in the IP Address and adds the CIDR /32 if needed. the YAML equivalent (`‎Hosts.UnmarshalYAML`) on the other hand does not. ### Expected Behavior The `‎Hosts.UnmarshalYAML` method should add the CIDR notation the the end of the IP if there is none existing. ### Steps To Reproduce 1. Use the YAML config 2. Add a host (for example `myhost`) to the hosts object and use the IP `10.0.0.10` 3. You will get an error that the `netip.ParsePrefix` method failed to parse the IP. 4. Now you add the CIDR /32 at the end and watch it work. ### Environment ```markdown - Client OS: Arch - Server OS: Debian 12 - Docker Image: scratch (upstream) - Headscale version: 0.23.0-alpha12 - Tailscale version: 1.66.4 (067defc641850791142cc83a44dadae29709344a-dirty) ``` ### Runtime environment - [X] Headscale is behind a (reverse) proxy - [X] Headscale runs in a container ### Anything else? The mentioned methods can be found in the `policy` package on lines 64 and 93, or via [this link](https://github.com/juanfont/headscale/blob/1f4b59566a27d5933f32ae58d0fcc71ba8f1ea9a/hscontrol/policy/acls_types.go#L63-L111).
adam added the bug label 2025-12-29 02:23:00 +01:00
adam closed this issue 2025-12-29 02:23:00 +01:00
Author
Owner

@kradalby commented on GitHub (Aug 19, 2024):

Policy does not longer support yaml, so I will close this

@kradalby commented on GitHub (Aug 19, 2024): Policy does not longer support yaml, so I will close this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#729