diff options
Diffstat (limited to 'src/backends')
| -rw-r--r-- | src/backends/Makefile.am | 7 | ||||
| -rw-r--r-- | src/backends/Makefile.in | 22 | ||||
| -rw-r--r-- | src/backends/NetworkManagerArch.c | 34 | ||||
| -rw-r--r-- | src/backends/NetworkManagerDebian.c | 30 | ||||
| -rw-r--r-- | src/backends/NetworkManagerExherbo.c | 32 | ||||
| -rw-r--r-- | src/backends/NetworkManagerFrugalware.c | 29 | ||||
| -rw-r--r-- | src/backends/NetworkManagerGeneric.c | 64 | ||||
| -rw-r--r-- | src/backends/NetworkManagerGeneric.h | 15 | ||||
| -rw-r--r-- | src/backends/NetworkManagerGentoo.c | 38 | ||||
| -rw-r--r-- | src/backends/NetworkManagerLinexa.c | 29 | ||||
| -rw-r--r-- | src/backends/NetworkManagerMandriva.c | 30 | ||||
| -rw-r--r-- | src/backends/NetworkManagerPaldo.c | 36 | ||||
| -rw-r--r-- | src/backends/NetworkManagerPardus.c | 29 | ||||
| -rw-r--r-- | src/backends/NetworkManagerRedHat.c | 30 | ||||
| -rw-r--r-- | src/backends/NetworkManagerSlackware.c | 29 | ||||
| -rw-r--r-- | src/backends/NetworkManagerSuSE.c | 36 | ||||
| -rw-r--r-- | src/backends/nm-backend.h | 30 |
17 files changed, 241 insertions, 279 deletions
diff --git a/src/backends/Makefile.am b/src/backends/Makefile.am index c0780d0b..11a154a0 100644 --- a/src/backends/Makefile.am +++ b/src/backends/Makefile.am @@ -2,13 +2,16 @@ INCLUDES = \ -I${top_srcdir} \ -I${top_srcdir}/src/logging \ -I${top_srcdir}/include \ + -I${top_builddir}/include \ -I${top_srcdir}/src \ -I${top_srcdir}/libnm-util noinst_LTLIBRARIES = libnmbackend.la -libnmbackend_la_SOURCES = NetworkManagerGeneric.c \ - NetworkManagerGeneric.h +libnmbackend_la_SOURCES = \ + NetworkManagerGeneric.c \ + NetworkManagerGeneric.h \ + nm-backend.h libnmbackend_la_LIBADD = diff --git a/src/backends/Makefile.in b/src/backends/Makefile.in index 87d3df4e..9c6f7d0c 100644 --- a/src/backends/Makefile.in +++ b/src/backends/Makefile.in @@ -74,7 +74,7 @@ libnmbackend_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__libnmbackend_la_SOURCES_DIST = NetworkManagerGeneric.c \ - NetworkManagerGeneric.h NetworkManagerRedHat.c \ + NetworkManagerGeneric.h nm-backend.h NetworkManagerRedHat.c \ NetworkManagerSuSE.c NetworkManagerGentoo.c \ NetworkManagerDebian.c NetworkManagerSlackware.c \ NetworkManagerArch.c NetworkManagerPaldo.c \ @@ -187,6 +187,8 @@ GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAKEFILE = @GLIB_MAKEFILE@ +GLIB_MKENUMS = @GLIB_MKENUMS@ GMODULE_CFLAGS = @GMODULE_CFLAGS@ GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ @@ -241,11 +243,15 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ +LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ +LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ +LIBSOUP_LIBS = @LIBSOUP_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -256,6 +262,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -295,6 +302,8 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -362,16 +371,17 @@ INCLUDES = \ -I${top_srcdir} \ -I${top_srcdir}/src/logging \ -I${top_srcdir}/include \ + -I${top_builddir}/include \ -I${top_srcdir}/src \ -I${top_srcdir}/libnm-util noinst_LTLIBRARIES = libnmbackend.la libnmbackend_la_SOURCES = NetworkManagerGeneric.c \ - NetworkManagerGeneric.h $(am__append_1) $(am__append_2) \ - $(am__append_3) $(am__append_4) $(am__append_5) \ - $(am__append_6) $(am__append_7) $(am__append_8) \ - $(am__append_10) $(am__append_11) $(am__append_12) \ - $(am__append_13) + NetworkManagerGeneric.h nm-backend.h $(am__append_1) \ + $(am__append_2) $(am__append_3) $(am__append_4) \ + $(am__append_5) $(am__append_6) $(am__append_7) \ + $(am__append_8) $(am__append_10) $(am__append_11) \ + $(am__append_12) $(am__append_13) libnmbackend_la_LIBADD = $(am__append_9) \ $(top_builddir)/src/logging/libnm-logging.la $(LIBNL_LIBS) \ $(DBUS_LIBS) $(GLIB_LIBS) diff --git a/src/backends/NetworkManagerArch.c b/src/backends/NetworkManagerArch.c index c70e2459..7e25ee37 100644 --- a/src/backends/NetworkManagerArch.c +++ b/src/backends/NetworkManagerArch.c @@ -28,43 +28,33 @@ * * (C) Copyright 2004 Tom Parker * (C) Copyright 2004 Matthew Garrett - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" #include "NetworkManagerUtils.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { nm_generic_enable_loopback (); } -/* - * nm_system_update_dns - * - * Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) { - /* Check if the daemon was already running - do not start a new instance */ + /* Make glibc/nscd aware of any changes to the resolv.conf file by + * restarting nscd; check if the daemon was already running - do not + * start a new instance + */ if (g_file_test("/var/run/daemons/nscd", G_FILE_TEST_EXISTS)) nm_spawn_process ("/etc/rc.d/nscd restart"); } +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +} + diff --git a/src/backends/NetworkManagerDebian.c b/src/backends/NetworkManagerDebian.c index 37eb6457..ed29dd3a 100644 --- a/src/backends/NetworkManagerDebian.c +++ b/src/backends/NetworkManagerDebian.c @@ -21,29 +21,18 @@ * * (C) Copyright 2004 Tom Parker * (C) Copyright 2004 Matthew Garrett - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" #include "NetworkManagerUtils.h" #include "nm-logging.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { /* ifupdown isn't always installed (bgo #625427) */ if (g_file_test ("/sbin/ifup", G_FILE_TEST_EXISTS)) @@ -52,18 +41,17 @@ void nm_system_enable_loopback (void) nm_generic_enable_loopback (); } -/* - * nm_system_update_dns - * - * Invalidate the nscd host cache, if it exists, since - * we changed resolv.conf. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) { + /* Invalidate the nscd host cache since we changed resolv.conf */ if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } } +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +} + diff --git a/src/backends/NetworkManagerExherbo.c b/src/backends/NetworkManagerExherbo.c index d7e24cf6..d0277896 100644 --- a/src/backends/NetworkManagerExherbo.c +++ b/src/backends/NetworkManagerExherbo.c @@ -18,7 +18,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. * (C) Copyright 2004 Dan Willemsen * (C) Copyright 2004 Robert Paskowitz */ @@ -27,38 +27,28 @@ #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" #include "NetworkManagerUtils.h" #include "nm-logging.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { nm_generic_enable_loopback (); } -/* - * nm_system_update_dns - * - * Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd. Only restart if already running. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) { + /* Make glibc/nscd aware of any changes to the resolv.conf file by + * restarting nscd. Only restart if already running. + */ if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } } +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +} + diff --git a/src/backends/NetworkManagerFrugalware.c b/src/backends/NetworkManagerFrugalware.c index dfe62921..301751e9 100644 --- a/src/backends/NetworkManagerFrugalware.c +++ b/src/backends/NetworkManagerFrugalware.c @@ -23,36 +23,21 @@ * (C) Copyright 2006 Alex Smith */ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include "nm-system.h" - /* Provided by the frugalwareutils package on Frugalware */ #include <libfwnetconfig.h> -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { fwnet_loup (); } - -/* - * nm_system_update_dns - * - * Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) { /* I'm not running nscd */ } +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +} + diff --git a/src/backends/NetworkManagerGeneric.c b/src/backends/NetworkManagerGeneric.c index 89b8a46d..eae6f733 100644 --- a/src/backends/NetworkManagerGeneric.c +++ b/src/backends/NetworkManagerGeneric.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 - 2010 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. * (C) Copyright 2006 Timothee Lecomte <timothee.lecomte@ens.fr> */ @@ -113,3 +113,65 @@ void nm_generic_update_dns (void) { } +/* + * nm_generic_ipv6_use_tempaddr + * + * Get net.ipv6.conf.default.use_tempaddr value from /etc/sysctl.conf or + * /lib/sysctl.d/sysctl.conf + * + */ +int nm_generic_ipv6_use_tempaddr (void) +{ + char *contents = NULL; + gsize len = 0; + const char *group_name = "[forged_group]\n"; + char *sysctl_data = NULL; + GKeyFile *keyfile; + GError *error = NULL; + int tmp, ret = -1; + + /* Read file contents to a string. */ + if (!g_file_get_contents ("/etc/sysctl.conf", &contents, &len, NULL)) + if (!g_file_get_contents ("/lib/sysctl.d/sysctl.conf", &contents, &len, NULL)) + return -1; + + /* Prepend a group so that we can use GKeyFile parser. */ + sysctl_data = g_strdup_printf ("%s%s", group_name, contents); + + keyfile = g_key_file_new (); + if (keyfile == NULL) + goto done; + + if (!g_key_file_load_from_data (keyfile, sysctl_data, len + strlen (group_name), G_KEY_FILE_NONE, NULL)) + goto done; + + tmp = g_key_file_get_integer (keyfile, "forged_group", "net.ipv6.conf.default.use_tempaddr", &error); + if (error == NULL) + ret = tmp; + +done: + g_free (contents); + g_free (sysctl_data); + g_clear_error (&error); + g_key_file_free (keyfile); + + return ret; +} + +#ifdef TARGET_GENERIC +void nm_backend_enable_loopback (void) +{ + nm_generic_enable_loopback (); +} + +void nm_backend_update_dns (void) +{ + nm_generic_update_dns (); +} + +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +} +#endif + diff --git a/src/backends/NetworkManagerGeneric.h b/src/backends/NetworkManagerGeneric.h index 0a0a88a2..3d4017e4 100644 --- a/src/backends/NetworkManagerGeneric.h +++ b/src/backends/NetworkManagerGeneric.h @@ -18,13 +18,16 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. */ -#ifndef NETWORK_MANAGER_GENERIC_H -#define NETWORK_MANAGER_GENERIC_H +#ifndef NM_GENERIC_H +#define NM_GENERIC_H -void nm_generic_enable_loopback (void); -void nm_generic_update_dns (void); +#include "nm-backend.h" -#endif +void nm_generic_enable_loopback (void); +void nm_generic_update_dns (void); +int nm_generic_ipv6_use_tempaddr (void); + +#endif /* NM_GENERIC_H */ diff --git a/src/backends/NetworkManagerGentoo.c b/src/backends/NetworkManagerGentoo.c index e5b09384..7370645a 100644 --- a/src/backends/NetworkManagerGentoo.c +++ b/src/backends/NetworkManagerGentoo.c @@ -18,7 +18,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. * (C) Copyright 2004 Dan Willemsen * (C) Copyright 2004 Robert Paskowitz */ @@ -27,18 +27,12 @@ #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <gio/gio.h> +#include <glib.h> #include "NetworkManagerGeneric.h" -#include "nm-system.h" #include "NetworkManagerUtils.h" #include "nm-logging.h" -#define BUFFER_SIZE 512 - static void openrc_start_lo_if_necessary() { /* No need to run net.lo if it is already running */ @@ -46,18 +40,11 @@ static void openrc_start_lo_if_necessary() nm_spawn_process ("/etc/init.d/net.lo start"); } -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { gchar *comm; - /* If anything goes wrong trying to open /proc/1/comm, we will assume - OpenRC. */ + /* If anything goes wrong trying to open /proc/1/comm, we will assume OpenRC */ if (!g_file_get_contents ("/proc/1/comm", &comm, NULL, NULL)) { nm_log_info (LOGD_CORE, "NetworkManager is running with OpenRC..."); openrc_start_lo_if_necessary (); @@ -77,18 +64,19 @@ void nm_system_enable_loopback (void) g_free (comm); } -/* - * nm_system_update_dns - * - * Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd. Only restart if already running. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) { + /* Make glibc/nscd aware of any changes to the resolv.conf file by + * restarting nscd. Only restart if already running. + */ if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } } +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +} + diff --git a/src/backends/NetworkManagerLinexa.c b/src/backends/NetworkManagerLinexa.c index 015aa17c..34fed3bb 100644 --- a/src/backends/NetworkManagerLinexa.c +++ b/src/backends/NetworkManagerLinexa.c @@ -21,46 +21,33 @@ * * (C) Copyright 2004 Tom Parker * (C) Copyright 2004 Matthew Garrett - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" #include "NetworkManagerUtils.h" #include "nm-logging.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { nm_generic_enable_loopback (); } -/* - * nm_system_update_dns - * - * Invalidate the nscd host cache, if it exists, since - * we changed resolv.conf. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) { + /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } } +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +} diff --git a/src/backends/NetworkManagerMandriva.c b/src/backends/NetworkManagerMandriva.c index 8209ff4f..f059beb6 100644 --- a/src/backends/NetworkManagerMandriva.c +++ b/src/backends/NetworkManagerMandriva.c @@ -17,7 +17,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. * (C) Copyright 2008 Per Øyvind Karlsen */ @@ -25,37 +25,25 @@ #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" #include "NetworkManagerUtils.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { nm_generic_enable_loopback (); } -/* - * nm_system_update_dns - * - * Invalidate the nscd host cache, if it exists, since - * we changed resolv.conf. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) { + /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_REGULAR)) { nm_spawn_process ("/etc/init.d/nscd condrestart"); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } } +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +} + diff --git a/src/backends/NetworkManagerPaldo.c b/src/backends/NetworkManagerPaldo.c index 0c67e5bd..2d01d857 100644 --- a/src/backends/NetworkManagerPaldo.c +++ b/src/backends/NetworkManagerPaldo.c @@ -18,7 +18,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. * (C) Copyright 2006 Jürg Billeter */ @@ -26,36 +26,26 @@ #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" #include "NetworkManagerUtils.h" #include "nm-logging.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { nm_generic_enable_loopback (); } -/* - * nm_system_update_dns - * - * Invalidate the nscd host cache, if it exists, since - * we changed resolv.conf. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) +{ + /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ + if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { + nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); + nm_spawn_process ("/usr/sbin/nscd -i hosts"); + } +} + +int nm_backend_ipv6_use_tempaddr (void) { - nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); - nm_spawn_process ("/usr/sbin/nscd -i hosts"); + return nm_generic_ipv6_use_tempaddr (); } diff --git a/src/backends/NetworkManagerPardus.c b/src/backends/NetworkManagerPardus.c index d952cf36..acfeaed3 100644 --- a/src/backends/NetworkManagerPardus.c +++ b/src/backends/NetworkManagerPardus.c @@ -16,7 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 RedHat, Inc. + * (C) Copyright 2004 - 2012 RedHat, Inc. * (C) Copyright 2009 TUBITAK/UEKAE */ @@ -24,34 +24,19 @@ #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { nm_generic_enable_loopback (); } +void nm_backend_update_dns (void) +{ +} -/* - * nm_system_update_dns - * - * Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd. - * - */ -void nm_system_update_dns (void) +int nm_backend_ipv6_use_tempaddr (void) { - /* I'm not running nscd */ + return nm_generic_ipv6_use_tempaddr (); } diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c index 954e58a8..c14eb837 100644 --- a/src/backends/NetworkManagerRedHat.c +++ b/src/backends/NetworkManagerRedHat.c @@ -16,44 +16,32 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" #include "NetworkManagerUtils.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { nm_generic_enable_loopback (); } -/* - * nm_system_update_dns - * - * Invalidate the nscd host cache, if it exists, since - * we changed resolv.conf. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) { + /* Invalidate the nscd host cache since we changed resolv.conf */ if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_REGULAR)) { nm_spawn_process ("/etc/init.d/nscd condrestart"); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } } +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +} + diff --git a/src/backends/NetworkManagerSlackware.c b/src/backends/NetworkManagerSlackware.c index a35e1bb6..cdd2dfb0 100644 --- a/src/backends/NetworkManagerSlackware.c +++ b/src/backends/NetworkManagerSlackware.c @@ -16,7 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 RedHat, Inc. + * (C) Copyright 2004 - 2012 RedHat, Inc. * (C) Copyright 2004 Narayan Newton */ @@ -24,34 +24,19 @@ #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { nm_generic_enable_loopback (); } +void nm_backend_update_dns (void) +{ +} -/* - * nm_system_update_dns - * - * Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd. - * - */ -void nm_system_update_dns (void) +int nm_backend_ipv6_use_tempaddr (void) { - /* I'm not running nscd */ + return nm_generic_ipv6_use_tempaddr (); } diff --git a/src/backends/NetworkManagerSuSE.c b/src/backends/NetworkManagerSuSE.c index 6c8ec1a5..12618532 100644 --- a/src/backends/NetworkManagerSuSE.c +++ b/src/backends/NetworkManagerSuSE.c @@ -19,7 +19,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2004 - 2012 Red Hat, Inc. * (C) Copyright 2005-2006 SuSE GmbH */ @@ -27,36 +27,26 @@ #include <config.h> #endif -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "NetworkManagerGeneric.h" -#include "nm-system.h" #include "NetworkManagerUtils.h" #include "nm-logging.h" -/* - * nm_system_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_system_enable_loopback (void) +void nm_backend_enable_loopback (void) { nm_generic_enable_loopback (); } -/* - * nm_system_update_dns - * - * Invalidate the nscd host cache, if it exists, since - * we changed resolv.conf. - * - */ -void nm_system_update_dns (void) +void nm_backend_update_dns (void) +{ + /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ + if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { + nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); + nm_spawn_process ("/usr/sbin/nscd -i hosts"); + } +} + +int nm_backend_ipv6_use_tempaddr (void) { - nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); - nm_spawn_process ("/usr/sbin/nscd -i hosts"); + return nm_generic_ipv6_use_tempaddr (); } diff --git a/src/backends/nm-backend.h b/src/backends/nm-backend.h new file mode 100644 index 00000000..17d1ff64 --- /dev/null +++ b/src/backends/nm-backend.h @@ -0,0 +1,30 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2011 - 2012 Red Hat, Inc. + */ + +#ifndef NM_BACKEND_H +#define NM_BACKEND_H + +/* Random disto-specific stuff */ + +void nm_backend_enable_loopback (void); +void nm_backend_update_dns (void); +int nm_backend_ipv6_use_tempaddr (void); + +#endif /* NM_BACKEND_H */ |