summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-04-21 15:25:41 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-04-30 11:26:30 -1000
commitea1f22b7c4d83351b0fc7d97c462f0a494764601 (patch)
treed865a9d82e77d54fc210e875e190e70c7c1dcaa9
parent475bd88dec96d15cb6a3ee8a29468eba05bd3836 (diff)
downloadanaconda-ea1f22b7c4d83351b0fc7d97c462f0a494764601.tar.gz
anaconda-ea1f22b7c4d83351b0fc7d97c462f0a494764601.tar.xz
anaconda-ea1f22b7c4d83351b0fc7d97c462f0a494764601.zip
Configure network in kickstartNetworkUp() iff NM is not connected (#490518)
In kickstartNetworkUp(), call is_nm_connected() to see if we are in NM_STATE_CONNECTED. If we are in any other state, prompt for network configuration and start NetworkManager.
-rw-r--r--isys/iface.c20
-rw-r--r--isys/iface.h6
-rw-r--r--loader/net.c3
3 files changed, 29 insertions, 0 deletions
diff --git a/isys/iface.c b/isys/iface.c
index 1df5fa0cd..137180275 100644
--- a/isys/iface.c
+++ b/isys/iface.c
@@ -356,6 +356,26 @@ int iface_have_in6_addr(struct in6_addr *addr6) {
return _iface_have_valid_addr(addr6, AF_INET6, INET6_ADDRSTRLEN);
}
+/* Check if NM has an active connection */
+gboolean is_nm_connected(void) {
+ NMState state;
+ NMClient *client = NULL;
+
+ g_type_init();
+
+ client = nm_client_new();
+ if (!client)
+ return FALSE;
+
+ state = nm_client_get_state(client);
+ g_object_unref(client);
+
+ if (state == NM_STATE_CONNECTED)
+ return TRUE;
+ else
+ return FALSE;
+}
+
/* Check if NM is already running */
gboolean is_nm_running(void) {
gboolean running;
diff --git a/isys/iface.h b/isys/iface.h
index c95c39bd6..16257bc89 100644
--- a/isys/iface.h
+++ b/isys/iface.h
@@ -26,6 +26,7 @@
#include <net/if.h>
#include <netlink/cache.h>
#include <netlink/socket.h>
+#include <glib.h>
/* Enumerated types used in iface.c as well as loader's network code */
enum { IPUNUSED, IPV4, IPV6 };
@@ -141,6 +142,11 @@ int iface_have_in_addr(struct in_addr *addr);
int iface_have_in6_addr(struct in6_addr *addr6);
/*
+ * Checks if NetworkManager has an active connection.
+ */
+gboolean is_nm_connected(void);
+
+/*
* Start NetworkManager
*/
int iface_start_NetworkManager(void);
diff --git a/loader/net.c b/loader/net.c
index 3a3fae9d1..47e234609 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1893,6 +1893,9 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) {
int kickstartNetworkUp(struct loaderData_s * loaderData, iface_t * iface) {
int rc, err;
+ if (is_nm_connected() == TRUE)
+ return 0;
+
memset(iface, 0, sizeof(*iface));
do {