--- b/config.h.in 2011-05-07 13:34:44.000000000 +1000 +++ a/config.h.in 2011-05-07 13:34:44.000000000 +1000 @@ -180,6 +180,9 @@ /* Define if you have Gentoo */ #undef TARGET_GENTOO +/* Define if you have NuTyX */ +#undef TARGET_NUTYX + /* Define if you have linexa */ #undef TARGET_LINEXA --- b/configure.ac 2011-05-07 13:34:44.000000000 +1000 +++ a/configure.ac 2011-05-07 13:34:44.000000000 +1000 @@ -107,7 +107,7 @@ dnl AC_C_BIGENDIAN -AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, arch, slackware, paldo, mandriva, pardus, linexa or exherbo])) +AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, arch, slackware, paldo, mandriva, pardus, linexa, exherbo or nutyx])) if test "z$with_distro" = "z"; then AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat") AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") @@ -121,6 +121,7 @@ AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus") AC_CHECK_FILE(/etc/linexa-release,with_distro="linexa") AC_CHECK_FILE(/etc/exherbo-release,with_distro="exherbo") + AC_CHECK_FILE(/etc/nutyx-version,with_distro="nutyx") if test "z$with_distro" = "z"; then with_distro=`lsb_release -is` fi @@ -132,7 +133,7 @@ exit 1 else case $with_distro in - redhat|suse|gentoo|debian|slackware|arch|paldo|frugalware|mandriva|pardus|linexa|exherbo|generic) ;; + redhat|suse|gentoo|debian|slackware|arch|paldo|frugalware|mandriva|pardus|linexa|exherbo|generic|nutyx) ;; *) echo "Your distribution (${with_distro}) is not yet supported! (patches welcome)" exit 1 @@ -205,6 +206,11 @@ AC_DEFINE(TARGET_EXHERBO, 1, [Define if you have Exherbo]) fi +AM_CONDITIONAL(TARGET_NUTYX, test x"$with_distro" = xnutyx) +if test x"$with_distro" = xnutyx; then + AC_DEFINE(TARGET_NUTYX, 1, [Define if you have NuTyX]) +fi + dnl dnl Distribution version string dnl --- b/src/backends/Makefile.am 2011-05-07 13:34:44.000000000 +1000 +++ a/src/backends/Makefile.am 2011-05-07 13:34:44.000000000 +1000 @@ -64,6 +64,10 @@ libnmbackend_la_SOURCES += NetworkManagerExherbo.c endif +if TARGET_NUTYX +libnmbackend_la_SOURCES += NetworkManagerNuTyX.c +endif + libnmbackend_la_LIBADD += \ $(top_builddir)/src/logging/libnm-logging.la \ $(LIBNL_LIBS) \ --- b/src/backends/NetworkManagerNuTyX.c 1970-01-01 10:00:00.000000000 +1000 +++ a/src/backends/NetworkManagerNuTyX.c 2011-05-07 13:34:44.000000000 +1000 @@ -0,0 +1,107 @@ +/* NetworkManager -- Network link manager + * + * Jürg Billeter + * + * Adapted for NuTyX by piernov + * Heavily based on NetworkManagerRedhat.c by Dan Williams + * + * 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. + * + * (C) Copyright 2004 Red Hat, Inc. + * (C) Copyright 2006 Jürg Billeter + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +//#include +//#include +//#include + +#include "NetworkManagerGeneric.h" +//#include "nm-system.h" +#include "NetworkManagerUtils.h" +#include "nm-logging.h" + +/* + * nm_backend_enable_loopback + * + * Bring up the loopback interface + * + */ +void nm_backend_enable_loopback (void) +{ + nm_spawn_process ("/etc/rc.d/init.d/localnet restart"); +} + +/* + * nm_backend_update_dns + * + * Invalidate the nscd host cache, if it exists, since + * we changed resolv.conf. + * + */ +void nm_backend_update_dns (void) +{ + if (g_file_test("/var/run/nscd/nscd.pid", G_FILE_TEST_EXISTS)) + nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); + nm_spawn_process ("/usr/sbin/nscd -i hosts"); +} + +/* + * nm_backend_ipv6_use_tempaddr + * + * Get net.ipv6.conf.default.use_tempaddr value from /etc/sysctl.conf or + * /lib/sysctl.d/sysctl.conf + * + */ +int nm_backend_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; +}