[PATCH rhel6-branch] Generate connection UUID in inital ifcfg files created by anaconda (#705328)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prevents using the same UUIDs for multiple installations when NM creates
UUID for already existing ifcfg file based on hashing of configuration
file name.

Resolves: rhbz#705328
---
 loader/net.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/loader/net.c b/loader/net.c
index d755eae..0b0d16d 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -40,6 +40,7 @@
 #include <glib.h>
 #include <NetworkManager.h>
 #include <nm-client.h>
+#include <nm-utils.h>
 
 #include "../isys/isys.h"
 #include "../isys/ethtool.h"
@@ -1219,6 +1220,7 @@ int writeDisabledIfcfgFile(char *device) {
     char *ofile = NULL;
     char *nfile = NULL;
     FILE *fp = NULL;
+    char *uuid = NULL;
 
     checked_asprintf(&ofile, "%s/.ifcfg-%s",
 		     NETWORK_SCRIPTS_PATH,
@@ -1234,6 +1236,9 @@ int writeDisabledIfcfgFile(char *device) {
 
     fprintf(fp, "DEVICE=%s\n", device);
     fprintf(fp, "HWADDR=%s\n", iface_mac2str(device));
+    uuid = nm_utils_uuid_generate();
+    fprintf(fp, "UUID=%s\n", uuid);
+    g_free(uuid);
     fprintf(fp, "ONBOOT=no\n");
     fprintf(fp, "NM_CONTROLLED=no\n");
     /* default for network service, NM assumes it */
@@ -1275,6 +1280,7 @@ int writeEnabledNetInfo(iface_t *iface) {
     char *ofile = NULL;
     char *nfile = NULL;
     struct utsname kv;
+    char *uuid = NULL;
 
     memset(&buf, '\0', sizeof(buf));
 
@@ -1336,6 +1342,9 @@ int writeEnabledNetInfo(iface_t *iface) {
 #if !defined(__s390__) && !defined(__s390x__)
     fprintf(fp, "HWADDR=%s\n", iface_mac2str(iface->device));
 #endif
+    uuid = nm_utils_uuid_generate();
+    fprintf(fp, "UUID=%s\n", uuid);
+    g_free(uuid);
     fprintf(fp, "ONBOOT=yes\n");
     char *str_type = netArpTypeStr(iface);
     if (str_type) fprintf(fp, "TYPE=%s\n", str_type);
-- 
1.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux