DHCP scope option 6 (`name_server`) breaks when using `value64` attribute
When applying the name_server option as shown in the example below, it appears to break the data served to DHCP clients.
- tagName: name_server
value64:
- "MTAuNTEuMTAuMjA="
- "MTAuNTIuMTAuMjA="
For example, dhclient successfully retrieves a lease, but warns: domain-name-servers 2 extra bytes at end of array
The result is that dhclient appears to parse this as 49.48.46.53,49.46.49.48,46.50.48.49,48.46.53.50,46.49.48.46 rather than the configured base64 representation of [10.51.10.20,10.52.10.20].
The following configuration works fine, but means I can only pass a single DNS server to the client (unless I'm unaware of some syntax which makes this possible?).
- tagName: name_server
value: 10.51.10.20
Note: the issue appears to be present regardless of the number of servers specified (tested with 1-3). The only difference is the warning from dhclient notes a differing number of extra bytes at the end of the array.
when using value64 you're responsible for encoding the values correctly yourself
Maybe I'm missing something then, but MTAuNTEuMTAuMjA= and MTAuNTIuMTAuMjA= (from the example config at the top) decode to 10.51.10.20 and 10.52.10.20 as expected.
@tigattack The issue is you're converting UTF-8 (Text) to Base64. you need to convert decimal (Number) to Base64. this took me a while to figure out.
Red Markings are there for aid
Thank you @july12123, good spot!
Probably a good shout to document this, @BeryJu. I'd happily do it myself, but I'm not sure which options this may be necessary for, so I'll leave it to you to ensure accuracy.
I believe the DHCP options page and docs for the Terraform provider's gravity_dhcp_scope resource will need updating.