summaryrefslogtreecommitdiffstats
path: root/isys
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 /isys
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.
Diffstat (limited to 'isys')
-rw-r--r--isys/iface.c20
-rw-r--r--isys/iface.h6
2 files changed, 26 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);