6 |
* |
* |
7 |
* Heavily based on NetworkManagerGentoo.c by Robert Paskowitz |
* Heavily based on NetworkManagerGentoo.c by Robert Paskowitz |
8 |
* |
* |
9 |
|
* Dan Williams <dcbw@redhat.com> |
10 |
|
* Dan Willemsen <dan@willemsen.us> |
11 |
|
* Robert Paskowitz |
12 |
|
* |
13 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
14 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
15 |
* the Free Software Foundation; either version 2 of the License, or |
* the Free Software Foundation; either version 2 of the License, or |
24 |
* with this program; if not, write to the Free Software Foundation, Inc., |
* with this program; if not, write to the Free Software Foundation, Inc., |
25 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
26 |
* |
* |
|
* (C) Copyright 2004 Tom Parker |
|
|
* (C) Copyright 2004 Matthew Garrett |
|
27 |
* (C) Copyright 2004 Red Hat, Inc. |
* (C) Copyright 2004 Red Hat, Inc. |
28 |
|
* (C) Copyright 2004 Dan Willemsen |
29 |
|
* (C) Copyright 2004 Robert Paskowitz |
30 |
*/ |
*/ |
31 |
|
|
32 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
36 |
#include <stdio.h> |
#include <stdio.h> |
37 |
#include <string.h> |
#include <string.h> |
38 |
#include <stdlib.h> |
#include <stdlib.h> |
39 |
|
#include <gio/gio.h> |
40 |
|
|
41 |
#include "NetworkManagerGeneric.h" |
#include "NetworkManagerGeneric.h" |
42 |
#include "nm-system.h" |
#include "nm-system.h" |
43 |
#include "NetworkManagerUtils.h" |
#include "NetworkManagerUtils.h" |
44 |
#include "nm-logging.h" |
#include "nm-logging.h" |
45 |
|
|
46 |
|
#define BUFFER_SIZE 512 |
47 |
|
|
48 |
|
static void sysvinit_start_lo_if_necessary() |
49 |
|
{ |
50 |
|
/* No need to run net.lo if it is already running */ |
51 |
|
if (nm_spawn_process ("/etc/rc.d/init.d/localnet status") != 0) |
52 |
|
nm_spawn_process ("/etc/rc.d/init.d/localnet start"); |
53 |
|
} |
54 |
|
|
55 |
/* |
/* |
56 |
* nm_system_enable_loopback |
* nm_system_enable_loopback |
57 |
* |
* |
60 |
*/ |
*/ |
61 |
void nm_system_enable_loopback (void) |
void nm_system_enable_loopback (void) |
62 |
{ |
{ |
63 |
/* No need to run localnet if it is already running */ |
gchar *comm = NULL; |
64 |
if (nm_spawn_process ("/etc/init.d/localnet status") != 0) |
|
65 |
nm_spawn_process("/etc/init.d/localnet start"); |
if (g_strstr_len (comm, -1, "systemd")) { |
66 |
|
/* We use the generic loopback enabler if using systemd. */ |
67 |
|
nm_log_info (LOGD_CORE, "NetworkManager is running with systemd..."); |
68 |
|
nm_generic_enable_loopback (); |
69 |
|
} else { |
70 |
|
/* SySVInit otherwise. */ |
71 |
|
nm_log_info (LOGD_CORE, "NetworkManager is running with SySVInit..."); |
72 |
|
sysvinit_start_lo_if_necessary(); |
73 |
|
} |
74 |
} |
} |
75 |
|
|
76 |
/* |
/* |
87 |
nm_spawn_process ("/usr/sbin/nscd -i hosts"); |
nm_spawn_process ("/usr/sbin/nscd -i hosts"); |
88 |
} |
} |
89 |
} |
} |
90 |
|
|