Generate connection UUID in inital ifcfg files created by anaconda (#705328)
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
", device);
fprintf(fp, "HWADDR=%s
", iface_mac2str(device));
+ uuid = nm_utils_uuid_generate();
+ fprintf(fp, "UUID=%s
", uuid);
+ g_free(uuid);
fprintf(fp, "ONBOOT=no
");
fprintf(fp, "NM_CONTROLLED=no
");
/* 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, ' ', sizeof(buf));
@@ -1336,6 +1342,9 @@ int writeEnabledNetInfo(iface_t *iface) {
#if !defined(__s390__) && !defined(__s390x__)
fprintf(fp, "HWADDR=%s
", iface_mac2str(iface->device));
#endif
+ uuid = nm_utils_uuid_generate();
+ fprintf(fp, "UUID=%s
", uuid);
+ g_free(uuid);
fprintf(fp, "ONBOOT=yes
");
char *str_type = netArpTypeStr(iface);
if (str_type) fprintf(fp, "TYPE=%s
", str_type);
--
1.7.4
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list