3 ms·
Here's what my serious error likely was: not putting double quotes around IPv6 addresses with netmask, as is seen in this example YAML snippet: allowed-ips:
by esbeeb 3y ago
Here's what my serious error likely was: not putting double quotes around IPv6 addresses with netmask, as is seen in this example YAML snippet:
allowed-ips: [0.0.0.0/0, "2001:fe:ad:de:ad:be:ef:1/24"]
Note that the IPv4 addy didn't need the double quotes, but the IPv6 addy did.
The parser should have picked this mistake up, and the server shouldn't have been crippled to the extent of needing a rescue.
More docs seen here: https://netplan.readthedocs.io/en/latest/netplan-yaml/ https://netplan.readthedocs.io/en/latest/netplan-yaml/
- deleted 3y ago[deleted]
- AceJohnny2 3y agoYes, without the quotes, the IPv6 address gets interpreted a YAML mapping/dict because of the colon(s). Perhaps the trap is the complacency that YAML induces by not requiring quotes around keys/values, and so text risks being interpreted in unexpected ways. The infamous Norway Problem has the same root cause.
- esbeeb 3y ago...and TOML would have dodged this, because it requires the double-quotes in both cases (IPv4 and 6), like you say.
- xelxebar 3y ago> Yes, without the quotes, the IPv6 address gets interpreted a YAML mapping/dict because of the colon(s). This is incorrect. The colon needs to be followed by whitespace for it to indicate a key-value pair. You can check this with the reference parser (and a bunch of others!) online: https://play.yaml.io/main/parser?input=YWxsb3dlZC1pcHM6IFswLjAuMC4wLzAsIDIwMDE6ZmU6YWQ6ZGU6YWQ6YmU6ZWY6MS8yNF0K https://play.yaml.io/main/parser?input=YWxsb3dlZC1pcHM6IFswL...
- TeMPOraL 3y agoEven in the first position? That makes it no longer be the claimed "superset of JSON", since (AFAIK) {"key":"value"} (with no whitespace) is valid JSON.
- xelxebar 3y agoFor delimited collections, so within {} and [], if the key is quoted, then you don't need the whitespace. So your example parses as expected as does `{"key":value}`, but `{key:value}` turns into `{"key:value": null}`.
- AceJohnny2 3y agoThat looks very interesting, but can you provide a screenshot of the results, for someone who doesn't have Docker?
- xelxebar 3y agoThat's odd. Looks like Netplan looks like uses libyaml, and vanilla libyaml definitely parses that naked v6 addr as a plain scalar. Maybe Netplan adds an extra schema on top or something? If you know what data the bare v6 string turned into, I'd love to hear it.
- jeroenhd 3y agoYaml is like JSON, in that the format requires you to think about strings vs integers. I bet the parser did actually fail, because you can't parse a misformed dictionary into a string. Your problem is that the tool probanlt took down the interface before trying to parse for format, and then failed to bring the interface back up. Similar to bogus data in /etc/network/interfaces, resetting the network interfaces with bogus data will end up with your server having no or limited connectivity capabilities. At least with YAML there are command line parsers available to check your work. Plaintext config files often end up being a game or chance to see if you've got the format right.
- totallywrong 3y agoThat should parse fine without quotes, most likely netplan's YAML handling is the actual issue here.