← Back to team overview

netplan-developers team mailing list archive

[Merge] ~xnox/netplan:master into netplan:master

 

Dimitri John Ledkov has proposed merging ~xnox/netplan:master into netplan:master.

Commit message:
Parse and set MACAdress on the vlan devices.
    
LP: #1690388

Requested reviews:
  Developers of netplan (netplan-developers)
Related bugs:
  Bug #1690388 in cloud-init (Ubuntu): "wrong hwaddr on the vlan bond with nplan and cloud-init"
  https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1690388

For more details, see:
https://code.launchpad.net/~xnox/netplan/+git/netplan/+merge/324020

Parse and set MACAdress on the vlan devices.
    
LP: #1690388
-- 
Your team Developers of netplan is requested to review the proposed merge of ~xnox/netplan:master into netplan:master.
diff --git a/src/networkd.c b/src/networkd.c
index 04c7c37..817c3d2 100644
--- a/src/networkd.c
+++ b/src/networkd.c
@@ -177,6 +177,9 @@ write_netdev_file(net_definition* def, const char* rootdir, const char* path)
     s = g_string_sized_new(200);
     g_string_append_printf(s, "[NetDev]\nName=%s\n", def->id);
 
+    if (def->set_mac)
+	g_string_append_printf(s, "MACAddress=%s\n", def->set_mac);
+
     switch (def->type) {
         case ND_BRIDGE:
             g_string_append(s, "Kind=bridge\n");
diff --git a/src/parse.c b/src/parse.c
index 4312112..70ec084 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -970,6 +970,7 @@ const mapping_entry_handler vlan_def_handlers[] = {
     {"id", YAML_SCALAR_NODE, handle_netdef_guint, NULL, netdef_offset(vlan_id)},
     {"link", YAML_SCALAR_NODE, handle_netdef_id_ref, NULL, netdef_offset(vlan_link)},
     {"nameservers", YAML_MAPPING_NODE, NULL, nameservers_handlers},
+    {"macaddress", YAML_SCALAR_NODE, handle_netdef_mac, NULL, netdef_offset(set_mac)},
     {"mtu", YAML_SCALAR_NODE, handle_netdef_guint, NULL, netdef_offset(mtubytes)},
     {"renderer", YAML_SCALAR_NODE, handle_netdef_renderer},
     {"routes", YAML_SEQUENCE_NODE, handle_routes},

Follow ups