[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [PATCH 1/3] Configure network in kickstartNetworkUp() iff NM is not connected (#490518)
- From: Peter Jones <pjones redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: Re: [PATCH 1/3] Configure network in kickstartNetworkUp() iff NM is not connected (#490518)
- Date: Thu, 30 Apr 2009 15:47:17 -0400
On 04/29/2009 04:57 PM, David Cantrell wrote:
> 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.
Looks fine.
> ---
> isys/iface.c | 20 ++++++++++++++++++++
> isys/iface.h | 6 ++++++
> loader/net.c | 3 +++
> 3 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/isys/iface.c b/isys/iface.c
> index 1df5fa0..1371802 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 c95c39b..16257bc 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 3a3fae9..47e2346 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 {
--
Peter
What we need is either less corruption, or more chances to
participate in it.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]