/srv/irclogs.ubuntu.com/2021/09/30/#netplan.txt

schopinslyon: I stumbled across something strange when working on the parsing code : https://github.com/canonical/netplan/blob/main/src/parse.c#L167208:03
schopincan you confirm that if the API client passes error = NULL, which is totally valid, the parser will silently swallow up errors as long as it has successfully parsed to and from ?08:04
schopini.e. [ { from: "192.168.1.1", to: "10.3.47.75", fwmark: bogus }, { ... a valid rule object } ] should return TRUE if we don't have a GError at hand.08:07
slyonschopin: indeed, I can confirm this is the current behaviour08:12
slyonwell...08:15
slyonbut the other values are checked in their handler, no? like mark/fwmark would be checked in handle_generic_guint and return yaml_error() if it is bogus08:16
schopinsure, but said value isn't stored anywhere, so if there are no GError provided we just don't append the faulty rule and go on to the next, as (error && *error) will always be false.08:19
schopinI'm starting to think that `if (error && *error) return FALSE;` is an antipattern. It's like a CLI tool that would change its return code if we pass in `-q` as an option :P08:22
slyonright. if process_mapping fails the cur_ip_rule is not appended to the cur_netdef->ip_rules array and leaks memory instead.. That should probably be fixed.08:29
schopinThere are leaks all over on error cases, they should be fixed in #23308:31
schopinBasically my question boils down to "is the client supposed to give us a valid GError pointer at the entry point" ?08:31
schopinNote that netplan_finish_parse has the same issue. If called like this `netplan_finish_parse(NULL)`, any error raised by finish_iterator will be ignored : https://github.com/canonical/netplan/blob/main/src/parse.c#L267608:39
slyonYeah. I think that is kind of the expected behaviour (sans the memory leaks). If the client passes error=NULL he wants to ignore any errors.08:41
schopinI find this a bit weird. The API supposedly already gives us room to signal the caller that something went wrong (return FALSE or NULL), and I understand the GError as simply a way to get more info.08:45
schopinPlus, this behaviour isn't consistent. You cannot ignore an error when parsing an ARP IP target (just below), for instance.08:47
slyonAgreed. You're right.08:48
slyonthe API should provide proper return values if parsing failed. and GError should be used to provide the extra info.08:50
schopinACK, I'll post a PR for this soon. Do you mind if I ignore the leaks in it though?08:51
slyonThank you schopin! You can ignore the leaks for now, but maybe mark them with an "XXX: fix memory leak" comment while on it09:07
Daulityhey10:09
Daulitytrying to configure a static address to an interface with netplan but after a apply the interface is assigned nothing 10:10
slyonDaulity: can you paste your config somewhere (e.g. paste.ubuntu.com)? and run `netplan --debug apply` to see if it shows any errors?10:10
Daulitythis is the config: https://termbin.com/2txcd10:12
Daulityall that should happen on that interface is set an ip address and a netmask 10:16
Daulitythis is the debug output: https://termbin.com/qehi10:20
slyonDaulity: yes that config looks correct. Could you please also show the output of `ip a`?10:47
slyondoes the config apply after a reboot?10:48
Daulityslyon: i haven't tried a reboot yet will do 11:36
Daulityhere is ip a output: https://termbin.com/kwnd11:37
Daulitydoesn't apply after a reboot 11:40
slyonDaulity: intersting... could you please check/share the output of `networkctl status eth0`?11:53
slyonits all looking correct so far. I wonder if there are some manual systemd-networkd configuration in place or systemd-networkd does not work correctly for another reason?11:54
Daulityslyon: it's not plugged in on that port but that never mattered in the past 12:12
Daulityhttps://termbin.com/fvf4d312:15
slyonDaulity: aha! that explains the situation. Systemd won't configure the interface if it has no carrier. We've recently landed a change upstream to allow specifying `ignore-carrier=true` in your netplan config: https://github.com/canonical/netplan/commit/d4884cfd40e1e33540b274371c3272df6595d22c12:20
slyonThat change will be included in the upcoming netplan release. For now you should be able to create a systemd-networkd drop-in config, e.g. in /etc/systemd/network/netplan-eth0.network.d/override.conf that includes:12:21
slyon[Network]12:21
slyonConfigureWithoutCarrier=yes12:21
DaulityI don't actually know if it is a problem 12:39
Daulitybecause if i plug in a network cable it's configured correctly and I think that is all that matters :) 12:39
slyonack12:44
=== Beret- is now known as Beret
=== dbungert1 is now known as dbungert
=== JanC_ is now known as JanC

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!