Skip to content

Commit

Permalink
parse-nm: account for veth and dummy when checking for virtual types
Browse files Browse the repository at this point in the history
The new types DUMMY and VETH were added to the types enum after the
generic type NM. In order to build the netdef ID, it checked if the
interface was virtual but it wouldn't consider DUMMY and VETH.

Because of that, when these types of interfaces are created via Network
Manager, their netdef IDs will be the connection UUID. For virtual
devices we want it to be the interface name.
  • Loading branch information
daniloegea committed Sep 3, 2024
1 parent 150090a commit c274b3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ typedef enum {
* requires links to another netdef (such as vlan_link)
* but it's not strictly mandatory
* It's intended to be used only when renderer is NetworkManager
* Keep the PLACEHOLDER_ and MAX_ elements at the end of the enum
*/
NETPLAN_DEF_TYPE_NM_PLACEHOLDER_,
NETPLAN_DEF_TYPE_MAX_
Expand Down
4 changes: 3 additions & 1 deletion src/parse-nm.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,9 @@ netplan_parser_load_keyfile(NetplanParser* npp, const char* filename, GError** e
nd_id = g_strdup(netdef_id);
if (g_strcmp0(netdef_id, tmp_str) == 0)
_kf_clear_key(kf, "connection", "interface-name");
} else if (tmp_str && nd_type >= NETPLAN_DEF_TYPE_VIRTUAL && nd_type < NETPLAN_DEF_TYPE_NM) {
} else if (tmp_str && nd_type != NETPLAN_DEF_TYPE_NM
&& nd_type >= NETPLAN_DEF_TYPE_VIRTUAL
&& nd_type < NETPLAN_DEF_TYPE_NM_PLACEHOLDER_) {
/* netdef ID equals "interface-name" for virtual devices (bridge/bond/...) */
nd_id = g_strdup(tmp_str);
_kf_clear_key(kf, "connection", "interface-name");
Expand Down

0 comments on commit c274b3b

Please sign in to comment.