[08:03] <schopin> slyon: I stumbled across something strange when working on the parsing code : https://github.com/canonical/netplan/blob/main/src/parse.c#L1672
[08:04] <schopin> can 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:07] <schopin> i.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:12] <slyon> schopin: indeed, I can confirm this is the current behaviour
[08:15] <slyon> well...
[08:16] <slyon> but 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 bogus
[08:19] <schopin> sure, 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:22] <schopin> I'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 :P
[08:29] <slyon> right. 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:31] <schopin> There are leaks all over on error cases, they should be fixed in #233
[08:31] <schopin> Basically my question boils down to "is the client supposed to give us a valid GError pointer at the entry point" ?
[08:39] <schopin> Note 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#L2676
[08:41] <slyon> Yeah. 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:45] <schopin> I 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:47] <schopin> Plus, this behaviour isn't consistent. You cannot ignore an error when parsing an ARP IP target (just below), for instance.
[08:48] <slyon> Agreed. You're right.
[08:50] <slyon> the API should provide proper return values if parsing failed. and GError should be used to provide the extra info.
[08:51] <schopin> ACK, I'll post a PR for this soon. Do you mind if I ignore the leaks in it though?
[09:07] <slyon> Thank you schopin! You can ignore the leaks for now, but maybe mark them with an "XXX: fix memory leak" comment while on it
[10:09] <Daulity> hey
[10:10] <Daulity> trying to configure a static address to an interface with netplan but after a apply the interface is assigned nothing 
[10:10] <slyon> Daulity: can you paste your config somewhere (e.g. paste.ubuntu.com)? and run `netplan --debug apply` to see if it shows any errors?
[10:12] <Daulity> this is the config: https://termbin.com/2txcd
[10:16] <Daulity> all that should happen on that interface is set an ip address and a netmask 
[10:20] <Daulity> this is the debug output: https://termbin.com/qehi
[10:47] <slyon> Daulity: yes that config looks correct. Could you please also show the output of `ip a`?
[10:48] <slyon> does the config apply after a reboot?
[11:36] <Daulity> slyon: i haven't tried a reboot yet will do 
[11:37] <Daulity> here is ip a output: https://termbin.com/kwnd
[11:40] <Daulity> doesn't apply after a reboot 
[11:53] <slyon> Daulity: intersting... could you please check/share the output of `networkctl status eth0`?
[11:54] <slyon> its 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?
[12:12] <Daulity> slyon: it's not plugged in on that port but that never mattered in the past 
[12:15] <Daulity> https://termbin.com/fvf4d3
[12:20] <slyon> Daulity: 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/d4884cfd40e1e33540b274371c3272df6595d22c
[12:21] <slyon> That 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] <slyon> ConfigureWithoutCarrier=yes
[12:39] <Daulity> I don't actually know if it is a problem 
[12:39] <Daulity> because if i plug in a network cable it's configured correctly and I think that is all that matters :) 
[12:44] <slyon> ack