diff options
Diffstat (limited to 'src/settings/plugins')
58 files changed, 2982 insertions, 2608 deletions
diff --git a/src/settings/plugins/Makefile.am b/src/settings/plugins/Makefile.am index d4ba12f0..8b39b3fc 100644 --- a/src/settings/plugins/Makefile.am +++ b/src/settings/plugins/Makefile.am @@ -1,21 +1,17 @@ SUBDIRS=keyfile example -if TARGET_REDHAT +if CONFIG_PLUGIN_IFCFG_RH SUBDIRS+=ifcfg-rh endif -if TARGET_SUSE +if CONFIG_PLUGIN_IFCFG_SUSE SUBDIRS+=ifcfg-suse endif -if TARGET_MANDRIVA -SUBDIRS+=ifcfg-rh -endif - -if TARGET_DEBIAN +if CONFIG_PLUGIN_IFUPDOWN SUBDIRS+=ifupdown endif -if TARGET_GENTOO +if CONFIG_PLUGIN_IFNET SUBDIRS+=ifnet endif diff --git a/src/settings/plugins/Makefile.in b/src/settings/plugins/Makefile.in index 2e8dff02..5642eda7 100644 --- a/src/settings/plugins/Makefile.in +++ b/src/settings/plugins/Makefile.in @@ -50,25 +50,26 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@TARGET_REDHAT_TRUE@am__append_1 = ifcfg-rh -@TARGET_SUSE_TRUE@am__append_2 = ifcfg-suse -@TARGET_MANDRIVA_TRUE@am__append_3 = ifcfg-rh -@TARGET_DEBIAN_TRUE@am__append_4 = ifupdown -@TARGET_GENTOO_TRUE@am__append_5 = ifnet +@CONFIG_PLUGIN_IFCFG_RH_TRUE@am__append_1 = ifcfg-rh +@CONFIG_PLUGIN_IFCFG_SUSE_TRUE@am__append_2 = ifcfg-suse +@CONFIG_PLUGIN_IFUPDOWN_TRUE@am__append_3 = ifupdown +@CONFIG_PLUGIN_IFNET_TRUE@am__append_4 = ifnet subdir = src/settings/plugins DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -141,6 +142,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -155,9 +160,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -167,17 +170,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -218,6 +218,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -234,11 +235,7 @@ 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@ @@ -253,6 +250,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -262,6 +261,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -288,13 +288,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -349,6 +350,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -363,8 +369,12 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ SUBDIRS = keyfile example $(am__append_1) $(am__append_2) \ - $(am__append_3) $(am__append_4) $(am__append_5) + $(am__append_3) $(am__append_4) all: all-recursive .SUFFIXES: diff --git a/src/settings/plugins/example/Makefile.am b/src/settings/plugins/example/Makefile.am index 027f6f89..95558b72 100644 --- a/src/settings/plugins/example/Makefile.am +++ b/src/settings/plugins/example/Makefile.am @@ -25,16 +25,12 @@ libnm_settings_plugin_example_la_SOURCES = \ libnm_settings_plugin_example_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libnm_settings_plugin_example_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) libnm_settings_plugin_example_la_LDFLAGS = -module -avoid-version diff --git a/src/settings/plugins/example/Makefile.in b/src/settings/plugins/example/Makefile.in index 775fabc0..fcdcd7b3 100644 --- a/src/settings/plugins/example/Makefile.in +++ b/src/settings/plugins/example/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/example DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -74,8 +76,7 @@ CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libnm_settings_plugin_example_la_DEPENDENCIES = \ - $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) am_libnm_settings_plugin_example_la_OBJECTS = \ libnm_settings_plugin_example_la-nm-example-connection.lo \ libnm_settings_plugin_example_la-plugin.lo \ @@ -139,6 +140,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -153,9 +158,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -165,17 +168,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -216,6 +216,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -232,11 +233,7 @@ 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@ @@ -251,6 +248,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -260,6 +259,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -286,13 +286,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -347,6 +348,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -361,6 +367,10 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ INCLUDES = \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ @@ -388,16 +398,12 @@ libnm_settings_plugin_example_la_SOURCES = \ libnm_settings_plugin_example_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libnm_settings_plugin_example_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) libnm_settings_plugin_example_la_LDFLAGS = -module -avoid-version all: all-am @@ -459,25 +465,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_example_la-writer.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< diff --git a/src/settings/plugins/example/common.h b/src/settings/plugins/example/common.h index a4197070..ed0be9a7 100644 --- a/src/settings/plugins/example/common.h +++ b/src/settings/plugins/example/common.h @@ -31,7 +31,7 @@ #define EXAMPLE_PLUGIN_NAME "example" #define EXAMPLE_PLUGIN_INFO "(c) 2012 Red Hat, Inc. To report bugs please use the NetworkManager mailing list." -#define EXAMPLE_DIR SYSCONFDIR"/NetworkManager/example-plugin" +#define EXAMPLE_DIR NMCONFDIR "/example-plugin" /* Boilerplate stuff for the plugin's error domain. Bits of the code that * create new errors in the plugin's domain will create errors of diff --git a/src/settings/plugins/ifcfg-rh/Makefile.am b/src/settings/plugins/ifcfg-rh/Makefile.am index 68225ba1..a2c3f0f0 100644 --- a/src/settings/plugins/ifcfg-rh/Makefile.am +++ b/src/settings/plugins/ifcfg-rh/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=. tests +SUBDIRS = . tests nm-ifcfg-rh-glue.h: nm-ifcfg-rh.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_ifcfg_rh --mode=glib-server --output=$@ $< @@ -29,13 +29,13 @@ INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util libifcfg_rh_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ $(NSS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DSBINDIR=\"$(sbindir)\" @@ -54,9 +54,7 @@ libnm_settings_plugin_ifcfg_rh_la_SOURCES = \ libnm_settings_plugin_ifcfg_rh_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifcfg_rh_la_LDFLAGS = -module -avoid-version @@ -64,9 +62,7 @@ libnm_settings_plugin_ifcfg_rh_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la \ libifcfg-rh-io.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) dbusservicedir = $(DBUS_SYS_DIR) dbusservice_DATA = nm-ifcfg-rh.conf diff --git a/src/settings/plugins/ifcfg-rh/Makefile.in b/src/settings/plugins/ifcfg-rh/Makefile.in index 6bdf1cc9..53492e72 100644 --- a/src/settings/plugins/ifcfg-rh/Makefile.in +++ b/src/settings/plugins/ifcfg-rh/Makefile.in @@ -56,16 +56,18 @@ subdir = src/settings/plugins/ifcfg-rh DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -118,7 +120,6 @@ am__v_lt_0 = --silent libnm_settings_plugin_ifcfg_rh_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la libifcfg-rh-io.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_libnm_settings_plugin_ifcfg_rh_la_OBJECTS = \ libnm_settings_plugin_ifcfg_rh_la-plugin.lo \ @@ -218,6 +219,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -232,9 +237,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -244,17 +247,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -295,6 +295,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -311,11 +312,7 @@ 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@ @@ -330,6 +327,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -339,6 +338,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -365,13 +365,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -426,6 +427,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -440,6 +446,10 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ SUBDIRS = . tests BUILT_SOURCES = \ nm-ifcfg-rh-glue.h @@ -465,13 +475,13 @@ INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util libifcfg_rh_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ $(NSS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DSBINDIR=\"$(sbindir)\" @@ -490,9 +500,7 @@ libnm_settings_plugin_ifcfg_rh_la_SOURCES = \ libnm_settings_plugin_ifcfg_rh_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifcfg_rh_la_LDFLAGS = -module -avoid-version @@ -500,9 +508,7 @@ libnm_settings_plugin_ifcfg_rh_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la \ libifcfg-rh-io.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) dbusservicedir = $(DBUS_SYS_DIR) dbusservice_DATA = nm-ifcfg-rh.conf @@ -607,25 +613,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_ifcfg_rh_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c index 04d5463c..50cbdf07 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.c +++ b/src/settings/plugins/ifcfg-rh/plugin.c @@ -80,10 +80,12 @@ typedef struct { gulong ih_event_id; int sc_network_wd; + GFileMonitor *hostname_monitor; + guint hostname_monitor_id; char *hostname; - GFileMonitor *monitor; - guint monitor_id; + GFileMonitor *ifcfg_monitor; + guint ifcfg_monitor_id; DBusGConnection *bus; } SCPluginIfcfgPrivate; @@ -325,11 +327,11 @@ connection_new_or_changed (SCPluginIfcfg *self, } static void -dir_changed (GFileMonitor *monitor, - GFile *file, - GFile *other_file, - GFileMonitorEvent event_type, - gpointer user_data) +ifcfg_dir_changed (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event_type, + gpointer user_data) { SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (user_data); SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); @@ -379,8 +381,9 @@ setup_ifcfg_monitoring (SCPluginIfcfg *plugin) g_object_unref (file); if (monitor) { - priv->monitor_id = g_signal_connect (monitor, "changed", G_CALLBACK (dir_changed), plugin); - priv->monitor = monitor; + priv->ifcfg_monitor_id = g_signal_connect (monitor, "changed", + G_CALLBACK (ifcfg_dir_changed), plugin); + priv->ifcfg_monitor = monitor; } } @@ -463,7 +466,8 @@ add_connection (NMSystemConfigInterface *config, return (NMSettingsConnection *) added; } -#define SC_NETWORK_FILE SYSCONFDIR"/sysconfig/network" +#define SC_NETWORK_FILE "/etc/sysconfig/network" +#define HOSTNAME_FILE "/etc/hostname" static char * plugin_get_hostname (SCPluginIfcfg *plugin) @@ -472,6 +476,11 @@ plugin_get_hostname (SCPluginIfcfg *plugin) char *hostname; gboolean ignore_localhost; + if (g_file_get_contents (HOSTNAME_FILE, &hostname, NULL, NULL)) { + g_strchomp (hostname); + return hostname; + } + network = svNewFile (SC_NETWORK_FILE); if (!network) { PLUGIN_WARN (IFCFG_PLUGIN_NAME, "Could not get hostname: failed to read " SC_NETWORK_FILE); @@ -500,34 +509,31 @@ plugin_set_hostname (SCPluginIfcfg *plugin, const char *hostname) SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); shvarFile *network; - network = svCreateFile (SC_NETWORK_FILE); - if (!network) { - PLUGIN_WARN (IFCFG_PLUGIN_NAME, "Could not save hostname: failed to create/open " SC_NETWORK_FILE); + if (!g_file_set_contents (HOSTNAME_FILE, hostname, -1, NULL)) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, "Could not save hostname: failed to create/open " HOSTNAME_FILE); return FALSE; } - svSetValue (network, "HOSTNAME", hostname, FALSE); - svWriteFile (network, 0644); - svCloseFile (network); - g_free (priv->hostname); priv->hostname = g_strdup (hostname); + + /* Remove "HOSTNAME" from SC_NETWORK_FILE, if present */ + network = svNewFile (SC_NETWORK_FILE); + if (network) { + svSetValue (network, "HOSTNAME", NULL, FALSE); + svWriteFile (network, 0644); + svCloseFile (network); + } + return TRUE; } static void -sc_network_changed_cb (NMInotifyHelper *ih, - struct inotify_event *evt, - const char *path, - gpointer user_data) +hostname_maybe_changed (SCPluginIfcfg *plugin) { - SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (user_data); SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); char *new_hostname; - if (evt->wd != priv->sc_network_wd) - return; - new_hostname = plugin_get_hostname (plugin); if ( (new_hostname && !priv->hostname) || (!new_hostname && priv->hostname) @@ -539,6 +545,33 @@ sc_network_changed_cb (NMInotifyHelper *ih, g_free (new_hostname); } +static void +sc_network_changed_cb (NMInotifyHelper *ih, + struct inotify_event *evt, + const char *path, + gpointer user_data) +{ + SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (user_data); + SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); + + if (evt->wd != priv->sc_network_wd) + return; + + hostname_maybe_changed (plugin); +} + +static void +hostname_changed_cb (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event_type, + gpointer user_data) +{ + SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (user_data); + + hostname_maybe_changed (plugin); +} + static gboolean impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin, const char *in_ifcfg, @@ -614,11 +647,29 @@ sc_plugin_ifcfg_init (SCPluginIfcfg *plugin) NMInotifyHelper *ih; GError *error = NULL; gboolean success = FALSE; + GFile *file; + GFileMonitor *monitor; + + /* We watch SC_NETWORK_FILE via NMInotifyHelper (which doesn't track file creation but + * *does* track modifications made via other hard links), since we expect it to always + * exist. But we watch HOSTNAME_FILE via GFileMonitor (which has the opposite + * semantics), since /etc/hostname might not exist, but is unlikely to have hard + * links. bgo 532815 is the bug for being able to just use GFileMonitor for both. + */ ih = nm_inotify_helper_get (); priv->ih_event_id = g_signal_connect (ih, "event", G_CALLBACK (sc_network_changed_cb), plugin); priv->sc_network_wd = nm_inotify_helper_add_watch (ih, SC_NETWORK_FILE); + file = g_file_new_for_path (HOSTNAME_FILE); + monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); + g_object_unref (file); + if (monitor) { + priv->hostname_monitor_id = + g_signal_connect (monitor, "changed", G_CALLBACK (hostname_changed_cb), plugin); + priv->hostname_monitor = monitor; + } + priv->hostname = plugin_get_hostname (plugin); priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); @@ -674,24 +725,35 @@ dispose (GObject *object) priv->bus = NULL; } - ih = nm_inotify_helper_get (); + if (priv->ih_event_id) { + ih = nm_inotify_helper_get (); + + g_signal_handler_disconnect (ih, priv->ih_event_id); + priv->ih_event_id = 0; - g_signal_handler_disconnect (ih, priv->ih_event_id); + if (priv->sc_network_wd >= 0) + nm_inotify_helper_remove_watch (ih, priv->sc_network_wd); + } + + if (priv->hostname_monitor) { + if (priv->hostname_monitor_id) + g_signal_handler_disconnect (priv->hostname_monitor, priv->hostname_monitor_id); - if (priv->sc_network_wd >= 0) - nm_inotify_helper_remove_watch (ih, priv->sc_network_wd); + g_file_monitor_cancel (priv->hostname_monitor); + g_object_unref (priv->hostname_monitor); + } g_free (priv->hostname); if (priv->connections) g_hash_table_destroy (priv->connections); - if (priv->monitor) { - if (priv->monitor_id) - g_signal_handler_disconnect (priv->monitor, priv->monitor_id); + if (priv->ifcfg_monitor) { + if (priv->ifcfg_monitor_id) + g_signal_handler_disconnect (priv->ifcfg_monitor, priv->ifcfg_monitor_id); - g_file_monitor_cancel (priv->monitor); - g_object_unref (priv->monitor); + g_file_monitor_cancel (priv->ifcfg_monitor); + g_object_unref (priv->ifcfg_monitor); } G_OBJECT_CLASS (sc_plugin_ifcfg_parent_class)->dispose (object); diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 6e5ec3c0..bbe83436 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -25,7 +25,6 @@ #include <sys/socket.h> #include <arpa/inet.h> #include <sys/wait.h> -#include <ctype.h> #include <sys/inotify.h> #include <errno.h> #include <sys/ioctl.h> @@ -45,6 +44,8 @@ #include <nm-setting-wireless.h> #include <nm-setting-8021x.h> #include <nm-setting-bond.h> +#include <nm-setting-bridge.h> +#include <nm-setting-bridge-port.h> #include <nm-utils.h> #include "wifi-utils.h" @@ -66,12 +67,27 @@ static gboolean get_int (const char *str, int *value) { char *e; + long int tmp; errno = 0; - *value = strtol (str, &e, 0); + tmp = strtol (str, &e, 0); if (errno || *e != '\0') return FALSE; + *value = (int) tmp; + return TRUE; +} + +static gboolean +get_uint (const char *str, guint32 *value) +{ + char *e; + long unsigned int tmp; + errno = 0; + tmp = strtoul (str, &e, 0); + if (errno || *e != '\0') + return FALSE; + *value = (guint32) tmp; return TRUE; } @@ -168,6 +184,39 @@ make_connection_setting (const char *file, g_object_set (s_con, NM_SETTING_CONNECTION_ZONE, zone, NULL); g_free (zone); + value = svGetValue (ifcfg, "SECONDARY_UUIDS", FALSE); + if (value) { + char **items, **iter; + + items = g_strsplit_set (value, " \t", -1); + for (iter = items; iter && *iter; iter++) { + if (strlen (*iter)) { + if (!nm_setting_connection_add_secondary (s_con, *iter)) + PLUGIN_WARN (IFCFG_PLUGIN_NAME, + " warning: secondary connection UUID '%s' already added", *iter); + } + } + g_free (value); + g_strfreev (items); + } + + value = svGetValue (ifcfg, "BRIDGE", FALSE); + if (value) { + const char *bridge; + + if ((bridge = nm_setting_connection_get_master (s_con))) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, + " warning: Already configured as slave of %s. " + "Ignoring BRIDGE=\"%s\"", bridge, value); + g_free (value); + } + + g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL); + g_object_set (s_con, NM_SETTING_CONNECTION_SLAVE_TYPE, + NM_SETTING_BRIDGE_SETTING_NAME, NULL); + g_free (value); + } + return NM_SETTING (s_con); } @@ -1590,8 +1639,13 @@ make_ip6_setting (shvarFile *ifcfg, nm_ip6_address_unref (addr); } g_strfreev (list); - } else if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { - /* TODO - autoconf or DHCPv6 stuff goes here */ + } else if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) + || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { + /* METHOD_AUTO may trigger DHCPv6, so save the hostname to send to DHCP */ + value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE); + if (value && value[0]) + g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, value, NULL); + g_free (value); } /* DNS servers @@ -1647,6 +1701,22 @@ error: return NULL; } +static void +check_if_bond_slave (shvarFile *ifcfg, + NMSettingConnection *s_con) +{ + char *value; + + value = svGetValue (ifcfg, "MASTER", FALSE); + if (value) { + g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL); + g_object_set (s_con, + NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BOND_SETTING_NAME, + NULL); + g_free (value); + } +} + static gboolean add_one_wep_key (shvarFile *ifcfg, const char *shvar_key, @@ -1699,7 +1769,7 @@ add_one_wep_key (shvarFile *ifcfg, char *p = value + 2; while (*p) { - if (!isascii ((int) (*p))) { + if (!g_ascii_isprint ((int) (*p))) { g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Invalid ASCII WEP key."); goto out; @@ -1997,7 +2067,7 @@ parse_wpa_psk (shvarFile *ifcfg, if (!quoted && (strlen (psk) == 64)) { /* Verify the hex PSK; 64 digits */ while (*p) { - if (!isxdigit (*p++)) { + if (!g_ascii_isxdigit (*p++)) { g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Invalid WPA_PSK (contains non-hexadecimal characters)"); goto out; @@ -2978,7 +3048,7 @@ make_wireless_setting (shvarFile *ifcfg, p = value + 2; while (*p) { - if (!isxdigit (*p)) { + if (!g_ascii_isxdigit (*p)) { g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Invalid SSID '%s' character (looks like hex SSID but '%c' isn't a hex digit)", value, *p); @@ -3249,7 +3319,7 @@ make_wired_setting (shvarFile *ifcfg, /* basic sanity checks */ while (*p) { - if (!isxdigit (*p) && (*p != ',') && (*p != '.')) { + if (!g_ascii_isxdigit (*p) && (*p != ',') && (*p != '.')) { PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid SUBCHANNELS '%s'", value); success = FALSE; break; @@ -3401,7 +3471,6 @@ wired_connection_from_ifcfg (const char *file, NMSetting *con_setting = NULL; NMSetting *wired_setting = NULL; NMSetting8021x *s_8021x = NULL; - char *value; g_return_val_if_fail (file != NULL, NULL); g_return_val_if_fail (ifcfg != NULL, NULL); @@ -3420,18 +3489,9 @@ wired_connection_from_ifcfg (const char *file, g_object_unref (connection); return NULL; } + check_if_bond_slave (ifcfg, NM_SETTING_CONNECTION (con_setting)); nm_connection_add_setting (connection, con_setting); - /* Might be a bond slave; handle master device or connection */ - value = svGetValue (ifcfg, "MASTER", FALSE); - if (value) { - g_object_set (con_setting, NM_SETTING_CONNECTION_MASTER, value, NULL); - g_object_set (con_setting, - NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BOND_SETTING_NAME, - NULL); - g_free (value); - } - wired_setting = make_wired_setting (ifcfg, file, nm_controlled, unmanaged, &s_8021x, error); if (!wired_setting) { g_object_unref (connection); @@ -3537,6 +3597,7 @@ infiniband_connection_from_ifcfg (const char *file, g_object_unref (connection); return NULL; } + check_if_bond_slave (ifcfg, NM_SETTING_CONNECTION (con_setting)); nm_connection_add_setting (connection, con_setting); infiniband_setting = make_infiniband_setting (ifcfg, file, nm_controlled, unmanaged, error); @@ -3672,6 +3733,232 @@ bond_connection_from_ifcfg (const char *file, return connection; } +typedef void (*BridgeOptFunc) (NMSetting *setting, + gboolean stp, + const char *key, + const char *value); + +static void +handle_bridge_option (NMSetting *setting, + gboolean stp, + const char *key, + const char *value) +{ + guint32 u = 0; + + if (!strcmp (key, "priority")) { + if (stp == FALSE) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: 'priority' invalid when STP is disabled"); + } else if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_PRIORITY, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid priority value '%s'", value); + } else if (!strcmp (key, "hello_time")) { + if (stp == FALSE) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: 'hello_time' invalid when STP is disabled"); + } else if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_HELLO_TIME, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid hello_time value '%s'", value); + } else if (!strcmp (key, "max_age")) { + if (stp == FALSE) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: 'max_age' invalid when STP is disabled"); + } else if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_MAX_AGE, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid max_age value '%s'", value); + } else if (!strcmp (key, "ageing_time")) { + if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_AGEING_TIME, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid ageing_time value '%s'", value); + } else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: unhandled bridge option '%s'", key); +} + +static void +handle_bridging_opts (NMSetting *setting, + gboolean stp, + const char *value, + BridgeOptFunc func) +{ + char **items, **iter; + + items = g_strsplit_set (value, " ", -1); + for (iter = items; iter && *iter; iter++) { + if (strlen (*iter)) { + char **keys, *key, *val; + + keys = g_strsplit_set (*iter, "=", 2); + if (keys && *keys) { + key = *keys; + val = *(keys + 1); + if (val && strlen(key) && strlen(val)) + func (setting, stp, key, val); + } + + g_strfreev (keys); + } + } + g_strfreev (items); +} + +static NMSetting * +make_bridge_setting (shvarFile *ifcfg, + const char *file, + gboolean nm_controlled, + char **unmanaged, + GError **error) +{ + NMSettingBridge *s_bridge; + char *value; + guint32 u; + gboolean stp = FALSE; + + s_bridge = NM_SETTING_BRIDGE (nm_setting_bridge_new ()); + + value = svGetValue (ifcfg, "DEVICE", FALSE); + if (!value || !strlen (value)) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "mandatory DEVICE keyword missing"); + goto error; + } + + g_object_set (s_bridge, NM_SETTING_BRIDGE_INTERFACE_NAME, value, NULL); + g_free (value); + + value = svGetValue (ifcfg, "STP", FALSE); + if (value) { + if (!strcasecmp (value, "on") || !strcasecmp (value, "yes")) { + g_object_set (s_bridge, NM_SETTING_BRIDGE_STP, TRUE, NULL); + stp = TRUE; + } else if (!strcasecmp (value, "off") || !strcasecmp (value, "no")) + g_object_set (s_bridge, NM_SETTING_BRIDGE_STP, FALSE, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid STP value '%s'", value); + g_free (value); + } + + value = svGetValue (ifcfg, "DELAY", FALSE); + if (value) { + if (stp) { + if (get_uint (value, &u)) + g_object_set (s_bridge, NM_SETTING_BRIDGE_FORWARD_DELAY, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid forward delay value '%s'", value); + } else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: DELAY invalid when STP is disabled"); + g_free (value); + } + + value = svGetValue (ifcfg, "BRIDGING_OPTS", FALSE); + if (value) { + handle_bridging_opts (NM_SETTING (s_bridge), stp, value, handle_bridge_option); + g_free (value); + } + + return (NMSetting *) s_bridge; + +error: + g_object_unref (s_bridge); + return NULL; +} + +static NMConnection * +bridge_connection_from_ifcfg (const char *file, + shvarFile *ifcfg, + gboolean nm_controlled, + char **unmanaged, + GError **error) +{ + NMConnection *connection = NULL; + NMSetting *con_setting = NULL; + NMSetting *bridge_setting = NULL; + + g_return_val_if_fail (file != NULL, NULL); + g_return_val_if_fail (ifcfg != NULL, NULL); + + connection = nm_connection_new (); + if (!connection) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, + "Failed to allocate new connection for %s.", file); + return NULL; + } + + con_setting = make_connection_setting (file, ifcfg, NM_SETTING_BRIDGE_SETTING_NAME, NULL, _("Bridge")); + if (!con_setting) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, + "Failed to create connection setting."); + g_object_unref (connection); + return NULL; + } + nm_connection_add_setting (connection, con_setting); + + bridge_setting = make_bridge_setting (ifcfg, file, nm_controlled, unmanaged, error); + if (!bridge_setting) { + g_object_unref (connection); + return NULL; + } + nm_connection_add_setting (connection, bridge_setting); + + if (!nm_connection_verify (connection, error)) { + g_object_unref (connection); + return NULL; + } + + return connection; +} + +static void +handle_bridge_port_option (NMSetting *setting, + gboolean stp, + const char *key, + const char *value) +{ + guint32 u = 0; + + if (!strcmp (key, "priority")) { + if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_PORT_PRIORITY, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid priority value '%s'", value); + } else if (!strcmp (key, "path_cost")) { + if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_PORT_PATH_COST, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid path_cost value '%s'", value); + } else if (!strcmp (key, "hairpin_mode")) { + if (!strcasecmp (value, "on") || !strcasecmp (value, "yes") || !strcmp (value, "1")) + g_object_set (setting, NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE, TRUE, NULL); + else if (!strcasecmp (value, "off") || !strcasecmp (value, "no")) + g_object_set (setting, NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE, FALSE, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid hairpin_mode value '%s'", value); + } else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: unhandled bridge port option '%s'", key); +} + +static NMSetting * +make_bridge_port_setting (shvarFile *ifcfg, GError **error) +{ + NMSetting *s_port; + char *value; + + value = svGetValue (ifcfg, "BRIDGE", FALSE); + if (!value) + return NULL; + g_free (value); + + s_port = nm_setting_bridge_port_new (); + + value = svGetValue (ifcfg, "BRIDGING_OPTS", FALSE); + if (value) { + handle_bridging_opts (s_port, FALSE, value, handle_bridge_port_option); + g_free (value); + } + + return s_port; +} + static gboolean is_bond_device (const char *name, shvarFile *parsed) { @@ -3904,11 +4191,6 @@ vlan_connection_from_ifcfg (const char *file, return connection; } -enum { - IGNORE_REASON_NONE = 0x00, - IGNORE_REASON_BRIDGE = 0x01, -}; - NMConnection * connection_from_file (const char *filename, const char *network_file, /* for unit tests only */ @@ -3923,13 +4205,12 @@ connection_from_file (const char *filename, { NMConnection *connection = NULL; shvarFile *parsed; - char *type, *nmc = NULL, *bootproto, *tmp; - NMSetting *s_ip4, *s_ip6; + char *type, *nmc = NULL, *bootproto; + NMSetting *s_ip4, *s_ip6, *s_port; const char *ifcfg_name = NULL; gboolean nm_controlled = TRUE; gboolean can_disable_ip4 = FALSE; GError *error = NULL; - guint32 ignore_reason = IGNORE_REASON_NONE; g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (unmanaged != NULL, NULL); @@ -4028,14 +4309,6 @@ connection_from_file (const char *filename, goto done; } - /* Ignore BRIDGE= connections for now too (rh #619863) */ - tmp = svGetValue (parsed, "BRIDGE", FALSE); - if (tmp) { - g_free (tmp); - nm_controlled = FALSE; - ignore_reason = IGNORE_REASON_BRIDGE; - } - /* Construct the connection */ if (!strcasecmp (type, TYPE_ETHERNET)) connection = wired_connection_from_ifcfg (filename, parsed, nm_controlled, unmanaged, &error); @@ -4048,8 +4321,7 @@ connection_from_file (const char *filename, else if (!strcasecmp (type, TYPE_VLAN)) connection = vlan_connection_from_ifcfg (filename, parsed, nm_controlled, unmanaged, &error); else if (!strcasecmp (type, TYPE_BRIDGE)) - g_set_error (&error, IFCFG_PLUGIN_ERROR, 0, - "Bridge connections are not yet supported"); + connection = bridge_connection_from_ifcfg (filename, parsed, nm_controlled, unmanaged, &error); else { g_set_error (&error, IFCFG_PLUGIN_ERROR, 0, "Unknown connection type '%s'", type); @@ -4063,24 +4335,8 @@ connection_from_file (const char *filename, g_free (type); /* Don't bother reading the connection fully if it's unmanaged or ignored */ - if (!connection || *unmanaged || ignore_reason) { - if (connection && !*unmanaged) { - /* However,BRIDGE and VLAN connections that don't have HWADDR won't - * be unmanaged because the unmanaged state is keyed off HWADDR. - * They willl still be tagged 'ignore' from code that checks BRIDGE - * and VLAN above. Since they aren't marked unmanaged, kill them - * completely. - */ - if (ignore_reason) { - g_object_unref (connection); - connection = NULL; - g_set_error (&error, IFCFG_PLUGIN_ERROR, 0, - "%s connections are not yet supported", - ignore_reason == IGNORE_REASON_BRIDGE ? "Bridge" : "VLAN"); - } - } + if (!connection || *unmanaged) goto done; - } s_ip6 = make_ip6_setting (parsed, network_file, iscsiadm_path, &error); if (error) { @@ -4110,6 +4366,15 @@ connection_from_file (const char *filename, } else if (s_ip4) nm_connection_add_setting (connection, s_ip4); + /* Bridge port? */ + s_port = make_bridge_port_setting (parsed, &error); + if (error) { + g_object_unref (connection); + connection = NULL; + goto done; + } else if (s_port) + nm_connection_add_setting (connection, s_port); + /* iSCSI / ibft connections are read-only since their settings are * stored in NVRAM and can only be changed in BIOS. */ diff --git a/src/settings/plugins/ifcfg-rh/tests/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/Makefile.am index 5b34ffe3..9aec92fe 100644 --- a/src/settings/plugins/ifcfg-rh/tests/Makefile.am +++ b/src/settings/plugins/ifcfg-rh/tests/Makefile.am @@ -1,9 +1,12 @@ +if ENABLE_TESTS + SUBDIRS=network-scripts INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util \ -I$(top_srcdir)/libnm-glib \ -I$(srcdir)/../ @@ -35,14 +38,10 @@ test_ifcfg_rh_utils_CPPFLAGS = \ test_ifcfg_rh_utils_LDADD = \ $(builddir)/../libifcfg-rh-io.la -if WITH_TESTS - check-local: test-ifcfg-rh $(abs_builddir)/test-ifcfg-rh-utils $(abs_builddir)/test-ifcfg-rh -endif - EXTRA_DIST = \ iscsiadm-test-dhcp \ iscsiadm-test-static \ @@ -53,4 +52,5 @@ EXTRA_DIST = \ iscsiadm-test-bad-entry \ iscsiadm-test-bad-record +endif diff --git a/src/settings/plugins/ifcfg-rh/tests/Makefile.in b/src/settings/plugins/ifcfg-rh/tests/Makefile.in index 24855a7b..155cb672 100644 --- a/src/settings/plugins/ifcfg-rh/tests/Makefile.in +++ b/src/settings/plugins/ifcfg-rh/tests/Makefile.in @@ -51,21 +51,24 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-ifcfg-rh$(EXEEXT) test-ifcfg-rh-utils$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-ifcfg-rh$(EXEEXT) \ +@ENABLE_TESTS_TRUE@ test-ifcfg-rh-utils$(EXEEXT) subdir = src/settings/plugins/ifcfg-rh/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -73,20 +76,25 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_ifcfg_rh_OBJECTS = test_ifcfg_rh-test-ifcfg-rh.$(OBJEXT) +am__test_ifcfg_rh_SOURCES_DIST = test-ifcfg-rh.c +@ENABLE_TESTS_TRUE@am_test_ifcfg_rh_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test_ifcfg_rh-test-ifcfg-rh.$(OBJEXT) test_ifcfg_rh_OBJECTS = $(am_test_ifcfg_rh_OBJECTS) am__DEPENDENCIES_1 = -test_ifcfg_rh_DEPENDENCIES = $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/wifi/libwifi-utils.la \ - $(builddir)/../libifcfg-rh-io.la $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_ifcfg_rh_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/wifi/libwifi-utils.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifcfg-rh-io.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent -am_test_ifcfg_rh_utils_OBJECTS = \ - test_ifcfg_rh_utils-test-ifcfg-rh-utils.$(OBJEXT) +am__test_ifcfg_rh_utils_SOURCES_DIST = test-ifcfg-rh-utils.c +@ENABLE_TESTS_TRUE@am_test_ifcfg_rh_utils_OBJECTS = test_ifcfg_rh_utils-test-ifcfg-rh-utils.$(OBJEXT) test_ifcfg_rh_utils_OBJECTS = $(am_test_ifcfg_rh_utils_OBJECTS) -test_ifcfg_rh_utils_DEPENDENCIES = $(builddir)/../libifcfg-rh-io.la +@ENABLE_TESTS_TRUE@test_ifcfg_rh_utils_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifcfg-rh-io.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles @@ -114,7 +122,8 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_ifcfg_rh_SOURCES) $(test_ifcfg_rh_utils_SOURCES) -DIST_SOURCES = $(test_ifcfg_rh_SOURCES) $(test_ifcfg_rh_utils_SOURCES) +DIST_SOURCES = $(am__test_ifcfg_rh_SOURCES_DIST) \ + $(am__test_ifcfg_rh_utils_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -134,7 +143,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ distdir ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) +DIST_SUBDIRS = network-scripts DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -173,6 +182,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -187,9 +200,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -199,17 +210,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -250,6 +258,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -266,11 +275,7 @@ 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@ @@ -285,6 +290,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -294,6 +301,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -320,13 +328,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -381,6 +390,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -395,48 +409,53 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = network-scripts -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_srcdir)/libnm-glib \ - -I$(srcdir)/../ - -test_ifcfg_rh_SOURCES = \ - test-ifcfg-rh.c - -test_ifcfg_rh_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - -DTEST_IFCFG_DIR=\"$(abs_srcdir)\" \ - -DTEST_SCRATCH_DIR=\"$(abs_builddir)/\" - -test_ifcfg_rh_LDADD = \ - $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/wifi/libwifi-utils.la \ - $(builddir)/../libifcfg-rh-io.la \ - $(LIBM) - -test_ifcfg_rh_utils_SOURCES = \ - test-ifcfg-rh-utils.c - -test_ifcfg_rh_utils_CPPFLAGS = \ - $(GLIB_CFLAGS) - -test_ifcfg_rh_utils_LDADD = \ - $(builddir)/../libifcfg-rh-io.la - -EXTRA_DIST = \ - iscsiadm-test-dhcp \ - iscsiadm-test-static \ - iscsiadm-test-bad-ipaddr \ - iscsiadm-test-bad-gateway \ - iscsiadm-test-bad-dns1 \ - iscsiadm-test-bad-dns2 \ - iscsiadm-test-bad-entry \ - iscsiadm-test-bad-record +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@SUBDIRS = network-scripts +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-glib \ +@ENABLE_TESTS_TRUE@ -I$(srcdir)/../ + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-ifcfg-rh.c + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) \ +@ENABLE_TESTS_TRUE@ -DTEST_IFCFG_DIR=\"$(abs_srcdir)\" \ +@ENABLE_TESTS_TRUE@ -DTEST_SCRATCH_DIR=\"$(abs_builddir)/\" + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/wifi/libwifi-utils.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifcfg-rh-io.la \ +@ENABLE_TESTS_TRUE@ $(LIBM) + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_utils_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-ifcfg-rh-utils.c + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_utils_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_utils_LDADD = \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifcfg-rh-io.la + +@ENABLE_TESTS_TRUE@EXTRA_DIST = \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-dhcp \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-static \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-ipaddr \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-gateway \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-dns1 \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-dns2 \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-entry \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-record all: all-recursive @@ -498,25 +517,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ifcfg_rh_utils-test-ifcfg-rh-utils.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< @@ -745,7 +761,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-recursive @@ -871,11 +887,11 @@ uninstall-am: mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am - $(DBUS_LIBS) +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) -@WITH_TESTS_TRUE@check-local: test-ifcfg-rh -@WITH_TESTS_TRUE@ $(abs_builddir)/test-ifcfg-rh-utils -@WITH_TESTS_TRUE@ $(abs_builddir)/test-ifcfg-rh +@ENABLE_TESTS_TRUE@check-local: test-ifcfg-rh +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-ifcfg-rh-utils +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-ifcfg-rh # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am index f4d416bf..94d8d834 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am @@ -91,7 +91,8 @@ EXTRA_DIST = \ keys-test-wifi-dynamic-wep-leap \ ifcfg-test-infiniband \ ifcfg-test-bond-main \ - ifcfg-test-bond-slave + ifcfg-test-bond-slave \ + ifcfg-test-bond-slave-ib check-local: @for f in $(EXTRA_DIST); do \ diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in index cb78cea2..43b0aadb 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in @@ -54,16 +54,18 @@ subdir = src/settings/plugins/ifcfg-rh/tests/network-scripts DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -96,6 +98,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -110,9 +116,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -122,17 +126,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -173,6 +174,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -189,11 +191,7 @@ 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@ @@ -208,6 +206,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -217,6 +217,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -243,13 +244,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -304,6 +306,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -318,6 +325,10 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ EXTRA_DIST = \ ifcfg-test-minimal \ ifcfg-test-variables-corner-cases-1 \ @@ -411,7 +422,8 @@ EXTRA_DIST = \ keys-test-wifi-dynamic-wep-leap \ ifcfg-test-infiniband \ ifcfg-test-bond-main \ - ifcfg-test-bond-slave + ifcfg-test-bond-slave \ + ifcfg-test-bond-slave-ib all: all-am diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave-ib b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave-ib new file mode 100644 index 00000000..5bd9a3a8 --- /dev/null +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave-ib @@ -0,0 +1,7 @@ +TYPE=InfiniBand +DEVICE=ib0 +HWADDR=80:00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22 +ONBOOT=no +MASTER=bond0 +# This should be ignored +BOOTPROTO=dhcp diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component index f586637e..24b51221 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component @@ -2,4 +2,4 @@ DEVICE=eth0 HWADDR=00:22:15:59:62:97 ONBOOT=no BRIDGE=br0 - +BRIDGING_OPTS="priority=28 hairpin_mode=1 path_cost=100" diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main index c5caf3fc..c406bbb3 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main @@ -4,4 +4,4 @@ TYPE=Bridge BOOTPROTO=dhcp STP=on DELAY=0 - +BRIDGING_OPTS="priority=32744 hello_time=7 max_age=39 ageing_time=235352" diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index f5cf32e1..fcad1707 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -11929,6 +11929,7 @@ static void test_read_bridge_main (void) { NMConnection *connection; + NMSettingBridge *s_bridge; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -11946,13 +11947,140 @@ test_read_bridge_main (void) &route6file, &error, &ignore_error); - ASSERT (connection == NULL, - "bridge-main-read", "unexpected success reading %s", TEST_IFCFG_BRIDGE_MAIN); + g_assert (connection); + g_assert (nm_connection_verify (connection, &error)); + g_assert_no_error (error); + + /* ===== Bridging SETTING ===== */ + + s_bridge = nm_connection_get_setting_bridge (connection); + g_assert (s_bridge); + g_assert_cmpstr (nm_setting_bridge_get_interface_name (s_bridge), ==, "br0"); + g_assert_cmpuint (nm_setting_bridge_get_forward_delay (s_bridge), ==, 0); + g_assert_cmpuint (nm_setting_bridge_get_stp (s_bridge), ==, TRUE); + g_assert_cmpuint (nm_setting_bridge_get_priority (s_bridge), ==, 32744); + g_assert_cmpuint (nm_setting_bridge_get_hello_time (s_bridge), ==, 7); + g_assert_cmpuint (nm_setting_bridge_get_max_age (s_bridge), ==, 39); + g_assert_cmpuint (nm_setting_bridge_get_ageing_time (s_bridge), ==, 235352); + + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); +} + +static void +test_write_bridge_main (void) +{ + NMConnection *connection; + NMConnection *reread; + NMSettingConnection *s_con; + NMSettingBridge *s_bridge; + NMSettingIP4Config *s_ip4; + NMSettingIP6Config *s_ip6; + char *uuid; + const guint32 ip1 = htonl (0x01010103); + const guint32 gw = htonl (0x01010101); + const guint32 prefix = 24; + NMIP4Address *addr; + gboolean success; + GError *error = NULL; + char *testfile = NULL; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bridge Main", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_BRIDGE_SETTING_NAME, + NULL); + g_free (uuid); + + /* bridge setting */ + s_bridge = (NMSettingBridge *) nm_setting_bridge_new (); + g_assert (s_bridge); + nm_connection_add_setting (connection, NM_SETTING (s_bridge)); + + g_object_set (s_bridge, + NM_SETTING_BRIDGE_INTERFACE_NAME, "br0", + NULL); + + /* IP4 setting */ + s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + g_assert (s_ip4); + nm_connection_add_setting (connection, NM_SETTING (s_ip4)); + + g_object_set (s_ip4, + NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NULL); + + addr = nm_ip4_address_new (); + nm_ip4_address_set_address (addr, ip1); + nm_ip4_address_set_prefix (addr, prefix); + nm_ip4_address_set_gateway (addr, gw); + nm_setting_ip4_config_add_address (s_ip4, addr); + nm_ip4_address_unref (addr); + + /* IP6 setting */ + s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + g_assert (s_ip6); + nm_connection_add_setting (connection, NM_SETTING (s_ip6)); + + g_object_set (s_ip6, + NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NULL); + + g_assert (nm_connection_verify (connection, &error)); + g_assert_no_error (error); + + /* Save the ifcfg */ + success = writer_new_connection (connection, + TEST_SCRATCH_DIR "/network-scripts/", + &testfile, + &error); + g_assert (success); + g_assert_cmpstr (testfile, !=, NULL); + /* re-read the connection for comparison */ + reread = connection_from_file (testfile, + NULL, + TYPE_BRIDGE, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + unlink (testfile); + + g_assert (reread); + g_assert (nm_connection_verify (reread, &error)); + g_assert_no_error (error); + g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT)); + + g_free (testfile); g_free (unmanaged); g_free (keyfile); g_free (routefile); g_free (route6file); + g_object_unref (connection); + g_object_unref (reread); } #define TEST_IFCFG_BRIDGE_COMPONENT TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bridge-component" @@ -11961,12 +12089,15 @@ static void test_read_bridge_component (void) { NMConnection *connection; + NMSettingConnection *s_con; + NMSettingBridgePort *s_port; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; char *route6file = NULL; gboolean ignore_error = FALSE; GError *error = NULL; + gboolean success; connection = connection_from_file (TEST_IFCFG_BRIDGE_COMPONENT, NULL, @@ -11978,14 +12109,22 @@ test_read_bridge_component (void) &route6file, &error, &ignore_error); - ASSERT (connection != NULL, - "bridge-component-read", "unexpected failure reading %s", TEST_IFCFG_BRIDGE_COMPONENT); + g_assert (connection); - ASSERT (unmanaged != NULL, - "bridge-component-read", "missing unmanaged spec from %s", TEST_IFCFG_BRIDGE_COMPONENT); + success = nm_connection_verify (connection, &error); + g_assert_no_error (error); + g_assert (success); - ASSERT (g_strcmp0 (unmanaged, "mac:00:22:15:59:62:97") == 0, - "bridge-component-read", "unexpected unmanaged spec from %s", TEST_IFCFG_BRIDGE_COMPONENT); + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + g_assert_cmpstr (nm_setting_connection_get_master (s_con), ==, "br0"); + g_assert_cmpstr (nm_setting_connection_get_slave_type (s_con), ==, NM_SETTING_BRIDGE_SETTING_NAME); + + s_port = nm_connection_get_setting_bridge_port (connection); + g_assert (s_port); + g_assert (nm_setting_bridge_port_get_hairpin_mode (s_port)); + g_assert_cmpuint (nm_setting_bridge_port_get_priority (s_port), ==, 28); + g_assert_cmpuint (nm_setting_bridge_port_get_path_cost (s_port), ==, 100); g_free (unmanaged); g_free (keyfile); @@ -11994,6 +12133,113 @@ test_read_bridge_component (void) g_object_unref (connection); } +static void +test_write_bridge_component (void) +{ + NMConnection *connection; + NMConnection *reread; + NMSettingConnection *s_con; + NMSettingWired *s_wired; + NMSetting *s_port; + static unsigned char tmpmac[] = { 0x31, 0x33, 0x33, 0x37, 0xbe, 0xcd }; + GByteArray *mac; + guint32 mtu = 1492; + char *uuid; + gboolean success; + GError *error = NULL; + char *testfile = NULL; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bridge Component", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME, + NM_SETTING_CONNECTION_MASTER, "br0", + NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BRIDGE_SETTING_NAME, + NULL); + g_free (uuid); + + /* Wired setting */ + s_wired = (NMSettingWired *) nm_setting_wired_new (); + g_assert (s_wired); + nm_connection_add_setting (connection, NM_SETTING (s_wired)); + + mac = g_byte_array_sized_new (sizeof (tmpmac)); + g_byte_array_append (mac, &tmpmac[0], sizeof (tmpmac)); + + g_object_set (s_wired, + NM_SETTING_WIRED_MAC_ADDRESS, mac, + NM_SETTING_WIRED_MTU, mtu, + NULL); + g_byte_array_free (mac, TRUE); + + /* Bridge port */ + s_port = nm_setting_bridge_port_new (); + nm_connection_add_setting (connection, s_port); + g_object_set (s_port, + NM_SETTING_BRIDGE_PORT_PRIORITY, 50, + NM_SETTING_BRIDGE_PORT_PATH_COST, 33, + NULL); + + success = nm_connection_verify (connection, &error); + g_assert_no_error (error); + g_assert (success); + + /* Save the ifcfg */ + success = writer_new_connection (connection, + TEST_SCRATCH_DIR "/network-scripts/", + &testfile, + &error); + g_assert_no_error (error); + g_assert (success); + g_assert (testfile); + + /* re-read the connection for comparison */ + reread = connection_from_file (testfile, + NULL, + TYPE_ETHERNET, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + unlink (testfile); + + g_assert (reread); + + success = nm_connection_verify (reread, &error); + g_assert_no_error (error); + + g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT)); + + if (route6file) + unlink (route6file); + + g_free (testfile); + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); + g_object_unref (reread); +} + #define TEST_IFCFG_VLAN_INTERFACE TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-interface" static void @@ -12262,6 +12508,124 @@ test_write_vlan_only_vlanid (void) g_object_unref (reread); } +static void +test_write_ethernet_missing_ipv6 (void) +{ + NMConnection *connection; + NMConnection *reread; + NMSettingConnection *s_con; + NMSettingWired *s_wired; + NMSettingIP4Config *s_ip4; + NMSettingIP6Config *s_ip6; + char *uuid; + gboolean success; + GError *error = NULL; + char *testfile = NULL; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Ethernet Without IPv6 Setting", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME, + NULL); + g_free (uuid); + + /* Wired setting */ + s_wired = (NMSettingWired *) nm_setting_wired_new (); + g_assert (s_wired); + nm_connection_add_setting (connection, NM_SETTING (s_wired)); + + /* IP4 setting */ + s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + g_assert (s_ip4); + nm_connection_add_setting (connection, NM_SETTING (s_ip4)); + g_object_set (s_ip4, + NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "random-client-id-00:22:33", + NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TRUE, + NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE, + NULL); + + /* IP6 setting */ + /* + * We intentionally don't add IPv6 setting here. ifcfg-rh plugin should regard + * missing IPv6 as IPv6 with NM_SETTING_IP6_CONFIG_METHOD_AUTO method. + */ + + ASSERT (nm_connection_verify (connection, &error) == TRUE, + "ethernet-missing-ipv6", "failed to verify connection: %s", + (error && error->message) ? error->message : "(unknown)"); + + /* Save the ifcfg */ + success = writer_new_connection (connection, + TEST_SCRATCH_DIR "/network-scripts/", + &testfile, + &error); + ASSERT (success == TRUE, + "ethernet-missing-ipv6", "failed to write connection to disk: %s", + (error && error->message) ? error->message : "(unknown)"); + + ASSERT (testfile != NULL, + "ethernet-missing-ipv6", "didn't get ifcfg file path back after writing connection"); + + /* re-read the connection for comparison */ + reread = connection_from_file (testfile, + NULL, + TYPE_ETHERNET, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + unlink (testfile); + + ASSERT (reread != NULL, + "ethernet-missing-ipv6-reread", "failed to read %s: %s", testfile, error->message); + + ASSERT (nm_connection_verify (reread, &error), + "ethernet-missing-ipv6-reread-verify", "failed to verify %s: %s", testfile, error->message); + + /* + * We need to add IPv6 setting to the original connection now so that + * the comparison can succeed. Missing IPv6 setting should have been + * written out (and re-read) as Automatic IPv6. + */ + s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + g_assert (s_ip6); + nm_connection_add_setting (connection, NM_SETTING (s_ip6)); + g_object_set (s_ip6, + NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NULL); + + ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, + "ethernet-missing-ipv6", "written and re-read connection weren't the same."); + + g_free (testfile); + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); + g_object_unref (reread); +} + #define TEST_IFCFG_BOND_MAIN TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bond-main" static void @@ -12479,10 +12843,10 @@ test_read_bond_slave (void) &error, &ignore_error); ASSERT (connection != NULL, - "bond-slave-read", "unexpected failure reading %s", TEST_IFCFG_BOND_MAIN); + "bond-slave-read", "unexpected failure reading %s", TEST_IFCFG_BOND_SLAVE); ASSERT (nm_connection_verify (connection, &error), - "bond-slave-read", "failed to verify %s: %s", TEST_IFCFG_BOND_MAIN, error->message); + "bond-slave-read", "failed to verify %s: %s", TEST_IFCFG_BOND_SLAVE, error->message); s_con = nm_connection_get_setting_connection (connection); ASSERT (s_con != NULL, @@ -12834,6 +13198,167 @@ test_write_infiniband (void) g_object_unref (reread); } +#define TEST_IFCFG_BOND_SLAVE_IB TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bond-slave-ib" + +static void +test_read_bond_slave_ib (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + GError *error = NULL; + + connection = connection_from_file (TEST_IFCFG_BOND_SLAVE_IB, + NULL, + NULL, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + ASSERT (connection != NULL, + "bond-slave-read-ib", "unexpected failure reading %s", TEST_IFCFG_BOND_SLAVE_IB); + + ASSERT (nm_connection_verify (connection, &error), + "bond-slave-read-ib", "failed to verify %s: %s", TEST_IFCFG_BOND_SLAVE_IB, error->message); + + s_con = nm_connection_get_setting_connection (connection); + ASSERT (s_con != NULL, + "bond-slave-read-ib", "failed to verify %s: missing %s setting", + TEST_IFCFG_BOND_SLAVE_IB, NM_SETTING_CONNECTION_SETTING_NAME); + + ASSERT (g_strcmp0 (nm_setting_connection_get_master (s_con), "bond0") == 0, + "bond-slave-read-ib", "failed to verify %s: master is not bond0", + TEST_IFCFG_BOND_SLAVE_IB); + + ASSERT (g_strcmp0 (nm_setting_connection_get_slave_type (s_con), NM_SETTING_BOND_SETTING_NAME) == 0, + "bond-slave-read-ib", "failed to verify %s: slave-type is not bond", + TEST_IFCFG_BOND_SLAVE_IB); + + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); +} + +static void +test_write_bond_slave_ib (void) +{ + NMConnection *connection; + NMConnection *reread; + NMSettingConnection *s_con; + NMSettingInfiniband *s_infiniband; + static unsigned char tmpmac[] = { + 0x80, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, + 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22 + }; + GByteArray *mac; + char *uuid; + gboolean success; + GError *error = NULL; + char *testfile = NULL; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + + connection = nm_connection_new (); + ASSERT (connection != NULL, + "bond-slave-write-ib", "failed to allocate new connection"); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + ASSERT (s_con != NULL, + "bond-slave-write-ib", "failed to allocate new %s setting", + NM_SETTING_CONNECTION_SETTING_NAME); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bond Slave InfiniBand", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_INFINIBAND_SETTING_NAME, + NM_SETTING_CONNECTION_MASTER, "bond0", + NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BOND_SETTING_NAME, + NULL); + g_free (uuid); + + /* InfiniBand setting */ + s_infiniband = (NMSettingInfiniband *) nm_setting_infiniband_new (); + ASSERT (s_infiniband != NULL, + "bond-main-write", "failed to allocate new %s setting", + NM_SETTING_INFINIBAND_SETTING_NAME); + nm_connection_add_setting (connection, NM_SETTING (s_infiniband)); + + mac = g_byte_array_sized_new (sizeof (tmpmac)); + g_byte_array_append (mac, &tmpmac[0], sizeof (tmpmac)); + + g_object_set (s_infiniband, + NM_SETTING_INFINIBAND_MAC_ADDRESS, mac, + NM_SETTING_INFINIBAND_MTU, 2044, + NM_SETTING_INFINIBAND_TRANSPORT_MODE, "datagram", + NULL); + g_byte_array_free (mac, TRUE); + + ASSERT (nm_connection_verify (connection, &error) == TRUE, + "bond-slave-write-ib", "failed to verify connection: %s", + (error && error->message) ? error->message : "(unknown)"); + + /* Save the ifcfg */ + success = writer_new_connection (connection, + TEST_SCRATCH_DIR "/network-scripts/", + &testfile, + &error); + ASSERT (success == TRUE, + "bond-slave-write-ib", "failed to write connection to disk: %s", + (error && error->message) ? error->message : "(unknown)"); + + ASSERT (testfile != NULL, + "bond-slave-write-ib", "didn't get ifcfg file path back after writing connection"); + + /* re-read the connection for comparison */ + reread = connection_from_file (testfile, + NULL, + NULL, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + unlink (testfile); + + ASSERT (reread != NULL, + "bond-slave-write-ib-reread", "failed to read %s: %s", testfile, error->message); + + ASSERT (nm_connection_verify (reread, &error), + "bond-slave-write-ib-reread-verify", "failed to verify %s: %s", testfile, error->message); + + ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, + "bond-slave-write-ib", "written and re-read connection weren't the same."); + + if (route6file) + unlink (route6file); + + g_free (testfile); + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); + g_object_unref (reread); +} + #define TEST_IFCFG_WIFI_OPEN_SSID_BAD_HEX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-bad-hex" #define TEST_IFCFG_WIFI_OPEN_SSID_LONG_QUOTED TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-long-quoted" #define TEST_IFCFG_WIFI_OPEN_SSID_LONG_HEX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-long-hex" @@ -12996,6 +13521,7 @@ int main (int argc, char **argv) test_write_infiniband (); test_write_vlan (); test_write_vlan_only_vlanid (); + test_write_ethernet_missing_ipv6 (); /* iSCSI / ibft */ test_read_ibft_dhcp (); @@ -13010,16 +13536,21 @@ int main (int argc, char **argv) /* bonding */ test_read_bond_main (); test_read_bond_slave (); + test_read_bond_slave_ib (); test_write_bond_main (); test_write_bond_slave (); + test_write_bond_slave_ib (); + + test_read_bridge_main (); + test_write_bridge_main (); + test_read_bridge_component (); + test_write_bridge_component (); /* Stuff we expect to fail for now */ test_write_wired_pppoe (); test_write_vpn (); test_write_mobile_broadband (TRUE); test_write_mobile_broadband (FALSE); - test_read_bridge_main (); - test_read_bridge_component (); base = g_path_get_basename (argv[0]); fprintf (stdout, "%s: SUCCESS\n", base); diff --git a/src/settings/plugins/ifcfg-rh/utils.c b/src/settings/plugins/ifcfg-rh/utils.c index 4e0afb96..04df6671 100644 --- a/src/settings/plugins/ifcfg-rh/utils.c +++ b/src/settings/plugins/ifcfg-rh/utils.c @@ -454,7 +454,8 @@ utils_ignore_ip_config (NMConnection *connection) /* bonding slaves have no IP configuration, and the system * scripts just ignore it if it's there. */ - if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME)) + if ( nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME) + || nm_setting_connection_is_slave_type (s_con, NM_SETTING_BRIDGE_SETTING_NAME)) return TRUE; return FALSE; diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c index 26a1585b..e258081f 100644 --- a/src/settings/plugins/ifcfg-rh/writer.c +++ b/src/settings/plugins/ifcfg-rh/writer.c @@ -18,7 +18,6 @@ * Copyright (C) 2009 - 2012 Red Hat, Inc. */ -#include <ctype.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> @@ -845,7 +844,7 @@ write_wireless_setting (NMConnection *connection, * hex notation of the SSID instead. */ for (i = 0; i < ssid->len; i++) { - if (!isprint (ssid->data[i])) { + if (!g_ascii_isprint (ssid->data[i])) { hex_ssid = TRUE; break; } @@ -1123,7 +1122,8 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) return TRUE; } -static GString *vlan_priority_maplist_to_stringlist (NMSettingVlan *s_vlan, NMVlanPriorityMap map) +static GString * +vlan_priority_maplist_to_stringlist (NMSettingVlan *s_vlan, NMVlanPriorityMap map) { GSList *strlist = NULL, *iter; GString *value = NULL; @@ -1145,10 +1145,11 @@ static GString *vlan_priority_maplist_to_stringlist (NMSettingVlan *s_vlan, NMVl } static gboolean -write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) +write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, GError **error) { NMSettingVlan *s_vlan; NMSettingConnection *s_con; + NMSettingWired *s_wired; char *tmp; guint32 vlan_flags = 0; GString *text = NULL; @@ -1200,6 +1201,39 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) if (text) g_string_free (text, TRUE); + svSetValue (ifcfg, "HWADDR", NULL, FALSE); + svSetValue (ifcfg, "MACADDR", NULL, FALSE); + svSetValue (ifcfg, "MTU", NULL, FALSE); + + s_wired = nm_connection_get_setting_wired (connection); + if (s_wired) { + const GByteArray *device_mac, *cloned_mac; + guint32 mtu; + + *wired = TRUE; + + device_mac = nm_setting_wired_get_mac_address (s_wired); + if (device_mac) { + tmp = nm_utils_hwaddr_ntoa (device_mac->data, ARPHRD_ETHER); + svSetValue (ifcfg, "HWADDR", tmp, FALSE); + g_free (tmp); + } + + cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired); + if (cloned_mac) { + tmp = nm_utils_hwaddr_ntoa (cloned_mac->data, ARPHRD_ETHER); + svSetValue (ifcfg, "MACADDR", tmp, FALSE); + g_free (tmp); + } + + mtu = nm_setting_wired_get_mtu (s_wired); + if (mtu) { + tmp = g_strdup_printf ("%u", mtu); + svSetValue (ifcfg, "MTU", tmp, FALSE); + g_free (tmp); + } + } + return TRUE; } @@ -1254,6 +1288,136 @@ write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, GError **erro return TRUE; } +static guint32 +get_setting_default (NMSetting *setting, const char *prop) +{ + GParamSpec *pspec; + GValue val = { 0 }; + guint32 ret = 0; + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), prop); + g_assert (pspec); + g_value_init (&val, pspec->value_type); + g_param_value_set_default (pspec, &val); + g_assert (G_VALUE_HOLDS_UINT (&val)); + ret = g_value_get_uint (&val); + g_value_unset (&val); + return ret; +} + +static gboolean +write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) +{ + NMSettingBridge *s_bridge; + const char *iface; + guint32 i; + GString *opts; + char *s; + + s_bridge = nm_connection_get_setting_bridge (connection); + if (!s_bridge) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, + "Missing '%s' setting", NM_SETTING_BRIDGE_SETTING_NAME); + return FALSE; + } + + iface = nm_setting_bridge_get_interface_name (s_bridge); + if (!iface) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Missing interface name"); + return FALSE; + } + + svSetValue (ifcfg, "DEVICE", iface, FALSE); + svSetValue (ifcfg, "BRIDGING_OPTS", NULL, FALSE); + svSetValue (ifcfg, "STP", NULL, FALSE); + svSetValue (ifcfg, "DELAY", NULL, FALSE); + + /* Bridge options */ + opts = g_string_sized_new (32); + + if (nm_setting_bridge_get_stp (s_bridge)) { + svSetValue (ifcfg, "STP", "yes", FALSE); + + i = nm_setting_bridge_get_forward_delay (s_bridge); + if (i && i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_FORWARD_DELAY)) { + s = g_strdup_printf ("%u", i); + svSetValue (ifcfg, "DELAY", s, FALSE); + g_free (s); + } + + g_string_append_printf (opts, "priority=%u", nm_setting_bridge_get_priority (s_bridge)); + + i = nm_setting_bridge_get_hello_time (s_bridge); + if (i && i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_HELLO_TIME)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "hello_time=%u", i); + } + + i = nm_setting_bridge_get_max_age (s_bridge); + if (i && i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_MAX_AGE)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "max_age=%u", i); + } + } + + i = nm_setting_bridge_get_ageing_time (s_bridge); + if (i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_AGEING_TIME)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "ageing_time=%u", i); + } + + if (opts->len) + svSetValue (ifcfg, "BRIDGING_OPTS", opts->str, FALSE); + g_string_free (opts, TRUE); + + svSetValue (ifcfg, "TYPE", TYPE_BRIDGE, FALSE); + + return TRUE; +} + +static gboolean +write_bridge_port_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) +{ + NMSettingBridgePort *s_port; + guint32 i; + GString *opts; + + s_port = nm_connection_get_setting_bridge_port (connection); + if (!s_port) + return TRUE; + + svSetValue (ifcfg, "BRIDGING_OPTS", NULL, FALSE); + + /* Bridge options */ + opts = g_string_sized_new (32); + + i = nm_setting_bridge_port_get_priority (s_port); + if (i && i != get_setting_default (NM_SETTING (s_port), NM_SETTING_BRIDGE_PORT_PRIORITY)) + g_string_append_printf (opts, "priority=%u", i); + + i = nm_setting_bridge_port_get_path_cost (s_port); + if (i && i != get_setting_default (NM_SETTING (s_port), NM_SETTING_BRIDGE_PORT_PATH_COST)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "path_cost=%u", i); + } + + if (nm_setting_bridge_port_get_hairpin_mode (s_port)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "hairpin_mode=1"); + } + + if (opts->len) + svSetValue (ifcfg, "BRIDGING_OPTS", opts->str, FALSE); + g_string_free (opts, TRUE); + + return TRUE; +} + static void write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) { @@ -1295,6 +1459,30 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) if (master) { if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME)) svSetValue (ifcfg, "MASTER", master, FALSE); + else if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BRIDGE_SETTING_NAME)) + svSetValue (ifcfg, "BRIDGE", master, FALSE); + } + + /* secondary connection UUIDs */ + svSetValue (ifcfg, "SECONDARY_UUIDS", NULL, FALSE); + n = nm_setting_connection_get_num_secondaries (s_con); + if (n > 0) { + str = g_string_sized_new (n * 37); + + for (i = 0; i < n; i++) { + const char *uuid; + + /* Items separated by space for consistency with eg + * IPV6ADDR_SECONDARIES and DOMAIN. + */ + if (str->len) + g_string_append_c (str, ' '); + + if ((uuid = nm_setting_connection_get_secondary (s_con, i)) != NULL) + g_string_append (str, uuid); + } + svSetValue (ifcfg, "SECONDARY_UUIDS", str->str, FALSE); + g_string_free (str, TRUE); } } @@ -1517,7 +1705,6 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValue (ifcfg, "PEERDNS", NULL, FALSE); svSetValue (ifcfg, "PEERROUTES", NULL, FALSE); - svSetValue (ifcfg, "DHCP_HOSTNAME", NULL, FALSE); svSetValue (ifcfg, "DHCP_CLIENT_ID", NULL, FALSE); if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { svSetValue (ifcfg, "PEERDNS", @@ -1710,9 +1897,15 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) s_ip6 = nm_connection_get_setting_ip6_config (connection); if (!s_ip6) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Missing '%s' setting", NM_SETTING_IP6_CONFIG_SETTING_NAME); - return FALSE; + /* Treat missing IPv6 setting as a setting with method "auto" */ + svSetValue (ifcfg, "IPV6INIT", "yes", FALSE); + svSetValue (ifcfg, "IPV6_AUTOCONF", "yes", FALSE); + svSetValue (ifcfg, "DHCPV6C", NULL, FALSE); + svSetValue (ifcfg, "IPV6_DEFROUTE", "yes", FALSE); + svSetValue (ifcfg, "IPV6_PEERDNS", "yes", FALSE); + svSetValue (ifcfg, "IPV6_PEERROUTES", "yes", FALSE); + svSetValue (ifcfg, "IPV6_FAILURE_FATAL", "no", FALSE); + return TRUE; } value = nm_setting_ip6_config_get_method (s_ip6); @@ -1726,9 +1919,13 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValue (ifcfg, "IPV6_AUTOCONF", "yes", FALSE); svSetValue (ifcfg, "DHCPV6C", NULL, FALSE); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { + const char *hostname; svSetValue (ifcfg, "IPV6INIT", "yes", FALSE); svSetValue (ifcfg, "IPV6_AUTOCONF", "no", FALSE); svSetValue (ifcfg, "DHCPV6C", "yes", FALSE); + hostname = nm_setting_ip6_config_get_dhcp_hostname (s_ip6); + if (hostname) + svSetValue (ifcfg, "DHCP_HOSTNAME", hostname, FALSE); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { svSetValue (ifcfg, "IPV6INIT", "yes", FALSE); svSetValue (ifcfg, "IPV6_AUTOCONF", "no", FALSE); @@ -1907,8 +2104,6 @@ write_connection (NMConnection *connection, GError **error) { NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; gboolean success = FALSE; shvarFile *ifcfg = NULL; char *ifcfg_name = NULL; @@ -1987,7 +2182,7 @@ write_connection (NMConnection *connection, goto out; wired = TRUE; } else if (!strcmp (type, NM_SETTING_VLAN_SETTING_NAME)) { - if (!write_vlan_setting (connection, ifcfg, error)) + if (!write_vlan_setting (connection, ifcfg, &wired, error)) goto out; } else if (!strcmp (type, NM_SETTING_WIRELESS_SETTING_NAME)) { if (!write_wireless_setting (connection, ifcfg, &no_8021x, error)) @@ -1998,6 +2193,9 @@ write_connection (NMConnection *connection, } else if (!strcmp (type, NM_SETTING_BOND_SETTING_NAME)) { if (!write_bonding_setting (connection, ifcfg, error)) goto out; + } else if (!strcmp (type, NM_SETTING_BRIDGE_SETTING_NAME)) { + if (!write_bridge_setting (connection, ifcfg, error)) + goto out; } else { g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Can't write connection type '%s'", type); @@ -2009,16 +2207,17 @@ write_connection (NMConnection *connection, goto out; } + if (!write_bridge_port_setting (connection, ifcfg, error)) + goto out; + if (!utils_ignore_ip_config (connection)) { - s_ip4 = nm_connection_get_setting_ip4_config (connection); + svSetValue (ifcfg, "DHCP_HOSTNAME", NULL, FALSE); + if (!write_ip4_setting (connection, ifcfg, error)) goto out; - s_ip6 = nm_connection_get_setting_ip6_config (connection); - if (s_ip6) { - if (!write_ip6_setting (connection, ifcfg, error)) - goto out; - } + if (!write_ip6_setting (connection, ifcfg, error)) + goto out; } write_connection_setting (s_con, ifcfg); diff --git a/src/settings/plugins/ifcfg-suse/Makefile.am b/src/settings/plugins/ifcfg-suse/Makefile.am index 3db8ed31..6b14bfe2 100644 --- a/src/settings/plugins/ifcfg-suse/Makefile.am +++ b/src/settings/plugins/ifcfg-suse/Makefile.am @@ -7,11 +7,10 @@ libnm_settings_plugin_ifcfg_suse_la_SOURCES = \ libnm_settings_plugin_ifcfg_suse_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -I${top_srcdir}/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ -I$(top_srcdir)/libnm-glib \ -DSYSCONFDIR=\"$(sysconfdir)\" @@ -20,7 +19,5 @@ libnm_settings_plugin_ifcfg_suse_la_LDFLAGS = -module -avoid-version libnm_settings_plugin_ifcfg_suse_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) diff --git a/src/settings/plugins/ifcfg-suse/Makefile.in b/src/settings/plugins/ifcfg-suse/Makefile.in index 90028f85..8832e679 100644 --- a/src/settings/plugins/ifcfg-suse/Makefile.in +++ b/src/settings/plugins/ifcfg-suse/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/ifcfg-suse DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -103,8 +105,7 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = libnm_settings_plugin_ifcfg_suse_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/libnm-glib/libnm-glib.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(top_builddir)/libnm-glib/libnm-glib.la $(am__DEPENDENCIES_1) am_libnm_settings_plugin_ifcfg_suse_la_OBJECTS = \ libnm_settings_plugin_ifcfg_suse_la-plugin.lo libnm_settings_plugin_ifcfg_suse_la_OBJECTS = \ @@ -165,6 +166,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -179,9 +184,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -191,17 +194,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -242,6 +242,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -258,11 +259,7 @@ 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@ @@ -277,6 +274,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -286,6 +285,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -312,13 +312,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -373,6 +374,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -387,6 +393,10 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ pkglib_LTLIBRARIES = libnm-settings-plugin-ifcfg-suse.la libnm_settings_plugin_ifcfg_suse_la_SOURCES = \ plugin.c \ @@ -394,11 +404,10 @@ libnm_settings_plugin_ifcfg_suse_la_SOURCES = \ libnm_settings_plugin_ifcfg_suse_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -I${top_srcdir}/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ -I$(top_srcdir)/libnm-glib \ -DSYSCONFDIR=\"$(sysconfdir)\" @@ -407,9 +416,7 @@ libnm_settings_plugin_ifcfg_suse_la_LDFLAGS = -module -avoid-version libnm_settings_plugin_ifcfg_suse_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) all: all-am @@ -489,25 +496,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_ifcfg_suse_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< diff --git a/src/settings/plugins/ifnet/Makefile.am b/src/settings/plugins/ifnet/Makefile.am index 07a2fc88..9aaa06f8 100644 --- a/src/settings/plugins/ifnet/Makefile.am +++ b/src/settings/plugins/ifnet/Makefile.am @@ -1,10 +1,13 @@ SUBDIRS = . tests + INCLUDES = \ -I$(top_srcdir)/src/wifi \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util pkglib_LTLIBRARIES = libnm-settings-plugin-ifnet.la @@ -18,10 +21,8 @@ libnm_settings_plugin_ifnet_la_SOURCES = \ libnm_settings_plugin_ifnet_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifnet_la_LDFLAGS = -module -avoid-version @@ -31,9 +32,7 @@ libnm_settings_plugin_ifnet_la_LIBADD = \ $(top_builddir)/libnm-glib/libnm-glib.la \ lib-ifnet-io.la\ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GUDEV_LIBS) \ - $(GIO_LIBS) + $(GUDEV_LIBS) lib_ifnet_io_la_SOURCES = \ net_parser.c\ @@ -48,12 +47,10 @@ lib_ifnet_io_la_SOURCES = \ lib_ifnet_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DSBINDIR=\"$(sbindir)\" lib_ifnet_io_la_LIBADD = \ $(top_builddir)/src/wifi/libwifi-utils.la \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS)\ - $(GIO_LIBS) + $(GLIB_LIBS) diff --git a/src/settings/plugins/ifnet/Makefile.in b/src/settings/plugins/ifnet/Makefile.in index e351a6ed..6cdf335d 100644 --- a/src/settings/plugins/ifnet/Makefile.in +++ b/src/settings/plugins/ifnet/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/ifnet DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -103,8 +105,7 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = lib_ifnet_io_la_DEPENDENCIES = \ $(top_builddir)/src/wifi/libwifi-utils.la \ - $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) + $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) am_lib_ifnet_io_la_OBJECTS = lib_ifnet_io_la-net_parser.lo \ lib_ifnet_io_la-connection_parser.lo \ lib_ifnet_io_la-net_utils.lo lib_ifnet_io_la-wpa_parser.lo @@ -115,7 +116,6 @@ am__v_lt_0 = --silent libnm_settings_plugin_ifnet_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la lib-ifnet-io.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libnm_settings_plugin_ifnet_la_OBJECTS = \ libnm_settings_plugin_ifnet_la-nm-ifnet-connection.lo \ @@ -214,6 +214,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -228,9 +232,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -240,17 +242,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -291,6 +290,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -307,11 +307,7 @@ 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@ @@ -326,6 +322,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -335,6 +333,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -361,13 +360,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -422,6 +422,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -436,13 +441,19 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/wifi \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util pkglib_LTLIBRARIES = libnm-settings-plugin-ifnet.la noinst_LTLIBRARIES = lib-ifnet-io.la @@ -454,10 +465,8 @@ libnm_settings_plugin_ifnet_la_SOURCES = \ libnm_settings_plugin_ifnet_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifnet_la_LDFLAGS = -module -avoid-version @@ -466,9 +475,7 @@ libnm_settings_plugin_ifnet_la_LIBADD = \ $(top_builddir)/libnm-glib/libnm-glib.la \ lib-ifnet-io.la\ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GUDEV_LIBS) \ - $(GIO_LIBS) + $(GUDEV_LIBS) lib_ifnet_io_la_SOURCES = \ net_parser.c\ @@ -483,15 +490,13 @@ lib_ifnet_io_la_SOURCES = \ lib_ifnet_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DSBINDIR=\"$(sbindir)\" lib_ifnet_io_la_LIBADD = \ $(top_builddir)/src/wifi/libwifi-utils.la \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS)\ - $(GIO_LIBS) + $(GLIB_LIBS) all: all-recursive @@ -587,25 +592,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_ifnet_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c index 78812f97..c85b5c4b 100644 --- a/src/settings/plugins/ifnet/connection_parser.c +++ b/src/settings/plugins/ifnet/connection_parser.c @@ -26,7 +26,6 @@ #include <stdlib.h> #include <netinet/ether.h> #include <errno.h> -#include <ctype.h> #include <glib/gi18n.h> #include <nm-setting-connection.h> @@ -76,24 +75,28 @@ static gboolean eap_simple_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); static gboolean eap_tls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); static gboolean eap_peap_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); static gboolean eap_ttls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); typedef struct { @@ -102,6 +105,7 @@ typedef struct { const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); gboolean wifi_phase2_only; } EAPReader; @@ -125,6 +129,7 @@ eap_simple_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error) { const char *value; @@ -153,17 +158,30 @@ eap_simple_reader (const char *eap_method, return TRUE; } +static char * +get_cert (const char *ssid, const char *key, const char *basepath) +{ + const char *orig; + + /* If it's a relative path, convert to absolute using 'basepath' */ + orig = wpa_get_value (ssid, key); + if (g_path_is_absolute (orig)) + return g_strdup (orig); + return g_strdup_printf ("%s/%s", basepath, orig); +} + static gboolean eap_tls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error) { const char *value; - const char *ca_cert = NULL; - const char *client_cert = NULL; - const char *privkey = NULL; + char *ca_cert = NULL; + char *client_cert = NULL; + char *privkey = NULL; const char *privkey_password = NULL; gboolean success = FALSE; NMSetting8021xCKFormat privkey_format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; @@ -179,7 +197,7 @@ eap_tls_reader (const char *eap_method, g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, value, NULL); /* ca cert */ - ca_cert = wpa_get_value (ssid, phase2 ? "ca_cert2" : "ca_cert"); + ca_cert = get_cert (ssid, phase2 ? "ca_cert2" : "ca_cert", basepath); if (ca_cert) { if (phase2) { if (!nm_setting_802_1x_set_phase2_ca_cert (s_8021x, @@ -216,7 +234,7 @@ eap_tls_reader (const char *eap_method, } /* The private key itself */ - privkey = wpa_get_value (ssid, phase2 ? "private_key2" : "private_key"); + privkey = get_cert (ssid, phase2 ? "private_key2" : "private_key", basepath); if (!privkey) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing %s for EAP method '%s'.", @@ -249,9 +267,7 @@ eap_tls_reader (const char *eap_method, */ if (privkey_format == NM_SETTING_802_1X_CK_FORMAT_RAW_KEY || privkey_format == NM_SETTING_802_1X_CK_FORMAT_X509) { - client_cert = wpa_get_value (ssid, - phase2 ? "client_cert2" : - "client_cert"); + client_cert = get_cert (ssid, phase2 ? "client_cert2" : "client_cert", basepath); if (!client_cert) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing %s for EAP method '%s'.", @@ -279,6 +295,9 @@ eap_tls_reader (const char *eap_method, success = TRUE; done: + g_free (ca_cert); + g_free (client_cert); + g_free (privkey); return success; } @@ -287,15 +306,16 @@ eap_peap_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error) { - const char *ca_cert = NULL; + char *ca_cert = NULL; const char *inner_auth = NULL; const char *peapver = NULL; char **list = NULL, **iter, *lower; gboolean success = FALSE; - ca_cert = wpa_get_value (ssid, "ca_cert"); + ca_cert = get_cert (ssid, "ca_cert", basepath); if (ca_cert) { if (!nm_setting_802_1x_set_ca_cert (s_8021x, ca_cert, @@ -347,11 +367,10 @@ eap_peap_reader (const char *eap_method, if (!(pos = strstr (*iter, "MSCHAPV2")) || !(pos = strstr (*iter, "MD5")) || !(pos = strstr (*iter, "GTC"))) { - if (!eap_simple_reader - (pos, ssid, s_8021x, TRUE, error)) + if (!eap_simple_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; } else if (!(pos = strstr (*iter, "TLS"))) { - if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, error)) + if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; } else { g_set_error (error, ifnet_plugin_error_quark (), 0, @@ -378,6 +397,7 @@ eap_peap_reader (const char *eap_method, success = TRUE; done: + g_free (ca_cert); if (list) g_strfreev (list); return success; @@ -388,16 +408,17 @@ eap_ttls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error) { gboolean success = FALSE; const char *anon_ident = NULL; - const char *ca_cert = NULL; + char *ca_cert = NULL; const char *tmp; char **list = NULL, **iter, *inner_auth = NULL; /* ca cert */ - ca_cert = wpa_get_value (ssid, "ca_cert"); + ca_cert = get_cert (ssid, "ca_cert", basepath); if (ca_cert) { if (!nm_setting_802_1x_set_ca_cert (s_8021x, ca_cert, @@ -435,20 +456,18 @@ eap_ttls_reader (const char *eap_method, || (pos = strstr (*iter, "mschap")) != NULL || (pos = strstr (*iter, "pap")) != NULL || (pos = strstr (*iter, "chap")) != NULL) { - if (!eap_simple_reader - (pos, ssid, s_8021x, TRUE, error)) + if (!eap_simple_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, pos, NULL); } else if ((pos = strstr (*iter, "tls")) != NULL) { - if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, error)) + if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTHEAP, "tls", NULL); } else if ((pos = strstr (*iter, "mschapv2")) != NULL || (pos = strstr (*iter, "md5")) != NULL) { - if (!eap_simple_reader - (pos, ssid, s_8021x, TRUE, error)) { + if (!eap_simple_reader (pos, ssid, s_8021x, TRUE, basepath, error)) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "SIMPLE ERROR"); goto done; } @@ -465,6 +484,7 @@ eap_ttls_reader (const char *eap_method, success = TRUE; done: + g_free (ca_cert); if (list) g_strfreev (list); g_free (inner_auth); @@ -1386,6 +1406,7 @@ static NMSetting8021x * fill_8021x (const char *ssid, const char *key_mgmt, gboolean wifi, + const char *basepath, GError **error) { NMSetting8021x *s_8021x; @@ -1427,8 +1448,7 @@ fill_8021x (const char *ssid, } /* Parse EAP method specific options */ - if (!(*eap->reader) - (lower, ssid, s_8021x, FALSE, error)) { + if (!(*eap->reader) (lower, ssid, s_8021x, FALSE, basepath, error)) { g_free (lower); goto error; } @@ -1463,6 +1483,7 @@ error: static NMSettingWirelessSecurity * make_wpa_setting (const char *ssid, + const char *basepath, NMSetting8021x **s_8021x, GError **error) { @@ -1477,8 +1498,7 @@ make_wpa_setting (const char *ssid, return NULL; } - wsec = - NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); + wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); /* mode=1: adhoc * mode=0: infrastructure */ @@ -1530,7 +1550,7 @@ make_wpa_setting (const char *ssid, value); goto error; } - *s_8021x = fill_8021x (ssid, value, TRUE, error); + *s_8021x = fill_8021x (ssid, value, TRUE, basepath, error); if (!*s_8021x) goto error; @@ -1552,6 +1572,7 @@ error: static NMSettingWirelessSecurity * make_wireless_security_setting (const char *conn_name, + const char *basepath, NMSetting8021x **s_8021x, GError ** error) { @@ -1579,7 +1600,7 @@ make_wireless_security_setting (const char *conn_name, goto error; } if (!wsec) { - wsec = make_wpa_setting (ssid, s_8021x, error); + wsec = make_wpa_setting (ssid, basepath, s_8021x, error); if (error && *error) goto error; } @@ -1636,7 +1657,9 @@ make_pppoe_connection_setting (NMConnection *connection, } NMConnection * -ifnet_update_connection_from_config_block (const char *conn_name, GError **error) +ifnet_update_connection_from_config_block (const char *conn_name, + const char *basepath, + GError **error) { const gchar *type = NULL; NMConnection *connection = NULL; @@ -1700,7 +1723,7 @@ ifnet_update_connection_from_config_block (const char *conn_name, GError **error } /* wireless security setting */ - wsec = make_wireless_security_setting (conn_name, &s_8021x, error); + wsec = make_wireless_security_setting (conn_name, basepath, &s_8021x, error); if (wsec) { nm_connection_add_setting (connection, NM_SETTING (wsec)); @@ -2291,7 +2314,7 @@ write_wireless_setting (NMConnection *connection, * support these characters, see bug #356337) */ for (i = 0; i < ssid->len; i++) { - if (!isalnum (ssid->data[i])) { + if (!g_ascii_isalnum (ssid->data[i])) { hex_ssid = TRUE; break; } @@ -2785,6 +2808,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection, const char *config_file, const char *wpa_file, gchar **out_new_name, + gchar **out_backup, GError **error) { NMSettingConnection *s_con; @@ -2868,7 +2892,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection, /* connection id will be displayed in nm-applet */ update_connection_id (connection, conn_name); - success = ifnet_flush_to_file (config_file); + success = ifnet_flush_to_file (config_file, out_backup); if (success) wpa_flush_to_file (wpa_file); @@ -2882,12 +2906,13 @@ out: gboolean ifnet_delete_connection_in_parsers (const char *conn_name, const char *config_file, - const char *wpa_file) + const char *wpa_file, + gchar **out_backup) { gboolean result = FALSE; ifnet_delete_network (conn_name); - result = ifnet_flush_to_file (config_file); + result = ifnet_flush_to_file (config_file, out_backup); if (result) { /* connection may not have security information * so simply ignore the return value*/ @@ -2953,7 +2978,7 @@ get_wireless_name (NMConnection * connection) } for (i = 0; i < ssid->len; i++) { - if (!isprint (ssid->data[i])) { + if (!g_ascii_isprint (ssid->data[i])) { hex_ssid = TRUE; break; } @@ -2982,6 +3007,7 @@ char * ifnet_add_new_connection (NMConnection *connection, const char *config_file, const char *wpa_file, + gchar **out_backup, GError **error) { NMSettingConnection *s_con; @@ -3025,6 +3051,7 @@ ifnet_add_new_connection (NMConnection *connection, config_file, wpa_file, NULL, + out_backup, error); } diff --git a/src/settings/plugins/ifnet/connection_parser.h b/src/settings/plugins/ifnet/connection_parser.h index b617b605..e8596a64 100644 --- a/src/settings/plugins/ifnet/connection_parser.h +++ b/src/settings/plugins/ifnet/connection_parser.h @@ -25,6 +25,7 @@ #include "net_parser.h" NMConnection *ifnet_update_connection_from_config_block (const char *conn_name, + const char *basepath, GError **error); /* nm_conn_name is used to update nm_ifnet_connection's priv data */ @@ -33,14 +34,17 @@ gboolean ifnet_update_parsers_by_connection (NMConnection *connection, const char *config_file, const char *wpa_file, gchar **out_new_name, + gchar **out_backup, GError **error); gboolean ifnet_delete_connection_in_parsers (const char *conn_name, const char *config_file, - const char *wpa_file); + const char *wpa_file, + gchar **out_backup); char * ifnet_add_new_connection (NMConnection *connection, const char *config_file, const char *wpa_file, + gchar **out_backup, GError ** error); #endif diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c index 2562e613..f37366af 100644 --- a/src/settings/plugins/ifnet/net_parser.c +++ b/src/settings/plugins/ifnet/net_parser.c @@ -590,7 +590,7 @@ done: } gboolean -ifnet_flush_to_file (const char *config_file) +ifnet_flush_to_file (const char *config_file, gchar **out_backup) { GIOChannel *channel; GError **error = NULL; @@ -600,18 +600,20 @@ ifnet_flush_to_file (const char *config_file) gchar *out_line = NULL; gsize bytes_written; gboolean result = FALSE; + gchar *backup; if (!net_parser_data_changed) return TRUE; if (!conn_table || !global_settings_table) return FALSE; - backup_file (config_file); + backup = backup_file (config_file); channel = g_io_channel_new_file (config_file, "w", NULL); if (!channel) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Can't open file %s for writing", config_file); + g_free (backup); return FALSE; } g_hash_table_iter_init (&iter, global_settings_table); @@ -714,7 +716,13 @@ ifnet_flush_to_file (const char *config_file) } result = TRUE; net_parser_data_changed = FALSE; + done: + if (result && out_backup) + *out_backup = backup; + else + g_free (backup); + g_io_channel_shutdown (channel, FALSE, NULL); g_io_channel_unref (channel); return result; diff --git a/src/settings/plugins/ifnet/net_parser.h b/src/settings/plugins/ifnet/net_parser.h index 5dcc7e25..47086c76 100644 --- a/src/settings/plugins/ifnet/net_parser.h +++ b/src/settings/plugins/ifnet/net_parser.h @@ -25,7 +25,6 @@ #include <glib.h> #define CONF_NET_FILE SYSCONFDIR "/conf.d/net" -#define IFNET_SYSTEM_SETTINGS_KEY_FILE SYSCONFDIR "/NetworkManager/nm-system-settings.conf" #define IFNET_KEY_FILE_GROUP "ifnet" gboolean ifnet_init (gchar * config_file); @@ -39,7 +38,7 @@ const char *ifnet_get_global_setting (const char *group, const char *key); gboolean ifnet_has_network (const char *conn_name); /* Writer functions */ -gboolean ifnet_flush_to_file (const char *config_file); +gboolean ifnet_flush_to_file (const char *config_file, gchar **out_backup); void ifnet_set_data (const char *conn_name, const char *key, const char *value); gboolean ifnet_add_network (const char *name, const char *type); gboolean ifnet_delete_network (const char *conn_name); diff --git a/src/settings/plugins/ifnet/net_utils.c b/src/settings/plugins/ifnet/net_utils.c index d613db6a..17eb1677 100644 --- a/src/settings/plugins/ifnet/net_utils.c +++ b/src/settings/plugins/ifnet/net_utils.c @@ -22,7 +22,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <ctype.h> #include <errno.h> #include <nm-utils.h> #include <nm-system-config-interface.h> @@ -67,7 +66,7 @@ is_hex (const char *value) if (!p) return FALSE; while (*p) { - if (!isxdigit (*p++)) + if (!g_ascii_isxdigit (*p++)) return FALSE; } return TRUE; @@ -79,7 +78,7 @@ is_ascii (const char *value) const char *p = value; while (*p) { - if (!isascii (*p++)) + if (!g_ascii_isprint (*p++)) return FALSE; } return TRUE; @@ -254,7 +253,7 @@ read_hostname (const char *path) } gboolean -write_hostname (const gchar *hostname, const char *path) +write_hostname (const char *path, const gchar *hostname) { gboolean result; char *contents; @@ -462,7 +461,7 @@ create_ip4_block (gchar * ip) iblock->ip = tmp_ip4_addr.s_addr; prefix = ip_mask[1]; i = 0; - while (i < length && isdigit (prefix[i])) + while (i < length && g_ascii_isdigit (prefix[i])) i++; prefix[i] = '\0'; iblock->netmask = nm_utils_ip4_prefix_to_netmask ((guint32) @@ -951,7 +950,7 @@ get_dhcp_hostname_and_client_id (char **hostname, char **client_id) g_free (contents); } -void backup_file (const gchar* target) +gchar *backup_file (const gchar* target) { GFile *source, *backup; gchar* backup_path; @@ -962,8 +961,11 @@ void backup_file (const gchar* target) backup = g_file_new_for_path (backup_path); g_file_copy (source, backup, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, error); - if (error && *error) + if (error && *error) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Backup failed: %s", (*error)->message); + g_free (backup_path); + backup_path = NULL; + } - g_free (backup_path); + return backup_path; } diff --git a/src/settings/plugins/ifnet/net_utils.h b/src/settings/plugins/ifnet/net_utils.h index dee49143..c2ed83a1 100644 --- a/src/settings/plugins/ifnet/net_utils.h +++ b/src/settings/plugins/ifnet/net_utils.h @@ -45,7 +45,7 @@ typedef struct _ip6_block { } ip6_block; gchar *read_hostname (const char *path); -gboolean write_hostname (const char *hostname, const char *path); +gboolean write_hostname (const char *path, const char *hostname); gboolean is_static_ip4 (const char *conn_name); gboolean is_static_ip6 (const char *conn_name); gboolean is_ip4_address (const char *in_address); @@ -77,5 +77,5 @@ gboolean is_true (const char *str); void get_dhcp_hostname_and_client_id (char **hostname, char **client_id); -void backup_file (const gchar* target); +gchar *backup_file (const gchar* target); #endif diff --git a/src/settings/plugins/ifnet/nm-ifnet-connection.c b/src/settings/plugins/ifnet/nm-ifnet-connection.c index 8b7a153c..873a62ec 100644 --- a/src/settings/plugins/ifnet/nm-ifnet-connection.c +++ b/src/settings/plugins/ifnet/nm-ifnet-connection.c @@ -68,7 +68,7 @@ nm_ifnet_connection_new (const char *conn_name, NMConnection *source) if (source) tmp = g_object_ref (source); else { - tmp = ifnet_update_connection_from_config_block (conn_name, &error); + tmp = ifnet_update_connection_from_config_block (conn_name, NULL, &error); if (!tmp){ g_error_free (error); return NULL; @@ -108,6 +108,7 @@ commit_changes (NMSettingsConnection *connection, CONF_NET_FILE, WPA_SUPPLICANT_CONF, &new_name, + NULL, &error)) { PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Failed to update %s", priv->conn_name); reload_parsers (); @@ -135,8 +136,7 @@ do_delete (NMSettingsConnection *connection, NMIfnetConnectionPrivate *priv = NM_IFNET_CONNECTION_GET_PRIVATE (connection); g_signal_emit (connection, signals[IFNET_CANCEL_MONITORS], 0); - if (!ifnet_delete_connection_in_parsers - (priv->conn_name, CONF_NET_FILE, WPA_SUPPLICANT_CONF)) { + if (!ifnet_delete_connection_in_parsers (priv->conn_name, CONF_NET_FILE, WPA_SUPPLICANT_CONF, NULL)) { PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Failed to delete %s", priv->conn_name); reload_parsers (); diff --git a/src/settings/plugins/ifnet/plugin.c b/src/settings/plugins/ifnet/plugin.c index fff83805..5100ad3e 100644 --- a/src/settings/plugins/ifnet/plugin.c +++ b/src/settings/plugins/ifnet/plugin.c @@ -108,7 +108,7 @@ write_system_hostname (NMSystemConfigInterface * config, g_return_if_fail (newhostname); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Write system hostname: %s", newhostname); - if (write_hostname (newhostname, IFNET_SYSTEM_HOSTNAME_FILE)) { + if (write_hostname (IFNET_SYSTEM_HOSTNAME_FILE, newhostname)) { g_free (priv->hostname); priv->hostname = g_strdup (newhostname); g_object_notify (G_OBJECT (config), @@ -360,7 +360,7 @@ add_connection (NMSystemConfigInterface *config, nm_connection_for_each_setting_value (source, check_flagged_secrets, &has_flagged_secrets); if (!has_flagged_secrets) { - conn_name = ifnet_add_new_connection (source, CONF_NET_FILE, WPA_SUPPLICANT_CONF, error); + conn_name = ifnet_add_new_connection (source, CONF_NET_FILE, WPA_SUPPLICANT_CONF, NULL, error); if (conn_name) connection = nm_ifnet_connection_new (conn_name, source); reload_connections (config); diff --git a/src/settings/plugins/ifnet/tests/Makefile.am b/src/settings/plugins/ifnet/tests/Makefile.am index 85d42388..23f96c81 100644 --- a/src/settings/plugins/ifnet/tests/Makefile.am +++ b/src/settings/plugins/ifnet/tests/Makefile.am @@ -1,19 +1,35 @@ +if ENABLE_TESTS + INCLUDES=-I$(srcdir)/../ \ -I$(top_srcdir)/libnm-glib \ -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/src/settings -TESTS = check_ifnet -check_PROGRAMS = check_ifnet -check_ifnet_SOURCES = test_all.c -check_ifnet_CPPFLAGS = $(CHECK_CFLAGS) $(GLIB_CFLAGS) + +noinst_PROGRAMS = check_ifnet +check_ifnet_SOURCES = test_all.c + +check_ifnet_CPPFLAGS = \ + $(CHECK_CFLAGS) \ + $(GLIB_CFLAGS) \ + -DTEST_WPA_SUPPLICANT_CONF='"$(srcdir)/wpa_supplicant.conf"' + check_ifnet_LDADD = $(top_builddir)/libnm-util/libnm-util.la \ $(builddir)/../lib-ifnet-io.la \ $(CHECK_LIBS) \ $(GLIB_LIBS) \ $(LIBM) -EXTRA_DIST = hostname \ - net \ - net.all \ - nm-system-settings.conf \ - wpa_supplicant.conf +check-local: check_ifnet + $(abs_builddir)/check_ifnet $(abs_srcdir) $(abs_builddir) + +EXTRA_DIST = \ + hostname \ + net \ + net.all \ + nm-system-settings.conf \ + wpa_supplicant.conf \ + test_ca_cert.pem + +endif diff --git a/src/settings/plugins/ifnet/tests/Makefile.in b/src/settings/plugins/ifnet/tests/Makefile.in index 669e22f6..0c2c1910 100644 --- a/src/settings/plugins/ifnet/tests/Makefile.in +++ b/src/settings/plugins/ifnet/tests/Makefile.in @@ -14,6 +14,7 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + VPATH = @srcdir@ am__make_dryrun = \ { \ @@ -50,34 +51,39 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -TESTS = check_ifnet$(EXEEXT) -check_PROGRAMS = check_ifnet$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = check_ifnet$(EXEEXT) subdir = src/settings/plugins/ifnet/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am_check_ifnet_OBJECTS = check_ifnet-test_all.$(OBJEXT) +PROGRAMS = $(noinst_PROGRAMS) +am__check_ifnet_SOURCES_DIST = test_all.c +@ENABLE_TESTS_TRUE@am_check_ifnet_OBJECTS = \ +@ENABLE_TESTS_TRUE@ check_ifnet-test_all.$(OBJEXT) check_ifnet_OBJECTS = $(am_check_ifnet_OBJECTS) am__DEPENDENCIES_1 = -check_ifnet_DEPENDENCIES = $(top_builddir)/libnm-util/libnm-util.la \ - $(builddir)/../lib-ifnet-io.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@check_ifnet_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../lib-ifnet-io.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -108,7 +114,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(check_ifnet_SOURCES) -DIST_SOURCES = $(check_ifnet_SOURCES) +DIST_SOURCES = $(am__check_ifnet_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -116,8 +122,6 @@ am__can_run_installinfo = \ esac ETAGS = etags CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ @@ -131,6 +135,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -145,9 +153,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -157,17 +163,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -208,6 +211,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -224,11 +228,7 @@ 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@ @@ -243,6 +243,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -252,6 +254,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -278,13 +281,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -339,6 +343,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -353,25 +362,37 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = -I$(srcdir)/../ \ - -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/src/settings - -check_ifnet_SOURCES = test_all.c -check_ifnet_CPPFLAGS = $(CHECK_CFLAGS) $(GLIB_CFLAGS) -check_ifnet_LDADD = $(top_builddir)/libnm-util/libnm-util.la \ - $(builddir)/../lib-ifnet-io.la \ - $(CHECK_LIBS) \ - $(GLIB_LIBS) \ - $(LIBM) - -EXTRA_DIST = hostname \ - net \ - net.all \ - nm-system-settings.conf \ - wpa_supplicant.conf +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@INCLUDES = -I$(srcdir)/../ \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-glib \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/src/settings + +@ENABLE_TESTS_TRUE@check_ifnet_SOURCES = test_all.c +@ENABLE_TESTS_TRUE@check_ifnet_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(CHECK_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ -DTEST_WPA_SUPPLICANT_CONF='"$(srcdir)/wpa_supplicant.conf"' + +@ENABLE_TESTS_TRUE@check_ifnet_LDADD = $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../lib-ifnet-io.la \ +@ENABLE_TESTS_TRUE@ $(CHECK_LIBS) \ +@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ +@ENABLE_TESTS_TRUE@ $(LIBM) + +@ENABLE_TESTS_TRUE@EXTRA_DIST = \ +@ENABLE_TESTS_TRUE@ hostname \ +@ENABLE_TESTS_TRUE@ net \ +@ENABLE_TESTS_TRUE@ net.all \ +@ENABLE_TESTS_TRUE@ nm-system-settings.conf \ +@ENABLE_TESTS_TRUE@ wpa_supplicant.conf \ +@ENABLE_TESTS_TRUE@ test_ca_cert.pem all: all-am @@ -408,8 +429,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ @@ -429,25 +450,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_ifnet-test_all.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< @@ -524,99 +542,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ - ;; \ - *) \ - col=$$grn; res=PASS; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ - fi; \ - echo "$${col}$$res$${std}: $$tst"; \ - done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ - fi; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ - else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ - else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ - else \ - skipped="($$skip tests were not run)"; \ - fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - fi; \ - echo "$${col}$$dashes$${std}"; \ - echo "$${col}$$banner$${std}"; \ - test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ - test -z "$$report" || echo "$${col}$$report$${std}"; \ - echo "$${col}$$dashes$${std}"; \ - test "$$failed" -eq 0; \ - else :; fi - distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -647,11 +572,11 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done +@ENABLE_TESTS_FALSE@check-local: check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS + $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am -all-am: Makefile +all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am @@ -685,7 +610,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am @@ -756,8 +681,8 @@ uninstall-am: .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool ctags \ +.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ + clean-generic clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ @@ -770,6 +695,8 @@ uninstall-am: mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am +@ENABLE_TESTS_TRUE@check-local: check_ifnet +@ENABLE_TESTS_TRUE@ $(abs_builddir)/check_ifnet $(abs_srcdir) $(abs_builddir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/settings/plugins/ifnet/tests/test_all.c b/src/settings/plugins/ifnet/tests/test_all.c index 974258b9..4c312601 100644 --- a/src/settings/plugins/ifnet/tests/test_all.c +++ b/src/settings/plugins/ifnet/tests/test_all.c @@ -25,6 +25,7 @@ #include <glib.h> #include <arpa/inet.h> #include <stdlib.h> +#include <unistd.h> #include <nm-utils.h> #include "net_parser.h" @@ -62,31 +63,33 @@ test_getdata () } static void -test_read_hostname () +test_read_hostname (const char *base_path) { - gchar *hostname = read_hostname ("hostname"); + char *hostname_path, *hostname; + + hostname_path = g_build_filename (base_path, "hostname", NULL); + hostname = read_hostname (hostname_path); + + g_assert_cmpstr (hostname, ==, "gentoo"); - ASSERT (hostname != NULL, "get hostname", "hostname is NULL"); - ASSERT (strcmp ("gentoo", hostname) == 0, - "get hostname", - "hostname is not correctly read, read:%s, expected: gentoo", - hostname); g_free (hostname); + g_free (hostname_path); } static void -test_write_hostname () +test_write_hostname (const char *temp_path) { - gchar *hostname = read_hostname ("hostname"); - gchar *tmp; - - write_hostname ("gentoo-nm", "hostname"); - tmp = read_hostname ("hostname"); - ASSERT (strcmp (tmp, "gentoo-nm") == 0, - "write hostname", "write hostname error"); - write_hostname (hostname, "hostname"); - g_free (tmp); + char *hostname_path, *hostname; + + hostname_path = g_build_filename (temp_path, "hostname-test", NULL); + write_hostname (hostname_path, "gentoo-nm"); + hostname = read_hostname (hostname_path); + + g_assert_cmpstr (hostname, ==, "gentoo-nm"); + g_free (hostname); + unlink (hostname_path); + g_free (hostname_path); } static void @@ -226,21 +229,15 @@ test_wpa_parser () { const char *value; - ASSERT (exist_ssid ("example"), "get wsec", - "ssid myxjtu2 is not found"); - ASSERT (exist_ssid ("static-wep-test"), "exist_ssid", - "ssid static-wep-test is not found"); + g_assert (exist_ssid ("example")); + + g_assert (exist_ssid ("static-wep-test")); value = wpa_get_value ("static-wep-test", "key_mgmt"); - ASSERT (value - && strcmp (value, "NONE") == 0, "get wpa data", - "key_mgmt of static-wep-test should be NONE, find %s", value); + g_assert_cmpstr (value, ==, "NONE"); value = wpa_get_value ("static-wep-test", "wep_key0"); - ASSERT (value - && strcmp (value, "\"abcde\"") == 0, - "get wpa data", - "wep_key0 of static-wep-test should be abcde, find %s", value); - ASSERT (exist_ssid ("leap-example"), "get wsec", - "ssid leap-example is not found"); + g_assert_cmpstr (value, ==, "\"abcde\""); + + g_assert (exist_ssid ("leap-example")); value = wpa_get_value ("test-with-hash-in-psk", "psk"); g_assert_cmpstr (value, ==, "\"xjtudlc3731###asdfasdfasdf\""); @@ -277,48 +274,59 @@ test_new_connection () GError *error = NULL; NMConnection *connection; - connection = ifnet_update_connection_from_config_block ("eth2", &error); + connection = ifnet_update_connection_from_config_block ("eth2", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection failed: %s", error ? error->message : "None"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("qiaomuf", &error); + connection = ifnet_update_connection_from_config_block ("qiaomuf", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection failed: %s", error ? error->message : "NONE"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("myxjtu2", &error); + connection = ifnet_update_connection_from_config_block ("myxjtu2", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection failed: %s", error ? error->message : "NONE"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("eth9", &error); + connection = ifnet_update_connection_from_config_block ("eth9", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection(eth9) failed: %s", error ? error->message : "NONE"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("eth10", &error); + connection = ifnet_update_connection_from_config_block ("eth10", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection(eth10) failed: %s", error ? error->message : "NONE"); g_object_unref (connection); } +static void +kill_backup (char **path) +{ + if (path) { + unlink (*path); + g_free (*path); + *path = NULL; + } +} + #define NET_GEN_NAME "net.generate" #define SUP_GEN_NAME "wpa_supplicant.conf.generate" static void -test_update_connection () +test_update_connection (const char *basepath) { GError *error = NULL; NMConnection *connection; gboolean success; + char *backup = NULL; - connection = ifnet_update_connection_from_config_block ("eth0", &error); + connection = ifnet_update_connection_from_config_block ("eth0", basepath, &error); ASSERT (connection != NULL, "get connection", "get connection failed: %s", error ? error->message : "None"); @@ -327,11 +335,13 @@ test_update_connection () NET_GEN_NAME, SUP_GEN_NAME, NULL, + &backup, &error); + kill_backup (&backup); ASSERT (success, "update connection", "update connection failed %s", "eth0"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("0xab3ace", &error); + connection = ifnet_update_connection_from_config_block ("0xab3ace", basepath, &error); ASSERT (connection != NULL, "get connection", "get connection failed: %s", error ? error->message : "None"); @@ -339,7 +349,9 @@ test_update_connection () NET_GEN_NAME, SUP_GEN_NAME, NULL, + &backup, &error); + kill_backup (&backup); ASSERT (success, "update connection", "update connection failed %s", "0xab3ace"); g_object_unref (connection); @@ -348,17 +360,21 @@ test_update_connection () } static void -test_add_connection () +test_add_connection (const char *basepath) { NMConnection *connection; + char *backup = NULL; - connection = ifnet_update_connection_from_config_block ("eth0", NULL); - ASSERT (ifnet_add_new_connection (connection, NET_GEN_NAME, SUP_GEN_NAME, NULL), + connection = ifnet_update_connection_from_config_block ("eth0", basepath, NULL); + ASSERT (ifnet_add_new_connection (connection, NET_GEN_NAME, SUP_GEN_NAME, &backup, NULL), "add connection", "add connection failed: %s", "eth0"); + kill_backup (&backup); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("myxjtu2", NULL); - ASSERT (ifnet_add_new_connection (connection, NET_GEN_NAME, SUP_GEN_NAME, NULL), + + connection = ifnet_update_connection_from_config_block ("myxjtu2", basepath, NULL); + ASSERT (ifnet_add_new_connection (connection, NET_GEN_NAME, SUP_GEN_NAME, &backup, NULL), "add connection", "add connection failed: %s", "myxjtu2"); + kill_backup (&backup); g_object_unref (connection); unlink (NET_GEN_NAME); @@ -370,20 +386,24 @@ test_delete_connection () { GError *error = NULL; NMConnection *connection; + char *backup = NULL; - connection = ifnet_update_connection_from_config_block ("eth7", &error); + connection = ifnet_update_connection_from_config_block ("eth7", NULL, &error); ASSERT (connection != NULL, "get connection", "get connection failed: %s", error ? error->message : "None"); - ASSERT (ifnet_delete_connection_in_parsers ("eth7", NET_GEN_NAME, SUP_GEN_NAME), + ASSERT (ifnet_delete_connection_in_parsers ("eth7", NET_GEN_NAME, SUP_GEN_NAME, &backup), "delete connection", "delete connection failed: %s", "eth7"); + kill_backup (&backup); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("qiaomuf", &error); + + connection = ifnet_update_connection_from_config_block ("qiaomuf", NULL, &error); ASSERT (connection != NULL, "get connection", "get connection failed: %s", error ? error->message : "None"); - ASSERT (ifnet_delete_connection_in_parsers ("qiaomuf", NET_GEN_NAME, SUP_GEN_NAME), + ASSERT (ifnet_delete_connection_in_parsers ("qiaomuf", NET_GEN_NAME, SUP_GEN_NAME, &backup), "delete connection", "delete connection failed: %s", "qiaomuf"); + kill_backup (&backup); g_object_unref (connection); unlink (NET_GEN_NAME); @@ -396,50 +416,51 @@ test_missing_config () GError *error = NULL; NMConnection *connection; - connection = ifnet_update_connection_from_config_block ("eth8", &error); + connection = ifnet_update_connection_from_config_block ("eth8", NULL, &error); ASSERT (connection == NULL && error != NULL, "get connection", "get connection should fail with 'Unknown config for eth8'"); } -static void -run_all (gboolean run) -{ - if (run) { - test_strip_string (); - test_is_static (); - test_has_ip6_address (); - test_has_default_route (); - test_getdata (); - test_read_hostname (); - test_write_hostname (); - test_is_ip4_address (); - test_is_ip6_address (); - test_convert_ipv4_config_block (); - test_convert_ipv4_routes_block (); - test_is_unmanaged (); - test_wpa_parser (); - test_convert_ipv4_routes_block (); - test_new_connection (); - test_update_connection (); - test_add_connection (); - test_delete_connection (); - test_missing_config (); - } -} - int -main (void) +main (int argc, char **argv) { -// g_mem_set_vtable(glib_mem_profiler_table); -// g_atexit(g_mem_profile); + char *f; + g_type_init (); + + f = g_build_filename (argv[1], "net", NULL); + ifnet_init (f); + g_free (f); + + f = g_build_filename (argv[1], "wpa_supplicant.conf", NULL); + wpa_parser_init (f); + g_free (f); + + test_strip_string (); + test_is_static (); + test_has_ip6_address (); + test_has_default_route (); + test_getdata (); + test_read_hostname (argv[1]); + test_write_hostname (argv[2]); + test_is_ip4_address (); + test_is_ip6_address (); + test_convert_ipv4_config_block (); + test_convert_ipv4_routes_block (); + test_is_unmanaged (); + test_wpa_parser (); + test_convert_ipv4_routes_block (); + test_new_connection (); + test_update_connection (argv[1]); + test_add_connection (argv[1]); + test_delete_connection (); + test_missing_config (); + ifnet_destroy (); wpa_parser_destroy (); - ifnet_init ("net"); - wpa_parser_init ("wpa_supplicant.conf"); - printf ("Initialization complete\n"); - run_all (TRUE); - ifnet_destroy (); - wpa_parser_destroy (); + + f = g_path_get_basename (argv[0]); + fprintf (stdout, "%s: SUCCESS\n", f); + g_free (f); return 0; } diff --git a/src/settings/plugins/ifnet/tests/test_ca_cert.pem b/src/settings/plugins/ifnet/tests/test_ca_cert.pem new file mode 100644 index 00000000..ef1be20d --- /dev/null +++ b/src/settings/plugins/ifnet/tests/test_ca_cert.pem @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE----- +MIIEjzCCA3egAwIBAgIJAOvnZPt59yIZMA0GCSqGSIb3DQEBBQUAMIGLMQswCQYD +VQQGEwJVUzESMBAGA1UECBMJQmVya3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcw +FQYDVQQKEw5NeSBDb21wYW55IEx0ZDEQMA4GA1UECxMHVGVzdGluZzENMAsGA1UE +AxMEdGVzdDEcMBoGCSqGSIb3DQEJARYNdGVzdEB0ZXN0LmNvbTAeFw0wOTAzMTAx +NTEyMTRaFw0xOTAzMDgxNTEyMTRaMIGLMQswCQYDVQQGEwJVUzESMBAGA1UECBMJ +QmVya3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcwFQYDVQQKEw5NeSBDb21wYW55 +IEx0ZDEQMA4GA1UECxMHVGVzdGluZzENMAsGA1UEAxMEdGVzdDEcMBoGCSqGSIb3 +DQEJARYNdGVzdEB0ZXN0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAKot9j+/+CX1/gZLgJHIXCRgCItKLGnf7qGbgqB9T2ACBqR0jllKWwDKrcWU +xjXNIc+GF9Wnv+lX6G0Okn4Zt3/uRNobL+2b/yOF7M3Td3/9W873zdkQQX930YZc +Rr8uxdRPP5bxiCgtcw632y21sSEbG9mjccAUnV/0jdvfmMNj0i8gN6E0fMBiJ9S3 +FkxX/KFvt9JWE9CtoyL7ki7UIDq+6vj7Gd5N0B3dOa1y+rRHZzKlJPcSXQSEYUS4 +HmKDwiKSVahft8c4tDn7KPi0vex91hlgZVd3usL2E/Vq7o5D9FAZ5kZY0AdFXwdm +J4lO4Mj7ac7GE4vNERNcXVIX59sCAwEAAaOB8zCB8DAdBgNVHQ4EFgQUuDU3Mr7P +T3n1e3Sy8hBauoDFahAwgcAGA1UdIwSBuDCBtYAUuDU3Mr7PT3n1e3Sy8hBauoDF +ahChgZGkgY4wgYsxCzAJBgNVBAYTAlVTMRIwEAYDVQQIEwlCZXJrc2hpcmUxEDAO +BgNVBAcTB05ld2J1cnkxFzAVBgNVBAoTDk15IENvbXBhbnkgTHRkMRAwDgYDVQQL +EwdUZXN0aW5nMQ0wCwYDVQQDEwR0ZXN0MRwwGgYJKoZIhvcNAQkBFg10ZXN0QHRl +c3QuY29tggkA6+dk+3n3IhkwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC +AQEAVRG4aALIvCXCiKfe7K+iJxjBVRDFPEf7JWA9LGgbFOn6pNvbxonrR+0BETdc +JV1ET4ct2xsE7QNFIkp9GKRC+6J32zCo8qtLCD5+v436r8TUG2/t2JRMkb9I2XVT +p7RJoot6M0Ltf8KNQUPYh756xmKZ4USfQUwc58MOSDGY8VWEXJOYij9Pf0e0c52t +qiCEjXH7uXiS8Pgq9TYm7AkWSOrglYhSa83x0f8mtT8Q15nBESIHZ6o8FAS2bBgn +B0BkrKRjtBUkuJG3vTox+bYINh2Gxi1JZHWSV1tN5z3hd4VFcKqanW5OgQwToBqp +3nniskIjbH0xjgZf/nVMyLnjxg== +-----END CERTIFICATE----- diff --git a/src/settings/plugins/ifnet/tests/wpa_supplicant.conf b/src/settings/plugins/ifnet/tests/wpa_supplicant.conf index 609ee0e1..917d495d 100644 --- a/src/settings/plugins/ifnet/tests/wpa_supplicant.conf +++ b/src/settings/plugins/ifnet/tests/wpa_supplicant.conf @@ -1,529 +1,3 @@ -##### Example wpa_supplicant configuration file ############################### -# -# This file describes configuration file format and lists all available option. -# Please also take a look at simpler configuration examples in 'examples' -# subdirectory. -# -# Empty lines and lines starting with # are ignored - -# NOTE! This file may contain password information and should probably be made -# readable only by root user on multiuser systems. - -# Note: All file paths in this configuration file should use full (absolute, -# not relative to working directory) path in order to allow working directory -# to be changed. This can happen if wpa_supplicant is run in the background. - -# Whether to allow wpa_supplicant to update (overwrite) configuration -# -# This option can be used to allow wpa_supplicant to overwrite configuration -# file whenever configuration is changed (e.g., new network block is added with -# wpa_cli or wpa_gui, or a password is changed). This is required for -# wpa_cli/wpa_gui to be able to store the configuration changes permanently. -# Please note that overwriting configuration file will remove the comments from -# it. -#update_config=1 - -# global configuration (shared by all network blocks) -# -# Parameters for the control interface. If this is specified, wpa_supplicant -# will open a control interface that is available for external programs to -# manage wpa_supplicant. The meaning of this string depends on which control -# interface mechanism is used. For all cases, the existance of this parameter -# in configuration is used to determine whether the control interface is -# enabled. -# -# For UNIX domain sockets (default on Linux and BSD): This is a directory that -# will be created for UNIX domain sockets for listening to requests from -# external programs (CLI/GUI, etc.) for status information and configuration. -# The socket file will be named based on the interface name, so multiple -# wpa_supplicant processes can be run at the same time if more than one -# interface is used. -# /var/run/wpa_supplicant is the recommended directory for sockets and by -# default, wpa_cli will use it when trying to connect with wpa_supplicant. -# -# Access control for the control interface can be configured by setting the -# directory to allow only members of a group to use sockets. This way, it is -# possible to run wpa_supplicant as root (since it needs to change network -# configuration and open raw sockets) and still allow GUI/CLI components to be -# run as non-root users. However, since the control interface can be used to -# change the network configuration, this access needs to be protected in many -# cases. By default, wpa_supplicant is configured to use gid 0 (root). If you -# want to allow non-root users to use the control interface, add a new group -# and change this value to match with that group. Add users that should have -# control interface access to this group. If this variable is commented out or -# not included in the configuration file, group will not be changed from the -# value it got by default when the directory or socket was created. -# -# When configuring both the directory and group, use following format: -# DIR=/var/run/wpa_supplicant GROUP=wheel -# DIR=/var/run/wpa_supplicant GROUP=0 -# (group can be either group name or gid) -# -# For UDP connections (default on Windows): The value will be ignored. This -# variable is just used to select that the control interface is to be created. -# The value can be set to, e.g., udp (ctrl_interface=udp) -# -# For Windows Named Pipe: This value can be used to set the security descriptor -# for controlling access to the control interface. Security descriptor can be -# set using Security Descriptor String Format (see http://msdn.microsoft.com/ -# library/default.asp?url=/library/en-us/secauthz/security/ -# security_descriptor_string_format.asp). The descriptor string needs to be -# prefixed with SDDL=. For example, ctrl_interface=SDDL=D: would set an empty -# DACL (which will reject all connections). See README-Windows.txt for more -# information about SDDL string format. -# -ctrl_interface=/var/run/wpa_supplicant - -# IEEE 802.1X/EAPOL version -# wpa_supplicant is implemented based on IEEE Std 802.1X-2004 which defines -# EAPOL version 2. However, there are many APs that do not handle the new -# version number correctly (they seem to drop the frames completely). In order -# to make wpa_supplicant interoperate with these APs, the version number is set -# to 1 by default. This configuration value can be used to set it to the new -# version (2). -eapol_version=1 - -# AP scanning/selection -# By default, wpa_supplicant requests driver to perform AP scanning and then -# uses the scan results to select a suitable AP. Another alternative is to -# allow the driver to take care of AP scanning and selection and use -# wpa_supplicant just to process EAPOL frames based on IEEE 802.11 association -# information from the driver. -# 1: wpa_supplicant initiates scanning and AP selection -# 0: driver takes care of scanning, AP selection, and IEEE 802.11 association -# parameters (e.g., WPA IE generation); this mode can also be used with -# non-WPA drivers when using IEEE 802.1X mode; do not try to associate with -# APs (i.e., external program needs to control association). This mode must -# also be used when using wired Ethernet drivers. -# 2: like 0, but associate with APs using security policy and SSID (but not -# BSSID); this can be used, e.g., with ndiswrapper and NDIS drivers to -# enable operation with hidden SSIDs and optimized roaming; in this mode, -# the network blocks in the configuration file are tried one by one until -# the driver reports successful association; each network block should have -# explicit security policy (i.e., only one option in the lists) for -# key_mgmt, pairwise, group, proto variables -ap_scan=1 - -# EAP fast re-authentication -# By default, fast re-authentication is enabled for all EAP methods that -# support it. This variable can be used to disable fast re-authentication. -# Normally, there is no need to disable this. -fast_reauth=1 - -# OpenSSL Engine support -# These options can be used to load OpenSSL engines. -# The two engines that are supported currently are shown below: -# They are both from the opensc project (http://www.opensc.org/) -# By default no engines are loaded. -# make the opensc engine available -#opensc_engine_path=/usr/lib64/engine_opensc.so -# make the pkcs11 engine available -#pkcs11_engine_path=/usr/lib64/engine_pkcs11.so -# configure the path to the pkcs11 module required by the pkcs11 engine -#pkcs11_module_path=/usr/lib64/opensc-pkcs11.so - -# Dynamic EAP methods -# If EAP methods were built dynamically as shared object files, they need to be -# loaded here before being used in the network blocks. By default, EAP methods -# are included statically in the build, so these lines are not needed -#load_dynamic_eap=/usr/lib/wpa_supplicant/eap_tls.so -#load_dynamic_eap=/usr/lib/wpa_supplicant/eap_md5.so - -# Driver interface parameters -# This field can be used to configure arbitrary driver interace parameters. The -# format is specific to the selected driver interface. This field is not used -# in most cases. -#driver_param="field=value" - -# Country code -# The ISO/IEC alpha2 country code for the country in which this device is -# currently operating. -#country=US - -# Maximum lifetime for PMKSA in seconds; default 43200 -#dot11RSNAConfigPMKLifetime=43200 -# Threshold for reauthentication (percentage of PMK lifetime); default 70 -#dot11RSNAConfigPMKReauthThreshold=70 -# Timeout for security association negotiation in seconds; default 60 -#dot11RSNAConfigSATimeout=60 - -# Wi-Fi Protected Setup (WPS) parameters - -# Universally Unique IDentifier (UUID; see RFC 4122) of the device -# If not configured, UUID will be generated based on the local MAC address. -#uuid=12345678-9abc-def0-1234-56789abcdef0 - -# Device Name -# User-friendly description of device; up to 32 octets encoded in UTF-8 -#device_name=Wireless Client - -# Manufacturer -# The manufacturer of the device (up to 64 ASCII characters) -#manufacturer=Company - -# Model Name -# Model of the device (up to 32 ASCII characters) -#model_name=cmodel - -# Model Number -# Additional device description (up to 32 ASCII characters) -#model_number=123 - -# Serial Number -# Serial number of the device (up to 32 characters) -#serial_number=12345 - -# Primary Device Type -# Used format: <categ>-<OUI>-<subcateg> -# categ = Category as an integer value -# OUI = OUI and type octet as a 4-octet hex-encoded value; 0050F204 for -# default WPS OUI -# subcateg = OUI-specific Sub Category as an integer value -# Examples: -# 1-0050F204-1 (Computer / PC) -# 1-0050F204-2 (Computer / Server) -# 5-0050F204-1 (Storage / NAS) -# 6-0050F204-1 (Network Infrastructure / AP) -#device_type=1-0050F204-1 - -# OS Version -# 4-octet operating system version number (hex string) -#os_version=01020300 - -# Credential processing -# 0 = process received credentials internally (default) -# 1 = do not process received credentials; just pass them over ctrl_iface to -# external program(s) -# 2 = process received credentials internally and pass them over ctrl_iface -# to external program(s) -#wps_cred_processing=0 - -# network block -# -# Each network (usually AP's sharing the same SSID) is configured as a separate -# block in this configuration file. The network blocks are in preference order -# (the first match is used). -# -# network block fields: -# -# disabled: -# 0 = this network can be used (default) -# 1 = this network block is disabled (can be enabled through ctrl_iface, -# e.g., with wpa_cli or wpa_gui) -# -# id_str: Network identifier string for external scripts. This value is passed -# to external action script through wpa_cli as WPA_ID_STR environment -# variable to make it easier to do network specific configuration. -# -# ssid: SSID (mandatory); either as an ASCII string with double quotation or -# as hex string; network name -# -# scan_ssid: -# 0 = do not scan this SSID with specific Probe Request frames (default) -# 1 = scan with SSID-specific Probe Request frames (this can be used to -# find APs that do not accept broadcast SSID or use multiple SSIDs; -# this will add latency to scanning, so enable this only when needed) -# -# bssid: BSSID (optional); if set, this network block is used only when -# associating with the AP using the configured BSSID -# -# priority: priority group (integer) -# By default, all networks will get same priority group (0). If some of the -# networks are more desirable, this field can be used to change the order in -# which wpa_supplicant goes through the networks when selecting a BSS. The -# priority groups will be iterated in decreasing priority (i.e., the larger the -# priority value, the sooner the network is matched against the scan results). -# Within each priority group, networks will be selected based on security -# policy, signal strength, etc. -# Please note that AP scanning with scan_ssid=1 and ap_scan=2 mode are not -# using this priority to select the order for scanning. Instead, they try the -# networks in the order that used in the configuration file. -# -# mode: IEEE 802.11 operation mode -# 0 = infrastructure (Managed) mode, i.e., associate with an AP (default) -# 1 = IBSS (ad-hoc, peer-to-peer) -# Note: IBSS can only be used with key_mgmt NONE (plaintext and static WEP) -# and key_mgmt=WPA-NONE (fixed group key TKIP/CCMP). In addition, ap_scan has -# to be set to 2 for IBSS. WPA-None requires following network block options: -# proto=WPA, key_mgmt=WPA-NONE, pairwise=NONE, group=TKIP (or CCMP, but not -# both), and psk must also be set. -# -# frequency: Channel frequency in megahertz (MHz) for IBSS, e.g., -# 2412 = IEEE 802.11b/g channel 1. This value is used to configure the initial -# channel for IBSS (adhoc) networks. It is ignored in the infrastructure mode. -# In addition, this value is only used by the station that creates the IBSS. If -# an IBSS network with the configured SSID is already present, the frequency of -# the network will be used instead of this configured value. -# -# proto: list of accepted protocols -# WPA = WPA/IEEE 802.11i/D3.0 -# RSN = WPA2/IEEE 802.11i (also WPA2 can be used as an alias for RSN) -# If not set, this defaults to: WPA RSN -# -# key_mgmt: list of accepted authenticated key management protocols -# WPA-PSK = WPA pre-shared key (this requires 'psk' field) -# WPA-EAP = WPA using EAP authentication -# IEEE8021X = IEEE 802.1X using EAP authentication and (optionally) dynamically -# generated WEP keys -# NONE = WPA is not used; plaintext or static WEP could be used -# WPA-PSK-SHA256 = Like WPA-PSK but using stronger SHA256-based algorithms -# WPA-EAP-SHA256 = Like WPA-EAP but using stronger SHA256-based algorithms -# If not set, this defaults to: WPA-PSK WPA-EAP -# -# auth_alg: list of allowed IEEE 802.11 authentication algorithms -# OPEN = Open System authentication (required for WPA/WPA2) -# SHARED = Shared Key authentication (requires static WEP keys) -# LEAP = LEAP/Network EAP (only used with LEAP) -# If not set, automatic selection is used (Open System with LEAP enabled if -# LEAP is allowed as one of the EAP methods). -# -# pairwise: list of accepted pairwise (unicast) ciphers for WPA -# CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0] -# TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0] -# NONE = Use only Group Keys (deprecated, should not be included if APs support -# pairwise keys) -# If not set, this defaults to: CCMP TKIP -# -# group: list of accepted group (broadcast/multicast) ciphers for WPA -# CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0] -# TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0] -# WEP104 = WEP (Wired Equivalent Privacy) with 104-bit key -# WEP40 = WEP (Wired Equivalent Privacy) with 40-bit key [IEEE 802.11] -# If not set, this defaults to: CCMP TKIP WEP104 WEP40 -# -# psk: WPA preshared key; 256-bit pre-shared key -# The key used in WPA-PSK mode can be entered either as 64 hex-digits, i.e., -# 32 bytes or as an ASCII passphrase (in which case, the real PSK will be -# generated using the passphrase and SSID). ASCII passphrase must be between -# 8 and 63 characters (inclusive). -# This field is not needed, if WPA-EAP is used. -# Note: Separate tool, wpa_passphrase, can be used to generate 256-bit keys -# from ASCII passphrase. This process uses lot of CPU and wpa_supplicant -# startup and reconfiguration time can be optimized by generating the PSK only -# only when the passphrase or SSID has actually changed. -# -# eapol_flags: IEEE 802.1X/EAPOL options (bit field) -# Dynamic WEP key required for non-WPA mode -# bit0 (1): require dynamically generated unicast WEP key -# bit1 (2): require dynamically generated broadcast WEP key -# (3 = require both keys; default) -# Note: When using wired authentication, eapol_flags must be set to 0 for the -# authentication to be completed successfully. -# -# mixed_cell: This option can be used to configure whether so called mixed -# cells, i.e., networks that use both plaintext and encryption in the same -# SSID, are allowed when selecting a BSS form scan results. -# 0 = disabled (default) -# 1 = enabled -# -# proactive_key_caching: -# Enable/disable opportunistic PMKSA caching for WPA2. -# 0 = disabled (default) -# 1 = enabled -# -# wep_key0..3: Static WEP key (ASCII in double quotation, e.g. "abcde" or -# hex without quotation, e.g., 0102030405) -# wep_tx_keyidx: Default WEP key index (TX) (0..3) -# -# peerkey: Whether PeerKey negotiation for direct links (IEEE 802.11e DLS) is -# allowed. This is only used with RSN/WPA2. -# 0 = disabled (default) -# 1 = enabled -#peerkey=1 -# -# wpa_ptk_rekey: Maximum lifetime for PTK in seconds. This can be used to -# enforce rekeying of PTK to mitigate some attacks against TKIP deficiencies. -# -# Following fields are only used with internal EAP implementation. -# eap: space-separated list of accepted EAP methods -# MD5 = EAP-MD5 (unsecure and does not generate keying material -> -# cannot be used with WPA; to be used as a Phase 2 method -# with EAP-PEAP or EAP-TTLS) -# MSCHAPV2 = EAP-MSCHAPv2 (cannot be used separately with WPA; to be used -# as a Phase 2 method with EAP-PEAP or EAP-TTLS) -# OTP = EAP-OTP (cannot be used separately with WPA; to be used -# as a Phase 2 method with EAP-PEAP or EAP-TTLS) -# GTC = EAP-GTC (cannot be used separately with WPA; to be used -# as a Phase 2 method with EAP-PEAP or EAP-TTLS) -# TLS = EAP-TLS (client and server certificate) -# PEAP = EAP-PEAP (with tunnelled EAP authentication) -# TTLS = EAP-TTLS (with tunnelled EAP or PAP/CHAP/MSCHAP/MSCHAPV2 -# authentication) -# If not set, all compiled in methods are allowed. -# -# identity: Identity string for EAP -# This field is also used to configure user NAI for -# EAP-PSK/PAX/SAKE/GPSK. -# anonymous_identity: Anonymous identity string for EAP (to be used as the -# unencrypted identity with EAP types that support different tunnelled -# identity, e.g., EAP-TTLS) -# password: Password string for EAP. This field can include either the -# plaintext password (using ASCII or hex string) or a NtPasswordHash -# (16-byte MD4 hash of password) in hash:<32 hex digits> format. -# NtPasswordHash can only be used when the password is for MSCHAPv2 or -# MSCHAP (EAP-MSCHAPv2, EAP-TTLS/MSCHAPv2, EAP-TTLS/MSCHAP, LEAP). -# EAP-PSK (128-bit PSK), EAP-PAX (128-bit PSK), and EAP-SAKE (256-bit -# PSK) is also configured using this field. For EAP-GPSK, this is a -# variable length PSK. -# ca_cert: File path to CA certificate file (PEM/DER). This file can have one -# or more trusted CA certificates. If ca_cert and ca_path are not -# included, server certificate will not be verified. This is insecure and -# a trusted CA certificate should always be configured when using -# EAP-TLS/TTLS/PEAP. Full path should be used since working directory may -# change when wpa_supplicant is run in the background. -# On Windows, trusted CA certificates can be loaded from the system -# certificate store by setting this to cert_store://<name>, e.g., -# ca_cert="cert_store://CA" or ca_cert="cert_store://ROOT". -# Note that when running wpa_supplicant as an application, the user -# certificate store (My user account) is used, whereas computer store -# (Computer account) is used when running wpasvc as a service. -# ca_path: Directory path for CA certificate files (PEM). This path may -# contain multiple CA certificates in OpenSSL format. Common use for this -# is to point to system trusted CA list which is often installed into -# directory like /etc/ssl/certs. If configured, these certificates are -# added to the list of trusted CAs. ca_cert may also be included in that -# case, but it is not required. -# client_cert: File path to client certificate file (PEM/DER) -# Full path should be used since working directory may change when -# wpa_supplicant is run in the background. -# Alternatively, a named configuration blob can be used by setting this -# to blob://<blob name>. -# private_key: File path to client private key file (PEM/DER/PFX) -# When PKCS#12/PFX file (.p12/.pfx) is used, client_cert should be -# commented out. Both the private key and certificate will be read from -# the PKCS#12 file in this case. Full path should be used since working -# directory may change when wpa_supplicant is run in the background. -# Windows certificate store can be used by leaving client_cert out and -# configuring private_key in one of the following formats: -# cert://substring_to_match -# hash://certificate_thumbprint_in_hex -# for example: private_key="hash://63093aa9c47f56ae88334c7b65a4" -# Note that when running wpa_supplicant as an application, the user -# certificate store (My user account) is used, whereas computer store -# (Computer account) is used when running wpasvc as a service. -# Alternatively, a named configuration blob can be used by setting this -# to blob://<blob name>. -# private_key_passwd: Password for private key file (if left out, this will be -# asked through control interface) -# dh_file: File path to DH/DSA parameters file (in PEM format) -# This is an optional configuration file for setting parameters for an -# ephemeral DH key exchange. In most cases, the default RSA -# authentication does not use this configuration. However, it is possible -# setup RSA to use ephemeral DH key exchange. In addition, ciphers with -# DSA keys always use ephemeral DH keys. This can be used to achieve -# forward secrecy. If the file is in DSA parameters format, it will be -# automatically converted into DH params. -# subject_match: Substring to be matched against the subject of the -# authentication server certificate. If this string is set, the server -# sertificate is only accepted if it contains this string in the subject. -# The subject string is in following format: -# /C=US/ST=CA/L=San Francisco/CN=Test AS/emailAddress=as@example.com -# altsubject_match: Semicolon separated string of entries to be matched against -# the alternative subject name of the authentication server certificate. -# If this string is set, the server sertificate is only accepted if it -# contains one of the entries in an alternative subject name extension. -# altSubjectName string is in following format: TYPE:VALUE -# Example: EMAIL:server@example.com -# Example: DNS:server.example.com;DNS:server2.example.com -# Following types are supported: EMAIL, DNS, URI -# phase1: Phase1 (outer authentication, i.e., TLS tunnel) parameters -# (string with field-value pairs, e.g., "peapver=0" or -# "peapver=1 peaplabel=1") -# 'peapver' can be used to force which PEAP version (0 or 1) is used. -# 'peaplabel=1' can be used to force new label, "client PEAP encryption", -# to be used during key derivation when PEAPv1 or newer. Most existing -# PEAPv1 implementation seem to be using the old label, "client EAP -# encryption", and wpa_supplicant is now using that as the default value. -# Some servers, e.g., Radiator, may require peaplabel=1 configuration to -# interoperate with PEAPv1; see eap_testing.txt for more details. -# 'peap_outer_success=0' can be used to terminate PEAP authentication on -# tunneled EAP-Success. This is required with some RADIUS servers that -# implement draft-josefsson-pppext-eap-tls-eap-05.txt (e.g., -# Lucent NavisRadius v4.4.0 with PEAP in "IETF Draft 5" mode) -# include_tls_length=1 can be used to force wpa_supplicant to include -# TLS Message Length field in all TLS messages even if they are not -# fragmented. -# sim_min_num_chal=3 can be used to configure EAP-SIM to require three -# challenges (by default, it accepts 2 or 3) -# result_ind=1 can be used to enable EAP-SIM and EAP-AKA to use -# protected result indication. -# 'crypto_binding' option can be used to control PEAPv0 cryptobinding -# behavior: -# * 0 = do not use cryptobinding (default) -# * 1 = use cryptobinding if server supports it -# * 2 = require cryptobinding -# EAP-WSC (WPS) uses following options: pin=<Device Password> or -# pbc=1. -# phase2: Phase2 (inner authentication with TLS tunnel) parameters -# (string with field-value pairs, e.g., "auth=MSCHAPV2" for EAP-PEAP or -# "autheap=MSCHAPV2 autheap=MD5" for EAP-TTLS) -# Following certificate/private key fields are used in inner Phase2 -# authentication when using EAP-TTLS or EAP-PEAP. -# ca_cert2: File path to CA certificate file. This file can have one or more -# trusted CA certificates. If ca_cert2 and ca_path2 are not included, -# server certificate will not be verified. This is insecure and a trusted -# CA certificate should always be configured. -# ca_path2: Directory path for CA certificate files (PEM) -# client_cert2: File path to client certificate file -# private_key2: File path to client private key file -# private_key2_passwd: Password for private key file -# dh_file2: File path to DH/DSA parameters file (in PEM format) -# subject_match2: Substring to be matched against the subject of the -# authentication server certificate. -# altsubject_match2: Substring to be matched against the alternative subject -# name of the authentication server certificate. -# -# fragment_size: Maximum EAP fragment size in bytes (default 1398). -# This value limits the fragment size for EAP methods that support -# fragmentation (e.g., EAP-TLS and EAP-PEAP). This value should be set -# small enough to make the EAP messages fit in MTU of the network -# interface used for EAPOL. The default value is suitable for most -# cases. -# -# EAP-FAST variables: -# pac_file: File path for the PAC entries. wpa_supplicant will need to be able -# to create this file and write updates to it when PAC is being -# provisioned or refreshed. Full path to the file should be used since -# working directory may change when wpa_supplicant is run in the -# background. Alternatively, a named configuration blob can be used by -# setting this to blob://<blob name> -# phase1: fast_provisioning option can be used to enable in-line provisioning -# of EAP-FAST credentials (PAC): -# 0 = disabled, -# 1 = allow unauthenticated provisioning, -# 2 = allow authenticated provisioning, -# 3 = allow both unauthenticated and authenticated provisioning -# fast_max_pac_list_len=<num> option can be used to set the maximum -# number of PAC entries to store in a PAC list (default: 10) -# fast_pac_format=binary option can be used to select binary format for -# storing PAC entries in order to save some space (the default -# text format uses about 2.5 times the size of minimal binary -# format) -# -# wpa_supplicant supports number of "EAP workarounds" to work around -# interoperability issues with incorrectly behaving authentication servers. -# These are enabled by default because some of the issues are present in large -# number of authentication servers. Strict EAP conformance mode can be -# configured by disabling workarounds with eap_workaround=0. - -# Example blocks: - -# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers -network={ - ssid="simple" - psk="very secret passphrase" - priority=5 -} - -# Same as previous, but request SSID-specific scanning (for APs that reject -# broadcast SSID) -network={ - ssid="second ssid" - scan_ssid=1 - psk="very secret passphrase" - priority=2 -} - # Only WPA-PSK is used. Any valid cipher combination is accepted. network={ ssid="example" @@ -535,149 +9,6 @@ network={ priority=2 } -# WPA-Personal(PSK) with TKIP and enforcement for frequent PTK rekeying -network={ - ssid="example" - proto=WPA - key_mgmt=WPA-PSK - pairwise=TKIP - group=TKIP - psk="not so secure passphrase" - wpa_ptk_rekey=600 -} - -# Only WPA-EAP is used. Both CCMP and TKIP is accepted. An AP that used WEP104 -# or WEP40 as the group cipher will not be accepted. -network={ - ssid="example" - proto=RSN - key_mgmt=WPA-EAP - pairwise=CCMP TKIP - group=CCMP TKIP - eap=TLS - identity="user@example.com" - ca_cert="/etc/cert/ca.pem" - client_cert="/etc/cert/user.pem" - private_key="/etc/cert/user.prv" - private_key_passwd="password" - priority=1 -} - -# EAP-PEAP/MSCHAPv2 configuration for RADIUS servers that use the new peaplabel -# (e.g., Radiator) -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=PEAP - identity="user@example.com" - password="foobar" - ca_cert="/etc/cert/ca.pem" - phase1="peaplabel=1" - phase2="auth=MSCHAPV2" - priority=10 -} - -# EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the -# unencrypted use. Real identity is sent only within an encrypted TLS tunnel. -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TTLS - identity="user@example.com" - anonymous_identity="anonymous@example.com" - password="foobar" - ca_cert="/etc/cert/ca.pem" - priority=2 -} - -# EAP-TTLS/MSCHAPv2 configuration with anonymous identity for the unencrypted -# use. Real identity is sent only within an encrypted TLS tunnel. -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TTLS - identity="user@example.com" - anonymous_identity="anonymous@example.com" - password="foobar" - ca_cert="/etc/cert/ca.pem" - phase2="auth=MSCHAPV2" -} - -# WPA-EAP, EAP-TTLS with different CA certificate used for outer and inner -# authentication. -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TTLS - # Phase1 / outer authentication - anonymous_identity="anonymous@example.com" - ca_cert="/etc/cert/ca.pem" - # Phase 2 / inner authentication - phase2="autheap=TLS" - ca_cert2="/etc/cert/ca2.pem" - client_cert2="/etc/cer/user.pem" - private_key2="/etc/cer/user.prv" - private_key2_passwd="password" - priority=2 -} - -# Both WPA-PSK and WPA-EAP is accepted. Only CCMP is accepted as pairwise and -# group cipher. -network={ - ssid="example" - bssid=00:11:22:33:44:55 - proto=WPA RSN - key_mgmt=WPA-PSK WPA-EAP - pairwise=CCMP - group=CCMP - psk=06b4be19da289f475aa46a33cb793029d4ab3db7a23ee92382eb0106c72ac7bb -} - -# Special characters in SSID, so use hex string. Default to WPA-PSK, WPA-EAP -# and all valid ciphers. -network={ - ssid=00010203 - psk=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f -} - - -# EAP-SIM with a GSM SIM or USIM -network={ - ssid="eap-sim-test" - key_mgmt=WPA-EAP - eap=SIM - pin="1234" - pcsc="" -} - - -# EAP-PSK -network={ - ssid="eap-psk-test" - key_mgmt=WPA-EAP - eap=PSK - anonymous_identity="eap_psk_user" - password=06b4be19da289f475aa46a33cb793029 - identity="eap_psk_user@example.com" -} - - -# IEEE 802.1X/EAPOL with dynamically generated WEP keys (i.e., no WPA) using -# EAP-TLS for authentication and key generation; require both unicast and -# broadcast WEP keys. -network={ - ssid="1xtest" - key_mgmt=IEEE8021X - eap=TLS - identity="user@example.com" - ca_cert="/etc/cert/ca.pem" - client_cert="/etc/cert/user.pem" - private_key="/etc/cert/user.prv" - private_key_passwd="password" - eapol_flags=3 -} - - # LEAP with dynamic WEP keys network={ ssid="leap-example" @@ -687,45 +18,6 @@ network={ password="foobar" } -# EAP-IKEv2 using shared secrets for both server and peer authentication -network={ - ssid="ikev2-example" - key_mgmt=WPA-EAP - eap=IKEV2 - identity="user" - password="foobar" -} - -# EAP-FAST with WPA (WPA or WPA2) -network={ - ssid="eap-fast-test" - key_mgmt=WPA-EAP - eap=FAST - anonymous_identity="FAST-000102030405" - identity="username" - password="password" - phase1="fast_provisioning=1" - pac_file="/etc/wpa_supplicant.eap-fast-pac" -} - -network={ - ssid="eap-fast-test" - key_mgmt=WPA-EAP - eap=FAST - anonymous_identity="FAST-000102030405" - identity="username" - password="password" - phase1="fast_provisioning=1" - pac_file="blob://eap-fast-pac" -} - -# Plaintext connection (no WPA, no IEEE 802.1X) -network={ - ssid="plaintext-test" - key_mgmt=NONE -} - - # Shared WEP key connection (no WPA, no IEEE 802.1X) network={ ssid="static-wep-test" @@ -737,107 +29,12 @@ network={ priority=5 } - -# Shared WEP key connection (no WPA, no IEEE 802.1X) using Shared Key -# IEEE 802.11 authentication -network={ - ssid="static-wep-test2" - key_mgmt=NONE - wep_key0="abcde" - wep_key1=0102030405 - wep_key2="1234567890123" - wep_tx_keyidx=0 - priority=5 - auth_alg=SHARED -} - - -# IBSS/ad-hoc network with WPA-None/TKIP. -network={ - ssid="test adhoc" - mode=1 - frequency=2412 - proto=WPA - key_mgmt=WPA-NONE - pairwise=NONE - group=TKIP - psk="secret passphrase" -} - - -# Catch all example that allows more or less all configuration modes -network={ - ssid="example" - scan_ssid=1 - key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE - pairwise=CCMP TKIP - group=CCMP TKIP WEP104 WEP40 - psk="very secret passphrase" - eap=TTLS PEAP TLS - identity="user@example.com" - password="foobar" - ca_cert="/etc/cert/ca.pem" - client_cert="/etc/cert/user.pem" - private_key="/etc/cert/user.prv" - private_key_passwd="password" - phase1="peaplabel=0" -} - -# Example of EAP-TLS with smartcard (openssl engine) -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TLS - proto=RSN - pairwise=CCMP TKIP - group=CCMP TKIP - identity="user@example.com" - ca_cert="/etc/cert/ca.pem" - client_cert="/etc/cert/user.pem" - - engine=1 - - # The engine configured here must be available. Look at - # OpenSSL engine support in the global section. - # The key available through the engine must be the private key - # matching the client certificate configured above. - - # use the opensc engine - #engine_id="opensc" - #key_id="45" - - # use the pkcs11 engine - engine_id="pkcs11" - key_id="id_45" - - # Optional PIN configuration; this can be left out and PIN will be - # asked through the control interface - pin="1234" -} - -# Example configuration showing how to use an inlined blob as a CA certificate -# data instead of using external file -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TTLS - identity="user@example.com" - anonymous_identity="anonymous@example.com" - password="foobar" - ca_cert="blob://exampleblob" - priority=20 -} - -blob-base64-exampleblob={ -SGVsbG8gV29ybGQhCg== -} - - # Wildcard match for SSID (plaintext APs only). This example select any # open AP regardless of its SSID. network={ key_mgmt=NONE } + network={ ssid="myxjtu2" scan_ssid=1 @@ -852,6 +49,7 @@ network={ auth_alg=OPEN mode=1 } + network={ ssid=ab3ace key_mgmt=WPA-EAP diff --git a/src/settings/plugins/ifnet/wpa_parser.c b/src/settings/plugins/ifnet/wpa_parser.c index 0fd7d16b..e517bf12 100644 --- a/src/settings/plugins/ifnet/wpa_parser.c +++ b/src/settings/plugins/ifnet/wpa_parser.c @@ -163,7 +163,7 @@ add_one_wep_key (GHashTable * table, int key_num, gchar * one_wep_key) } /* Reading wep security information from /etc/conf.d/net. - * This should not be used in futre, use wpa_supplicant instead. */ + * This should not be used in future, use wpa_supplicant instead. */ static void add_keys_from_net () { diff --git a/src/settings/plugins/ifupdown/Makefile.am b/src/settings/plugins/ifupdown/Makefile.am index 9f9d0218..9d0ad259 100644 --- a/src/settings/plugins/ifupdown/Makefile.am +++ b/src/settings/plugins/ifupdown/Makefile.am @@ -1,11 +1,13 @@ -SUBDIRS=. tests +SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/logging \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util noinst_LTLIBRARIES = libifupdown-io.la @@ -18,13 +20,11 @@ libifupdown_io_la_SOURCES = \ libifupdown_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libifupdown_io_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) + $(GLIB_LIBS) pkglib_LTLIBRARIES = libnm-settings-plugin-ifupdown.la @@ -36,10 +36,8 @@ libnm_settings_plugin_ifupdown_la_SOURCES = \ libnm_settings_plugin_ifupdown_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifupdown_la_LDFLAGS = -module -avoid-version @@ -48,6 +46,5 @@ libnm_settings_plugin_ifupdown_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ libifupdown-io.la \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ $(GUDEV_LIBS) diff --git a/src/settings/plugins/ifupdown/Makefile.in b/src/settings/plugins/ifupdown/Makefile.in index 5663847e..def93ad7 100644 --- a/src/settings/plugins/ifupdown/Makefile.in +++ b/src/settings/plugins/ifupdown/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/ifupdown DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -102,8 +104,7 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = libifupdown_io_la_DEPENDENCIES = \ - $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) + $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) am_libifupdown_io_la_OBJECTS = libifupdown_io_la-interface_parser.lo \ libifupdown_io_la-parser.lo libifupdown_io_la_OBJECTS = $(am_libifupdown_io_la_OBJECTS) @@ -113,8 +114,7 @@ am__v_lt_0 = --silent libnm_settings_plugin_ifupdown_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/src/logging/libnm-logging.la libifupdown-io.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libnm_settings_plugin_ifupdown_la_OBJECTS = \ libnm_settings_plugin_ifupdown_la-nm-ifupdown-connection.lo \ libnm_settings_plugin_ifupdown_la-plugin.lo @@ -212,6 +212,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -226,9 +230,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -238,17 +240,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -289,6 +288,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -305,11 +305,7 @@ 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@ @@ -324,6 +320,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -333,6 +331,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -359,13 +358,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -420,6 +420,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -434,13 +439,19 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/logging \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util noinst_LTLIBRARIES = libifupdown-io.la libifupdown_io_la_SOURCES = \ @@ -452,13 +463,11 @@ libifupdown_io_la_SOURCES = \ libifupdown_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libifupdown_io_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) + $(GLIB_LIBS) pkglib_LTLIBRARIES = libnm-settings-plugin-ifupdown.la libnm_settings_plugin_ifupdown_la_SOURCES = \ @@ -469,10 +478,8 @@ libnm_settings_plugin_ifupdown_la_SOURCES = \ libnm_settings_plugin_ifupdown_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifupdown_la_LDFLAGS = -module -avoid-version @@ -481,7 +488,6 @@ libnm_settings_plugin_ifupdown_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ libifupdown-io.la \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ $(GUDEV_LIBS) all: all-recursive @@ -576,25 +582,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_ifupdown_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< diff --git a/src/settings/plugins/ifupdown/parser.c b/src/settings/plugins/ifupdown/parser.c index 7016b35f..d81fd84d 100644 --- a/src/settings/plugins/ifupdown/parser.c +++ b/src/settings/plugins/ifupdown/parser.c @@ -25,7 +25,6 @@ #include <arpa/inet.h> #include <stdlib.h> #include <errno.h> -#include <ctype.h> #include <nm-connection.h> #include <NetworkManager.h> @@ -447,7 +446,7 @@ ifupdown_ip4_add_dns (NMSettingIP4Config *s_ip4, const char *dns) list = g_strsplit_set (dns, " \t", -1); for (iter = list; iter && *iter; iter++) { g_strstrip (*iter); - if (isblank (*iter[0])) + if (g_ascii_isspace (*iter[0])) continue; if (!inet_pton (AF_INET, *iter, &addr)) { PLUGIN_WARN ("SCPlugin-Ifupdown", @@ -553,7 +552,7 @@ update_ip4_setting_from_if_block(NMConnection *connection, list = g_strsplit_set (search_v, " \t", -1); for (iter = list; iter && *iter; iter++) { g_strstrip (*iter); - if (isblank (*iter[0])) + if (g_ascii_isspace (*iter[0])) continue; if (!nm_setting_ip4_config_add_dns_search (s_ip4, *iter)) { PLUGIN_WARN ("SCPlugin-Ifupdown", @@ -586,7 +585,7 @@ ifupdown_ip6_add_dns (NMSettingIP6Config *s_ip6, const char *dns) list = g_strsplit_set (dns, " \t", -1); for (iter = list; iter && *iter; iter++) { g_strstrip (*iter); - if (isblank (*iter[0])) + if (g_ascii_isspace (*iter[0])) continue; if (!inet_pton (AF_INET6, *iter, &addr)) { PLUGIN_WARN ("SCPlugin-Ifupdown", diff --git a/src/settings/plugins/ifupdown/tests/Makefile.am b/src/settings/plugins/ifupdown/tests/Makefile.am index 54eeda7e..6bde26fe 100644 --- a/src/settings/plugins/ifupdown/tests/Makefile.am +++ b/src/settings/plugins/ifupdown/tests/Makefile.am @@ -1,6 +1,10 @@ +if ENABLE_TESTS + INCLUDES = \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util \ -I$(top_srcdir)/libnm-glib \ -I$(srcdir)/../ @@ -20,14 +24,12 @@ test_ifupdown_LDADD = \ $(builddir)/../libifupdown-io.la \ $(DBUS_LIBS) -if WITH_TESTS - check-local: test-ifupdown $(abs_builddir)/test-ifupdown -endif - EXTRA_DIST = \ test1 test2 test3 test4 test5 test6 test7 test8 test9 test11 test12 \ test13 test14 test15 test16 test17-wired-static-verify-ip4 \ test18-wired-static-verify-ip6 test19-wired-static-verify-ip4-plen + +endif diff --git a/src/settings/plugins/ifupdown/tests/Makefile.in b/src/settings/plugins/ifupdown/tests/Makefile.in index 8d7ef490..2d4be7bf 100644 --- a/src/settings/plugins/ifupdown/tests/Makefile.in +++ b/src/settings/plugins/ifupdown/tests/Makefile.in @@ -51,21 +51,23 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-ifupdown$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-ifupdown$(EXEEXT) subdir = src/settings/plugins/ifupdown/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -73,12 +75,16 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_ifupdown_OBJECTS = test_ifupdown-test-ifupdown.$(OBJEXT) +am__test_ifupdown_SOURCES_DIST = test-ifupdown.c +@ENABLE_TESTS_TRUE@am_test_ifupdown_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test_ifupdown-test-ifupdown.$(OBJEXT) test_ifupdown_OBJECTS = $(am_test_ifupdown_OBJECTS) am__DEPENDENCIES_1 = -test_ifupdown_DEPENDENCIES = $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(builddir)/../libifupdown-io.la $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_ifupdown_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifupdown-io.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -109,7 +115,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_ifupdown_SOURCES) -DIST_SOURCES = $(test_ifupdown_SOURCES) +DIST_SOURCES = $(am__test_ifupdown_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -130,6 +136,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -144,9 +154,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -156,17 +164,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -207,6 +212,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -223,11 +229,7 @@ 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@ @@ -242,6 +244,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -251,6 +255,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -277,13 +282,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -338,6 +344,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -352,30 +363,36 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_srcdir)/libnm-glib \ - -I$(srcdir)/../ - -test_ifupdown_SOURCES = \ - test-ifupdown.c - -test_ifupdown_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - -DTEST_ENI_DIR=\"$(abs_srcdir)\" - -test_ifupdown_LDADD = \ - $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(builddir)/../libifupdown-io.la \ - $(DBUS_LIBS) - -EXTRA_DIST = \ - test1 test2 test3 test4 test5 test6 test7 test8 test9 test11 test12 \ - test13 test14 test15 test16 test17-wired-static-verify-ip4 \ - test18-wired-static-verify-ip6 test19-wired-static-verify-ip4-plen +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-glib \ +@ENABLE_TESTS_TRUE@ -I$(srcdir)/../ + +@ENABLE_TESTS_TRUE@test_ifupdown_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-ifupdown.c + +@ENABLE_TESTS_TRUE@test_ifupdown_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) \ +@ENABLE_TESTS_TRUE@ -DTEST_ENI_DIR=\"$(abs_srcdir)\" + +@ENABLE_TESTS_TRUE@test_ifupdown_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifupdown-io.la \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) + +@ENABLE_TESTS_TRUE@EXTRA_DIST = \ +@ENABLE_TESTS_TRUE@ test1 test2 test3 test4 test5 test6 test7 test8 test9 test11 test12 \ +@ENABLE_TESTS_TRUE@ test13 test14 test15 test16 test17-wired-static-verify-ip4 \ +@ENABLE_TESTS_TRUE@ test18-wired-static-verify-ip6 test19-wired-static-verify-ip4-plen all: all-am @@ -433,25 +450,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ifupdown-test-ifupdown.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< @@ -558,7 +572,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am @@ -682,8 +696,8 @@ uninstall-am: tags uninstall uninstall-am -@WITH_TESTS_TRUE@check-local: test-ifupdown -@WITH_TESTS_TRUE@ $(abs_builddir)/test-ifupdown +@ENABLE_TESTS_TRUE@check-local: test-ifupdown +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-ifupdown # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/settings/plugins/keyfile/Makefile.am b/src/settings/plugins/keyfile/Makefile.am index 83031c24..a9fbb663 100644 --- a/src/settings/plugins/keyfile/Makefile.am +++ b/src/settings/plugins/keyfile/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=. tests +SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/settings \ @@ -26,8 +26,7 @@ libkeyfile_io_la_SOURCES = \ libkeyfile_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libkeyfile_io_la_LIBADD = $(GLIB_LIBS) @@ -41,18 +40,14 @@ libnm_settings_plugin_keyfile_la_SOURCES = \ libnm_settings_plugin_keyfile_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libnm_settings_plugin_keyfile_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ libkeyfile-io.la \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(DBUS_LIBS) \ - $(GIO_LIBS) + $(DBUS_LIBS) libnm_settings_plugin_keyfile_la_LDFLAGS = -rdynamic diff --git a/src/settings/plugins/keyfile/Makefile.in b/src/settings/plugins/keyfile/Makefile.in index 6e70908d..071838b1 100644 --- a/src/settings/plugins/keyfile/Makefile.in +++ b/src/settings/plugins/keyfile/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/keyfile DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -83,7 +85,6 @@ am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libnm_settings_plugin_keyfile_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la libkeyfile-io.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libnm_settings_plugin_keyfile_la_OBJECTS = \ libnm_settings_plugin_keyfile_la-nm-keyfile-connection.lo \ @@ -182,6 +183,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -196,9 +201,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -208,17 +211,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -259,6 +259,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -275,11 +276,7 @@ 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@ @@ -294,6 +291,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -303,6 +302,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -329,13 +329,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -390,6 +391,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -404,6 +410,10 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/settings \ @@ -431,8 +441,7 @@ libkeyfile_io_la_SOURCES = \ libkeyfile_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libkeyfile_io_la_LIBADD = $(GLIB_LIBS) @@ -445,18 +454,14 @@ libnm_settings_plugin_keyfile_la_SOURCES = \ libnm_settings_plugin_keyfile_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libnm_settings_plugin_keyfile_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ libkeyfile-io.la \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(DBUS_LIBS) \ - $(GIO_LIBS) + $(DBUS_LIBS) libnm_settings_plugin_keyfile_la_LDFLAGS = -rdynamic keyfiledir = $(sysconfdir)/NetworkManager/system-connections @@ -522,25 +527,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_keyfile_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< diff --git a/src/settings/plugins/keyfile/common.h b/src/settings/plugins/keyfile/common.h index 7d94a705..d48c32f2 100644 --- a/src/settings/plugins/keyfile/common.h +++ b/src/settings/plugins/keyfile/common.h @@ -26,7 +26,7 @@ #define KEYFILE_PLUGIN_NAME "keyfile" #define KEYFILE_PLUGIN_INFO "(c) 2007 - 2010 Red Hat, Inc. To report bugs please use the NetworkManager mailing list." -#define KEYFILE_DIR SYSCONFDIR "/NetworkManager/system-connections" +#define KEYFILE_DIR NMCONFDIR "/system-connections" #define VPN_SECRETS_GROUP "vpn-secrets" diff --git a/src/settings/plugins/keyfile/nm-keyfile-connection.c b/src/settings/plugins/keyfile/nm-keyfile-connection.c index 23618f7c..6d72bbfe 100644 --- a/src/settings/plugins/keyfile/nm-keyfile-connection.c +++ b/src/settings/plugins/keyfile/nm-keyfile-connection.c @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 - 2011 Red Hat, Inc. + * Copyright (C) 2008 - 2012 Red Hat, Inc. */ #include <string.h> @@ -96,6 +96,19 @@ nm_keyfile_connection_get_path (NMKeyfileConnection *self) return NM_KEYFILE_CONNECTION_GET_PRIVATE (self)->path; } +void +nm_keyfile_connection_set_path (NMKeyfileConnection *self, const char *path) +{ + NMKeyfileConnectionPrivate *priv; + + g_return_if_fail (NM_IS_KEYFILE_CONNECTION (self)); + g_return_if_fail (path != NULL); + + priv = NM_KEYFILE_CONNECTION_GET_PRIVATE (self); + g_free (priv->path); + priv->path = g_strdup (path); +} + static void commit_changes (NMSettingsConnection *connection, NMSettingsConnectionCommitFunc callback, diff --git a/src/settings/plugins/keyfile/nm-keyfile-connection.h b/src/settings/plugins/keyfile/nm-keyfile-connection.h index 932b36f7..e3bce11b 100644 --- a/src/settings/plugins/keyfile/nm-keyfile-connection.h +++ b/src/settings/plugins/keyfile/nm-keyfile-connection.h @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 - 2011 Red Hat, Inc. + * Copyright (C) 2008 - 2012 Red Hat, Inc. */ #ifndef NM_KEYFILE_CONNECTION_H @@ -48,6 +48,7 @@ NMKeyfileConnection *nm_keyfile_connection_new (const char *filename, GError **error); const char *nm_keyfile_connection_get_path (NMKeyfileConnection *self); +void nm_keyfile_connection_set_path (NMKeyfileConnection *self, const char *path); G_END_DECLS diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c index d53907a9..062eb082 100644 --- a/src/settings/plugins/keyfile/plugin.c +++ b/src/settings/plugins/keyfile/plugin.c @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 - 2011 Red Hat, Inc. + * Copyright (C) 2008 - 2012 Red Hat, Inc. */ #include <config.h> @@ -268,6 +268,10 @@ dir_changed (GFileMonitor *monitor, * filename property too. */ update_connection_settings (found, connection); + /* However, when connections are the same and only the filename changed + * we need to update the path manually (commit_changes() is not called. + */ + nm_keyfile_connection_set_path (found, full_path); /* Re-insert the connection back into the hash with the new filename */ g_hash_table_insert (priv->hash, diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugins/keyfile/reader.c index 7f0ab4af..6ddf50d5 100644 --- a/src/settings/plugins/keyfile/reader.c +++ b/src/settings/plugins/keyfile/reader.c @@ -39,7 +39,6 @@ #include <netinet/ether.h> #include <linux/if_infiniband.h> #include <string.h> -#include <ctype.h> #include "nm-dbus-glib-types.h" #include "nm-system-config-interface.h" @@ -58,13 +57,13 @@ read_array_of_uint (GKeyFile *file, tmp = g_key_file_get_integer_list (file, nm_setting_get_name (setting), key, &length, NULL); array = g_array_sized_new (FALSE, FALSE, sizeof (guint32), length); + g_return_val_if_fail (array != NULL, FALSE); + for (i = 0; i < length; i++) g_array_append_val (array, tmp[i]); - if (array) { - g_object_set (setting, key, array, NULL); - g_array_free (array, TRUE); - } + g_object_set (setting, key, array, NULL); + g_array_unref (array); return TRUE; } @@ -85,209 +84,326 @@ get_one_int (const char *str, guint32 max_val, const char *key_name, guint32 *ou return TRUE; } -static void -free_one_ip4_address (gpointer data, gpointer user_data) +static gpointer +build_ip4_address_or_route (const char *address_str, guint32 plen, const char *gateway_str, guint32 metric, gboolean route) { - g_array_free ((GArray *) data, TRUE); -} + GArray *result; + struct in_addr addr; + guint32 address = 0; + guint32 gateway = 0; + int err; + + g_return_val_if_fail (address_str, NULL); + + /* Address */ + err = inet_pton (AF_INET, address_str, &addr); + if (err <= 0) { + g_warning ("%s: ignoring invalid IPv4 address '%s'", __func__, address_str); + return NULL; + } + address = addr.s_addr; + /* Gateway */ + if (gateway_str) { + err = inet_pton (AF_INET, gateway_str, &addr); + if (err <= 0) { + g_warning ("%s: ignoring invalid IPv4 gateway '%s'", __func__, gateway_str); + return NULL; + } + gateway = addr.s_addr; + } + else + gateway = 0; -static GPtrArray * -read_ip4_addresses (GKeyFile *file, - const char *setting_name, - const char *key) -{ - GPtrArray *addresses; - int i = 0; + result = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3); + g_array_append_val (result, address); + g_array_append_val (result, plen); + g_array_append_val (result, gateway); + if (route) + g_array_append_val (result, metric); - addresses = g_ptr_array_sized_new (3); + return result; +} - /* Look for individual addresses */ - while (i++ < 1000) { - gchar **tmp, **iter; - char *key_name; - gsize length = 0; - int ret; - GArray *address; - guint32 empty = 0; - int j; +static gpointer +build_ip6_address_or_route (const char *address_str, guint32 plen, const char *gateway_str, guint32 metric, gboolean route) +{ + GValueArray *result; + struct in6_addr addr; + GByteArray *address; + GByteArray *gateway; + GValue value = { 0, }; + int err; - key_name = g_strdup_printf ("%s%d", key, i); - tmp = g_key_file_get_string_list (file, setting_name, key_name, &length, NULL); + g_return_val_if_fail (address_str, NULL); - if (!tmp || !length) { - g_free (key_name); - break; /* all done */ - } + result = g_value_array_new (3); - if ((length < 2) || (length > 3)) { - g_warning ("%s: ignoring invalid IPv4 address item '%s'", __func__, key_name); - goto next; + /* add address */ + err = inet_pton (AF_INET6, address_str, &addr); + if (err <= 0) { + g_warning ("%s: ignoring invalid IPv6 address '%s'", __func__, address_str); + g_value_array_free (result); + return NULL; + } + address = g_byte_array_new (); + g_byte_array_append (address, (guint8 *) addr.s6_addr, 16); + g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); + g_value_take_boxed (&value, address); + g_value_array_append (result, &value); + g_value_unset (&value); + + /* add prefix length */ + g_value_init (&value, G_TYPE_UINT); + g_value_set_uint (&value, plen); + g_value_array_append (result, &value); + g_value_unset (&value); + + /* add gateway */ + if (gateway_str) { + err = inet_pton (AF_INET6, gateway_str, &addr); + if (err <= 0) { + g_warning ("%s: ignoring invalid IPv6 gateway '%s'", __func__, gateway_str); + g_value_array_free (result); + return NULL; } + } else + memset (&addr, 0, 16); + gateway = g_byte_array_new (); + g_byte_array_append (gateway, (guint8 *) addr.s6_addr, 16); + g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); + g_value_take_boxed (&value, gateway); + g_value_array_append (result, &value); + g_value_unset (&value); + + /* add metric (for routing) */ + if (route) { + g_value_init (&value, G_TYPE_UINT); + g_value_set_uint (&value, metric); + g_value_array_append (result, &value); + g_value_unset (&value); + } - /* convert the string array into IP addresses */ - address = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3); - for (iter = tmp, j = 0; *iter; iter++, j++) { - struct in_addr addr; + return result; +} - if (j == 1) { - guint32 prefix = 0; +/* On success, returns pointer to the zero-terminated field (original @current). + * The @current * pointer target is set to point to the rest of the input + * or NULL if there is no more input. Sets error to NULL for convenience. + * + * On failure, returns NULL (unspecified). The @current pointer target is + * resets to its original value to allow skipping fields. The @error target + * is set to the character that breaks the parsing or NULL if @current was NULL. + * + * When @current target is NULL, gracefully fail returning NULL while + * leaving the @current target NULL end setting @error to NULL; + */ +static char * +read_field (char **current, char **error, const char *characters, const char *delimiters) +{ + char *start; - /* prefix */ - if (!get_one_int (*iter, 32, key_name, &prefix)) { - g_array_free (address, TRUE); - goto next; - } + g_return_val_if_fail (current, NULL); + g_return_val_if_fail (error, NULL); + g_return_val_if_fail (characters, NULL); + g_return_val_if_fail (delimiters, NULL); - g_array_append_val (address, prefix); - } else { - /* address and gateway */ - ret = inet_pton (AF_INET, *iter, &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv4 %s element '%s'", __func__, key_name, *iter); - g_array_free (address, TRUE); - goto next; - } - g_array_append_val (address, addr.s_addr); - } - } + if (!*current) { + /* graceful failure, leave '*current' NULL */ + *error = NULL; + return NULL; + } - /* fill in blank gateway if not specified */ - if (address->len == 2) - g_array_append_val (address, empty); + /* fail on empty input */ + g_return_val_if_fail (**current, NULL); - g_ptr_array_add (addresses, address); + /* remember beginning of input */ + start = *current; -next: - g_free (key_name); - g_strfreev (tmp); + while (**current && strchr (characters, **current)) + (*current)++; + if (**current) + if (strchr (delimiters, **current)) { + /* success, more data available */ + *error = NULL; + *(*current)++ = '\0'; + return start; + } else { + /* error, bad character */ + *error = *current; + *current = start; + return NULL; + } + else { + /* success, end of input */ + *error = NULL; + *current = NULL; + return start; } +} - if (addresses->len < 1) { - g_ptr_array_free (addresses, TRUE); - addresses = NULL; - } +#define IP_ADDRESS_CHARS "0123456789abcdefABCDEF:.%" +#define DIGITS "0123456789" +#define DELIMITERS "/;," - return addresses; -} -static void -ip4_addr_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) +/* The following IPv4 and IPv6 address formats are supported: + * + * address (DEPRECATED) + * address/plen + * address/gateway (DEPRECATED) + * address/plen/gateway + * + * The following IPv4 and IPv6 route formats are supported: + * + * address/plen (NETWORK dev DEVICE) + * address/plen/gateway (NETWORK via GATEWAY dev DEVICE) + * address/plen//gateway (NETWORK dev DEVICE metric METRIC) + * address/plen/gateway/metric (NETWORK via GATEWAY dev DEVICE metric METRIC) + * + * For backward, forward and sideward compatibility, slash (/), + * semicolon (;) and comma (,) are interchangable. The use of + * slash in the above examples is therefore not significant. + * + * Leaving out the prefix length is discouraged and DEPRECATED. The + * default value of IPv6 prefix length was 64 and has not been + * changed. The default for IPv4 is now 24, which is the closest + * IPv4 equivalent. These defaults may just as well be changed to + * match the iproute2 defaults (32 for IPv4 and 128 for IPv6). + * + * The returned result is GArray for IPv4 and GValueArray for IPv6. + */ +static gpointer +read_one_ip_address_or_route (GKeyFile *file, + const char *setting_name, + const char *key_name, + gboolean ipv6, + gboolean route) { - GPtrArray *addresses; - const char *setting_name = nm_setting_get_name (setting); + guint32 plen, metric; + gpointer result; + char *address_str, *plen_str, *gateway_str, *metric_str, *value, *current, *error; - addresses = read_ip4_addresses (keyfile, setting_name, key); + current = value = g_key_file_get_string (file, setting_name, key_name, NULL); + if (!value) + return NULL; - /* Work around for previous syntax */ - if (!addresses && !strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES)) - addresses = read_ip4_addresses (keyfile, setting_name, "address"); + /* get address field */ + address_str = read_field (¤t, &error, IP_ADDRESS_CHARS, DELIMITERS); + if (error) { + g_warning ("keyfile: Unexpected character '%c' in '%s.%s' address (position %td of '%s').", + *error, setting_name, key_name, error - current, current); + goto error; + } + /* get prefix length field (skippable) */ + plen_str = read_field (¤t, &error, DIGITS, DELIMITERS); + /* get gateway field */ + gateway_str = read_field (¤t, &error, IP_ADDRESS_CHARS, DELIMITERS); + if (error) { + g_warning ("keyfile: Unexpected character '%c' in '%s.%s' %s (position %td of '%s').", + *error, setting_name, key_name, + plen_str ? "gateway" : "gateway or prefix length", + error - current, current); + goto error; + } + /* for routes, get metric */ + if (route) { + metric_str = read_field (¤t, &error, DIGITS, DELIMITERS); + if (error) { + g_warning ("keyfile: Unexpected character '%c' in '%s.%s' prefix length (position %td of '%s').", + *error, setting_name, key_name, error - current, current); + goto error; + } + } else + metric_str = NULL; + if (current) { + /* there is still some data */ + if (*current) { + /* another field follows */ + g_warning ("keyfile: %s.%s: Garbage at the and of the line: %s", + setting_name, key_name, current); + goto error; + } else { + /* semicolon at the end of input */ + g_message ("keyfile: %s.%s: Deprecated semicolon at the end of value.", + setting_name, key_name); + } + } - if (addresses) { - g_object_set (setting, key, addresses, NULL); - g_ptr_array_foreach (addresses, free_one_ip4_address, NULL); - g_ptr_array_free (addresses, TRUE); + /* parse plen, fallback to defaults */ + if (plen_str) + g_return_val_if_fail (get_one_int (plen_str, ipv6 ? 128 : 32, + key_name, &plen), NULL); + else { + if (route) + plen = ipv6 ? 128 : 24; + else + plen = ipv6 ? 64 : 24; + g_warning ("keyfile: Missing prefix length in '%s.%s', defaulting to %d", + setting_name, key_name, plen); } -} -static void -free_one_ip4_route (gpointer data, gpointer user_data) -{ - g_array_free ((GArray *) data, TRUE); + /* parse metric, default to 0 */ + metric = 0; + if (metric_str) + g_return_val_if_fail (get_one_int (metric_str, G_MAXUINT32, + key_name, &metric), NULL); + + /* build the appropriate data structure for NetworkManager settings */ + if (route) + g_debug ("keyfile: %s.%s: route %s/%d gateway %s metric %d", setting_name, key_name, address_str, plen, gateway_str, metric); + else + g_debug ("keyfile: %s.%s: address %s/%d gateway %s", setting_name, key_name, address_str, plen, gateway_str); + result = (ipv6 ? build_ip6_address_or_route : build_ip4_address_or_route) ( + address_str, plen, gateway_str, metric, route); + + g_free (value); + return result; +error: + g_free (value); + return NULL; } -static GPtrArray * -read_ip4_routes (GKeyFile *file, - const char *setting_name, - const char *key) +static void +ip_address_or_route_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) { - GPtrArray *routes; - int i = 0; - - routes = g_ptr_array_sized_new (3); - - /* Look for individual routes */ - while (i++ < 1000) { - gchar **tmp, **iter; - char *key_name; - gsize length = 0; - int ret; - GArray *route; - int j; - - key_name = g_strdup_printf ("%s%d", key, i); - tmp = g_key_file_get_string_list (file, setting_name, key_name, &length, NULL); - g_free (key_name); - - if (!tmp || !length) - break; /* all done */ - - if (length != 4) { - g_warning ("%s: ignoring invalid IPv4 route item '%s'", __func__, key_name); - goto next; - } + const char *setting_name = nm_setting_get_name (setting); + gboolean ipv6 = !strcmp (setting_name, "ipv6"); + gboolean routes = !strcmp (key, "routes"); + static const char *key_names_routes[] = { "route", "routes", NULL }; + static const char *key_names_addresses[] = { "address", "addresses", NULL }; + const char **key_names = routes ? key_names_routes : key_names_addresses; + GPtrArray *list; + int i; - /* convert the string array into IP addresses */ - route = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 4); - for (iter = tmp, j = 0; *iter; iter++, j++) { - struct in_addr addr; + list = g_ptr_array_new_with_free_func ( + ipv6 ? (GDestroyNotify) g_value_array_free : (GDestroyNotify) g_array_unref); - if (j == 1) { - guint32 prefix = 0; + for (i = -1; i < 1000; i++) { + const char **key_basename; + + for (key_basename = key_names; *key_basename; key_basename++) { + char *key_name; + gpointer item; - /* prefix */ - if (!get_one_int (*iter, 32, key_name, &prefix)) { - g_array_free (route, TRUE); - goto next; - } + /* -1 means no suffix */ + if (i >= 0) + key_name = g_strdup_printf ("%s%d", *key_basename, i); + else + key_name = g_strdup (*key_basename); - g_array_append_val (route, prefix); - } else if (j == 3) { - guint32 metric = 0; + item = read_one_ip_address_or_route (keyfile, setting_name, key_name, ipv6, routes); - /* metric */ - if (!get_one_int (*iter, G_MAXUINT32, key_name, &metric)) { - g_array_free (route, TRUE); - goto next; - } + if (item) + g_ptr_array_add (list, item); - g_array_append_val (route, metric); - } else { - /* address and next hop */ - ret = inet_pton (AF_INET, *iter, &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv4 %s element '%s'", __func__, key_name, *iter); - g_array_free (route, TRUE); - goto next; - } - g_array_append_val (route, addr.s_addr); - } + g_free (key_name); } - g_ptr_array_add (routes, route); - -next: - g_strfreev (tmp); - } - - if (routes->len < 1) { - g_ptr_array_free (routes, TRUE); - routes = NULL; } - return routes; -} - -static void -ip4_route_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) -{ - GPtrArray *routes; - const char *setting_name = nm_setting_get_name (setting); + if (list->len >= 1) + g_object_set (setting, key, list, NULL); - routes = read_ip4_routes (keyfile, setting_name, key); - if (routes) { - g_object_set (setting, key, routes, NULL); - g_ptr_array_foreach (routes, free_one_ip4_route, NULL); - g_ptr_array_free (routes, TRUE); - } + g_ptr_array_unref (list); } static void @@ -319,301 +435,11 @@ ip4_dns_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const ch if (array) { g_object_set (setting, key, array, NULL); - g_array_free (array, TRUE); - } -} - -static void -free_one_ip6_address (gpointer data, gpointer user_data) -{ - g_value_array_free ((GValueArray *) data); -} - -static char * -split_prefix (char *addr) -{ - char *slash; - - g_return_val_if_fail (addr != NULL, NULL); - - /* Find the prefix and split the string */ - slash = strchr (addr, '/'); - if (slash && slash > addr) { - slash++; - *(slash - 1) = '\0'; - } - - return slash; -} - -static char * -split_gw (char *str) -{ - char *comma; - - g_return_val_if_fail (str != NULL, NULL); - - /* Find the prefix and split the string */ - comma = strchr (str, ','); - if (comma && comma > str) { - comma++; - *(comma - 1) = '\0'; - return comma; - } - return NULL; -} - -static GPtrArray * -read_ip6_addresses (GKeyFile *file, - const char *setting_name, - const char *key) -{ - GPtrArray *addresses; - struct in6_addr addr, gw; - guint32 prefix; - int i = 0; - - addresses = g_ptr_array_sized_new (3); - - /* Look for individual addresses */ - while (i++ < 1000) { - char *tmp, *key_name, *str_prefix, *str_gw; - int ret; - GValueArray *values; - GByteArray *address; - GByteArray *gateway; - GValue value = { 0 }; - - key_name = g_strdup_printf ("%s%d", key, i); - tmp = g_key_file_get_string (file, setting_name, key_name, NULL); - g_free (key_name); - - if (!tmp) - break; /* all done */ - - /* convert the string array into IPv6 addresses */ - values = g_value_array_new (2); /* NMIP6Address has 2 items */ - - /* Split the address and prefix */ - str_prefix = split_prefix (tmp); - - /* address */ - ret = inet_pton (AF_INET6, tmp, &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv6 %s element '%s'", __func__, key_name, tmp); - g_value_array_free (values); - goto next; - } - - address = g_byte_array_new (); - g_byte_array_append (address, (guint8 *) addr.s6_addr, 16); - g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); - g_value_take_boxed (&value, address); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* prefix */ - prefix = 0; - if (str_prefix) { - if (!get_one_int (str_prefix, 128, key_name, &prefix)) { - g_value_array_free (values); - goto next; - } - } else { - /* Missing prefix defaults to /64 */ - prefix = 64; - } - - g_value_init (&value, G_TYPE_UINT); - g_value_set_uint (&value, prefix); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* Gateway (optional) */ - str_gw = split_gw (str_prefix); - if (str_gw) { - ret = inet_pton (AF_INET6, str_gw, &gw); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv6 %s gateway '%s'", __func__, key_name, tmp); - g_value_array_free (values); - goto next; - } - - if (!IN6_IS_ADDR_UNSPECIFIED (&gw)) { - gateway = g_byte_array_new (); - g_byte_array_append (gateway, (guint8 *) gw.s6_addr, 16); - g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); - g_value_take_boxed (&value, gateway); - g_value_array_append (values, &value); - g_value_unset (&value); - } - } - - g_ptr_array_add (addresses, values); - -next: - g_free (tmp); - } - - if (addresses->len < 1) { - g_ptr_array_free (addresses, TRUE); - addresses = NULL; - } - - return addresses; -} - -static void -ip6_addr_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) -{ - GPtrArray *addresses; - const char *setting_name = nm_setting_get_name (setting); - - addresses = read_ip6_addresses (keyfile, setting_name, key); - if (addresses) { - g_object_set (setting, key, addresses, NULL); - g_ptr_array_foreach (addresses, free_one_ip6_address, NULL); - g_ptr_array_free (addresses, TRUE); + g_array_unref (array); } } static void -free_one_ip6_route (gpointer data, gpointer user_data) -{ - g_value_array_free ((GValueArray *) data); -} - -static GPtrArray * -read_ip6_routes (GKeyFile *file, - const char *setting_name, - const char *key) -{ - GPtrArray *routes; - struct in6_addr addr; - guint32 prefix, metric; - int i = 0; - - routes = g_ptr_array_sized_new (3); - - /* Look for individual routes */ - while (i++ < 1000) { - gchar **tmp; - char *key_name, *str_prefix; - gsize length = 0; - int ret; - GValueArray *values; - GByteArray *address; - GValue value = { 0 }; - - key_name = g_strdup_printf ("%s%d", key, i); - tmp = g_key_file_get_string_list (file, setting_name, key_name, &length, NULL); - g_free (key_name); - - if (!tmp || !length) - break; /* all done */ - - if (length != 3) { - g_warning ("%s: ignoring invalid IPv6 address item '%s'", __func__, key_name); - goto next; - } - - /* convert the string array into IPv6 routes */ - values = g_value_array_new (4); /* NMIP6Route has 4 items */ - - /* Split the route and prefix */ - str_prefix = split_prefix (tmp[0]); - - /* destination address */ - ret = inet_pton (AF_INET6, tmp[0], &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv6 %s element '%s'", __func__, key_name, tmp[0]); - g_value_array_free (values); - goto next; - } - address = g_byte_array_new (); - g_byte_array_append (address, (guint8 *) addr.s6_addr, 16); - g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); - g_value_take_boxed (&value, address); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* prefix */ - prefix = 0; - if (str_prefix) { - if (!get_one_int (str_prefix, 128, key_name, &prefix)) { - g_value_array_free (values); - goto next; - } - } else { - /* default to 64 if unspecified */ - prefix = 64; - } - g_value_init (&value, G_TYPE_UINT); - g_value_set_uint (&value, prefix); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* next hop address */ - ret = inet_pton (AF_INET6, tmp[1], &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv6 %s element '%s'", __func__, key_name, tmp[1]); - g_value_array_free (values); - goto next; - } - address = g_byte_array_new (); - g_byte_array_append (address, (guint8 *) addr.s6_addr, 16); - g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); - g_value_take_boxed (&value, address); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* metric */ - metric = 0; - if (!get_one_int (tmp[2], G_MAXUINT32, key_name, &metric)) { - g_value_array_free (values); - goto next; - } - g_value_init (&value, G_TYPE_UINT); - g_value_set_uint (&value, metric); - g_value_array_append (values, &value); - g_value_unset (&value); - - g_ptr_array_add (routes, values); - -next: - g_strfreev (tmp); - } - - if (routes->len < 1) { - g_ptr_array_free (routes, TRUE); - routes = NULL; - } - - return routes; -} - -static void -ip6_route_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) -{ - GPtrArray *routes; - const char *setting_name = nm_setting_get_name (setting); - - routes = read_ip6_routes (keyfile, setting_name, key); - - if (routes) { - g_object_set (setting, key, routes, NULL); - g_ptr_array_foreach (routes, free_one_ip6_route, NULL); - g_ptr_array_free (routes, TRUE); - } -} - -static void -free_one_ip6_dns (gpointer data, gpointer user_data) -{ - g_byte_array_free ((GByteArray *) data, TRUE); -} - -static void ip6_dns_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) { const char *setting_name = nm_setting_get_name (setting); @@ -626,7 +452,8 @@ ip6_dns_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const ch if (!list || !g_strv_length (list)) return; - array = g_ptr_array_sized_new (length); + array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_byte_array_unref); + for (iter = list; *iter; iter++) { GByteArray *byte_array; struct in6_addr addr; @@ -645,8 +472,7 @@ ip6_dns_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const ch if (array) { g_object_set (setting, key, array, NULL); - g_ptr_array_foreach (array, free_one_ip6_dns, NULL); - g_ptr_array_free (array, TRUE); + g_ptr_array_unref (array); } } @@ -988,26 +814,26 @@ typedef struct { /* A table of keys that require further parsing/conversion because they are * stored in a format that can't be automatically read using the key's type. * i.e. IPv4 addresses, which are stored in NetworkManager as guint32, but are - * stored in keyfiles as strings, eg "10.1.1.2" or IPv6 addresses stored + * stored in keyfiles as strings, eg "10.1.1.2" or IPv6 addresses stored * in struct in6_addr internally, but as string in keyfiles. */ static KeyParser key_parsers[] = { { NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES, FALSE, - ip4_addr_parser }, + ip_address_or_route_parser }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDRESSES, FALSE, - ip6_addr_parser }, + ip_address_or_route_parser }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ROUTES, FALSE, - ip4_route_parser }, + ip_address_or_route_parser }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ROUTES, FALSE, - ip6_route_parser }, + ip_address_or_route_parser }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS, FALSE, @@ -1044,6 +870,10 @@ static KeyParser key_parsers[] = { NM_SETTING_INFINIBAND_MAC_ADDRESS, TRUE, mac_address_parser }, + { NM_SETTING_WIMAX_SETTING_NAME, + NM_SETTING_WIMAX_MAC_ADDRESS, + TRUE, + mac_address_parser }, { NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_SSID, TRUE, @@ -1359,6 +1189,8 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error) g_clear_error (&verify_error); g_object_unref (connection); connection = NULL; + g_warning ("Connection failed to verify: %s", + verify_error ? g_type_name (nm_connection_lookup_setting_type_by_quark (verify_error->domain)) : "(unknown)"); } out: diff --git a/src/settings/plugins/keyfile/tests/Makefile.am b/src/settings/plugins/keyfile/tests/Makefile.am index 2adbf873..26e8eafd 100644 --- a/src/settings/plugins/keyfile/tests/Makefile.am +++ b/src/settings/plugins/keyfile/tests/Makefile.am @@ -1,3 +1,5 @@ +if ENABLE_TESTS + SUBDIRS=keyfiles INCLUDES = \ @@ -25,10 +27,7 @@ test_keyfile_LDADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(DBUS_LIBS) -if WITH_TESTS - check-local: test-keyfile $(abs_builddir)/test-keyfile endif - diff --git a/src/settings/plugins/keyfile/tests/Makefile.in b/src/settings/plugins/keyfile/tests/Makefile.in index 991cd55e..ae5836f5 100644 --- a/src/settings/plugins/keyfile/tests/Makefile.in +++ b/src/settings/plugins/keyfile/tests/Makefile.in @@ -51,21 +51,23 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-keyfile$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-keyfile$(EXEEXT) subdir = src/settings/plugins/keyfile/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -73,12 +75,16 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_keyfile_OBJECTS = test_keyfile-test-keyfile.$(OBJEXT) +am__test_keyfile_SOURCES_DIST = test-keyfile.c +@ENABLE_TESTS_TRUE@am_test_keyfile_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test_keyfile-test-keyfile.$(OBJEXT) test_keyfile_OBJECTS = $(am_test_keyfile_OBJECTS) am__DEPENDENCIES_1 = -test_keyfile_DEPENDENCIES = $(builddir)/../libkeyfile-io.la \ - $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_keyfile_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libkeyfile-io.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -109,7 +115,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_keyfile_SOURCES) -DIST_SOURCES = $(test_keyfile_SOURCES) +DIST_SOURCES = $(am__test_keyfile_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -129,7 +135,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ distdir ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) +DIST_SUBDIRS = keyfiles DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -168,6 +174,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -182,9 +192,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -194,17 +202,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -245,6 +250,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -261,11 +267,7 @@ 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@ @@ -280,6 +282,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -289,6 +293,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -315,13 +320,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -376,6 +382,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -390,29 +401,33 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = keyfiles -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_builddir)/libnm-util \ - -I$(top_srcdir)/libnm-glib \ - -I$(srcdir)/../ - -test_keyfile_SOURCES = \ - test-keyfile.c - -test_keyfile_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - -DTEST_KEYFILES_DIR=\"$(abs_srcdir)/keyfiles\" \ - -DTEST_SCRATCH_DIR=\"$(abs_builddir)/keyfiles\" - -test_keyfile_LDADD = \ - $(builddir)/../libkeyfile-io.la \ - $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(DBUS_LIBS) +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@SUBDIRS = keyfiles +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-glib \ +@ENABLE_TESTS_TRUE@ -I$(srcdir)/../ + +@ENABLE_TESTS_TRUE@test_keyfile_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-keyfile.c + +@ENABLE_TESTS_TRUE@test_keyfile_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) \ +@ENABLE_TESTS_TRUE@ -DTEST_KEYFILES_DIR=\"$(abs_srcdir)/keyfiles\" \ +@ENABLE_TESTS_TRUE@ -DTEST_SCRATCH_DIR=\"$(abs_builddir)/keyfiles\" + +@ENABLE_TESTS_TRUE@test_keyfile_LDADD = \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libkeyfile-io.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) all: all-recursive @@ -470,25 +485,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_keyfile-test-keyfile.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< @@ -703,7 +715,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-recursive @@ -830,8 +842,8 @@ uninstall-am: tags tags-recursive uninstall uninstall-am -@WITH_TESTS_TRUE@check-local: test-keyfile -@WITH_TESTS_TRUE@ $(abs_builddir)/test-keyfile +@ENABLE_TESTS_TRUE@check-local: test-keyfile +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-keyfile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am b/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am index f163312e..759b29f4 100644 --- a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am +++ b/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am @@ -14,7 +14,9 @@ KEYFILES = \ Test_Wired_TLS_New \ Test_Wired_TLS_Blob \ Test_Wired_TLS_Path_Missing \ - Test_InfiniBand_Connection + Test_InfiniBand_Connection \ + Test_Bridge_Main \ + Test_Bridge_Component CERTS = \ test-ca-cert.pem \ diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.in b/src/settings/plugins/keyfile/tests/keyfiles/Makefile.in index 930d9af5..0f0a0445 100644 --- a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.in +++ b/src/settings/plugins/keyfile/tests/keyfiles/Makefile.in @@ -54,16 +54,18 @@ subdir = src/settings/plugins/keyfile/tests/keyfiles DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -96,6 +98,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -110,9 +116,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -122,17 +126,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -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@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -173,6 +174,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -189,11 +191,7 @@ 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@ @@ -208,6 +206,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -217,6 +217,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -243,13 +244,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -304,6 +306,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -318,6 +325,10 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ KEYFILES = \ Test_Wired_Connection \ Test_GSM_Connection \ @@ -334,7 +345,9 @@ KEYFILES = \ Test_Wired_TLS_New \ Test_Wired_TLS_Blob \ Test_Wired_TLS_Path_Missing \ - Test_InfiniBand_Connection + Test_InfiniBand_Connection \ + Test_Bridge_Main \ + Test_Bridge_Component CERTS = \ test-ca-cert.pem \ diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component b/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component new file mode 100644 index 00000000..f5463ed0 --- /dev/null +++ b/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component @@ -0,0 +1,15 @@ +[connection] +id=Test Bridge Component +uuid=d7b4f96c-c45e-4298-bef8-f48574f8c1c0 +type=802-3-ethernet +master=br0 +slave-type=bridge + +[802-3-ethernet] +mac-address=00:22:15:59:62:97 + +[bridge-port] +priority=28 +hairpin-mode=true +path-cost=100 + diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Main b/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Main new file mode 100644 index 00000000..7fbbfe22 --- /dev/null +++ b/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Main @@ -0,0 +1,17 @@ +[connection] +id=Test Bridge Main +uuid=8f061643-fe41-4d4c-a8d9-097d26e2ad3a +type=bridge + +[bridge] +interface-name=br0 +stp=true +forward-delay=0 +priority=32744 +hello-time=7 +max-age=39 +ageing-time=235352 + +[ipv4] +method=auto + diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Test_Wired_Connection b/src/settings/plugins/keyfile/tests/keyfiles/Test_Wired_Connection index 5785dc24..203441ef 100644 --- a/src/settings/plugins/keyfile/tests/keyfiles/Test_Wired_Connection +++ b/src/settings/plugins/keyfile/tests/keyfiles/Test_Wired_Connection @@ -18,6 +18,10 @@ method=manual dns=4.2.2.1;4.2.2.2; addresses1=192.168.0.5;24;192.168.0.1; addresses2=1.2.3.4;16;1.2.1.1; +address=2.3.4.5/24,2.3.4.6 +address3=3.4.5.6/16 +routes1=1.2.3.0/24,2.3.4.8,99 +route=5.6.7.8/32 ignore-auto-routes=false ignore-auto-dns=false @@ -27,6 +31,10 @@ dns=1111:dddd::aaaa;1::cafe; dns-search=super-domain.com;redhat.com;gnu.org; addresses1=abcd:1234:ffff::cdde/64 addresses2=1:2:3:4:5:6:7:8/96 +address=2:3:4:5:6:7:8:9/64,2:3:4:5:1:2:3:4 +address3=3:4:5:6:7:8:9:0/128 routes1=a:b:c:d::/64;f:e:d:c:1:2:3:4;99; +route=d:e:f:0:1:2:3:4/64,f:e:d:c:1:2:3:4 +route2=8:7:6:5:4:3:2:1/128 ignore-auto-routes=false ignore-auto-dns=false diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c index 79fa2f9c..8a646e1c 100644 --- a/src/settings/plugins/keyfile/tests/test-keyfile.c +++ b/src/settings/plugins/keyfile/tests/test-keyfile.c @@ -50,6 +50,74 @@ #define TEST_WIRELESS_FILE TEST_KEYFILES_DIR"/Test_Wireless_Connection" static void +check_ip4_address (NMSettingIP4Config *config, int idx, const char *address_str, int plen, const char *gateway_str) +{ + NMIP4Address *ip4 = nm_setting_ip4_config_get_address (config, idx); + struct in_addr address; + struct in_addr gateway; + + g_assert (inet_pton (AF_INET, address_str, &address) == 1); + g_assert (inet_pton (AF_INET, gateway_str, &gateway) == 1); + + g_assert (ip4); + g_assert (nm_ip4_address_get_address (ip4) == address.s_addr); + g_assert (nm_ip4_address_get_prefix (ip4) == plen); + g_assert (nm_ip4_address_get_gateway (ip4) == gateway.s_addr); +} + +static void +check_ip6_address (NMSettingIP6Config *config, int idx, const char *address_str, int plen, const char *gateway_str) +{ + NMIP6Address *ip6 = nm_setting_ip6_config_get_address (config, idx); + struct in6_addr address; + struct in6_addr gateway; + + g_assert (inet_pton (AF_INET6, address_str, &address) == 1); + g_assert (inet_pton (AF_INET6, gateway_str, &gateway) == 1); + + g_assert (ip6); + g_assert (!memcmp (nm_ip6_address_get_address (ip6), &address, sizeof(address))); + g_assert (nm_ip6_address_get_prefix (ip6) == plen); + g_assert (!memcmp (nm_ip6_address_get_gateway (ip6), &gateway, sizeof(gateway))); +} + +static void +check_ip4_route (NMSettingIP4Config *config, int idx, const char *destination_str, int plen, + const char *nexthop_str, int metric) +{ + NMIP4Route *route = nm_setting_ip4_config_get_route (config, idx); + struct in_addr destination; + struct in_addr nexthop; + + g_assert (inet_pton (AF_INET, destination_str, &destination) == 1); + g_assert (inet_pton (AF_INET, nexthop_str, &nexthop) == 1); + + g_assert (route); + g_assert (nm_ip4_route_get_dest (route) == destination.s_addr); + g_assert (nm_ip4_route_get_prefix (route) == plen); + g_assert (nm_ip4_route_get_next_hop (route) == nexthop.s_addr); + g_assert (nm_ip4_route_get_metric (route) == metric); +} + +static void +check_ip6_route (NMSettingIP6Config *config, int idx, const char *destination_str, int plen, + const char *next_hop_str, int metric) +{ + NMIP6Route *route = nm_setting_ip6_config_get_route (config, idx); + struct in6_addr destination; + struct in6_addr next_hop; + + g_assert (inet_pton (AF_INET6, destination_str, &destination) == 1); + g_assert (inet_pton (AF_INET6, next_hop_str, &next_hop) == 1); + + g_assert (route); + g_assert (!memcmp (nm_ip6_route_get_dest (route), &destination, sizeof(destination))); + g_assert (nm_ip6_route_get_prefix (route) == plen); + g_assert (!memcmp (nm_ip6_route_get_next_hop (route), &next_hop, sizeof(next_hop))); + g_assert (nm_ip6_route_get_metric (route) == metric); +} + +static void test_read_valid_wired_connection (void) { NMConnection *connection; @@ -68,23 +136,12 @@ test_read_valid_wired_connection (void) const char *expected_dns1 = "4.2.2.1"; const char *expected_dns2 = "4.2.2.2"; struct in_addr addr; - const char *expected_address1 = "192.168.0.5"; - const char *expected_address2 = "1.2.3.4"; - const char *expected_address1_gw = "192.168.0.1"; - const char *expected_address2_gw = "1.2.1.1"; - NMIP4Address *ip4_addr; + struct in6_addr addr6; const char *expected6_dns1 = "1111:dddd::aaaa"; const char *expected6_dns2 = "1::cafe"; const char *expected6_dnssearch1 = "super-domain.com"; const char *expected6_dnssearch2 = "redhat.com"; const char *expected6_dnssearch3 = "gnu.org"; - struct in6_addr addr6; - const char *expected6_address1 = "abcd:1234:ffff::cdde"; - const char *expected6_address2 = "1:2:3:4:5:6:7:8"; - const char *expected6_route_dest = "a:b:c:d::"; - const char *expected6_route_nh = "f:e:d:c:1:2:3:4"; - NMIP6Address *ip6_addr; - NMIP6Route *ip6_route; connection = nm_keyfile_plugin_connection_from_file (TEST_WIRED_FILE, NULL); ASSERT (connection != NULL, @@ -219,83 +276,17 @@ test_read_valid_wired_connection (void) NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 2, - "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - /* Address #1 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); - ASSERT (ip4_addr, - "connection-verify-wired", "failed to verify %s: missing IP4 address #1", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == 24, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1, &addr) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #1", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1_gw, &addr) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #1 gateway", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - ASSERT (nm_ip4_address_get_gateway (ip4_addr) == addr.s_addr, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1 gateway", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - /* Address #2 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 1); - ASSERT (ip4_addr, - "connection-verify-wired", "failed to verify %s: missing IP4 address #2", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + /* IPv4 addresses */ + g_assert (nm_setting_ip4_config_get_num_addresses (s_ip4) == 4); + check_ip4_address (s_ip4, 0, "2.3.4.5", 24, "2.3.4.6"); + check_ip4_address (s_ip4, 1, "192.168.0.5", 24, "192.168.0.1"); + check_ip4_address (s_ip4, 2, "1.2.3.4", 16, "1.2.1.1"); + check_ip4_address (s_ip4, 3, "3.4.5.6", 16, "0.0.0.0"); - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == 16, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #2 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address2, &addr) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #2", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #2", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address2_gw, &addr) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #2 gateway", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - ASSERT (nm_ip4_address_get_gateway (ip4_addr) == addr.s_addr, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #2 gateway", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + /* IPv4 routes */ + g_assert (nm_setting_ip4_config_get_num_routes (s_ip4) == 2); + check_ip4_route (s_ip4, 0, "5.6.7.8", 32, "0.0.0.0", 0); + check_ip4_route (s_ip4, 1, "1.2.3.0", 24, "2.3.4.8", 99); /* ===== IPv6 SETTING ===== */ @@ -342,12 +333,6 @@ test_read_valid_wired_connection (void) NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS); - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 2, - "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - /* DNS Searches */ ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 3, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", @@ -371,98 +356,18 @@ test_read_valid_wired_connection (void) NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS_SEARCH); - /* Address #1 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); - ASSERT (ip6_addr, - "connection-verify-wired", "failed to verify %s: missing IP6 address #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == 64, - "connection-verify-wired", "failed to verify %s: unexpected IP6 address #1 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET6, expected6_address1, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - /* Address #2 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1); - ASSERT (ip6_addr, - "connection-verify-wired", "failed to verify %s: missing IP6 address #2", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == 96, - "connection-verify-wired", "failed to verify %s: unexpected IP6 address #2 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET6, expected6_address2, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #2", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP6 address #2", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); + /* IPv6 addresses */ + g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 4); + check_ip6_address (s_ip6, 0, "2:3:4:5:6:7:8:9", 64, "2:3:4:5:1:2:3:4"); + check_ip6_address (s_ip6, 1, "abcd:1234:ffff::cdde", 64, "::"); + check_ip6_address (s_ip6, 2, "1:2:3:4:5:6:7:8", 96, "::"); + check_ip6_address (s_ip6, 3, "3:4:5:6:7:8:9:0", 128, "::"); /* Route #1 */ - ip6_route = nm_setting_ip6_config_get_route (s_ip6, 0); - ASSERT (ip6_route, - "connection-verify-wired", "failed to verify %s: missing IP6 route #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - - ASSERT (inet_pton (AF_INET6, expected6_route_dest, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP route dest #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_route_get_dest (ip6_route), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 route dest #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - - ASSERT (nm_ip6_route_get_prefix (ip6_route) == 64, - "connection-verify-wired", "failed to verify %s: unexpected IP6 route #1 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - - ASSERT (inet_pton (AF_INET6, expected6_route_nh, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP route next hop #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_route_get_next_hop (ip6_route), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 route dest #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - - ASSERT (nm_ip6_route_get_metric (ip6_route) == 99, - "connection-verify-wired", "failed to verify %s: unexpected IP6 route #1 metric", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - + g_assert (nm_setting_ip6_config_get_num_routes (s_ip6) == 3); + check_ip6_route (s_ip6, 0, "d:e:f:0:1:2:3:4", 64, "f:e:d:c:1:2:3:4", 0); + check_ip6_route (s_ip6, 1, "a:b:c:d::", 64, "f:e:d:c:1:2:3:4", 99); + check_ip6_route (s_ip6, 2, "8:7:6:5:4:3:2:1", 128, "::", 0); g_object_unref (connection); } @@ -733,10 +638,6 @@ test_read_ip6_wired_connection (void) const char *tmp; const char *expected_id = "Test Wired Connection IP6"; const char *expected_uuid = "4e80a56d-c99f-4aad-a6dd-b449bc398c57"; - struct in6_addr addr6; - const char *expected6_address1 = "abcd:1234:ffff::cdde"; - const char *expected6_gw1 = "abcd:1234:ffff::cdd1"; - NMIP6Address *ip6_addr; connection = nm_keyfile_plugin_connection_from_file (TEST_WIRED_IP6_FILE, NULL); ASSERT (connection != NULL, @@ -825,47 +726,9 @@ test_read_ip6_wired_connection (void) NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_METHOD); - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1, - "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - /* Address #1 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); - ASSERT (ip6_addr, - "connection-verify-wired", "failed to verify %s: missing IP6 address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == 64, - "connection-verify-wired", "failed to verify %s: unexpected IP6 address #1 prefix", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET6, expected6_address1, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET6, expected6_gw1, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert GW address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_gateway (ip6_addr), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); + /* IPv6 address */ + g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1); + check_ip6_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1"); g_object_unref (connection); } @@ -2958,6 +2821,264 @@ test_write_infiniband_connection (void) g_object_unref (connection); } +#define TEST_BRIDGE_MAIN_FILE TEST_KEYFILES_DIR"/Test_Bridge_Main" + +static void +test_read_bridge_main (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + NMSettingIP4Config *s_ip4; + NMSettingBridge *s_bridge; + GError *error = NULL; + const char *expected_id = "Test Bridge Main"; + const char *expected_uuid = "8f061643-fe41-4d4c-a8d9-097d26e2ad3a"; + gboolean success; + + connection = nm_keyfile_plugin_connection_from_file (TEST_BRIDGE_MAIN_FILE, &error); + g_assert_no_error (error); + g_assert (connection); + success = nm_connection_verify (connection, &error); + g_assert_no_error (error); + g_assert (success); + + /* Connection setting */ + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, expected_id); + g_assert_cmpstr (nm_setting_connection_get_uuid (s_con), ==, expected_uuid); + + /* IPv4 setting */ + s_ip4 = nm_connection_get_setting_ip4_config (connection); + g_assert (s_ip4); + g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); + + /* Bridge setting */ + s_bridge = nm_connection_get_setting_bridge (connection); + g_assert (s_bridge); + g_assert_cmpstr (nm_setting_bridge_get_interface_name (s_bridge), ==, "br0"); + g_assert_cmpuint (nm_setting_bridge_get_forward_delay (s_bridge), ==, 0); + g_assert_cmpuint (nm_setting_bridge_get_stp (s_bridge), ==, TRUE); + g_assert_cmpuint (nm_setting_bridge_get_priority (s_bridge), ==, 32744); + g_assert_cmpuint (nm_setting_bridge_get_hello_time (s_bridge), ==, 7); + g_assert_cmpuint (nm_setting_bridge_get_max_age (s_bridge), ==, 39); + g_assert_cmpuint (nm_setting_bridge_get_ageing_time (s_bridge), ==, 235352); + + g_object_unref (connection); +} + +static void +test_write_bridge_main (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + NMSettingBridge *s_bridge; + NMSettingIP4Config *s_ip4; + NMSettingIP6Config *s_ip6; + char *uuid; + gboolean success; + NMConnection *reread; + char *testfile = NULL; + GError *error = NULL; + pid_t owner_grp; + uid_t owner_uid; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bridge Main", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_BRIDGE_SETTING_NAME, + NULL); + g_free (uuid); + + /* Bridge setting */ + s_bridge = (NMSettingBridge *) nm_setting_bridge_new (); + g_assert (s_bridge); + nm_connection_add_setting (connection, NM_SETTING (s_bridge)); + + g_object_set (s_bridge, + NM_SETTING_BRIDGE_INTERFACE_NAME, "br0", + NULL); + + /* IP4 setting */ + s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + g_assert (s_ip4); + nm_connection_add_setting (connection, NM_SETTING (s_ip4)); + g_object_set (s_ip4, + NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NULL); + + add_one_ip4_address (s_ip4, "1.2.3.4", "1.1.1.1", 24); + + /* IP6 setting */ + s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + g_assert (s_ip6); + nm_connection_add_setting (connection, NM_SETTING (s_ip6)); + g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); + + /* Write out the connection */ + owner_uid = geteuid (); + owner_grp = getegid (); + success = nm_keyfile_plugin_write_test_connection (connection, TEST_SCRATCH_DIR, owner_uid, owner_grp, &testfile, &error); + g_assert_no_error (error); + g_assert (success); + g_assert (testfile); + + /* Read the connection back in and compare it to the one we just wrote out */ + reread = nm_keyfile_plugin_connection_from_file (testfile, &error); + g_assert_no_error (error); + g_assert (reread); + + g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT)); + + unlink (testfile); + g_free (testfile); + + g_object_unref (reread); + g_object_unref (connection); +} + +#define TEST_BRIDGE_COMPONENT_FILE TEST_KEYFILES_DIR"/Test_Bridge_Component" + +static void +test_read_bridge_component (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + NMSettingBridgePort *s_port; + NMSettingWired *s_wired; + const GByteArray *array; + guint8 expected_mac[ETH_ALEN] = { 0x00, 0x22, 0x15, 0x59, 0x62, 0x97 }; + GError *error = NULL; + const char *expected_id = "Test Bridge Component"; + const char *expected_uuid = "d7b4f96c-c45e-4298-bef8-f48574f8c1c0"; + gboolean success; + + connection = nm_keyfile_plugin_connection_from_file (TEST_BRIDGE_COMPONENT_FILE, &error); + g_assert_no_error (error); + g_assert (connection); + success = nm_connection_verify (connection, &error); + g_assert_no_error (error); + g_assert (success); + + /* Connection setting */ + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, expected_id); + g_assert_cmpstr (nm_setting_connection_get_uuid (s_con), ==, expected_uuid); + g_assert_cmpstr (nm_setting_connection_get_master (s_con), ==, "br0"); + g_assert (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BRIDGE_SETTING_NAME)); + + /* Wired setting */ + s_wired = nm_connection_get_setting_wired (connection); + g_assert (s_wired); + array = nm_setting_wired_get_mac_address (s_wired); + g_assert (array); + g_assert_cmpint (array->len, ==, ETH_ALEN); + g_assert_cmpint (memcmp (array->data, expected_mac, sizeof (expected_mac)), ==, 0); + + /* BridgePort setting */ + s_port = nm_connection_get_setting_bridge_port (connection); + g_assert (s_port); + g_assert (nm_setting_bridge_port_get_hairpin_mode (s_port)); + g_assert_cmpuint (nm_setting_bridge_port_get_priority (s_port), ==, 28); + g_assert_cmpuint (nm_setting_bridge_port_get_path_cost (s_port), ==, 100); + + g_object_unref (connection); +} + +static void +test_write_bridge_component (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + NMSettingBridgePort *s_port; + NMSettingWired *s_wired; + char *uuid; + GByteArray *mac; + guint8 tmpmac[] = { 0x99, 0x88, 0x77, 0x66, 0x55, 0x44 }; + gboolean success; + NMConnection *reread; + char *testfile = NULL; + GError *error = NULL; + pid_t owner_grp; + uid_t owner_uid; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bridge Component", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME, + NM_SETTING_CONNECTION_MASTER, "br0", + NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BRIDGE_SETTING_NAME, + NULL); + g_free (uuid); + + /* Wired setting */ + s_wired = NM_SETTING_WIRED (nm_setting_wired_new ()); + g_assert (s_wired); + nm_connection_add_setting (connection, NM_SETTING (s_wired)); + + mac = g_byte_array_sized_new (ETH_ALEN); + g_byte_array_append (mac, &tmpmac[0], sizeof (tmpmac)); + g_object_set (s_wired, + NM_SETTING_WIRED_MAC_ADDRESS, mac, + NM_SETTING_WIRED_MTU, 1300, + NULL); + g_byte_array_free (mac, TRUE); + + /* BridgePort setting */ + s_port = (NMSettingBridgePort *) nm_setting_bridge_port_new (); + g_assert (s_port); + nm_connection_add_setting (connection, NM_SETTING (s_port)); + + g_object_set (s_port, + NM_SETTING_BRIDGE_PORT_PRIORITY, 3, + NM_SETTING_BRIDGE_PORT_PATH_COST, 99, + NULL); + + /* Write out the connection */ + owner_uid = geteuid (); + owner_grp = getegid (); + success = nm_keyfile_plugin_write_test_connection (connection, TEST_SCRATCH_DIR, owner_uid, owner_grp, &testfile, &error); + g_assert_no_error (error); + g_assert (success); + g_assert (testfile); + + /* Read the connection back in and compare it to the one we just wrote out */ + reread = nm_keyfile_plugin_connection_from_file (testfile, &error); + g_assert_no_error (error); + g_assert (reread); + + g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT)); + + unlink (testfile); + g_free (testfile); + + g_object_unref (reread); + g_object_unref (connection); +} + + int main (int argc, char **argv) { GError *error = NULL; @@ -3009,6 +3130,11 @@ int main (int argc, char **argv) test_read_infiniband_connection (); test_write_infiniband_connection (); + test_read_bridge_main (); + test_write_bridge_main (); + test_read_bridge_component (); + test_write_bridge_component (); + base = g_path_get_basename (argv[0]); fprintf (stdout, "%s: SUCCESS\n", base); g_free (base); diff --git a/src/settings/plugins/keyfile/writer.c b/src/settings/plugins/keyfile/writer.c index bbd6a7c3..0b8c1592 100644 --- a/src/settings/plugins/keyfile/writer.c +++ b/src/settings/plugins/keyfile/writer.c @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 - 2011 Red Hat, Inc. + * Copyright (C) 2008 - 2012 Red Hat, Inc. */ #include <config.h> @@ -41,7 +41,6 @@ #include <string.h> #include <arpa/inet.h> #include <netinet/ether.h> -#include <ctype.h> #include "nm-dbus-glib-types.h" #include "nm-glib-compat.h" @@ -116,18 +115,16 @@ write_ip4_values (GKeyFile *file, guint32 addr1_pos, guint32 addr2_pos) { - char **list = NULL; + GString *output; int i, j; - list = g_new (char *, tuple_len); - for (i = 0, j = 0; i < array->len; i++, j++) { GArray *tuple = g_ptr_array_index (array, i); gboolean success = TRUE; char *key_name; int k; - memset (list, 0, tuple_len * sizeof (char *)); + output = g_string_new (""); for (k = 0; k < tuple_len; k++) { if (k == addr1_pos || k == addr2_pos) { @@ -142,24 +139,23 @@ write_ip4_values (GKeyFile *file, success = FALSE; break; } else { - list[k] = g_strdup (buf); + g_string_append_printf (output, "%s%s", k == 0 ? "" : ",", buf); } } else { /* prefix, metric */ - list[k] = g_strdup_printf ("%d", g_array_index (tuple, guint32, k)); + g_string_append_printf (output, "%c%d", k == 1 ? '/' : ',', g_array_index (tuple, guint32, k)); } } if (success) { key_name = g_strdup_printf ("%s%d", key, j + 1); - g_key_file_set_string_list (file, setting_name, key_name, (const char **) list, tuple_len); + g_key_file_set_string (file, setting_name, key_name, output->str); g_free (key_name); } - for (k = 0; k < tuple_len; k++) - g_free (list[k]); + g_string_free (output, TRUE); + } - g_free (list); } static void @@ -177,7 +173,7 @@ ip4_addr_writer (GKeyFile *file, array = (GPtrArray *) g_value_get_boxed (value); if (array && array->len) - write_ip4_values (file, setting_name, key, array, 3, 0, 2); + write_ip4_values (file, setting_name, "address", array, 3, 0, 2); } static void @@ -195,7 +191,7 @@ ip4_route_writer (GKeyFile *file, array = (GPtrArray *) g_value_get_boxed (value); if (array && array->len) - write_ip4_values (file, setting_name, key, array, 4, 0, 2); + write_ip4_values (file, setting_name, "route", array, 4, 0, 2); } static void @@ -340,7 +336,7 @@ ip6_addr_writer (GKeyFile *file, ip6_addr = ip6_array_to_addr_prefix (values); if (ip6_addr) { /* Write it out */ - key_name = g_strdup_printf ("%s%d", key, j++); + key_name = g_strdup_printf ("address%d", j++); g_key_file_set_string (file, setting_name, key_name, ip6_addr); g_free (key_name); g_free (ip6_addr); @@ -358,7 +354,7 @@ ip6_route_writer (GKeyFile *file, { GPtrArray *array; const char *setting_name = nm_setting_get_name (setting); - char *list[3]; + GString *output; int i, j; g_return_if_fail (G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_IP6_ROUTE)); @@ -371,36 +367,23 @@ ip6_route_writer (GKeyFile *file, GValueArray *values = g_ptr_array_index (array, i); char *key_name; guint32 int_val; - char buf[INET6_ADDRSTRLEN + 1]; - gboolean is_unspec = FALSE; - memset (list, 0, sizeof (list)); + output = g_string_new (""); - /* Address and prefix */ - list[0] = ip6_array_to_addr_prefix (values); - if (!list[0]) - continue; - - /* Next Hop */ - if (!ip6_array_to_addr (values, 2, buf, sizeof (buf), &is_unspec)) - continue; - if (is_unspec) - continue; - list[1] = g_strdup (buf); + /* Address, prefix and next hop*/ + g_string_append (output, ip6_array_to_addr_prefix (values)); /* Metric */ value = g_value_array_get_nth (values, 3); int_val = g_value_get_uint (value); - list[2] = g_strdup_printf ("%d", int_val); + g_string_append_printf (output, ",%d", int_val); /* Write it out */ - key_name = g_strdup_printf ("%s%d", key, j++); - g_key_file_set_string_list (file, setting_name, key_name, (const char **) list, 3); + key_name = g_strdup_printf ("route%d", j++); + g_key_file_set_string (file, setting_name, key_name, output->str); g_free (key_name); - g_free (list[0]); - g_free (list[1]); - g_free (list[2]); + g_string_free (output, TRUE); } } @@ -500,7 +483,7 @@ ssid_writer (GKeyFile *file, */ for (i = 0; i < array->len; i++) { char c = array->data[i] & 0xFF; - if (!isprint (c)) { + if (!g_ascii_isprint (c)) { new_format = FALSE; break; } @@ -816,6 +799,9 @@ static KeyWriter key_writers[] = { { NM_SETTING_INFINIBAND_SETTING_NAME, NM_SETTING_INFINIBAND_MAC_ADDRESS, mac_address_writer }, + { NM_SETTING_WIMAX_SETTING_NAME, + NM_SETTING_WIMAX_MAC_ADDRESS, + mac_address_writer }, { NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_SSID, ssid_writer }, @@ -1024,8 +1010,15 @@ _internal_write_connection (NMConnection *connection, if (!data) goto out; - filename = _writer_id_to_filename (id); - path = g_build_filename (keyfile_dir, filename, NULL); + /* If we have existing file path, use it. Else generate one from + * connection's ID. + */ + if (existing_path != NULL) { + path = g_strdup (existing_path); + } else { + filename = _writer_id_to_filename (id); + path = g_build_filename (keyfile_dir, filename, NULL); + } /* If a file with this path already exists (but isn't the existing path * of the connection) then we need another name. Multiple connections |