Blob Blame History Raw
From 8087cf31d97607feae71f6ed89ccfed386321c7f Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 31 Jan 2018 17:00:47 +0100
Subject: [PATCH] network: Fix cloned MAC not being saved for Ethernet

We read the MAC as being the cloned MAC, which NM would likely take to
mean that we didn't want a cloned MAC.

See https://bugzilla.redhat.com/show_bug.cgi?id=1467295

https://bugzilla.gnome.org/show_bug.cgi?id=793072
---
 panels/network/connection-editor/ce-page-ethernet.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/panels/network/connection-editor/ce-page-ethernet.c b/panels/network/connection-editor/ce-page-ethernet.c
index 2163cdbb6..dbca6b934 100644
--- a/panels/network/connection-editor/ce-page-ethernet.c
+++ b/panels/network/connection-editor/ce-page-ethernet.c
@@ -86,7 +86,7 @@ static void
 ui_to_setting (CEPageEthernet *page)
 {
         gchar *device_mac = NULL;
-        gchar *cloned_mac;
+        gchar *cloned_mac = NULL;
         const gchar *text;
         GtkWidget *entry;
 
@@ -95,8 +95,12 @@ ui_to_setting (CEPageEthernet *page)
                 text = gtk_entry_get_text (GTK_ENTRY (entry));
                 device_mac = ce_page_trim_address (text);
         }
-        text = gtk_entry_get_text (GTK_ENTRY (entry));
-        cloned_mac = ce_page_trim_address (text);
+
+        entry = gtk_bin_get_child (GTK_BIN (page->cloned_mac));
+        if (entry) {
+                text = gtk_entry_get_text (GTK_ENTRY (entry));
+                cloned_mac = ce_page_trim_address (text);
+        }
 
         g_object_set (page->setting_wired,
                       NM_SETTING_WIRED_MAC_ADDRESS, device_mac,
-- 
2.14.3