diff options
author | Michael Biebl <biebl@debian.org> | 2011-05-04 21:35:41 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2011-05-04 21:35:41 +0200 |
commit | 9f806e97a24bba61417ae312fcc0da40914266fb (patch) | |
tree | 4a25723414ceac11b4cba0558aa16f6f4b459f4b /system-settings/plugins/ifcfg-rh/tests | |
parent | 8baa1aca8dfd35e3190d7d5655eb83b5b901e263 (diff) |
Imported Upstream version 0.8.999upstream/0.8.999
Diffstat (limited to 'system-settings/plugins/ifcfg-rh/tests')
88 files changed, 0 insertions, 13069 deletions
diff --git a/system-settings/plugins/ifcfg-rh/tests/Makefile.am b/system-settings/plugins/ifcfg-rh/tests/Makefile.am deleted file mode 100644 index 8933bb2ea..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -SUBDIRS=network-scripts - -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/system-settings/plugins/ifcfg-rh - -noinst_PROGRAMS = test-ifcfg-rh test-ifcfg-rh-utils - -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)/system-settings/plugins/ifcfg-rh/libifcfg-rh-io.la \ - $(DBUS_LIBS) - -test_ifcfg_rh_utils_SOURCES = \ - test-ifcfg-rh-utils.c - -test_ifcfg_rh_utils_CPPFLAGS = \ - $(GLIB_CFLAGS) - -test_ifcfg_rh_utils_LDADD = \ - $(top_builddir)/system-settings/plugins/ifcfg-rh/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 \ - iscsiadm-test-bad-ipaddr \ - iscsiadm-test-bad-gateway \ - iscsiadm-test-bad-dns1 \ - iscsiadm-test-bad-dns2 - diff --git a/system-settings/plugins/ifcfg-rh/tests/Makefile.in b/system-settings/plugins/ifcfg-rh/tests/Makefile.in deleted file mode 100644 index 34da7b60e..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/Makefile.in +++ /dev/null @@ -1,807 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -noinst_PROGRAMS = test-ifcfg-rh$(EXEEXT) test-ifcfg-rh-utils$(EXEEXT) -subdir = system-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/gtk-doc.m4 $(top_srcdir)/m4/intltool.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)/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 = -PROGRAMS = $(noinst_PROGRAMS) -am_test_ifcfg_rh_OBJECTS = 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)/system-settings/plugins/ifcfg-rh/libifcfg-rh-io.la \ - $(am__DEPENDENCIES_1) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) -am__v_lt_0 = --silent -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 = $(top_builddir)/system-settings/plugins/ifcfg-rh/libifcfg-rh-io.la -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -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) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -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@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GUDEV_CFLAGS = @GUDEV_CFLAGS@ -GUDEV_LIBS = @GUDEV_LIBS@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -IPTABLES_PATH = @IPTABLES_PATH@ -KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBDL = @LIBDL@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBM = @LIBM@ -LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_LIBS = @LIBNL_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ -NM_MICRO_VERSION = @NM_MICRO_VERSION@ -NM_MINOR_VERSION = @NM_MINOR_VERSION@ -NM_VERSION = @NM_VERSION@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKGCONFIG_PATH = @PKGCONFIG_PATH@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POFILES = @POFILES@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ -UDEV_BASE_DIR = @UDEV_BASE_DIR@ -USE_NLS = @USE_NLS@ -UUID_CFLAGS = @UUID_CFLAGS@ -UUID_LIBS = @UUID_LIBS@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -systemdsystemunitdir = @systemdsystemunitdir@ -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_srcdir)/libnm-util \ - -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/system-settings/plugins/ifcfg-rh - -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)/system-settings/plugins/ifcfg-rh/libifcfg-rh-io.la \ - $(DBUS_LIBS) - -test_ifcfg_rh_utils_SOURCES = \ - test-ifcfg-rh-utils.c - -test_ifcfg_rh_utils_CPPFLAGS = \ - $(GLIB_CFLAGS) - -test_ifcfg_rh_utils_LDADD = \ - $(top_builddir)/system-settings/plugins/ifcfg-rh/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 - -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu system-settings/plugins/ifcfg-rh/tests/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu system-settings/plugins/ifcfg-rh/tests/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -test-ifcfg-rh$(EXEEXT): $(test_ifcfg_rh_OBJECTS) $(test_ifcfg_rh_DEPENDENCIES) - @rm -f test-ifcfg-rh$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_ifcfg_rh_OBJECTS) $(test_ifcfg_rh_LDADD) $(LIBS) -test-ifcfg-rh-utils$(EXEEXT): $(test_ifcfg_rh_utils_OBJECTS) $(test_ifcfg_rh_utils_DEPENDENCIES) - @rm -f test-ifcfg-rh-utils$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_ifcfg_rh_utils_OBJECTS) $(test_ifcfg_rh_utils_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ifcfg_rh-test-ifcfg-rh.Po@am__quote@ -@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_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< - -.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_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(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_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -test_ifcfg_rh-test-ifcfg-rh.o: test-ifcfg-rh.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ifcfg_rh_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_ifcfg_rh-test-ifcfg-rh.o -MD -MP -MF $(DEPDIR)/test_ifcfg_rh-test-ifcfg-rh.Tpo -c -o test_ifcfg_rh-test-ifcfg-rh.o `test -f 'test-ifcfg-rh.c' || echo '$(srcdir)/'`test-ifcfg-rh.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ifcfg_rh-test-ifcfg-rh.Tpo $(DEPDIR)/test_ifcfg_rh-test-ifcfg-rh.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-ifcfg-rh.c' object='test_ifcfg_rh-test-ifcfg-rh.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ifcfg_rh_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_ifcfg_rh-test-ifcfg-rh.o `test -f 'test-ifcfg-rh.c' || echo '$(srcdir)/'`test-ifcfg-rh.c - -test_ifcfg_rh-test-ifcfg-rh.obj: test-ifcfg-rh.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ifcfg_rh_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_ifcfg_rh-test-ifcfg-rh.obj -MD -MP -MF $(DEPDIR)/test_ifcfg_rh-test-ifcfg-rh.Tpo -c -o test_ifcfg_rh-test-ifcfg-rh.obj `if test -f 'test-ifcfg-rh.c'; then $(CYGPATH_W) 'test-ifcfg-rh.c'; else $(CYGPATH_W) '$(srcdir)/test-ifcfg-rh.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ifcfg_rh-test-ifcfg-rh.Tpo $(DEPDIR)/test_ifcfg_rh-test-ifcfg-rh.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-ifcfg-rh.c' object='test_ifcfg_rh-test-ifcfg-rh.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ifcfg_rh_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_ifcfg_rh-test-ifcfg-rh.obj `if test -f 'test-ifcfg-rh.c'; then $(CYGPATH_W) 'test-ifcfg-rh.c'; else $(CYGPATH_W) '$(srcdir)/test-ifcfg-rh.c'; fi` - -test_ifcfg_rh_utils-test-ifcfg-rh-utils.o: test-ifcfg-rh-utils.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ifcfg_rh_utils_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_ifcfg_rh_utils-test-ifcfg-rh-utils.o -MD -MP -MF $(DEPDIR)/test_ifcfg_rh_utils-test-ifcfg-rh-utils.Tpo -c -o test_ifcfg_rh_utils-test-ifcfg-rh-utils.o `test -f 'test-ifcfg-rh-utils.c' || echo '$(srcdir)/'`test-ifcfg-rh-utils.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ifcfg_rh_utils-test-ifcfg-rh-utils.Tpo $(DEPDIR)/test_ifcfg_rh_utils-test-ifcfg-rh-utils.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-ifcfg-rh-utils.c' object='test_ifcfg_rh_utils-test-ifcfg-rh-utils.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ifcfg_rh_utils_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_ifcfg_rh_utils-test-ifcfg-rh-utils.o `test -f 'test-ifcfg-rh-utils.c' || echo '$(srcdir)/'`test-ifcfg-rh-utils.c - -test_ifcfg_rh_utils-test-ifcfg-rh-utils.obj: test-ifcfg-rh-utils.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ifcfg_rh_utils_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_ifcfg_rh_utils-test-ifcfg-rh-utils.obj -MD -MP -MF $(DEPDIR)/test_ifcfg_rh_utils-test-ifcfg-rh-utils.Tpo -c -o test_ifcfg_rh_utils-test-ifcfg-rh-utils.obj `if test -f 'test-ifcfg-rh-utils.c'; then $(CYGPATH_W) 'test-ifcfg-rh-utils.c'; else $(CYGPATH_W) '$(srcdir)/test-ifcfg-rh-utils.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ifcfg_rh_utils-test-ifcfg-rh-utils.Tpo $(DEPDIR)/test_ifcfg_rh_utils-test-ifcfg-rh-utils.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-ifcfg-rh-utils.c' object='test_ifcfg_rh_utils-test-ifcfg-rh-utils.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ifcfg_rh_utils_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_ifcfg_rh_utils-test-ifcfg-rh-utils.obj `if test -f 'test-ifcfg-rh-utils.c'; then $(CYGPATH_W) 'test-ifcfg-rh-utils.c'; else $(CYGPATH_W) '$(srcdir)/test-ifcfg-rh-utils.c'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -@WITH_TESTS_FALSE@check-local: -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-recursive -all-am: Makefile $(PROGRAMS) -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ - ctags-recursive install-am install-strip tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am check-local clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags ctags-recursive \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am - - -@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 - -# 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. -.NOEXPORT: diff --git a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-dns1 b/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-dns1 deleted file mode 100755 index 4a6a93822..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-dns1 +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -cat << EOF -# BEGIN RECORD -iface.initiatorname = iqn.pjones6 -iface.hwaddress = 00:33:21:98:b9:f0 -iface.bootproto = STATIC -iface.ipaddress = 192.168.32.72 -iface.subnet_mask = 255.255.252.0 -iface.gateway = 192.168.35.254 -iface.primary_dns = 10000.500.250.1 -iface.secondary_dns = 10.16.255.3 -iface.vlan = 0 -iface.net_ifacename = eth0 -node.name = iqn.0.2008-11.com.blahblah:iscsi0 -node.conn[0].address = 10.16.52.16 -node.conn[0].port = 3260 -node.boot_lun = 00000000 -# END RECORD -EOF - diff --git a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-dns2 b/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-dns2 deleted file mode 100755 index 9bd5839bd..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-dns2 +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -cat << EOF -# BEGIN RECORD -iface.initiatorname = iqn.pjones6 -iface.hwaddress = 00:33:21:98:b9:f0 -iface.bootproto = STATIC -iface.ipaddress = 192.168.32.72 -iface.subnet_mask = 255.255.252.0 -iface.gateway = 192.168.35.254 -iface.primary_dns = 10.16.255.2 -iface.secondary_dns = blah.foo.bar.baz -iface.vlan = 0 -iface.net_ifacename = eth0 -node.name = iqn.0.2008-11.com.blahblah:iscsi0 -node.conn[0].address = 10.16.52.16 -node.conn[0].port = 3260 -node.boot_lun = 00000000 -# END RECORD -EOF - diff --git a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-gateway b/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-gateway deleted file mode 100755 index b3dc74478..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-gateway +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -cat << EOF -# BEGIN RECORD -iface.initiatorname = iqn.pjones6 -iface.hwaddress = 00:33:21:98:b9:f0 -iface.bootproto = STATIC -iface.ipaddress = aa.bb.cc.dd -iface.subnet_mask = 255.255.252.0 -iface.gateway = 192.168.35.254 -iface.primary_dns = 10.16.255.2 -iface.secondary_dns = 10.16.255.3 -iface.vlan = 0 -iface.net_ifacename = eth0 -node.name = iqn.0.2008-11.com.blahblah:iscsi0 -node.conn[0].address = 10.16.52.16 -node.conn[0].port = 3260 -node.boot_lun = 00000000 -# END RECORD -EOF - diff --git a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-ipaddr b/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-ipaddr deleted file mode 100755 index 92f44777b..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-bad-ipaddr +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -cat << EOF -# BEGIN RECORD -iface.initiatorname = iqn.pjones6 -iface.hwaddress = 00:33:21:98:b9:f0 -iface.bootproto = STATIC -iface.ipaddress = 192.168.32.72 -iface.subnet_mask = 255.255.252.0 -iface.gateway = bb.cc.dd.ee -iface.primary_dns = 10.16.255.2 -iface.secondary_dns = 10.16.255.3 -iface.vlan = 0 -iface.net_ifacename = eth0 -node.name = iqn.0.2008-11.com.blahblah:iscsi0 -node.conn[0].address = 10.16.52.16 -node.conn[0].port = 3260 -node.boot_lun = 00000000 -# END RECORD -EOF - diff --git a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-dhcp b/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-dhcp deleted file mode 100755 index 6de0637cb..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-dhcp +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -cat << EOF -# BEGIN RECORD -iface.initiatorname = iqn.pjones6 -iface.hwaddress = 00:33:21:98:b9:f0 -iface.bootproto = DHCP -iface.gateway = 10.16.52.254 -iface.primary_dns = 10.16.255.2 -iface.secondary_dns = 10.16.255.3 -iface.vlan = 0 -iface.net_ifacename = eth0 -node.name = iqn.0.2008-11.com.blahblah:iscsi0 -node.conn[0].address = 10.16.52.16 -node.conn[0].port = 3260 -node.boot_lun = 00000000 -# END RECORD -# BEGIN RECORD -iface.initiatorname = iqn.pjones6 -iface.hwaddress = 00:33:21:98:b9:f1 -iface.bootproto = DHCP -iface.gateway = 10.16.52.254 -iface.primary_dns = 10.16.255.2 -iface.secondary_dns = 10.16.255.3 -iface.vlan = 0 -iface.net_ifacename = eth1 -node.name = iqn.1.2008-11.com.blahblah:iscsi1 -node.conn[0].address = 10.16.52.16 -node.conn[0].port = 3260 -node.boot_lun = 00000000 -# END RECORD -EOF - diff --git a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-static b/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-static deleted file mode 100755 index 99a6e7c17..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/iscsiadm-test-static +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -cat << EOF -# BEGIN RECORD -iface.initiatorname = iqn.pjones6 -iface.hwaddress = 00:33:21:98:b9:f0 -iface.bootproto = STATIC -iface.ipaddress = 192.168.32.72 -iface.subnet_mask = 255.255.252.0 -iface.gateway = 192.168.35.254 -iface.primary_dns = 10.16.255.2 -iface.secondary_dns = 10.16.255.3 -iface.vlan = 0 -iface.net_ifacename = eth0 -node.name = iqn.0.2008-11.com.blahblah:iscsi0 -node.conn[0].address = 10.16.52.16 -node.conn[0].port = 3260 -node.boot_lun = 00000000 -# END RECORD -# BEGIN RECORD -iface.initiatorname = iqn.pjones6 -iface.hwaddress = 00:33:21:98:b9:f1 -iface.bootproto = DHCP -iface.gateway = 10.16.52.254 -iface.primary_dns = 10.16.255.2 -iface.secondary_dns = 10.16.255.3 -iface.vlan = 0 -iface.net_ifacename = eth1 -node.name = iqn.1.2008-11.com.blahblah:iscsi1 -node.conn[0].address = 10.16.52.16 -node.conn[0].port = 3260 -node.boot_lun = 00000000 -# END RECORD -EOF - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am deleted file mode 100644 index 154bb2b76..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am +++ /dev/null @@ -1,86 +0,0 @@ -EXTRA_DIST = \ - ifcfg-test-minimal \ - ifcfg-test-nm-controlled \ - ifcfg-test-wired-static \ - ifcfg-test-wired-static-bootproto \ - ifcfg-test-wired-dhcp \ - ifcfg-test-wired-dhcp6-only \ - ifcfg-test-wired-global-gateway \ - network-test-wired-global-gateway \ - ifcfg-test-wired-never-default \ - network-test-wired-never-default \ - ifcfg-test-wired-defroute-no \ - ifcfg-test-wired-defroute-no-gatewaydev-yes \ - network-test-wired-defroute-no-gatewaydev-yes \ - ifcfg-test-wired-8021x-peap-mschapv2 \ - keys-test-wired-8021x-peap-mschapv2 \ - ifcfg-test-onboot-no \ - ifcfg-test-wifi-open \ - ifcfg-test-wifi-open-auto \ - ifcfg-test-wifi-open-ssid-quoted \ - ifcfg-test-wifi-open-ssid-long-quoted \ - ifcfg-test-wifi-open-ssid-hex \ - ifcfg-test-wifi-open-ssid-long-hex \ - ifcfg-test-wifi-open-ssid-bad-hex \ - ifcfg-test-wifi-wep \ - keys-test-wifi-wep \ - ifcfg-test-wifi-wep-adhoc \ - keys-test-wifi-wep-adhoc \ - ifcfg-test-wifi-wep-eap-ttls-chap \ - keys-test-wifi-wep-eap-ttls-chap \ - ifcfg-test-wifi-leap \ - keys-test-wifi-leap \ - ifcfg-test-wifi-wpa-psk \ - keys-test-wifi-wpa-psk \ - ifcfg-test-wifi-wpa-psk-unquoted \ - keys-test-wifi-wpa-psk-unquoted \ - ifcfg-test-wifi-wpa-psk-unquoted2 \ - keys-test-wifi-wpa-psk-unquoted2 \ - ifcfg-test-wifi-wpa-psk-adhoc \ - keys-test-wifi-wpa-psk-adhoc \ - ifcfg-test-wifi-wpa-psk-hex \ - keys-test-wifi-wpa-psk-hex \ - ifcfg-test-wifi-wpa-eap-tls \ - keys-test-wifi-wpa-eap-tls \ - ifcfg-test-wifi-wpa-eap-ttls-tls \ - keys-test-wifi-wpa-eap-ttls-tls \ - test_ca_cert.pem \ - test1_key_and_cert.pem \ - ifcfg-test-ibft-dhcp \ - ifcfg-test-ibft-static \ - ifcfg-test-static-routes-legacy \ - route-test-static-routes-legacy \ - ifcfg-test-wired-static-routes \ - route-test-wired-static-routes \ - ifcfg-test-wired-static-routes-legacy \ - route-test-wired-static-routes-legacy \ - ifcfg-test-wired-ipv4-manual-1 \ - ifcfg-test-wired-ipv4-manual-2 \ - ifcfg-test-wired-ipv4-manual-3 \ - ifcfg-test-wired-ipv4-manual-4 \ - ifcfg-test-wired-ipv6-manual \ - route6-test-wired-ipv6-manual \ - ifcfg-test-wired-static-no-prefix-8 \ - ifcfg-test-wired-static-no-prefix-16 \ - ifcfg-test-wired-static-no-prefix-24 \ - ifcfg-test-wired-ipv6-only \ - ifcfg-test-wifi-wep-passphrase \ - keys-test-wifi-wep-passphrase \ - ifcfg-test-wifi-wep-40-ascii \ - keys-test-wifi-wep-40-ascii \ - ifcfg-test-wifi-wep-104-ascii \ - keys-test-wifi-wep-104-ascii \ - ifcfg-test-wired-qeth-static \ - ifcfg-test-wired-ctc-static \ - ifcfg-test-bridge-main \ - ifcfg-test-bridge-component \ - ifcfg-test-vlan-interface - -check-local: - @for f in $(EXTRA_DIST); do \ - chmod 0600 $(abs_srcdir)/$$f; \ - done - -# Make the special temp dir for some written connections - mkdir -p $(abs_builddir)/tmp - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in b/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in deleted file mode 100644 index 53f86e160..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in +++ /dev/null @@ -1,521 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = system-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/gtk-doc.m4 $(top_srcdir)/m4/intltool.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)/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_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -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@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GUDEV_CFLAGS = @GUDEV_CFLAGS@ -GUDEV_LIBS = @GUDEV_LIBS@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -IPTABLES_PATH = @IPTABLES_PATH@ -KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBDL = @LIBDL@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBM = @LIBM@ -LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_LIBS = @LIBNL_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ -NM_MICRO_VERSION = @NM_MICRO_VERSION@ -NM_MINOR_VERSION = @NM_MINOR_VERSION@ -NM_VERSION = @NM_VERSION@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKGCONFIG_PATH = @PKGCONFIG_PATH@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POFILES = @POFILES@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ -UDEV_BASE_DIR = @UDEV_BASE_DIR@ -USE_NLS = @USE_NLS@ -UUID_CFLAGS = @UUID_CFLAGS@ -UUID_LIBS = @UUID_LIBS@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -systemdsystemunitdir = @systemdsystemunitdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -EXTRA_DIST = \ - ifcfg-test-minimal \ - ifcfg-test-nm-controlled \ - ifcfg-test-wired-static \ - ifcfg-test-wired-static-bootproto \ - ifcfg-test-wired-dhcp \ - ifcfg-test-wired-dhcp6-only \ - ifcfg-test-wired-global-gateway \ - network-test-wired-global-gateway \ - ifcfg-test-wired-never-default \ - network-test-wired-never-default \ - ifcfg-test-wired-defroute-no \ - ifcfg-test-wired-defroute-no-gatewaydev-yes \ - network-test-wired-defroute-no-gatewaydev-yes \ - ifcfg-test-wired-8021x-peap-mschapv2 \ - keys-test-wired-8021x-peap-mschapv2 \ - ifcfg-test-onboot-no \ - ifcfg-test-wifi-open \ - ifcfg-test-wifi-open-auto \ - ifcfg-test-wifi-open-ssid-quoted \ - ifcfg-test-wifi-open-ssid-long-quoted \ - ifcfg-test-wifi-open-ssid-hex \ - ifcfg-test-wifi-open-ssid-long-hex \ - ifcfg-test-wifi-open-ssid-bad-hex \ - ifcfg-test-wifi-wep \ - keys-test-wifi-wep \ - ifcfg-test-wifi-wep-adhoc \ - keys-test-wifi-wep-adhoc \ - ifcfg-test-wifi-wep-eap-ttls-chap \ - keys-test-wifi-wep-eap-ttls-chap \ - ifcfg-test-wifi-leap \ - keys-test-wifi-leap \ - ifcfg-test-wifi-wpa-psk \ - keys-test-wifi-wpa-psk \ - ifcfg-test-wifi-wpa-psk-unquoted \ - keys-test-wifi-wpa-psk-unquoted \ - ifcfg-test-wifi-wpa-psk-unquoted2 \ - keys-test-wifi-wpa-psk-unquoted2 \ - ifcfg-test-wifi-wpa-psk-adhoc \ - keys-test-wifi-wpa-psk-adhoc \ - ifcfg-test-wifi-wpa-psk-hex \ - keys-test-wifi-wpa-psk-hex \ - ifcfg-test-wifi-wpa-eap-tls \ - keys-test-wifi-wpa-eap-tls \ - ifcfg-test-wifi-wpa-eap-ttls-tls \ - keys-test-wifi-wpa-eap-ttls-tls \ - test_ca_cert.pem \ - test1_key_and_cert.pem \ - ifcfg-test-ibft-dhcp \ - ifcfg-test-ibft-static \ - ifcfg-test-static-routes-legacy \ - route-test-static-routes-legacy \ - ifcfg-test-wired-static-routes \ - route-test-wired-static-routes \ - ifcfg-test-wired-static-routes-legacy \ - route-test-wired-static-routes-legacy \ - ifcfg-test-wired-ipv4-manual-1 \ - ifcfg-test-wired-ipv4-manual-2 \ - ifcfg-test-wired-ipv4-manual-3 \ - ifcfg-test-wired-ipv4-manual-4 \ - ifcfg-test-wired-ipv6-manual \ - route6-test-wired-ipv6-manual \ - ifcfg-test-wired-static-no-prefix-8 \ - ifcfg-test-wired-static-no-prefix-16 \ - ifcfg-test-wired-static-no-prefix-24 \ - ifcfg-test-wired-ipv6-only \ - ifcfg-test-wifi-wep-passphrase \ - keys-test-wifi-wep-passphrase \ - ifcfg-test-wifi-wep-40-ascii \ - keys-test-wifi-wep-40-ascii \ - ifcfg-test-wifi-wep-104-ascii \ - keys-test-wifi-wep-104-ascii \ - ifcfg-test-wired-qeth-static \ - ifcfg-test-wired-ctc-static \ - ifcfg-test-bridge-main \ - ifcfg-test-bridge-component \ - ifcfg-test-vlan-interface - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: all all-am check check-am check-local clean clean-generic \ - clean-libtool distclean distclean-generic distclean-libtool \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - uninstall uninstall-am - - -check-local: - @for f in $(EXTRA_DIST); do \ - chmod 0600 $(abs_srcdir)/$$f; \ - done - -# Make the special temp dir for some written connections - mkdir -p $(abs_builddir)/tmp - -# 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. -.NOEXPORT: diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component deleted file mode 100644 index f586637ec..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component +++ /dev/null @@ -1,5 +0,0 @@ -DEVICE=eth0 -HWADDR=00:22:15:59:62:97 -ONBOOT=no -BRIDGE=br0 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main deleted file mode 100644 index c5caf3fc9..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main +++ /dev/null @@ -1,7 +0,0 @@ -DEVICE=br0 -ONBOOT=no -TYPE=Bridge -BOOTPROTO=dhcp -STP=on -DELAY=0 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-ibft-dhcp b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-ibft-dhcp deleted file mode 100644 index abfcd6e4c..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-ibft-dhcp +++ /dev/null @@ -1,4 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -DEVICE=eth0 -HWADDR=00:33:21:98:b9:f1 -BOOTPROTO=ibft diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-ibft-static b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-ibft-static deleted file mode 100644 index 99b02e42b..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-ibft-static +++ /dev/null @@ -1,4 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -DEVICE=eth0 -HWADDR=00:33:21:98:b9:f0 -BOOTPROTO=ibft diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-minimal b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-minimal deleted file mode 100644 index 63bcc840d..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-minimal +++ /dev/null @@ -1,4 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -DEVICE=eth0 -HWADDR=00:16:41:11:22:33 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-nm-controlled b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-nm-controlled deleted file mode 100644 index a38f1f5f1..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-nm-controlled +++ /dev/null @@ -1,9 +0,0 @@ -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:f8:9f -BOOTPROTO=dhcp -ONBOOT=yes -USERCTL=yes -IPV6INIT=no -NM_CONTROLLED=no - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-onboot-no b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-onboot-no deleted file mode 100644 index b94917110..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-onboot-no +++ /dev/null @@ -1,5 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -ONBOOT=no - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-static-routes-legacy b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-static-routes-legacy deleted file mode 100644 index 2173729d1..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-static-routes-legacy +++ /dev/null @@ -1,12 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -DEVICE=eth0 -HWADDR=00:16:41:11:22:33 -NAME="test-static-routes-legacy" -TYPE=Ethernet -BOOTPROTO=dhcp -DEFROUTE=yes -UUID=ba60d05a-7898-820d-c2db-427a88f8f2a5 -ONBOOT=yes -IPV6INIT=no -PEERDNS=yes -PEERROUTES=yes diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-vlan-interface b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-vlan-interface deleted file mode 100644 index 6c841855e..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-vlan-interface +++ /dev/null @@ -1,7 +0,0 @@ -DEVICE=eth1.43 -VLAN=yes -ONBOOT=yes -BOOTPROTO=none -IPADDR=192.168.43.149 -NETMASK=255.255.255.0 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-leap b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-leap deleted file mode 100644 index 50f4fd31e..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-leap +++ /dev/null @@ -1,17 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -KEY_MGMT=IEEE8021X -SECURITYMODE=LEAP -IEEE_8021X_IDENTITY="Bill Smith" - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open deleted file mode 100644 index d4bb8f75b..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open +++ /dev/null @@ -1,13 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-auto b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-auto deleted file mode 100644 index 42ee200af..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-auto +++ /dev/null @@ -1,13 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Auto -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-bad-hex b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-bad-hex deleted file mode 100644 index 32d633428..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-bad-hex +++ /dev/null @@ -1,13 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=0x626cxx -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-hex b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-hex deleted file mode 100644 index dcb46da7f..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-hex +++ /dev/null @@ -1,13 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=0x626c6168626c6168 -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-long-hex b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-long-hex deleted file mode 100644 index 37bb085b5..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-long-hex +++ /dev/null @@ -1,13 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=0x626c6168626c6168626c6168626c6168626c6168626c6168626c6168626c6168AA -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-long-quoted b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-long-quoted deleted file mode 100644 index 0b46acd66..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-long-quoted +++ /dev/null @@ -1,13 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID="foo\"bar\\foo\"bar\\foo\"bar\\foo\"bar\\1" -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-quoted b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-quoted deleted file mode 100644 index 08496bb56..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-quoted +++ /dev/null @@ -1,13 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID="foo\"bar\\" -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep deleted file mode 100644 index e1ce20d6d..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep +++ /dev/null @@ -1,14 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -SECURITYMODE=restricted diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-104-ascii b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-104-ascii deleted file mode 100644 index 250efa134..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-104-ascii +++ /dev/null @@ -1,14 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -SECURITYMODE=open diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-40-ascii b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-40-ascii deleted file mode 100644 index 250efa134..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-40-ascii +++ /dev/null @@ -1,14 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -SECURITYMODE=open diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-adhoc b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-adhoc deleted file mode 100644 index 9d0bacfc7..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-adhoc +++ /dev/null @@ -1,15 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=11 -MODE=Ad-Hoc -RATE=auto -ONBOOT=no -USERCTL=yes -PEERDNS=no -DNS1=4.2.2.1 -DNS2=4.2.2.2 -IPV6INIT=no diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-eap-ttls-chap b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-eap-ttls-chap deleted file mode 100644 index bdea6aa3b..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-eap-ttls-chap +++ /dev/null @@ -1,20 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -BOOTPROTO=dhcp -ONBOOT=yes -ONBOOT=yes -USERCTL=yes -IPV6INIT=no -NM_CONTROLLED=yes -PEERDNS=yes -ESSID=blahblah -MODE=Managed -RATE=auto -KEY_MGMT=IEEE8021X -IEEE_8021X_EAP_METHODS=TTLS -IEEE_8021X_IDENTITY="David Smith" -IEEE_8021X_CA_CERT=test_ca_cert.pem -IEEE_8021X_INNER_AUTH_METHODS=CHAP - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-passphrase b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-passphrase deleted file mode 100644 index 250efa134..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-passphrase +++ /dev/null @@ -1,14 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -SECURITYMODE=open diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-eap-tls b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-eap-tls deleted file mode 100644 index 92aaeeab9..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-eap-tls +++ /dev/null @@ -1,25 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -BOOTPROTO=dhcp -ONBOOT=yes -ONBOOT=yes -USERCTL=yes -IPV6INIT=no -NM_CONTROLLED=yes -PEERDNS=yes -ESSID=blahblah -MODE=Managed -RATE=auto -CIPHER_PAIRWISE="TKIP CCMP" -CIPHER_GROUP="TKIP CCMP WEP40 WEP104" -KEY_MGMT=WPA-EAP -WPA_ALLOW_WPA=yes -WPA_ALLOW_WPA2=yes -IEEE_8021X_EAP_METHODS=TLS -IEEE_8021X_IDENTITY="Bill Smith" -IEEE_8021X_CA_CERT=test_ca_cert.pem -IEEE_8021X_CLIENT_CERT=test1_key_and_cert.pem -IEEE_8021X_PRIVATE_KEY=test1_key_and_cert.pem - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-eap-ttls-tls b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-eap-ttls-tls deleted file mode 100644 index 42ed1d68a..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-eap-ttls-tls +++ /dev/null @@ -1,28 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -BOOTPROTO=dhcp -ONBOOT=yes -ONBOOT=yes -USERCTL=yes -IPV6INIT=no -NM_CONTROLLED=yes -PEERDNS=yes -ESSID=blahblah -MODE=Managed -RATE=auto -CIPHER_PAIRWISE="TKIP CCMP" -CIPHER_GROUP="TKIP CCMP WEP40 WEP104" -KEY_MGMT=WPA-EAP -WPA_ALLOW_WPA=yes -WPA_ALLOW_WPA2=yes -IEEE_8021X_EAP_METHODS=TTLS -IEEE_8021X_IDENTITY="Chuck Shumer" -IEEE_8021X_ANON_IDENTITY="anonymous" -IEEE_8021X_CA_CERT=test_ca_cert.pem -IEEE_8021X_INNER_AUTH_METHODS=EAP-TLS -IEEE_8021X_INNER_CA_CERT=test_ca_cert.pem -IEEE_8021X_INNER_CLIENT_CERT=test1_key_and_cert.pem -IEEE_8021X_INNER_PRIVATE_KEY=test1_key_and_cert.pem - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk deleted file mode 100644 index 2119ba8e6..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk +++ /dev/null @@ -1,19 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -CIPHER_PAIRWISE="TKIP CCMP" -CIPHER_GROUP="TKIP CCMP WEP40 WEP104" -KEY_MGMT=WPA-PSK -WPA_ALLOW_WPA=yes -WPA_ALLOW_WPA2=yes - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-adhoc b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-adhoc deleted file mode 100644 index aa00925e1..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-adhoc +++ /dev/null @@ -1,16 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Ad-Hoc -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -CIPHER_GROUP=CCMP -KEY_MGMT=WPA-PSK - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-hex b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-hex deleted file mode 100644 index 2119ba8e6..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-hex +++ /dev/null @@ -1,19 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -CIPHER_PAIRWISE="TKIP CCMP" -CIPHER_GROUP="TKIP CCMP WEP40 WEP104" -KEY_MGMT=WPA-PSK -WPA_ALLOW_WPA=yes -WPA_ALLOW_WPA2=yes - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted deleted file mode 100644 index 2119ba8e6..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted +++ /dev/null @@ -1,19 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -CIPHER_PAIRWISE="TKIP CCMP" -CIPHER_GROUP="TKIP CCMP WEP40 WEP104" -KEY_MGMT=WPA-PSK -WPA_ALLOW_WPA=yes -WPA_ALLOW_WPA2=yes - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted2 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted2 deleted file mode 100644 index 2119ba8e6..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted2 +++ /dev/null @@ -1,19 +0,0 @@ -TYPE=Wireless -DEVICE=eth2 -HWADDR=00:16:41:11:22:33 -NM_CONTROLLED=yes -BOOTPROTO=dhcp -ESSID=blahblah -CHANNEL=1 -MODE=Managed -RATE=auto -ONBOOT=yes -USERCTL=yes -PEERDNS=yes -IPV6INIT=no -CIPHER_PAIRWISE="TKIP CCMP" -CIPHER_GROUP="TKIP CCMP WEP40 WEP104" -KEY_MGMT=WPA-PSK -WPA_ALLOW_WPA=yes -WPA_ALLOW_WPA2=yes - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-8021x-peap-mschapv2 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-8021x-peap-mschapv2 deleted file mode 100644 index 6d68eca13..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-8021x-peap-mschapv2 +++ /dev/null @@ -1,15 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=dhcp -ONBOOT=yes -NM_CONTROLLED=yes -KEY_MGMT=IEEE8021X -IEEE_8021X_EAP_METHODS=PEAP -IEEE_8021X_IDENTITY="David Smith" -IEEE_8021X_CA_CERT=test_ca_cert.pem -IEEE_8021X_PEAP_VERSION=1 -IEEE_8021X_PEAP_FORCE_NEW_LABEL=yes -IEEE_8021X_INNER_AUTH_METHODS=MSCHAPV2 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ctc-static b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ctc-static deleted file mode 100644 index 61f8f423d..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ctc-static +++ /dev/null @@ -1,12 +0,0 @@ -# IBM CTC -DEVICE=ctc0 -TYPE=CTC -BOOTPROTO=static -IPADDR=192.168.70.87 -GATEWAY=192.168.70.136 -NETMASK=255.255.255.0 -ONBOOT=yes -SUBCHANNELS=0.0.1b00,0.0.1b01 -NETTYPE=ctc -CTCPROT=0 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-defroute-no b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-defroute-no deleted file mode 100644 index fe8b15b29..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-defroute-no +++ /dev/null @@ -1,15 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth4 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=dhcp -ONBOOT=yes -USERCTL=yes -NM_CONTROLLED=yes -PEERDNS=yes -DEFROUTE=no - -IPV6INIT=yes -IPV6_AUTOCONF=yes -IPV6_DEFROUTE=no - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-defroute-no-gatewaydev-yes b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-defroute-no-gatewaydev-yes deleted file mode 100644 index 3cf4323dd..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-defroute-no-gatewaydev-yes +++ /dev/null @@ -1,15 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=dhcp -ONBOOT=yes -USERCTL=yes -NM_CONTROLLED=yes -PEERDNS=yes -DEFROUTE=no - -IPV6INIT=yes -IPV6_AUTOCONF=yes -IPV6_DEFROUTE=no - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp deleted file mode 100644 index 727d2cebc..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp +++ /dev/null @@ -1,14 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=dhcp -ONBOOT=yes -USERCTL=yes -IPV6INIT=no -NM_CONTROLLED=yes -PEERDNS=no -DHCP_HOSTNAME=foobar -DNS1=4.2.2.1 -DNS2=4.2.2.2 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp6-only b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp6-only deleted file mode 100644 index de03e0448..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp6-only +++ /dev/null @@ -1,11 +0,0 @@ -DEVICE="eth0" -ONBOOT=no -TYPE=Ethernet -DEFROUTE=yes -PEERDNS=yes -PEERROUTES=yes -IPV6INIT=yes -IPV6_AUTOCONF=no -DHCPV6C=yes -HWADDR=00:13:20:F5:F5:E4 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-global-gateway b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-global-gateway deleted file mode 100644 index 98d910531..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-global-gateway +++ /dev/null @@ -1,14 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -ONBOOT=yes -USERCTL=yes -IPV6INIT=no -NM_CONTROLLED=yes -DNS1=4.2.2.1 -DNS2=4.2.2.2 -IPADDR=192.168.1.5 -PREFIX=24 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-1 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-1 deleted file mode 100644 index cad0f6cf3..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-1 +++ /dev/null @@ -1,12 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -IPADDR0=1.2.3.4 -PREFIX0=24 -GATEWAY0=1.1.1.1 -IPADDR1=9.8.7.6 -PREFIX1=16 -IPADDR2=3.3.3.3 -PREFIX2=8 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-2 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-2 deleted file mode 100644 index ad9290a4d..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-2 +++ /dev/null @@ -1,14 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -IPADDR=1.2.3.4 -PREFIX=24 -GATEWAY=1.1.1.1 -IPADDR2=9.8.7.6 -PREFIX2=16 -GATEWAY2=5.5.5.5 -IPADDR3=3.3.3.3 -PREFIX3=8 -GATEWAY3=7.7.7.7 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-3 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-3 deleted file mode 100644 index f2457bd2a..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-3 +++ /dev/null @@ -1,11 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -IPADDR2=1.2.3.4 -PREFIX2=24 -IPADDR3=9.8.7.6 -PREFIX3=16 -IPADDR4=3.3.3.3 -PREFIX4=8 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-4 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-4 deleted file mode 100644 index e6b77141f..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv4-manual-4 +++ /dev/null @@ -1,11 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -IPADDR=1.2.3.4 -PREFIX=24 -IPADDR1=9.8.7.6 -PREFIX1=16 -IPADDR2=3.3.3.3 -PREFIX2=8 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv6-manual b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv6-manual deleted file mode 100644 index 45db0e4c4..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv6-manual +++ /dev/null @@ -1,19 +0,0 @@ -# Intel Corporation 82567LM Gigabit Network Connection -TYPE=Ethernet -DEVICE=eth2 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=dhcp -ONBOOT=yes -USERCTL=yes -NM_CONTROLLED=yes -PEERDNS=yes -DNS1=10.2.0.4 -DNS2=10.2.0.5 -DNS3=1:2:3:4::a -DNS4=1:2:3:4::b -DOMAIN="lorem.com ipsum.org dolor.edu" -IPV6INIT=yes -IPV6_AUTOCONF=no -IPV6ADDR="1001:abba::1234/56" -IPV6ADDR_SECONDARIES="2001:abba::2234/64 3001:abba::3234/96" -IPV6_FAILURE_FATAL=no diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv6-only b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv6-only deleted file mode 100644 index 59ec32e5b..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-ipv6-only +++ /dev/null @@ -1,14 +0,0 @@ -# Intel Corporation 82567LM Gigabit Network Connection -TYPE=Ethernet -DEVICE=eth2 -HWADDR=00:11:22:33:44:ee -ONBOOT=yes -USERCTL=yes -NM_CONTROLLED=yes -PEERDNS=yes -DNS1=1:2:3:4::a -DOMAIN="lorem.com ipsum.org dolor.edu" -IPV6INIT=yes -IPV6_AUTOCONF=no -IPV6ADDR="1001:abba::1234/56" - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-never-default b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-never-default deleted file mode 100644 index 12d5b5e63..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-never-default +++ /dev/null @@ -1,11 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth4 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=dhcp -ONBOOT=yes -USERCTL=yes -NM_CONTROLLED=yes -PEERDNS=yes -IPV6INIT=yes -IPV6_AUTOCONF=yes diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-qeth-static b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-qeth-static deleted file mode 100644 index 4719de217..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-qeth-static +++ /dev/null @@ -1,13 +0,0 @@ -# IBM QETH -DEVICE=eth1 -BOOTPROTO=static -IPADDR=192.168.70.87 -NETMASK=255.255.255.0 -ONBOOT=yes -NETTYPE=qeth -SUBCHANNELS=0.0.0600,0.0.0601,0.0.0602 -TYPE=Ethernet -PORTNAME=OSAPORT -OPTIONS='layer2=1 portno=0' -MACADDR=02:00:00:23:65:1a - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static deleted file mode 100644 index c8315f45d..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static +++ /dev/null @@ -1,20 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -ONBOOT=yes -USERCTL=yes -MTU=1492 -NM_CONTROLLED=yes -DNS1=4.2.2.1 -DNS2=4.2.2.2 -IPADDR=192.168.1.5 -NETMASK=255.255.255.0 -GATEWAY=192.168.1.1 -IPV6INIT=yes -IPV6_AUTOCONF=no -IPV6ADDR=dead:beaf::1 -IPV6ADDR_SECONDARIES="dead:beaf::2/56" -DNS3=1:2:3:4::a -DNS4=1:2:3:4::b diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-bootproto b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-bootproto deleted file mode 100644 index ee821503e..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-bootproto +++ /dev/null @@ -1,15 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=static -ONBOOT=yes -USERCTL=yes -IPV6INIT=no -MTU=1492 -NM_CONTROLLED=yes -DNS1=4.2.2.1 -DNS2=4.2.2.2 -IPADDR=192.168.1.5 -NETMASK=255.255.255.0 -GATEWAY=192.168.1.1 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-no-prefix-16 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-no-prefix-16 deleted file mode 100644 index 079990388..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-no-prefix-16 +++ /dev/null @@ -1,14 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -ONBOOT=yes -USERCTL=yes -MTU=1492 -NM_CONTROLLED=yes -DNS1=4.2.2.1 -DNS2=4.2.2.2 -IPADDR=172.16.3.4 -GATEWAY=172.16.3.1 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-no-prefix-24 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-no-prefix-24 deleted file mode 100644 index 688143cd2..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-no-prefix-24 +++ /dev/null @@ -1,14 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -ONBOOT=yes -USERCTL=yes -MTU=1492 -NM_CONTROLLED=yes -DNS1=4.2.2.1 -DNS2=4.2.2.2 -IPADDR=192.168.1.5 -GATEWAY=192.168.1.1 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-no-prefix-8 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-no-prefix-8 deleted file mode 100644 index 0433c62a8..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-no-prefix-8 +++ /dev/null @@ -1,14 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -ONBOOT=yes -USERCTL=yes -MTU=1492 -NM_CONTROLLED=yes -DNS1=4.2.2.1 -DNS2=4.2.2.2 -IPADDR=10.11.12.13 -GATEWAY=10.0.0.1 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-routes b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-routes deleted file mode 100644 index 7faf49bda..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-routes +++ /dev/null @@ -1,15 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -ONBOOT=yes -USERCTL=yes -IPV6INIT=no -MTU=1492 -NM_CONTROLLED=yes -DNS1=4.2.2.1 -DNS2=4.2.2.2 -IPADDR=192.168.1.5 -NETMASK=255.255.255.0 -GATEWAY=192.168.1.1 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-routes-legacy b/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-routes-legacy deleted file mode 100644 index 7faf49bda..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-static-routes-legacy +++ /dev/null @@ -1,15 +0,0 @@ -# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) -TYPE=Ethernet -DEVICE=eth0 -HWADDR=00:11:22:33:44:ee -BOOTPROTO=none -ONBOOT=yes -USERCTL=yes -IPV6INIT=no -MTU=1492 -NM_CONTROLLED=yes -DNS1=4.2.2.1 -DNS2=4.2.2.2 -IPADDR=192.168.1.5 -NETMASK=255.255.255.0 -GATEWAY=192.168.1.1 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-leap b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-leap deleted file mode 100644 index fe78177e7..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-leap +++ /dev/null @@ -1 +0,0 @@ -IEEE_8021X_PASSWORD="foobarblah" diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep deleted file mode 100644 index 0bd766c27..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep +++ /dev/null @@ -1 +0,0 @@ -KEY=0123456789abcdef0123456789 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-104-ascii b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-104-ascii deleted file mode 100644 index f5d532b28..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-104-ascii +++ /dev/null @@ -1 +0,0 @@ -KEY1=s:LoremIpsumSit diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-40-ascii b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-40-ascii deleted file mode 100644 index b0d147082..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-40-ascii +++ /dev/null @@ -1 +0,0 @@ -KEY1=s:Lorem diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-adhoc b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-adhoc deleted file mode 100644 index 0bd766c27..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-adhoc +++ /dev/null @@ -1 +0,0 @@ -KEY=0123456789abcdef0123456789 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-eap-ttls-chap b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-eap-ttls-chap deleted file mode 100644 index 6936f2e06..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-eap-ttls-chap +++ /dev/null @@ -1,2 +0,0 @@ -IEEE_8021X_PASSWORD="foobar baz" - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-passphrase b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-passphrase deleted file mode 100644 index d45c0ea8e..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-passphrase +++ /dev/null @@ -1 +0,0 @@ -KEY_PASSPHRASE1="foobar222blahblah" diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-eap-tls b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-eap-tls deleted file mode 100644 index 0c3bc1e1d..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-eap-tls +++ /dev/null @@ -1,2 +0,0 @@ -IEEE_8021X_PRIVATE_KEY_PASSWORD="test1" - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-eap-ttls-tls b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-eap-ttls-tls deleted file mode 100644 index b6256b951..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-eap-ttls-tls +++ /dev/null @@ -1,2 +0,0 @@ -IEEE_8021X_INNER_PRIVATE_KEY_PASSWORD="test1" - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk deleted file mode 100644 index d7813b2f5..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk +++ /dev/null @@ -1,2 +0,0 @@ -WPA_PSK="I wonder what the king is doing tonight?" - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-adhoc b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-adhoc deleted file mode 100644 index d7813b2f5..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-adhoc +++ /dev/null @@ -1,2 +0,0 @@ -WPA_PSK="I wonder what the king is doing tonight?" - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-hex b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-hex deleted file mode 100644 index d0576a8de..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-hex +++ /dev/null @@ -1,2 +0,0 @@ -WPA_PSK=1da190379817bc360dda52e85c388c439a21ea5c7bf819c64e9da051807deae6 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-unquoted b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-unquoted deleted file mode 100644 index 9a47196a2..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-unquoted +++ /dev/null @@ -1,2 +0,0 @@ -WPA_PSK=54336845e2f3f321c4c7 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-unquoted2 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-unquoted2 deleted file mode 100644 index 347bb85e5..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-unquoted2 +++ /dev/null @@ -1,2 +0,0 @@ -WPA_PSK="a5d4d45e78e1455d8e6124e81ea137f9a5d4d45e78e1455d8e6124e81ea137f9" - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-8021x-peap-mschapv2 b/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-8021x-peap-mschapv2 deleted file mode 100644 index 6936f2e06..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-8021x-peap-mschapv2 +++ /dev/null @@ -1,2 +0,0 @@ -IEEE_8021X_PASSWORD="foobar baz" - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-defroute-no-gatewaydev-yes b/system-settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-defroute-no-gatewaydev-yes deleted file mode 100644 index 0d6a302f1..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-defroute-no-gatewaydev-yes +++ /dev/null @@ -1,2 +0,0 @@ -GATEWAYDEV=eth0 -IPV6_DEFAULTDEV=eth0 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-global-gateway b/system-settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-global-gateway deleted file mode 100644 index 7987d1058..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-global-gateway +++ /dev/null @@ -1 +0,0 @@ -GATEWAY=192.168.1.2 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-never-default b/system-settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-never-default deleted file mode 100644 index 9a292679a..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-never-default +++ /dev/null @@ -1,4 +0,0 @@ -GATEWAYDEV=eth0 -# when devices in IPV6_DEFAULTDEV and IPV6_DEFAULTGW don't match the one in IPV6_DEFAULTGW is prefered -IPV6_DEFAULTDEV=eth4 -IPV6_DEFAULTGW=2001::1234%eth0 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/route-test-static-routes-legacy b/system-settings/plugins/ifcfg-rh/tests/network-scripts/route-test-static-routes-legacy deleted file mode 100644 index 3db42ab5b..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/route-test-static-routes-legacy +++ /dev/null @@ -1,3 +0,0 @@ -1.2.3.0/24 via 222.173.190.239 metric 0 -3.2.1.0/24 via 202.254.171.190 metric 77 -7.7.7.7/32 via 10.0.2.2 metric 11 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/route-test-wired-static-routes b/system-settings/plugins/ifcfg-rh/tests/network-scripts/route-test-wired-static-routes deleted file mode 100644 index ee2a32d8e..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/route-test-wired-static-routes +++ /dev/null @@ -1,8 +0,0 @@ -ADDRESS0=11.22.33.0 -NETMASK0=255.255.255.0 -GATEWAY0=192.168.1.5 - -ADDRESS1=44.55.66.77 -NETMASK1=255.255.255.255 -GATEWAY1=192.168.1.7 -METRIC1=3 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/route-test-wired-static-routes-legacy b/system-settings/plugins/ifcfg-rh/tests/network-scripts/route-test-wired-static-routes-legacy deleted file mode 100644 index cb7d42bde..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/route-test-wired-static-routes-legacy +++ /dev/null @@ -1,7 +0,0 @@ -# Test route file in legacy format; i.e. lines passed as argumet to "ip route add" - - -21.31.41.0/24 via 9.9.9.9 metric 1 - via 8.8.8.8 to 32.42.52.62 - 43.53.0.0/16 metric 3 via 7.7.7.7 dev eth2 - diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/route6-test-wired-ipv6-manual b/system-settings/plugins/ifcfg-rh/tests/network-scripts/route6-test-wired-ipv6-manual deleted file mode 100644 index ae4e47ae5..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/route6-test-wired-ipv6-manual +++ /dev/null @@ -1 +0,0 @@ -9876::1234/96 via 9876::7777 metric 2 diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/test1_key_and_cert.pem b/system-settings/plugins/ifcfg-rh/tests/network-scripts/test1_key_and_cert.pem deleted file mode 100644 index dec9aa1b8..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/test1_key_and_cert.pem +++ /dev/null @@ -1,118 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,4DE0615F23D82107 - -QPNCO5Dobvz9dDhN32KkZRoEifW+HDm2PCbRQhKDiscGwB6LgypvVjHNsZiFKwzz -L4R51UqgQeJx7GSGJqE626e9z9J+UNBhop02aOO2X0eSPdvBzr/uJ6Umiyr1xqD7 -zWf7u9l5kXElDJRhK+87GMBewp4Ie9NeXDjhF8hzC5Kiulen4AH3AYnfH3S7DimU -h8GFMg8inrudrTbcjBhCdPeHG2jCygOxw3InRFz7uaN6LIhOaPQvmvpP4Cc1WRnW -ZPq9o+eU3fPWPD5t+Op/VzYLvKwgBy/yK1rQXUm6ZMO7MhhRJ94ZCsJv+nVWpJlv -QyBlxDKxwfkfYbDELdnnDQdHdMbKatLqa0KhSkgpp8LywBtanPz731tyT0r7b3na -eLdra59lRU7ZQLPEdS3lPZd2O/KQvWf8wbg7MjXS9LxQ7R5HOPu6DNJlwXVZBmmo -cAfu2q8ubU2IePvWLD1GOrBi6hE9TiGvFJkw+wBK+t72sz3njv9Xm/zlxruaEk5m -RW/kybU3FP4PtjriBbskz3/VZaaxuRN7OoOYTkmyHmG1ADgcRUV6fea19qqsBlN8 -xb+SRtoH28oT/JVWU5neE2dbNzk5LeVO+w70NNdR5s5xqkBhbGGaJxvXwNP4ltFr -T06SMh8znOLKwWB00aRtwfU7jOwR3mOleQO4ugIHmau3zp1TqzAHW8XtpuV7qVeI -ESZOZuf0vW43BtNzgLXt1+r+bmsMsRwhnyomL9M0TUyyBdVYY9GkzTG9pOESheRo -RSvAZ8qKGUliTpgBcbt2v1+NqkszcHa6FxuvS8YU4uo5/GqsgTxHTNIB232hIrrZ -EIm6QL9TC5oFXMjy6UNqoCm5Nb8DBJ6aErt7pt7aoktqUW3O3QIzQT3IbZ4nAcTt -lVF4d7j29I9t7bcC8GOVU1neilguZUss4ghJg9x4zI5UZdR7hZ8fbFT47TyxB+j5 -r0YdmjbjVTaSyaN2JGh1wvb4TzawGNVx/U2EJE16HigOtPfsfQRJ3x+FROKBdVa4 -aIFYXkRBeIPxX6n9pcw0lBCsnXo6/5iTjQSk2VqO3rHO/wyWiEjNczhL33dY2A8W -GG5ECMO5SqXZHQQzpABqK94dxe3UC8aEESO5NhEqDuV7qQGol0qPKrUA3wb0jb2e -DrejJ9HS2m1SUDmjpvvmEGy6GN7CRibbKt5rNZdJNNvWArOF5d0F6wkixQLl73oE -lq5gLQQk9n7ClleKLhlQpBCorxilBbzmSUekkJLi0eaZiBBFWBX9udqnUZloXTgO -8qwuO8K/GPR9Jy1/UH2Vh1H+wivaqKTVgEb0NotzgzECgTEFKJafl7rUNs1OZRZ3 -VBjevi6+iDpxVFgF71kXfdUC4ph0E1XDl0ja2rrKQGivMkUhWJ57+4EV5+hBkAnt -G0RV45NwHXLrK2bd8F9PlRk2XHW6mIcFRXsW1DjeBhk/sQjvlO9R01GRSgcXtekJ -tmX17FWrMrzXHpvy1IC3fk4RVnSjpzQ8O+17YE8/la9wVaeZZzHyYFmMT7VXjIhW -QozJQ0vJ2jxJRh5GYn3tpJzdaeRfvTBik0pChNdUTnWP+BJ35xoCTs8iwJbmgVZ1 ------END RSA PRIVATE KEY----- -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 1 (0x1) - Signature Algorithm: md5WithRSAEncryption - Issuer: C=US, ST=Berkshire, L=Newbury, O=My Company Ltd, OU=Testing, CN=test/emailAddress=test@test.com - Validity - Not Before: Mar 10 15:13:16 2009 GMT - Not After : Mar 8 15:13:16 2019 GMT - Subject: C=US, ST=Berkshire, O=My Company Ltd, OU=Testing, CN=test1/emailAddress=test@test.com - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (2048 bit) - Modulus (2048 bit): - 00:cd:34:b1:2e:b0:04:c6:f4:2b:a2:c0:a0:39:7a: - 82:ed:96:c4:f7:19:83:91:5c:b4:e7:9c:de:ec:48: - ec:2d:e4:51:08:26:42:ac:d3:98:26:7a:72:f7:49: - c2:9e:66:05:c6:47:29:fe:3b:ac:6b:af:6f:5e:a8: - 03:5a:73:33:ba:19:03:00:35:f5:00:bc:a8:be:14: - ce:46:69:e3:6d:ed:34:37:85:55:87:62:b3:b7:c9: - c0:cc:9a:aa:61:05:5b:cd:a2:17:42:d3:e5:6f:1c: - 60:8d:c2:15:41:46:f8:12:54:d0:38:57:e1:fd:8d: - 44:c8:fb:56:b3:b9:6c:e9:f8:9e:21:11:57:1b:8b: - f9:cf:e3:17:e7:d8:fd:ac:d1:01:c6:92:30:f3:2d: - c9:d6:c1:f0:3d:fd:ca:30:dd:75:74:e7:d1:6b:75: - d8:c5:4d:43:61:fe:f6:ad:7e:4c:63:7c:03:17:a2: - 06:8f:d0:8b:69:d3:7a:07:0f:0b:a2:cf:0c:70:38: - ba:cc:55:35:60:84:58:d8:d2:be:1f:ef:76:a9:ba: - ae:6a:dc:08:97:80:de:42:00:b7:d4:ce:9a:b0:36: - 2a:c7:6f:45:04:7c:ea:41:19:d8:b9:19:04:1f:11: - a9:22:80:bd:69:08:15:0d:3c:de:cd:7e:88:6c:0f: - a3:43 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - CE:03:7E:EF:E7:DE:C9:87:BF:DE:56:F4:C8:A3:40:F6:C8:6F:05:8C - X509v3 Authority Key Identifier: - keyid:B8:35:37:32:BE:CF:4F:79:F5:7B:74:B2:F2:10:5A:BA:80:C5:6A:10 - DirName:/C=US/ST=Berkshire/L=Newbury/O=My Company Ltd/OU=Testing/CN=test/emailAddress=test@test.com - serial:EB:E7:64:FB:79:F7:22:19 - - Signature Algorithm: md5WithRSAEncryption - 7a:20:93:63:40:73:7d:33:01:2e:c0:13:52:a4:a7:e1:4d:82: - f4:fb:b2:7b:d0:2b:5a:3f:0e:3c:28:61:71:ab:01:4d:fe:89: - b5:cd:2f:97:59:93:53:9d:51:86:48:dd:b9:e4:73:5e:22:0b: - 12:0d:25:39:76:16:44:06:0c:40:45:21:6b:a6:b1:e0:bf:76: - 1b:36:f3:1e:41:82:57:d9:59:b7:60:40:43:1c:1d:79:f6:48: - 32:5c:4e:e2:06:89:96:41:d2:54:1f:4a:6f:f6:78:a5:3c:02: - 85:21:e2:65:e1:8a:6d:24:19:95:f8:c0:35:ab:bd:ff:3d:f1: - fb:50:2d:30:1e:67:a6:7c:50:f9:d5:77:66:77:5a:14:0f:5c: - cd:21:09:9b:a3:92:57:19:dd:01:a4:18:c5:f9:70:e4:17:43: - 8d:b1:e6:61:e9:50:89:83:4f:ce:a4:57:68:58:40:70:ae:71: - 1c:47:66:d2:30:54:50:ea:3a:87:32:64:3b:18:42:fe:5a:19: - 07:64:f7:f1:b1:10:07:fd:a7:d2:a7:a8:05:79:5b:25:ba:69: - 7b:1a:3e:b1:3e:e4:17:17:01:ba:eb:54:ae:83:00:ed:66:62: - 8d:c0:3e:8a:b4:27:5f:e9:01:ce:20:c3:34:a9:28:c0:6f:c7: - 3b:65:fe:f9 ------BEGIN CERTIFICATE----- -MIIEojCCA4qgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBizELMAkGA1UEBhMCVVMx -EjAQBgNVBAgTCUJlcmtzaGlyZTEQMA4GA1UEBxMHTmV3YnVyeTEXMBUGA1UEChMO -TXkgQ29tcGFueSBMdGQxEDAOBgNVBAsTB1Rlc3RpbmcxDTALBgNVBAMTBHRlc3Qx -HDAaBgkqhkiG9w0BCQEWDXRlc3RAdGVzdC5jb20wHhcNMDkwMzEwMTUxMzE2WhcN -MTkwMzA4MTUxMzE2WjB6MQswCQYDVQQGEwJVUzESMBAGA1UECBMJQmVya3NoaXJl -MRcwFQYDVQQKEw5NeSBDb21wYW55IEx0ZDEQMA4GA1UECxMHVGVzdGluZzEOMAwG -A1UEAxMFdGVzdDExHDAaBgkqhkiG9w0BCQEWDXRlc3RAdGVzdC5jb20wggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNNLEusATG9CuiwKA5eoLtlsT3GYOR -XLTnnN7sSOwt5FEIJkKs05gmenL3ScKeZgXGRyn+O6xrr29eqANaczO6GQMANfUA -vKi+FM5GaeNt7TQ3hVWHYrO3ycDMmqphBVvNohdC0+VvHGCNwhVBRvgSVNA4V+H9 -jUTI+1azuWzp+J4hEVcbi/nP4xfn2P2s0QHGkjDzLcnWwfA9/cow3XV059FrddjF -TUNh/vatfkxjfAMXogaP0Itp03oHDwuizwxwOLrMVTVghFjY0r4f73apuq5q3AiX -gN5CALfUzpqwNirHb0UEfOpBGdi5GQQfEakigL1pCBUNPN7NfohsD6NDAgMBAAGj -ggEfMIIBGzAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVy -YXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUzgN+7+feyYe/3lb0yKNA9shvBYww -gcAGA1UdIwSBuDCBtYAUuDU3Mr7PT3n1e3Sy8hBauoDFahChgZGkgY4wgYsxCzAJ -BgNVBAYTAlVTMRIwEAYDVQQIEwlCZXJrc2hpcmUxEDAOBgNVBAcTB05ld2J1cnkx -FzAVBgNVBAoTDk15IENvbXBhbnkgTHRkMRAwDgYDVQQLEwdUZXN0aW5nMQ0wCwYD -VQQDEwR0ZXN0MRwwGgYJKoZIhvcNAQkBFg10ZXN0QHRlc3QuY29tggkA6+dk+3n3 -IhkwDQYJKoZIhvcNAQEEBQADggEBAHogk2NAc30zAS7AE1Kkp+FNgvT7snvQK1o/ -DjwoYXGrAU3+ibXNL5dZk1OdUYZI3bnkc14iCxINJTl2FkQGDEBFIWumseC/dhs2 -8x5BglfZWbdgQEMcHXn2SDJcTuIGiZZB0lQfSm/2eKU8AoUh4mXhim0kGZX4wDWr -vf898ftQLTAeZ6Z8UPnVd2Z3WhQPXM0hCZujklcZ3QGkGMX5cOQXQ42x5mHpUImD -T86kV2hYQHCucRxHZtIwVFDqOocyZDsYQv5aGQdk9/GxEAf9p9KnqAV5WyW6aXsa -PrE+5BcXAbrrVK6DAO1mYo3APoq0J1/pAc4gwzSpKMBvxztl/vk= ------END CERTIFICATE----- diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/test_ca_cert.pem b/system-settings/plugins/ifcfg-rh/tests/network-scripts/test_ca_cert.pem deleted file mode 100644 index ef1be20d2..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/test_ca_cert.pem +++ /dev/null @@ -1,27 +0,0 @@ ------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/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.c b/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.c deleted file mode 100644 index e32ad7890..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.c +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager system settings service - keyfile plugin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2008 - 2011 Red Hat, Inc. - */ - -#include <stdio.h> -#include <stdarg.h> -#include <unistd.h> -#include <string.h> - -#include "nm-test-helpers.h" - -#include "common.h" -#include "utils.h" - - -static void -test_get_ifcfg_name (const char *desc, - const char *path, - gboolean only_ifcfg, - const char *expected) -{ - const char *result; - - result = utils_get_ifcfg_name (path, only_ifcfg); - if (expected == NULL) { - ASSERT (result == NULL, desc, "unexpected valid ifcfg name '%s'", result); - } else { - ASSERT (result != NULL, desc, "failed to create ifcfg name for '%s'", path); - - ASSERT (strcmp (result, expected) == 0, - desc, "unexpected ifcfg name '%s' created for '%s'", result, path); - } -} - -static void -test_get_ifcfg_path (const char *desc, - const char *path, - const char *expected) -{ - char *result; - - result = utils_get_ifcfg_path (path); - if (expected == NULL) { - ASSERT (result == NULL, desc, "unexpected valid ifcfg name '%s'", result); - } else { - ASSERT (result != NULL, desc, "failed to create ifcfg name for '%s'", path); - - ASSERT (strcmp (result, expected) == 0, - desc, "unexpected ifcfg name '%s' created for '%s'", result, path); - } - g_free (result); -} - -static void -test_get_keys_path (const char *desc, - const char *path, - const char *expected) -{ - char *result; - - result = utils_get_keys_path (path); - if (expected == NULL) { - ASSERT (result == NULL, desc, "unexpected valid extra path '%s'", result); - } else { - ASSERT (result != NULL, desc, "failed to create extra path for '%s'", path); - - ASSERT (strcmp (result, expected) == 0, - desc, "unexpected extra path '%s' created for '%s'", result, path); - } - g_free (result); -} - -static void -test_get_route_path (const char *desc, - const char *path, - const char *expected) -{ - char *result; - - result = utils_get_route_path (path); - if (expected == NULL) { - ASSERT (result == NULL, desc, "unexpected valid extra path '%s'", result); - } else { - ASSERT (result != NULL, desc, "failed to create extra path for '%s'", path); - - ASSERT (strcmp (result, expected) == 0, - desc, "unexpected extra path '%s' created for '%s'", result, path); - } - g_free (result); -} - -static void -test_ignored (const char *desc, const char *path, gboolean expected_ignored) -{ - gboolean result; - - result = utils_should_ignore_file (path, FALSE); - ASSERT (result == expected_ignored, desc, "unexpected ignore result for path '%s'", path); -} - -int main (int argc, char **argv) -{ - char *base; - - /* The tests */ - test_get_ifcfg_name ("get-ifcfg-name-bad", "/foo/bar/adfasdfadf", FALSE, NULL); - test_get_ifcfg_name ("get-ifcfg-name-good", "/foo/bar/ifcfg-FooBar", FALSE, "FooBar"); - test_get_ifcfg_name ("get-ifcfg-name-keys", "/foo/bar/keys-BlahLbah", FALSE, "BlahLbah"); - test_get_ifcfg_name ("get-ifcfg-name-route", "/foo/bar/route-Lalalala", FALSE, "Lalalala"); - test_get_ifcfg_name ("get-ifcfg-name-only-ifcfg-route", "/foo/bar/route-Lalalala", TRUE, NULL); - test_get_ifcfg_name ("get-ifcfg-name-only-ifcfg-keys", "/foo/bar/keys-Lalalala", TRUE, NULL); - test_get_ifcfg_name ("get-ifcfg-name-no-path-ifcfg", "ifcfg-Lalalala", FALSE, "Lalalala"); - test_get_ifcfg_name ("get-ifcfg-name-no-path-keys", "keys-Lalalala", FALSE, "Lalalala"); - test_get_ifcfg_name ("get-ifcfg-name-no-path-route", "route-Lalalala", FALSE, "Lalalala"); - - test_get_ifcfg_name ("get-ifcfg-name-bad2-ifcfg", "/foo/bar/asdfasifcfg-Foobar", FALSE, NULL); - test_get_ifcfg_name ("get-ifcfg-name-bad2-keys", "/foo/bar/asdfaskeys-Foobar", FALSE, NULL); - test_get_ifcfg_name ("get-ifcfg-name-bad2-route", "/foo/bar/asdfasroute-Foobar", FALSE, NULL); - - test_get_ifcfg_path ("ifcfg-path-bad", "/foo/bar/adfasdfasdf", NULL); - test_get_ifcfg_path ("ifcfg-path-from-keys-no-path", "keys-BlahBlah", "ifcfg-BlahBlah"); - test_get_ifcfg_path ("ifcfg-path-from-keys", "/foo/bar/keys-BlahBlah", "/foo/bar/ifcfg-BlahBlah"); - test_get_ifcfg_path ("ifcfg-path-from-route", "/foo/bar/route-BlahBlah", "/foo/bar/ifcfg-BlahBlah"); - - test_get_keys_path ("keys-path-bad", "/foo/bar/asdfasdfasdfasdf", NULL); - test_get_keys_path ("keys-path-from-ifcfg-no-path", "ifcfg-FooBar", "keys-FooBar"); - test_get_keys_path ("keys-path-from-ifcfg", "/foo/bar/ifcfg-FooBar", "/foo/bar/keys-FooBar"); - test_get_keys_path ("keys-path-from-route", "/foo/bar/route-FooBar", "/foo/bar/keys-FooBar"); - - test_get_route_path ("route-path-bad", "/foo/bar/asdfasdfasdfasdf", NULL); - test_get_route_path ("route-path-from-ifcfg-no-path", "ifcfg-FooBar", "route-FooBar"); - test_get_route_path ("route-path-from-ifcfg", "/foo/bar/ifcfg-FooBar", "/foo/bar/route-FooBar"); - test_get_route_path ("route-path-from-keys", "/foo/bar/keys-FooBar", "/foo/bar/route-FooBar"); - - test_ignored ("ignored-ifcfg", "ifcfg-FooBar", FALSE); - test_ignored ("ignored-keys", "keys-FooBar", FALSE); - test_ignored ("ignored-route", "route-FooBar", FALSE); - test_ignored ("ignored-bak", "ifcfg-FooBar" BAK_TAG, TRUE); - test_ignored ("ignored-tilde", "ifcfg-FooBar" TILDE_TAG, TRUE); - test_ignored ("ignored-orig", "ifcfg-FooBar" ORIG_TAG, TRUE); - test_ignored ("ignored-rej", "ifcfg-FooBar" REJ_TAG, TRUE); - test_ignored ("ignored-rpmnew", "ifcfg-FooBar" RPMNEW_TAG, TRUE); - test_ignored ("ignored-augnew", "ifcfg-FooBar" AUGNEW_TAG, TRUE); - test_ignored ("ignored-augtmp", "ifcfg-FooBar" AUGTMP_TAG, TRUE); - - base = g_path_get_basename (argv[0]); - fprintf (stdout, "%s: SUCCESS\n", base); - g_free (base); - return 0; -} - diff --git a/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c deleted file mode 100644 index 0876ac945..000000000 --- a/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ /dev/null @@ -1,10382 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager system settings service - keyfile plugin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2008 - 2011 Red Hat, Inc. - */ - -#include <stdio.h> -#include <stdarg.h> -#include <unistd.h> -#include <string.h> -#include <netinet/ether.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <sys/socket.h> -#include <sys/types.h> -#include <sys/stat.h> - -#include <nm-utils.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-ip4-config.h> -#include <nm-setting-ip6-config.h> -#include <nm-setting-8021x.h> -#include <nm-setting-pppoe.h> -#include <nm-setting-ppp.h> -#include <nm-setting-vpn.h> -#include <nm-setting-gsm.h> -#include <nm-setting-cdma.h> -#include <nm-setting-serial.h> - -#include "nm-test-helpers.h" - -#include "common.h" -#include "reader.h" -#include "writer.h" - -typedef enum { - CK_CA_CERT = 0, - CK_CLIENT_CERT = 1, - CK_PRIV_KEY = 2 -} CertKeyType; - -static gboolean -verify_cert_or_key (CertKeyType ck_type, - NMSetting8021x *s_compare, - const char *file, - const char *privkey_password, - const char *ifcfg, - const char *test_name, - const char *setting_key) -{ - NMSetting8021x *s_8021x; - GError *error = NULL; - gboolean success = FALSE; - const char *expected = NULL, *setting = NULL; - gboolean phase2 = FALSE; - NMSetting8021xCKScheme scheme = NM_SETTING_802_1X_CK_SCHEME_UNKNOWN; - - if (strstr (setting_key, "phase2")) - phase2 = TRUE; - - /* CA Cert */ - s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - test_name, "failed to verify %s: could not create temp 802.1x setting", - ifcfg); - - if (ck_type == CK_CA_CERT) { - if (phase2) - success = nm_setting_802_1x_set_phase2_ca_cert (s_8021x, file, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, &error); - else - success = nm_setting_802_1x_set_ca_cert (s_8021x, file, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, &error); - } else if (ck_type == CK_CLIENT_CERT) { - if (phase2) - success = nm_setting_802_1x_set_phase2_client_cert (s_8021x, file, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, &error); - else - success = nm_setting_802_1x_set_client_cert (s_8021x, file, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, &error); - } else if (ck_type == CK_PRIV_KEY) { - if (phase2) - success = nm_setting_802_1x_set_phase2_private_key (s_8021x, file, privkey_password, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, &error); - else - success = nm_setting_802_1x_set_private_key (s_8021x, file, privkey_password, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, &error); - } - ASSERT (success == TRUE, - test_name, "failed to verify %s: could not load item for %s / %s: %s", - ifcfg, NM_SETTING_802_1X_SETTING_NAME, setting_key, error->message); - - if (ck_type == CK_CA_CERT) { - if (phase2) - scheme = nm_setting_802_1x_get_phase2_ca_cert_scheme (s_8021x); - else - scheme = nm_setting_802_1x_get_ca_cert_scheme (s_8021x); - } else if (ck_type == CK_CLIENT_CERT) { - if (phase2) - scheme = nm_setting_802_1x_get_phase2_client_cert_scheme (s_8021x); - else - scheme = nm_setting_802_1x_get_client_cert_scheme (s_8021x); - } else if (ck_type == CK_PRIV_KEY) { - if (phase2) - scheme = nm_setting_802_1x_get_phase2_private_key_scheme (s_8021x); - else - scheme = nm_setting_802_1x_get_private_key_scheme (s_8021x); - } - ASSERT (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH, - test_name, "failed to verify %s: unexpected cert/key scheme for %s / %s", - ifcfg, NM_SETTING_802_1X_SETTING_NAME, setting_key); - - if (ck_type == CK_CA_CERT) { - if (phase2) - expected = nm_setting_802_1x_get_phase2_ca_cert_path (s_8021x); - else - expected = nm_setting_802_1x_get_ca_cert_path (s_8021x); - } else if (ck_type == CK_CLIENT_CERT) { - if (phase2) - expected = nm_setting_802_1x_get_phase2_client_cert_path (s_8021x); - else - expected = nm_setting_802_1x_get_client_cert_path (s_8021x); - } else if (ck_type == CK_PRIV_KEY) { - if (phase2) - expected = nm_setting_802_1x_get_phase2_private_key_path (s_8021x); - else - expected = nm_setting_802_1x_get_private_key_path (s_8021x); - } - ASSERT (expected != NULL, - test_name, "failed to verify %s: failed to get read item for %s / %s", - ifcfg, NM_SETTING_802_1X_SETTING_NAME, setting_key); - - if (ck_type == CK_CA_CERT) { - if (phase2) - setting = nm_setting_802_1x_get_phase2_ca_cert_path (s_compare); - else - setting = nm_setting_802_1x_get_ca_cert_path (s_compare); - } else if (ck_type == CK_CLIENT_CERT) { - if (phase2) - setting = nm_setting_802_1x_get_phase2_client_cert_path (s_compare); - else - setting = nm_setting_802_1x_get_client_cert_path (s_compare); - } else if (ck_type == CK_PRIV_KEY) { - if (phase2) - setting = nm_setting_802_1x_get_phase2_private_key_path (s_compare); - else - setting = nm_setting_802_1x_get_private_key_path (s_compare); - } - ASSERT (setting != NULL, - test_name, "failed to verify %s: missing %s / %s key", - ifcfg, NM_SETTING_802_1X_SETTING_NAME, setting_key); - - ASSERT (strlen (setting) == strlen (expected), - test_name, "failed to verify %s: unexpected %s / %s certificate length", - test_name, NM_SETTING_802_1X_SETTING_NAME, setting_key); - - ASSERT (strcmp (setting, expected) == 0, - test_name, "failed to verify %s: %s / %s key certificate mismatch", - ifcfg, NM_SETTING_802_1X_SETTING_NAME, setting_key); - - g_object_unref (s_8021x); - return TRUE; -} - - -#define TEST_IFCFG_MINIMAL TEST_IFCFG_DIR"/network-scripts/ifcfg-test-minimal" - -static void -test_read_minimal (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; - const char *expected_id = "System test-minimal"; - guint64 expected_timestamp = 0; - - connection = connection_from_file (TEST_IFCFG_MINIMAL, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "minimal-wired-read", "failed to read %s: %s", TEST_IFCFG_MINIMAL, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "minimal-wired-verify", "failed to verify %s: %s", TEST_IFCFG_MINIMAL, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "minimal-wired-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_MINIMAL, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "minimal-wired-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_MINIMAL, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "minimal-wired-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_MINIMAL, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ - - /* Timestamp */ - ASSERT (nm_setting_connection_get_timestamp (s_con) == expected_timestamp, - "minimal-wired-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_MINIMAL, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_TIMESTAMP); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "minimal-wired-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_MINIMAL, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "minimal-wired-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_MINIMAL, - NM_SETTING_WIRED_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wired_get_mac_address (s_wired); - ASSERT (array != NULL, - "minimal-wired-verify-wired", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_MINIMAL, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (array->len == ETH_ALEN, - "minimal-wired-verify-wired", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_MINIMAL, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (memcmp (array->data, &expected_mac_address[0], sizeof (expected_mac_address)) == 0, - "minimal-wired-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_MINIMAL, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - - ASSERT (nm_setting_wired_get_mtu (s_wired) == 0, - "minimal-wired-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_MINIMAL, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MTU); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "minimal-wired-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_MINIMAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "minimal-wired-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_MINIMAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE, - "minimal-wired-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_MINIMAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_UNMANAGED TEST_IFCFG_DIR"/network-scripts/ifcfg-test-nm-controlled" - -static void -test_read_unmanaged (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0x22, 0x33, 0xf8, 0x9f }; - const char *expected_id = "System test-nm-controlled"; - guint64 expected_timestamp = 0; - - connection = connection_from_file (TEST_IFCFG_UNMANAGED, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "unmanaged-read", "failed to read %s: %s", TEST_IFCFG_UNMANAGED, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "unmanaged-verify", "failed to verify %s: %s", TEST_IFCFG_UNMANAGED, error->message); - - ASSERT (unmanaged != NULL, - "unmanaged-verify", "failed to verify %s: expected unmanaged", TEST_IFCFG_UNMANAGED); - - ASSERT (strcmp (unmanaged, "mac:00:11:22:33:f8:9f") == 0, - "unmanaged-verify", "failed to verify %s: expected unmanaged", TEST_IFCFG_UNMANAGED); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "unmanaged-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_UNMANAGED, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "unmanaged-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_UNMANAGED, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "unmanaged-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_UNMANAGED, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* Timestamp */ - ASSERT (nm_setting_connection_get_timestamp (s_con) == expected_timestamp, - "unmanaged-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_UNMANAGED, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_TIMESTAMP); - - /* Autoconnect */ - /* Since the unmanaged connections are not completely read, defaults will - * be used for many settings. - */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "unmanaged-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_UNMANAGED, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "unmanaged-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_UNMANAGED, - NM_SETTING_WIRED_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wired_get_mac_address (s_wired); - ASSERT (array != NULL, - "unmanaged-verify-wired", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_UNMANAGED, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (array->len == ETH_ALEN, - "unmanaged-verify-wired", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_UNMANAGED, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (memcmp (array->data, &expected_mac_address[0], sizeof (expected_mac_address)) == 0, - "unmanaged-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_UNMANAGED, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 == NULL, - "unmanaged-verify-ip4", "failed to verify %s: unexpected %s setting", - TEST_IFCFG_UNMANAGED, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - g_free (unmanaged); - g_object_unref (connection); -} - -static void -test_read_wired_static (const char *file, const char *expected_id) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const GByteArray *array; - char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0xee }; - const char *tmp; - const char *expected_dns1 = "4.2.2.1"; - const char *expected_dns2 = "4.2.2.2"; - struct in_addr addr; - struct in6_addr addr6; - const char *expected_address1 = "192.168.1.5"; - const char *expected_address1_gw = "192.168.1.1"; - const char *expected6_address1 = "dead:beaf::1"; - const char *expected6_address2 = "dead:beaf::2"; - const char *expected6_dns1 = "1:2:3:4::a"; - const char *expected6_dns2 = "1:2:3:4::b"; - NMIP4Address *ip4_addr; - NMIP6Address *ip6_addr; - - connection = connection_from_file (file, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-static-read", "failed to read %s: %s", file, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-static-verify", "failed to verify %s: %s", file, error->message); - - ASSERT (unmanaged == NULL, - "wired-static-verify", "failed to verify %s: unexpected unmanaged value", file); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-static-verify-connection", "failed to verify %s: missing %s setting", - file, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-static-verify-connection", "failed to verify %s: missing %s / %s key", - file, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-static-verify-connection", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* Timestamp */ - ASSERT (nm_setting_connection_get_timestamp (s_con) == 0, - "wired-static-verify-connection", "failed to verify %s: unexpected %s /%s key value", - file, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_TIMESTAMP); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "wired-static-verify-connection", "failed to verify %s: unexpected %s /%s key value", - file, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-static-verify-wired", "failed to verify %s: missing %s setting", - file, - NM_SETTING_WIRED_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wired_get_mac_address (s_wired); - ASSERT (array != NULL, - "wired-static-verify-wired", "failed to verify %s: missing %s / %s key", - file, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (array->len == ETH_ALEN, - "wired-static-verify-wired", "failed to verify %s: unexpected %s / %s key value length", - file, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (memcmp (array->data, &expected_mac_address[0], sizeof (expected_mac_address)) == 0, - "wired-static-verify-wired", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - - ASSERT (nm_setting_wired_get_mtu (s_wired) == 1492, - "wired-static-verify-wired", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MTU); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-static-verify-ip4", "failed to verify %s: missing %s setting", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, - "wired-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* Implicit may-fail */ - ASSERT (nm_setting_ip4_config_get_may_fail (s_ip4) == FALSE, - "wired-static-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_MAY_FAIL); - - /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, - "wired-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET, expected_dns1, &addr) > 0, - "wired-static-verify-ip4", "failed to verify %s: couldn't convert DNS IP address #1", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_dns (s_ip4, 0) == addr.s_addr, - "wired-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET, expected_dns2, &addr) > 0, - "wired-static-verify-ip4", "failed to verify %s: couldn't convert DNS IP address #2", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_dns (s_ip4, 1) == addr.s_addr, - "wired-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1, - "wired-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - 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, - "wired-static-verify-ip4", "failed to verify %s: missing IP4 address #1", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == 24, - "wired-static-verify-ip4", "failed to verify %s: unexpected IP4 address #1 prefix", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1, &addr) > 0, - "wired-static-verify-ip4", "failed to verify %s: couldn't convert IP address #1", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "wired-static-verify-ip4", "failed to verify %s: unexpected IP4 address #1", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1_gw, &addr) > 0, - "wired-static-verify-ip4", "failed to verify %s: couldn't convert IP address #1 gateway", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - ASSERT (nm_ip4_address_get_gateway (ip4_addr) == addr.s_addr, - "wired-static-verify-ip4", "failed to verify %s: unexpected IP4 address #1 gateway", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - if (!strcmp (expected_id, "System test-wired-static")) { - /* ===== IPv6 SETTING ===== */ - - s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG)); - ASSERT (s_ip6 != NULL, - "wired-static-verify-ip6", "failed to verify %s: missing %s setting", - file, - NM_SETTING_IP6_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); - ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0, - "wired-static-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); - - /* Implicit may-fail */ - ASSERT (nm_setting_ip6_config_get_may_fail (s_ip6) == TRUE, - "wired-static-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_MAY_FAIL); - - /* DNS Addresses */ - ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2, - "wired-static-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET6, expected6_dns1, &addr6) > 0, - "wired-static-verify-ip6", "failed to verify %s: couldn't convert DNS IP address #1", - file); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_setting_ip6_config_get_dns (s_ip6, 0), &addr6), - "wired-static-verify-ip6", "failed to verify %s: unexpected %s / %s key value #1", - file, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET6, expected6_dns2, &addr6) > 0, - "wired-static-verify-ip6", "failed to verify %s: couldn't convert DNS IP address #2", - file); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_setting_ip6_config_get_dns (s_ip6, 1), &addr6), - "wired-static-verify-ip6", "failed to verify %s: unexpected %s / %s key value #2", - file, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 2, - "wired-static-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - /* Address #1 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); - ASSERT (ip6_addr, - "wired-static-verify-ip6", "failed to verify %s: missing IP6 address #1", - file); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == 64, - "wired-static-verify-ip6", "failed to verify %s: unexpected IP6 address #1 prefix", - file); - - ASSERT (inet_pton (AF_INET6, expected6_address1, &addr6) > 0, - "wired-static-verify-ip6", "failed to verify %s: couldn't convert IP address #1", - file); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr6), - "wired-static-verify-ip6", "failed to verify %s: unexpected IP6 address #1", - file); - - /* Address #2 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1); - ASSERT (ip6_addr, - "wired-static-verify-ip6", "failed to verify %s: missing IP6 address #2", - file); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == 56, - "wired-static-verify-ip6", "failed to verify %s: unexpected IP6 address #2 prefix", - file); - - ASSERT (inet_pton (AF_INET6, expected6_address2, &addr6) > 0, - "wired-static-verify-ip6", "failed to verify %s: couldn't convert IP address #2", - file); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr6), - "wired-static-verify-ip6", "failed to verify %s: unexpected IP6 address #2", - file); - } - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_STATIC_NO_PREFIX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-static-no-prefix" - -static void -test_read_wired_static_no_prefix (guint32 expected_prefix) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - NMIP4Address *ip4_addr; - char *file, *expected_id; - const char *tmp; - - file = g_strdup_printf (TEST_IFCFG_STATIC_NO_PREFIX "-%u", expected_prefix); - ASSERT (file != NULL, - "wired-static-no-prefix-read", "failed to create path to file"); - - expected_id = g_strdup_printf ("System test-wired-static-no-prefix-%u", expected_prefix); - ASSERT (expected_id != NULL, - "wired-static-no-prefix-read", "failed to expected connection ID"); - - connection = connection_from_file (file, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-static-no-prefix-read", "failed to read %s: %s", file, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-static-no-prefix-verify", "failed to verify %s: %s", file, error->message); - - ASSERT (unmanaged == NULL, - "wired-static-no-prefix-verify", "failed to verify %s: unexpected unmanaged value", file); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-static-no-prefix-verify-connection", "failed to verify %s: missing %s setting", - file, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-static-no-prefix-verify-connection", "failed to verify %s: missing %s / %s key", - file, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-static-no-prefix-verify-connection", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - g_free (expected_id); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-static-no-prefix-verify-ip4", "failed to verify %s: missing %s setting", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, - "wired-static-no-prefix-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1, - "wired-static-no-prefix-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - 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, - "wired-static-no-prefix-verify-ip4", "failed to verify %s: missing IP4 address #1", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == expected_prefix, - "wired-static-no-prefix-verify-ip4", "failed to verify %s: unexpected IP4 address #1 prefix", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - g_free (file); - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_DHCP TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-dhcp" - -static void -test_read_wired_dhcp (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const GByteArray *array; - char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0xee }; - const char *tmp; - const char *expected_id = "System test-wired-dhcp"; - const char *expected_dns1 = "4.2.2.1"; - const char *expected_dns2 = "4.2.2.2"; - struct in_addr addr; - const char *expected_dhcp_hostname = "foobar"; - - connection = connection_from_file (TEST_IFCFG_WIRED_DHCP, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-dhcp-read", "failed to read %s: %s", TEST_IFCFG_WIRED_DHCP, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-dhcp-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_DHCP, error->message); - - ASSERT (unmanaged == NULL, - "wired-dhcp-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_DHCP); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-dhcp-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-dhcp-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-dhcp-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* Timestamp */ - ASSERT (nm_setting_connection_get_timestamp (s_con) == 0, - "wired-dhcp-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_TIMESTAMP); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "wired-dhcp-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-dhcp-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_WIRED_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wired_get_mac_address (s_wired); - ASSERT (array != NULL, - "wired-dhcp-verify-wired", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (array->len == ETH_ALEN, - "wired-dhcp-verify-wired", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (memcmp (array->data, &expected_mac_address[0], sizeof (expected_mac_address)) == 0, - "wired-dhcp-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-dhcp-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - tmp = nm_setting_ip4_config_get_dhcp_hostname (s_ip4); - ASSERT (tmp != NULL, - "wired-dhcp-verify-ip4", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME); - ASSERT (strcmp (tmp, expected_dhcp_hostname) == 0, - "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME); - - ASSERT (nm_setting_ip4_config_get_ignore_auto_dns (s_ip4) == TRUE, - "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS); - - /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, - "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET, expected_dns1, &addr) > 0, - "wired-dhcp-verify-ip4", "failed to verify %s: couldn't convert DNS IP address #1", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_dns (s_ip4, 0) == addr.s_addr, - "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET, expected_dns2, &addr) > 0, - "wired-dhcp-verify-ip4", "failed to verify %s: couldn't convert DNS IP address #2", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_dns (s_ip4, 1) == addr.s_addr, - "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", - TEST_IFCFG_WIRED_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_GLOBAL_GATEWAY TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-global-gateway" -#define TEST_NETWORK_WIRED_GLOBAL_GATEWAY TEST_IFCFG_DIR"/network-scripts/network-test-wired-global-gateway" - -static void -test_read_wired_global_gateway (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System test-wired-global-gateway"; - struct in_addr addr; - const char *expected_address1 = "192.168.1.5"; - const char *expected_address1_gw = "192.168.1.2"; - NMIP4Address *ip4_addr; - - connection = connection_from_file (TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - TEST_NETWORK_WIRED_GLOBAL_GATEWAY, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-global-gateway-read", "failed to read %s: %s", TEST_IFCFG_WIRED_GLOBAL_GATEWAY, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-global-gateway-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_GLOBAL_GATEWAY, error->message); - - ASSERT (unmanaged == NULL, - "wired-global-gateway-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_GLOBAL_GATEWAY); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-global-gateway-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-global-gateway-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-global-gateway-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-global-gateway-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-global-gateway-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, - "wired-global-gateway-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* Address #1 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); - ASSERT (ip4_addr, - "wired-global-gateway-verify-ip4", "failed to verify %s: missing IP4 address #1", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == 24, - "wired-global-gateway-verify-ip4", "failed to verify %s: unexpected IP4 address #1 prefix", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1, &addr) > 0, - "wired-global-gateway-verify-ip4", "failed to verify %s: couldn't convert IP address #1", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "wired-global-gateway-verify-ip4", "failed to verify %s: unexpected IP4 address #1", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1_gw, &addr) > 0, - "wired-global-gateway-verify-ip4", "failed to verify %s: couldn't convert IP address #1 gateway", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - ASSERT (nm_ip4_address_get_gateway (ip4_addr) == addr.s_addr, - "wired-global-gateway-verify-ip4", "failed to verify %s: unexpected IP4 address #1 gateway", - TEST_IFCFG_WIRED_GLOBAL_GATEWAY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_NEVER_DEFAULT TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-never-default" -#define TEST_NETWORK_WIRED_NEVER_DEFAULT TEST_IFCFG_DIR"/network-scripts/network-test-wired-never-default" - -static void -test_read_wired_never_default (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System test-wired-never-default"; - - connection = connection_from_file (TEST_IFCFG_WIRED_NEVER_DEFAULT, - TEST_NETWORK_WIRED_NEVER_DEFAULT, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-never-default-read", "failed to read %s: %s", TEST_IFCFG_WIRED_NEVER_DEFAULT, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-never-default-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_NEVER_DEFAULT, error->message); - - ASSERT (unmanaged == NULL, - "wired-never-default-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_NEVER_DEFAULT); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-never-default-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-never-default-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-never-default-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-never-default-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-never-default-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wired-never-default-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == TRUE, - "wired-never-default-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT); - - /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 0, - "wired-never-default-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - /* ===== IPv6 SETTING ===== */ - - s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG)); - ASSERT (s_ip6 != NULL, - "wired-never-default-verify-ip6", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_IP6_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); - ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0, - "wired-never-default-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); - - ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == TRUE, - "wired-never-default-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_NEVER_DEFAULT, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_DEFROUTE_NO TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-defroute-no" - -static void -test_read_wired_defroute_no (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System test-wired-defroute-no"; - - connection = connection_from_file (TEST_IFCFG_WIRED_DEFROUTE_NO, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-defroute-no-read", "failed to read %s: %s", TEST_IFCFG_WIRED_DEFROUTE_NO, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-defroute-no-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_DEFROUTE_NO, error->message); - - ASSERT (unmanaged == NULL, - "wired-defroute-no-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_DEFROUTE_NO); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-defroute-no-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-defroute-no-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-defroute-no-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-defroute-no-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-defroute-no-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wired-defroute-no-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == TRUE, - "wired-defroute-no-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT); - - /* ===== IPv6 SETTING ===== */ - - s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG)); - ASSERT (s_ip6 != NULL, - "wired-defroute-no-verify-ip6", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_IP6_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); - ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0, - "wired-defroute-no-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); - - ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == TRUE, - "wired-defroute-no-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-defroute-no-gatewaydev-yes" -#define TEST_NETWORK_WIRED_DEFROUTE_NO_GATEWAYDEV_YES TEST_IFCFG_DIR"/network-scripts/network-test-wired-defroute-no-gatewaydev-yes" - -static void -test_read_wired_defroute_no_gatewaydev_yes (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System test-wired-defroute-no-gatewaydev-yes"; - - connection = connection_from_file (TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - TEST_NETWORK_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-defroute-no-gatewaydev-yes-read", - "failed to read %s: %s", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-defroute-no-gatewaydev-yes-verify", - "failed to verify %s: %s", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - error->message); - - ASSERT (unmanaged == NULL, - "wired-defroute-no-gatewaydev-yes-verify", - "failed to verify %s: unexpected unmanaged value", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-defroute-no-gatewaydev-yes-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-defroute-no-gatewaydev-yes-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-defroute-no-gatewaydev-yes-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-defroute-no-gatewaydev-yes-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE, - "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT); - - /* ===== IPv6 SETTING ===== */ - - s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG)); - ASSERT (s_ip6 != NULL, - "wired-defroute-no-gatewaydev-yes-verify-ip6", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_IP6_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); - - ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE, - "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_STATIC_ROUTES TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-static-routes" - -static void -test_read_wired_static_routes (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - NMIP4Route *ip4_route; - struct in_addr addr; - const char *expected_id = "System test-wired-static-routes"; - const char *expected_dst1 = "11.22.33.0"; - const char *expected_dst2 = "44.55.66.77"; - const char *expected_gw1 = "192.168.1.5"; - const char *expected_gw2 = "192.168.1.7"; - - connection = connection_from_file (TEST_IFCFG_WIRED_STATIC_ROUTES, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - - ASSERT (connection != NULL, - "wired-static-routes-read", - "failed to read %s: %s", - TEST_IFCFG_WIRED_STATIC_ROUTES, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-static-routes-verify", "failed to verify %s: %s", - TEST_IFCFG_WIRED_STATIC_ROUTES, error->message); - - ASSERT (unmanaged == NULL, - "wired-static-routes-verify", - "failed to verify %s: unexpected unmanaged value", - TEST_IFCFG_WIRED_STATIC_ROUTES); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-static-routes-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-static-routes-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-static-routes-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-static-routes-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-static-routes-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, - "wired-static-routes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* Routes */ - ASSERT (nm_setting_ip4_config_get_num_routes (s_ip4) == 2, - "wired-static-routes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 0); - ASSERT (ip4_route, - "wired-static-routes-verify-ip4", "failed to verify %s: missing IP4 route #1", - TEST_IFCFG_WIRED_STATIC_ROUTES); - - ASSERT (inet_pton (AF_INET, expected_dst1, &addr) > 0, - "wired-static-routes-verify-ip4", "failed to verify %s: couldn't convert destination IP address #1", - TEST_IFCFG_WIRED_STATIC_ROUTES); - ASSERT (nm_ip4_route_get_dest (ip4_route) == addr.s_addr, - "wired-static-routes-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ASSERT (nm_ip4_route_get_prefix (ip4_route) == 24, - "wired-static-routes-verify-ip4", "failed to verify %s: unexpected destination route #1 prefix", - TEST_IFCFG_WIRED_STATIC_ROUTES); - - ASSERT (inet_pton (AF_INET, expected_gw1, &addr) > 0, - "wired-static-routes-verify-ip4", "failed to verify %s: couldn't convert next hop IP address #1", - TEST_IFCFG_WIRED_STATIC_ROUTES); - ASSERT (nm_ip4_route_get_next_hop (ip4_route) == addr.s_addr, - "wired-static-routes-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 1); - ASSERT (ip4_route, - "wired-static-routes-verify-ip4", "failed to verify %s: missing IP4 route #2", - TEST_IFCFG_WIRED_STATIC_ROUTES); - - ASSERT (inet_pton (AF_INET, expected_dst2, &addr) > 0, - "wired-static-routes-verify-ip4", "failed to verify %s: couldn't convert destination IP address #2", - TEST_IFCFG_WIRED_STATIC_ROUTES); - ASSERT (nm_ip4_route_get_dest (ip4_route) == addr.s_addr, - "wired-static-routes-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ASSERT (nm_ip4_route_get_prefix (ip4_route) == 32, - "wired-static-routes-verify-ip4", "failed to verify %s: unexpected destination route #2 prefix", - TEST_IFCFG_WIRED_STATIC_ROUTES); - - ASSERT (inet_pton (AF_INET, expected_gw2, &addr) > 0, - "wired-static-routes-verify-ip4", "failed to verify %s: couldn't convert next hop IP address #2", - TEST_IFCFG_WIRED_STATIC_ROUTES); - ASSERT (nm_ip4_route_get_next_hop (ip4_route) == addr.s_addr, - "wired-static-routes-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", - TEST_IFCFG_WIRED_STATIC_ROUTES, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - ASSERT (nm_ip4_route_get_metric (ip4_route) == 3, - "wired-static-routes-verify-ip4", "failed to verify %s: unexpected route metric #2", - TEST_IFCFG_WIRED_STATIC_ROUTES); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-static-routes-legacy" - -static void -test_read_wired_static_routes_legacy (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - NMIP4Route *ip4_route; - struct in_addr addr; - const char *expected_id = "System test-wired-static-routes-legacy"; - const char *expected_dst1 = "21.31.41.0"; - const char *expected_dst2 = "32.42.52.62"; - const char *expected_dst3 = "43.53.0.0"; - const char *expected_gw1 = "9.9.9.9"; - const char *expected_gw2 = "8.8.8.8"; - const char *expected_gw3 = "7.7.7.7"; - - connection = connection_from_file (TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - - ASSERT (connection != NULL, - "wired-static-routes-legacy-read", - "failed to read %s: %s", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-static-routes-legacy-verify", "failed to verify %s: %s", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, error->message); - - ASSERT (unmanaged == NULL, - "wired-static-routes-legacy-verify", - "failed to verify %s: unexpected unmanaged value", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-static-routes-legacy-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-static-routes-legacy-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-static-routes-legacy-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-static-routes-legacy-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* Routes */ - ASSERT (nm_setting_ip4_config_get_num_routes (s_ip4) == 3, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - /* Route #1 */ - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 0); - ASSERT (ip4_route, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: missing IP4 route #1", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - ASSERT (inet_pton (AF_INET, expected_dst1, &addr) > 0, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: couldn't convert destination IP address #1", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - ASSERT (nm_ip4_route_get_dest (ip4_route) == addr.s_addr, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ASSERT (nm_ip4_route_get_prefix (ip4_route) == 24, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected destination route #1 prefix", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - ASSERT (inet_pton (AF_INET, expected_gw1, &addr) > 0, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: couldn't convert next hop IP address #1", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - ASSERT (nm_ip4_route_get_next_hop (ip4_route) == addr.s_addr, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ASSERT (nm_ip4_route_get_metric (ip4_route) == 1, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected destination route #1 metric", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - /* Route #2 */ - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 1); - ASSERT (ip4_route, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: missing IP4 route #2", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - ASSERT (inet_pton (AF_INET, expected_dst2, &addr) > 0, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: couldn't convert destination IP address #2", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - ASSERT (nm_ip4_route_get_dest (ip4_route) == addr.s_addr, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ASSERT (nm_ip4_route_get_prefix (ip4_route) == 32, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected destination route #2 prefix", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - ASSERT (inet_pton (AF_INET, expected_gw2, &addr) > 0, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: couldn't convert next hop IP address #2", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - ASSERT (nm_ip4_route_get_next_hop (ip4_route) == addr.s_addr, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ASSERT (nm_ip4_route_get_metric (ip4_route) == 0, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected destination route #2 metric", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - /* Route #3 */ - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 2); - ASSERT (ip4_route, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: missing IP4 route #3", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - ASSERT (inet_pton (AF_INET, expected_dst3, &addr) > 0, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: couldn't convert destination IP address #3", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - ASSERT (nm_ip4_route_get_dest (ip4_route) == addr.s_addr, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value #3", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ASSERT (nm_ip4_route_get_prefix (ip4_route) == 16, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected destination route #3 prefix", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - ASSERT (inet_pton (AF_INET, expected_gw3, &addr) > 0, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: couldn't convert next hop IP address #3", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - ASSERT (nm_ip4_route_get_next_hop (ip4_route) == addr.s_addr, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value #3", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); - - ASSERT (nm_ip4_route_get_metric (ip4_route) == 3, - "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected destination route #3 metric", - TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -static void -test_read_wired_ipv4_manual (const char *file, const char *expected_id) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_address1 = "1.2.3.4"; - const char *expected_address2 = "9.8.7.6"; - const char *expected_address3 = "3.3.3.3"; - guint32 expected_prefix1 = 24; - guint32 expected_prefix2 = 16; - guint32 expected_prefix3 = 8; - NMIP4Address *ip4_addr; - struct in_addr addr; - - connection = connection_from_file (file, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-ipv4-manual-read", "failed to read %s: %s", file, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-ipv4-manual-verify", "failed to verify %s: %s", file, error->message); - - ASSERT (unmanaged == NULL, - "wired-ipv4-manual-verify", "failed to verify %s: unexpected unmanaged value", file); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-ipv4-manual-verify-connection", "failed to verify %s: missing %s setting", - file, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-ipv4-manual-verify-connection", "failed to verify %s: missing %s / %s key", - file, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-ipv4-manual-verify-connection", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-ipv4-manual-verify-wired", "failed to verify %s: missing %s setting", - file, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: missing %s setting", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* IP addresses */ - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 3, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - file, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - /* Address #1 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); - ASSERT (ip4_addr, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: missing IP4 address #1", - file); - - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == expected_prefix1, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected IP4 address #1 prefix", - file); - - ASSERT (inet_pton (AF_INET, expected_address1, &addr) > 0, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: couldn't convert IP address #1", - file); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected IP4 address #1", - file); - - /* Address #2 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 1); - ASSERT (ip4_addr, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: missing IP4 address #2", - file); - - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == expected_prefix2, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected IP4 address #2 prefix", - file); - - ASSERT (inet_pton (AF_INET, expected_address2, &addr) > 0, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: couldn't convert IP address #2", - file); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected IP4 address #2", - file); - - /* Address #3 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 2); - ASSERT (ip4_addr, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: missing IP4 address #3", - file); - - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == expected_prefix3, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected IP4 address #3 prefix", - file); - - ASSERT (inet_pton (AF_INET, expected_address3, &addr) > 0, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: couldn't convert IP address #3", - file); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected IP4 address #3", - file); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_IPV6_MANUAL TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv6-manual" - -static void -test_read_wired_ipv6_manual (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System test-wired-ipv6-manual"; - const char *expected_address1 = "1001:abba::1234"; - const char *expected_address2 = "2001:abba::2234"; - const char *expected_address3 = "3001:abba::3234"; - guint32 expected_prefix1 = 56; - guint32 expected_prefix2 = 64; - guint32 expected_prefix3 = 96; - const char *expected_route1_dest = "9876::1234"; - guint32 expected_route1_prefix = 96; - const char *expected_route1_nexthop = "9876::7777"; - guint32 expected_route1_metric = 2; - const char *expected_dns1 = "1:2:3:4::a"; - const char *expected_dns2 = "1:2:3:4::b"; - NMIP6Address *ip6_addr; - NMIP6Route *ip6_route; - struct in6_addr addr; - - connection = connection_from_file (TEST_IFCFG_WIRED_IPV6_MANUAL, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-ipv6-manual-read", "failed to read %s: %s", TEST_IFCFG_WIRED_IPV6_MANUAL, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-ipv6-manual-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_IPV6_MANUAL, error->message); - - ASSERT (unmanaged == NULL, - "wired-ipv6-manual-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_IPV6_MANUAL); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-ipv6-manual-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-ipv6-manual-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-ipv6-manual-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-ipv6-manual-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, - "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - /* DNS search domains */ - ASSERT (nm_setting_ip4_config_get_num_dns_searches (s_ip4) == 3, - "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 0); - ASSERT (tmp != NULL, - "wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); - ASSERT (strcmp (tmp, "lorem.com") == 0, - "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); - - tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 1); - ASSERT (tmp != NULL, - "wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); - ASSERT (strcmp (tmp, "ipsum.org") == 0, - "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); - - tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 2); - ASSERT (tmp != NULL, - "wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); - ASSERT (strcmp (tmp, "dolor.edu") == 0, - "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); - - /* ===== IPv6 SETTING ===== */ - - s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG)); - ASSERT (s_ip6 != NULL, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); - ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); - - ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT); - - ASSERT (nm_setting_ip6_config_get_may_fail (s_ip6) == TRUE, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_MAY_FAIL); - - /* IP addresses */ - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 3, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - /* Address #1 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); - ASSERT (ip6_addr, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: missing IP6 address #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == expected_prefix1, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 address #1 prefix", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (inet_pton (AF_INET6, expected_address1, &addr) > 0, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: couldn't convert IP address #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr), - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 address #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - /* Address #2 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1); - ASSERT (ip6_addr, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: missing IP6 address #2", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == expected_prefix2, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 address #2 prefix", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (inet_pton (AF_INET6, expected_address2, &addr) > 0, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: couldn't convert IP address #2", - TEST_IFCFG_WIRED_IPV6_MANUAL); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr), - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 address #2", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - /* Address #3 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 2); - ASSERT (ip6_addr, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: missing IP6 address #3", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == expected_prefix3, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 address #3 prefix", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (inet_pton (AF_INET6, expected_address3, &addr) > 0, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: couldn't convert IP address #3", - TEST_IFCFG_WIRED_IPV6_MANUAL); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr), - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 address #3", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - /* Routes */ - ASSERT (nm_setting_ip6_config_get_num_routes (s_ip6) == 1, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - - /* Route #1 */ - ip6_route = nm_setting_ip6_config_get_route (s_ip6, 0); - ASSERT (ip6_route, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: missing IP6 route #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (inet_pton (AF_INET6, expected_route1_dest, &addr) > 0, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: couldn't convert IP route dest #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_route_get_dest (ip6_route), &addr), - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 route dest #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (nm_ip6_route_get_prefix (ip6_route) == expected_route1_prefix, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 route #1 prefix", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (inet_pton (AF_INET6, expected_route1_nexthop, &addr) > 0, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: couldn't convert IP route next_hop #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_route_get_next_hop (ip6_route), &addr), - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 route next hop #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (nm_ip6_route_get_metric (ip6_route) == expected_route1_metric, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected IP6 route #1 metric", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - /* DNS Addresses */ - ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET6, expected_dns1, &addr) > 0, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: couldn't convert DNS IP address #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_setting_ip6_config_get_dns (s_ip6, 0), &addr), - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value #1", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET6, expected_dns2, &addr) > 0, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: couldn't convert DNS IP address #2", - TEST_IFCFG_WIRED_IPV6_MANUAL); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_setting_ip6_config_get_dns (s_ip6, 1), &addr), - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value #2", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - /* DNS domains - none as domains are stuffed to 'ipv4' setting */ - ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 0, - "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_IPV6_ONLY TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv6-only" - -static void -test_read_wired_ipv6_only (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System test-wired-ipv6-only"; - const char *expected_address1 = "1001:abba::1234"; - guint32 expected_prefix1 = 56; - const char *expected_dns1 = "1:2:3:4::a"; - NMIP6Address *ip6_addr; - struct in6_addr addr; - const char *method; - - connection = connection_from_file (TEST_IFCFG_WIRED_IPV6_ONLY, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-ipv6-only-read", "failed to read %s: %s", TEST_IFCFG_WIRED_IPV6_ONLY, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-ipv6-only-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_IPV6_ONLY, error->message); - - ASSERT (unmanaged == NULL, - "wired-ipv6-only-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_IPV6_MANUAL); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-ipv6-only-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-ipv6-only-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-ipv6-only-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-ipv6-only-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-ipv6-only-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - method = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0, - "wired-ipv6-only-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* ===== IPv6 SETTING ===== */ - - s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG)); - ASSERT (s_ip6 != NULL, - "wired-ipv6-only-verify-ip6", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); - ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0, - "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); - - /* IP addresses */ - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1, - "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - /* Address #1 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); - ASSERT (ip6_addr, - "wired-ipv6-only-verify-ip6", "failed to verify %s: missing IP6 address #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == expected_prefix1, - "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected IP6 address #1 prefix", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - ASSERT (inet_pton (AF_INET6, expected_address1, &addr) > 0, - "wired-ipv6-only-verify-ip6", "failed to verify %s: couldn't convert IP address #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr), - "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected IP6 address #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - - /* DNS Addresses */ - ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 1, - "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET6, expected_dns1, &addr) > 0, - "wired-ipv6-only-verify-ip6", "failed to verify %s: couldn't convert DNS IP address #1", - TEST_IFCFG_WIRED_IPV6_MANUAL); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_setting_ip6_config_get_dns (s_ip6, 0), &addr), - "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value #1", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - /* DNS domains - none as domains are stuffed to 'ipv4' setting */ - ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 0, - "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_IPV6_MANUAL, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_DHCP6_ONLY TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-dhcp6-only" - -static void -test_read_wired_dhcp6_only (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System test-wired-dhcp6-only"; - const char *method; - - connection = connection_from_file (TEST_IFCFG_WIRED_DHCP6_ONLY, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-dhcp6-only-read", "failed to read %s: %s", TEST_IFCFG_WIRED_DHCP6_ONLY, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-dhcp6-only-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_DHCP6_ONLY, error->message); - - ASSERT (unmanaged == NULL, - "wired-dhcp6-only-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_DHCP6_ONLY); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-dhcp6-only-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DHCP6_ONLY, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-dhcp6-only-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_DHCP6_ONLY, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-dhcp6-only-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DHCP6_ONLY, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-dhcp6-only-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DHCP6_ONLY, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-dhcp6-only-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DHCP6_ONLY, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - method = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0, - "wired-dhcp6-only-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DHCP6_ONLY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* ===== IPv6 SETTING ===== */ - - s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG)); - ASSERT (s_ip6 != NULL, - "wired-dhcp6-only-verify-ip6", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_DHCP6_ONLY, - NM_SETTING_IP6_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); - ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0, - "wired-dhcp6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_DHCP6_ONLY, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_ONBOOT_NO TEST_IFCFG_DIR"/network-scripts/ifcfg-test-onboot-no" - -static void -test_read_onboot_no (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_ONBOOT_NO, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "onboot-no-read", "failed to read %s: %s", TEST_IFCFG_ONBOOT_NO, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "onboot-no-verify", "failed to verify %s: %s", TEST_IFCFG_ONBOOT_NO, error->message); - - ASSERT (unmanaged == NULL, - "onboot-no-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_ONBOOT_NO); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "onboot-no-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_ONBOOT_NO, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == FALSE, - "onboot-no-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_ONBOOT_NO, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2 TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-8021x-peap-mschapv2" -#define TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2_CA_CERT TEST_IFCFG_DIR"/network-scripts/test_ca_cert.pem" - -static void -test_read_wired_8021x_peap_mschapv2 (void) -{ - NMConnection *connection; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSetting8021x *s_8021x; - NMSetting8021x *tmp_8021x; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_identity = "David Smith"; - const char *expected_password = "foobar baz"; - gboolean success = FALSE; - const char *expected_ca_cert_path; - const char *read_ca_cert_path; - - connection = connection_from_file (TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-8021x-peap-mschapv2-read", "failed to read %s: %s", TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-8021x-peap-mschapv2-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, error->message); - - ASSERT (unmanaged == NULL, - "wired-8021x-peap-mschapv2-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-8021x-peap-mschapv2-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-8021x-peap-mschapv2-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wired-8021x-peap-mschapv2-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* ===== 802.1x SETTING ===== */ - s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X)); - ASSERT (s_8021x != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME); - - /* EAP methods */ - ASSERT (nm_setting_802_1x_get_num_eap_methods (s_8021x) == 1, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - tmp = nm_setting_802_1x_get_eap_method (s_8021x, 0); - ASSERT (tmp != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: missing %s / %s eap method", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - ASSERT (strcmp (tmp, "peap") == 0, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - - /* Identity */ - tmp = nm_setting_802_1x_get_identity (s_8021x); - ASSERT (tmp != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_IDENTITY); - ASSERT (strcmp (tmp, expected_identity) == 0, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_IDENTITY); - - /* Password */ - tmp = nm_setting_802_1x_get_password (s_8021x); - ASSERT (tmp != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PASSWORD); - ASSERT (strcmp (tmp, expected_password) == 0, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PASSWORD); - - /* PEAP version */ - tmp = nm_setting_802_1x_get_phase1_peapver (s_8021x); - ASSERT (tmp != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE1_PEAPVER); - ASSERT (strcmp (tmp, "1") == 0, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE1_PEAPVER); - - /* PEAP Label */ - tmp = nm_setting_802_1x_get_phase1_peaplabel (s_8021x); - ASSERT (tmp != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE1_PEAPLABEL); - ASSERT (strcmp (tmp, "1") == 0, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE1_PEAPLABEL); - - /* CA Cert */ - tmp_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (tmp_8021x != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: could not create temp 802.1x setting", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME); - - success = nm_setting_802_1x_set_ca_cert (tmp_8021x, - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2_CA_CERT, - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: could not load CA certificate", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_CA_CERT); - expected_ca_cert_path = nm_setting_802_1x_get_ca_cert_path (tmp_8021x); - ASSERT (expected_ca_cert_path != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: failed to get CA certificate", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_CA_CERT); - - read_ca_cert_path = nm_setting_802_1x_get_ca_cert_path (s_8021x); - ASSERT (read_ca_cert_path != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_CA_CERT); - - ASSERT (strcmp (read_ca_cert_path, expected_ca_cert_path) == 0, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: unexpected %s / %s certificate path", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_CA_CERT); - - g_object_unref (tmp_8021x); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_OPEN TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open" - -static void -test_read_wifi_open (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; - const char *expected_id = "System blahblah (test-wifi-open)"; - guint64 expected_timestamp = 0; - const char *expected_ssid = "blahblah"; - const char *expected_mode = "infrastructure"; - const guint32 expected_channel = 1; - - connection = connection_from_file (TEST_IFCFG_WIFI_OPEN, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-open-read", "failed to read %s: %s", TEST_IFCFG_WIFI_OPEN, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-open-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_OPEN, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-open-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-open-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-open-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ - - /* Timestamp */ - ASSERT (nm_setting_connection_get_timestamp (s_con) == expected_timestamp, - "wifi-open-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_TIMESTAMP); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "wifi-open-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-open-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wireless_get_mac_address (s_wireless); - ASSERT (array != NULL, - "wifi-open-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MAC_ADDRESS); - ASSERT (array->len == ETH_ALEN, - "wifi-open-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MAC_ADDRESS); - ASSERT (memcmp (array->data, &expected_mac_address[0], sizeof (expected_mac_address)) == 0, - "wifi-open-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MAC_ADDRESS); - - ASSERT (nm_setting_wireless_get_mtu (s_wireless) == 0, - "wifi-open-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MTU); - - array = nm_setting_wireless_get_ssid (s_wireless); - ASSERT (array != NULL, - "wifi-open-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (array->len == strlen (expected_ssid), - "wifi-open-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (memcmp (array->data, expected_ssid, strlen (expected_ssid)) == 0, - "wifi-open-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - - ASSERT (nm_setting_wireless_get_bssid (s_wireless) == NULL, - "wifi-open-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_BSSID); - - tmp = nm_setting_wireless_get_mode (s_wireless); - ASSERT (tmp != NULL, - "wifi-open-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - ASSERT (strcmp (tmp, expected_mode) == 0, - "wifi-open-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - - ASSERT (nm_setting_wireless_get_security (s_wireless) == NULL, - "wifi-open-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - ASSERT (nm_setting_wireless_get_channel (s_wireless) == expected_channel, - "wifi-open-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_CHANNEL); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wifi-open-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wifi-open-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_OPEN_AUTO TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-auto" - -static void -test_read_wifi_open_auto (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System blahblah (test-wifi-open-auto)"; - const char *expected_mode = "infrastructure"; - - connection = connection_from_file (TEST_IFCFG_WIFI_OPEN_AUTO, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-open-auto-read", "failed to read %s: %s", TEST_IFCFG_WIFI_OPEN_AUTO, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-open-auto-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_OPEN_AUTO, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-open-auto-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_OPEN_AUTO, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-open-auto-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN_AUTO, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-open-auto-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN_AUTO, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-open-auto-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_OPEN_AUTO, - NM_SETTING_WIRELESS_SETTING_NAME); - - tmp = nm_setting_wireless_get_mode (s_wireless); - ASSERT (tmp != NULL, - "wifi-open-auto-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN_AUTO, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - ASSERT (strcmp (tmp, expected_mode) == 0, - "wifi-open-auto-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN_AUTO, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_OPEN_SSID_HEX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-hex" - -static void -test_read_wifi_open_ssid_hex (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - const char *expected_id = "System blahblah (test-wifi-open-ssid-hex)"; - const char *expected_ssid = "blahblah"; - - connection = connection_from_file (TEST_IFCFG_WIFI_OPEN_SSID_HEX, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-open-ssid-hex-read", "failed to read %s: %s", TEST_IFCFG_WIFI_OPEN_SSID_HEX, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-open-ssid-hex-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_OPEN_SSID_HEX, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-open-ssid-hex-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_OPEN_SSID_HEX, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-open-ssid-hex-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN_SSID_HEX, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-open-ssid-hex-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN_SSID_HEX, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-open-ssid-hex-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_OPEN_SSID_HEX, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* SSID */ - array = nm_setting_wireless_get_ssid (s_wireless); - ASSERT (array != NULL, - "wifi-open-ssid-hex-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN_SSID_HEX, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (array->len == strlen (expected_ssid), - "wifi-open-ssid-hex-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_OPEN_SSID_HEX, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (memcmp (array->data, expected_ssid, strlen (expected_ssid)) == 0, - "wifi-open-ssid-hex-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN_SSID_HEX, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -static void -test_read_wifi_open_ssid_bad (const char *file, const char *test) -{ - NMConnection *connection; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - - connection = connection_from_file (file, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection == NULL, test, "unexpected success reading %s", file); - g_clear_error (&error); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); -} - -#define TEST_IFCFG_WIFI_OPEN_SSID_QUOTED TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-quoted" - -static void -test_read_wifi_open_ssid_quoted (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - const char *expected_id = "System foo\"bar\\ (test-wifi-open-ssid-quoted)"; - const char *expected_ssid = "foo\"bar\\"; - - connection = connection_from_file (TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-open-ssid-quoted-read", "failed to read %s: %s", TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-open-ssid-quoted-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-open-ssid-quoted-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-open-ssid-quoted-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-open-ssid-quoted-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-open-ssid-quoted-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* SSID */ - array = nm_setting_wireless_get_ssid (s_wireless); - ASSERT (array != NULL, - "wifi-open-ssid-quoted-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (array->len == strlen (expected_ssid), - "wifi-open-ssid-quoted-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (memcmp (array->data, expected_ssid, strlen (expected_ssid)) == 0, - "wifi-open-ssid-quoted-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_OPEN_SSID_QUOTED, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WEP TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wep" - -static void -test_read_wifi_wep (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; - const char *expected_id = "System blahblah (test-wifi-wep)"; - guint64 expected_timestamp = 0; - const char *expected_ssid = "blahblah"; - const char *expected_mode = "infrastructure"; - const guint32 expected_channel = 1; - const char *expected_wep_key0 = "0123456789abcdef0123456789"; - NMWepKeyType key_type; - - connection = connection_from_file (TEST_IFCFG_WIFI_WEP, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wep-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WEP, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wep-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WEP, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-wep-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-wep-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-wep-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ - - /* Timestamp */ - ASSERT (nm_setting_connection_get_timestamp (s_con) == expected_timestamp, - "wifi-wep-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_TIMESTAMP); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "wifi-wep-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wireless_get_mac_address (s_wireless); - ASSERT (array != NULL, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MAC_ADDRESS); - ASSERT (array->len == ETH_ALEN, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MAC_ADDRESS); - ASSERT (memcmp (array->data, &expected_mac_address[0], sizeof (expected_mac_address)) == 0, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MAC_ADDRESS); - - /* MTU */ - ASSERT (nm_setting_wireless_get_mtu (s_wireless) == 0, - "wifi-wep-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MTU); - - /* SSID */ - array = nm_setting_wireless_get_ssid (s_wireless); - ASSERT (array != NULL, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (array->len == strlen (expected_ssid), - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (memcmp (array->data, expected_ssid, strlen (expected_ssid)) == 0, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - - /* BSSID */ - ASSERT (nm_setting_wireless_get_bssid (s_wireless) == NULL, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_BSSID); - - /* Mode */ - tmp = nm_setting_wireless_get_mode (s_wireless); - ASSERT (tmp != NULL, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - ASSERT (strcmp (tmp, expected_mode) == 0, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - - /* Channel */ - ASSERT (nm_setting_wireless_get_channel (s_wireless) == expected_channel, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_CHANNEL); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* Key management */ - ASSERT (strcmp (nm_setting_wireless_security_get_key_mgmt (s_wsec), "none") == 0, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* WEP key index */ - ASSERT (nm_setting_wireless_security_get_wep_tx_keyidx (s_wsec) == 0, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX); - - /* WEP key type */ - key_type = nm_setting_wireless_security_get_wep_key_type (s_wsec); - ASSERT (key_type == NM_WEP_KEY_TYPE_UNKNOWN || key_type == NM_WEP_KEY_TYPE_KEY, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected WEP key type %d", - TEST_IFCFG_WIFI_WEP, - key_type); - - /* WEP key index 0 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0); - ASSERT (tmp != NULL, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - ASSERT (strcmp (tmp, expected_wep_key0) == 0, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - - /* WEP key index 1 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 1); - ASSERT (tmp == NULL, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY1); - - /* WEP key index 2 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 2); - ASSERT (tmp == NULL, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY2); - - /* WEP key index 3 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 3); - ASSERT (tmp == NULL, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY3); - - /* WEP Authentication mode */ - tmp = nm_setting_wireless_security_get_auth_alg (s_wsec); - ASSERT (tmp != NULL, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG); - ASSERT (strcmp (tmp, "shared") == 0, - "wifi-wep-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wifi-wep-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wifi-wep-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WEP_ADHOC TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wep-adhoc" - -static void -test_read_wifi_wep_adhoc (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - const char *expected_id = "System blahblah (test-wifi-wep-adhoc)"; - const char *expected_ssid = "blahblah"; - const char *expected_mode = "adhoc"; - const char *expected_wep_key0 = "0123456789abcdef0123456789"; - struct in_addr addr; - const char *expected_dns1 = "4.2.2.1"; - const char *expected_dns2 = "4.2.2.2"; - - connection = connection_from_file (TEST_IFCFG_WIFI_WEP_ADHOC, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wep-adhoc-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WEP_ADHOC, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wep-adhoc-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WEP_ADHOC, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-wep-adhoc-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-wep-adhoc-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-wep-adhoc-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == FALSE, - "wifi-wep-adhoc-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* SSID */ - array = nm_setting_wireless_get_ssid (s_wireless); - ASSERT (array != NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (array->len == strlen (expected_ssid), - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (memcmp (array->data, expected_ssid, strlen (expected_ssid)) == 0, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - - /* BSSID */ - ASSERT (nm_setting_wireless_get_bssid (s_wireless) == NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_BSSID); - - /* Mode */ - tmp = nm_setting_wireless_get_mode (s_wireless); - ASSERT (tmp != NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - ASSERT (strcmp (tmp, expected_mode) == 0, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - - /* Channel */ - ASSERT (nm_setting_wireless_get_channel (s_wireless) == 11, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_CHANNEL); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* Key management */ - ASSERT (strcmp (nm_setting_wireless_security_get_key_mgmt (s_wsec), "none") == 0, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* WEP key index */ - ASSERT (nm_setting_wireless_security_get_wep_tx_keyidx (s_wsec) == 0, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX); - - /* WEP key index 0 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0); - ASSERT (tmp != NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - ASSERT (strcmp (tmp, expected_wep_key0) == 0, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - - /* WEP key index 1 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 1); - ASSERT (tmp == NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY1); - - /* WEP key index 2 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 2); - ASSERT (tmp == NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY2); - - /* WEP key index 3 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 3); - ASSERT (tmp == NULL, - "wifi-wep-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY3); - - /* WEP Authentication mode */ - tmp = nm_setting_wireless_security_get_auth_alg (s_wsec); - ASSERT (tmp == NULL, - "wifi-wep-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wifi-wep-adhoc-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* Ignore auto DNS */ - ASSERT (nm_setting_ip4_config_get_ignore_auto_dns (s_ip4) == TRUE, - "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS); - - /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, - "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET, expected_dns1, &addr) > 0, - "wifi-wep-adhoc-verify-ip4", "failed to verify %s: couldn't convert DNS IP address #1", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_dns (s_ip4, 0) == addr.s_addr, - "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET, expected_dns2, &addr) > 0, - "wifi-wep-adhoc-verify-ip4", "failed to verify %s: couldn't convert DNS IP address #2", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_dns (s_ip4, 1) == addr.s_addr, - "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", - TEST_IFCFG_WIFI_WEP_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WEP_PASSPHRASE TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wep-passphrase" - -static void -test_read_wifi_wep_passphrase (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_wep_key0 = "foobar222blahblah"; - NMWepKeyType key_type; - - connection = connection_from_file (TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wep-passphrase-read", "failed to read %s: %s", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wep-passphrase-verify", "failed to verify %s: %s", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-wep-passphrase-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* Key management */ - ASSERT (strcmp (nm_setting_wireless_security_get_key_mgmt (s_wsec), "none") == 0, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* WEP key index */ - ASSERT (nm_setting_wireless_security_get_wep_tx_keyidx (s_wsec) == 0, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX); - - /* WEP key type */ - key_type = nm_setting_wireless_security_get_wep_key_type (s_wsec); - ASSERT (key_type == NM_WEP_KEY_TYPE_PASSPHRASE, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: unexpected WEP key type %d", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - key_type); - - /* WEP key index 0 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0); - ASSERT (tmp != NULL, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - ASSERT (strcmp (tmp, expected_wep_key0) == 0, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - - /* WEP key index 1 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 1); - ASSERT (tmp == NULL, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY1); - - /* WEP key index 2 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 2); - ASSERT (tmp == NULL, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY2); - - /* WEP key index 3 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 3); - ASSERT (tmp == NULL, - "wifi-wep-passphrase-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_PASSPHRASE, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY3); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WEP_40_ASCII TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wep-40-ascii" - -static void -test_read_wifi_wep_40_ascii (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_wep_key0 = "Lorem"; - NMWepKeyType key_type; - - connection = connection_from_file (TEST_IFCFG_WIFI_WEP_40_ASCII, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wep-40-ascii-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WEP_40_ASCII, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wep-40-ascii-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WEP_40_ASCII, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-wep-40-ascii-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* Key management */ - ASSERT (strcmp (nm_setting_wireless_security_get_key_mgmt (s_wsec), "none") == 0, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* WEP key index */ - ASSERT (nm_setting_wireless_security_get_wep_tx_keyidx (s_wsec) == 0, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX); - - /* WEP key type */ - key_type = nm_setting_wireless_security_get_wep_key_type (s_wsec); - ASSERT (key_type == NM_WEP_KEY_TYPE_UNKNOWN || key_type == NM_WEP_KEY_TYPE_KEY, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: unexpected WEP key type %d", - TEST_IFCFG_WIFI_WEP_40_ASCII, - key_type); - - /* WEP key index 0 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0); - ASSERT (tmp != NULL, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - ASSERT (strcmp (tmp, expected_wep_key0) == 0, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - - /* WEP key index 1 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 1); - ASSERT (tmp == NULL, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY1); - - /* WEP key index 2 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 2); - ASSERT (tmp == NULL, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY2); - - /* WEP key index 3 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 3); - ASSERT (tmp == NULL, - "wifi-wep-40-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_40_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY3); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WEP_104_ASCII TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wep-104-ascii" - -static void -test_read_wifi_wep_104_ascii (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_wep_key0 = "LoremIpsumSit"; - NMWepKeyType key_type; - - connection = connection_from_file (TEST_IFCFG_WIFI_WEP_104_ASCII, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wep-104-ascii-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WEP_104_ASCII, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wep-104-ascii-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WEP_104_ASCII, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-wep-104-ascii-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* Key management */ - ASSERT (strcmp (nm_setting_wireless_security_get_key_mgmt (s_wsec), "none") == 0, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* WEP key index */ - ASSERT (nm_setting_wireless_security_get_wep_tx_keyidx (s_wsec) == 0, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX); - - /* WEP key type */ - key_type = nm_setting_wireless_security_get_wep_key_type (s_wsec); - ASSERT (key_type == NM_WEP_KEY_TYPE_UNKNOWN || key_type == NM_WEP_KEY_TYPE_KEY, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: unexpected WEP key type %d", - TEST_IFCFG_WIFI_WEP_104_ASCII, - key_type); - - /* WEP key index 0 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0); - ASSERT (tmp != NULL, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - ASSERT (strcmp (tmp, expected_wep_key0) == 0, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); - - /* WEP key index 1 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 1); - ASSERT (tmp == NULL, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY1); - - /* WEP key index 2 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 2); - ASSERT (tmp == NULL, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY2); - - /* WEP key index 3 */ - tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 3); - ASSERT (tmp == NULL, - "wifi-wep-104-ascii-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WEP_104_ASCII, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_WEP_KEY3); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_LEAP TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-leap" - -static void -test_read_wifi_leap (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System blahblah (test-wifi-leap)"; - const char *expected_identity = "Bill Smith"; - const char *expected_password = "foobarblah"; - - connection = connection_from_file (TEST_IFCFG_WIFI_LEAP, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-leap-read", "failed to read %s: %s", TEST_IFCFG_WIFI_LEAP, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-leap-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_LEAP, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-leap-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-leap-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-leap-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-leap-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-leap-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-leap-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-leap-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* Key management */ - ASSERT (strcmp (nm_setting_wireless_security_get_key_mgmt (s_wsec), "ieee8021x") == 0, - "wifi-leap-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* WEP Authentication mode */ - tmp = nm_setting_wireless_security_get_auth_alg (s_wsec); - ASSERT (tmp != NULL, - "wifi-leap-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG); - ASSERT (strcmp (tmp, "leap") == 0, - "wifi-leap-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG); - - /* LEAP Username */ - tmp = nm_setting_wireless_security_get_leap_username (s_wsec); - ASSERT (tmp != NULL, - "wifi-leap-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME); - ASSERT (strcmp (tmp, expected_identity) == 0, - "wifi-leap-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME); - - /* LEAP Password */ - tmp = nm_setting_wireless_security_get_leap_password (s_wsec); - ASSERT (tmp != NULL, - "wifi-leap-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD); - ASSERT (strcmp (tmp, expected_password) == 0, - "wifi-leap-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_LEAP, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WPA_PSK TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wpa-psk" - -static void -test_read_wifi_wpa_psk (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; - const char *expected_id = "System blahblah (test-wifi-wpa-psk)"; - guint64 expected_timestamp = 0; - const char *expected_ssid = "blahblah"; - const char *expected_mode = "infrastructure"; - const guint32 expected_channel = 1; - const char *expected_key_mgmt = "wpa-psk"; - const char *expected_psk = "I wonder what the king is doing tonight?"; - guint32 n, i; - gboolean found_pair_tkip = FALSE; - gboolean found_pair_ccmp = FALSE; - gboolean found_group_tkip = FALSE; - gboolean found_group_ccmp = FALSE; - gboolean found_group_wep40 = FALSE; - gboolean found_group_wep104 = FALSE; - gboolean found_proto_wpa = FALSE; - gboolean found_proto_rsn = FALSE; - - connection = connection_from_file (TEST_IFCFG_WIFI_WPA_PSK, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wpa-psk-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WPA_PSK, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wpa-psk-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WPA_PSK, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-wpa-psk-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-wpa-psk-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-wpa-psk-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ - - /* Timestamp */ - ASSERT (nm_setting_connection_get_timestamp (s_con) == expected_timestamp, - "wifi-wpa-psk-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_TIMESTAMP); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "wifi-wpa-psk-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wireless_get_mac_address (s_wireless); - ASSERT (array != NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MAC_ADDRESS); - ASSERT (array->len == ETH_ALEN, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MAC_ADDRESS); - ASSERT (memcmp (array->data, &expected_mac_address[0], sizeof (expected_mac_address)) == 0, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MAC_ADDRESS); - - /* MTU */ - ASSERT (nm_setting_wireless_get_mtu (s_wireless) == 0, - "wifi-wpa-psk-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MTU); - - /* SSID */ - array = nm_setting_wireless_get_ssid (s_wireless); - ASSERT (array != NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (array->len == strlen (expected_ssid), - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (memcmp (array->data, expected_ssid, strlen (expected_ssid)) == 0, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - - /* BSSID */ - ASSERT (nm_setting_wireless_get_bssid (s_wireless) == NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_BSSID); - - /* Mode */ - tmp = nm_setting_wireless_get_mode (s_wireless); - ASSERT (tmp != NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - ASSERT (strcmp (tmp, expected_mode) == 0, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - - /* Channel */ - ASSERT (nm_setting_wireless_get_channel (s_wireless) == expected_channel, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_CHANNEL); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* Key management */ - tmp = nm_setting_wireless_security_get_key_mgmt (s_wsec); - ASSERT (tmp != NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - ASSERT (strcmp (tmp, expected_key_mgmt) == 0, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* PSK */ - tmp = nm_setting_wireless_security_get_psk (s_wsec); - ASSERT (tmp != NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PSK); - ASSERT (strcmp (tmp, expected_psk) == 0, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PSK); - - /* WEP Authentication mode */ - tmp = nm_setting_wireless_security_get_auth_alg (s_wsec); - ASSERT (tmp == NULL, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG); - - /* Pairwise ciphers */ - n = nm_setting_wireless_security_get_num_pairwise (s_wsec); - ASSERT (n == 2, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PAIRWISE); - for (i = 0; i < n; i++) { - tmp = nm_setting_wireless_security_get_pairwise (s_wsec, i); - ASSERT (tmp, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing pairwise cipher", - TEST_IFCFG_WIFI_WPA_PSK); - if (strcmp (tmp, "tkip") == 0) - found_pair_tkip = TRUE; - else if (strcmp (tmp, "ccmp") == 0) - found_pair_ccmp = TRUE; - } - ASSERT (found_pair_tkip, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing pairwise TKIP cipher", - TEST_IFCFG_WIFI_WPA_PSK); - ASSERT (found_pair_ccmp, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing pairwise CCMP cipher", - TEST_IFCFG_WIFI_WPA_PSK); - - /* Group ciphers */ - n = nm_setting_wireless_security_get_num_groups (s_wsec); - ASSERT (n == 4, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_GROUP); - for (i = 0; i < n; i++) { - tmp = nm_setting_wireless_security_get_group (s_wsec, i); - ASSERT (tmp, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing group cipher", - TEST_IFCFG_WIFI_WPA_PSK); - if (strcmp (tmp, "tkip") == 0) - found_group_tkip = TRUE; - else if (strcmp (tmp, "ccmp") == 0) - found_group_ccmp = TRUE; - else if (strcmp (tmp, "wep40") == 0) - found_group_wep40 = TRUE; - else if (strcmp (tmp, "wep104") == 0) - found_group_wep104 = TRUE; - } - ASSERT (found_group_tkip, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing group TKIP cipher", - TEST_IFCFG_WIFI_WPA_PSK); - ASSERT (found_group_ccmp, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing group CCMP cipher", - TEST_IFCFG_WIFI_WPA_PSK); - ASSERT (found_group_wep40, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing group WEP-40 cipher", - TEST_IFCFG_WIFI_WPA_PSK); - ASSERT (found_group_wep104, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing group WEP-104 cipher", - TEST_IFCFG_WIFI_WPA_PSK); - - /* Protocols */ - n = nm_setting_wireless_security_get_num_protos (s_wsec); - ASSERT (n == 2, - "wifi-wpa-psk-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PROTO); - for (i = 0; i < n; i++) { - tmp = nm_setting_wireless_security_get_proto (s_wsec, i); - ASSERT (tmp, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing protocol", - TEST_IFCFG_WIFI_WPA_PSK); - if (strcmp (tmp, "wpa") == 0) - found_proto_wpa = TRUE; - else if (strcmp (tmp, "rsn") == 0) - found_proto_rsn = TRUE; - } - ASSERT (found_proto_wpa, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing protoocl WPA", - TEST_IFCFG_WIFI_WPA_PSK); - ASSERT (found_proto_rsn, "wifi-wpa-psk-verify-wireless", "failed to verify %s: missing protocol RSN", - TEST_IFCFG_WIFI_WPA_PSK); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wifi-wpa-psk-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wifi-wpa-psk-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted" - -static void -test_read_wifi_wpa_psk_unquoted (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System blahblah (test-wifi-wpa-psk-unquoted)"; - const char *expected_psk = "54336845e2f3f321c4c7"; - - connection = connection_from_file (TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wpa-psk-unquoted-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wpa-psk-unquoted-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-wpa-psk-unquoted-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-wpa-psk-unquoted-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-wpa-psk-unquoted-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wpa-psk-unquoted-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-wpa-psk-unquoted-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-wpa-psk-unquoted-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wpa-psk-unquoted-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* PSK */ - tmp = nm_setting_wireless_security_get_psk (s_wsec); - ASSERT (tmp != NULL, - "wifi-wpa-psk-unquoted-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PSK); - ASSERT (strcmp (tmp, expected_psk) == 0, - "wifi-wpa-psk-unquoted-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PSK); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED2 TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted2" - -static void -test_read_wifi_wpa_psk_unquoted2 (void) -{ - NMConnection *connection; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - - /* Ensure a quoted 64-character WPA passphrase will fail since passphrases - * must be between 8 and 63 ASCII characters inclusive per the WPA spec. - */ - - connection = connection_from_file (TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED2, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection == NULL, - "wifi-wpa-psk-unquoted-read", "unexpected success reading %s", TEST_IFCFG_WIFI_WPA_PSK_UNQUOTED2); - g_clear_error (&error); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); -} - -#define TEST_IFCFG_WIFI_WPA_PSK_ADHOC TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wpa-psk-adhoc" - -static void -test_read_wifi_wpa_psk_adhoc (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System blahblah (test-wifi-wpa-psk-adhoc)"; - const char *expected_mode = "adhoc"; - const char *expected_key_mgmt = "wpa-none"; - const char *expected_psk = "I wonder what the king is doing tonight?"; - const char *expected_group = "ccmp"; - const char *expected_proto = "wpa"; - - connection = connection_from_file (TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wpa-psk-adhoc-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WPA_PSK_ADHOC, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wpa-psk-adhoc-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WPA_PSK_ADHOC, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-wpa-psk-adhoc-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-wpa-psk-adhoc-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-wpa-psk-adhoc-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* Mode */ - tmp = nm_setting_wireless_get_mode (s_wireless); - ASSERT (tmp != NULL, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - ASSERT (strcmp (tmp, expected_mode) == 0, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_MODE); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* Key management */ - tmp = nm_setting_wireless_security_get_key_mgmt (s_wsec); - ASSERT (tmp != NULL, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - ASSERT (strcmp (tmp, expected_key_mgmt) == 0, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* PSK */ - tmp = nm_setting_wireless_security_get_psk (s_wsec); - ASSERT (tmp != NULL, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PSK); - ASSERT (strcmp (tmp, expected_psk) == 0, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PSK); - - /* Pairwise cipher: unused in adhoc mode */ - ASSERT (nm_setting_wireless_security_get_num_pairwise (s_wsec) == 0, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PAIRWISE); - - /* Group cipher */ - ASSERT (nm_setting_wireless_security_get_num_groups (s_wsec) == 1, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_GROUP); - - tmp = nm_setting_wireless_security_get_group (s_wsec, 0); - ASSERT (tmp != NULL, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: missing group cipher", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC); - ASSERT (strcmp (tmp, expected_group) == 0, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_GROUP); - - /* Protocols */ - ASSERT (nm_setting_wireless_security_get_num_protos (s_wsec) == 1, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PROTO); - tmp = nm_setting_wireless_security_get_proto (s_wsec, 0); - ASSERT (tmp != NULL, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: missing proto", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC); - ASSERT (strcmp (tmp, expected_proto) == 0, - "wifi-wpa-psk-adhoc-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PROTO); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wifi-wpa-psk-adhoc-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wifi-wpa-psk-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_ADHOC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WPA_PSK_HEX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wpa-psk-hex" - -static void -test_read_wifi_wpa_psk_hex (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - const char *expected_id = "System blahblah (test-wifi-wpa-psk-hex)"; - const char *expected_ssid = "blahblah"; - const char *expected_key_mgmt = "wpa-psk"; - const char *expected_psk = "1da190379817bc360dda52e85c388c439a21ea5c7bf819c64e9da051807deae6"; - - connection = connection_from_file (TEST_IFCFG_WIFI_WPA_PSK_HEX, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wpa-psk-hex-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WPA_PSK_HEX, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wpa-psk-hex-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WPA_PSK_HEX, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wifi-wpa-psk-hex-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wifi-wpa-psk-hex-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wifi-wpa-psk-hex-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* SSID */ - array = nm_setting_wireless_get_ssid (s_wireless); - ASSERT (array != NULL, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (array->len == strlen (expected_ssid), - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - ASSERT (memcmp (array->data, expected_ssid, strlen (expected_ssid)) == 0, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SSID); - - /* Security */ - tmp = nm_setting_wireless_get_security (s_wireless); - ASSERT (tmp != NULL, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - ASSERT (strcmp (tmp, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SETTING_NAME, - NM_SETTING_WIRELESS_SEC); - - /* ===== WIRELESS SECURITY SETTING ===== */ - - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - - /* Key management */ - tmp = nm_setting_wireless_security_get_key_mgmt (s_wsec); - ASSERT (tmp != NULL, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - ASSERT (strcmp (tmp, expected_key_mgmt) == 0, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* PSK */ - tmp = nm_setting_wireless_security_get_psk (s_wsec); - ASSERT (tmp != NULL, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PSK); - ASSERT (strcmp (tmp, expected_psk) == 0, - "wifi-wpa-psk-hex-verify-wireless", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_PSK); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wifi-wpa-psk-hex-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wifi-wpa-psk-hex-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK_HEX, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WPA_EAP_TLS TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wpa-eap-tls" -#define TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT TEST_IFCFG_DIR"/network-scripts/test_ca_cert.pem" -#define TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT TEST_IFCFG_DIR"/network-scripts/test1_key_and_cert.pem" -#define TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY TEST_IFCFG_DIR"/network-scripts/test1_key_and_cert.pem" - -static void -test_read_wifi_wpa_eap_tls (void) -{ - NMConnection *connection; - NMSettingWireless *s_wireless; - NMSettingIP4Config *s_ip4; - NMSetting8021x *s_8021x; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp, *password; - const char *expected_identity = "Bill Smith"; - const char *expected_privkey_password = "test1"; - - connection = connection_from_file (TEST_IFCFG_WIFI_WPA_EAP_TLS, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wpa-eap-tls-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WPA_EAP_TLS, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wpa-eap-tls-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WPA_EAP_TLS, error->message); - - ASSERT (unmanaged == NULL, - "wifi-wpa-eap-tls-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIFI_WPA_EAP_TLS); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wpa-eap-tls-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wifi-wpa-eap-tls-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wifi-wpa-eap-tls-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* ===== 802.1x SETTING ===== */ - s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X)); - ASSERT (s_8021x != NULL, - "wifi-wpa-eap-tls-verify-8021x", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_802_1X_SETTING_NAME); - - /* EAP methods */ - ASSERT (nm_setting_802_1x_get_num_eap_methods (s_8021x) == 1, - "wifi-wpa-eap-tls-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - tmp = nm_setting_802_1x_get_eap_method (s_8021x, 0); - ASSERT (tmp != NULL, - "wifi-wpa-eap-tls-verify-8021x", "failed to verify %s: missing %s / %s eap method", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - ASSERT (strcmp (tmp, "tls") == 0, - "wifi-wpa-eap-tls-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - - /* Identity */ - tmp = nm_setting_802_1x_get_identity (s_8021x); - ASSERT (tmp != NULL, - "wifi-wpa-eap-tls-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_IDENTITY); - ASSERT (strcmp (tmp, expected_identity) == 0, - "wifi-wpa-eap-tls-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_IDENTITY); - - /* CA Cert */ - verify_cert_or_key (CK_CA_CERT, - s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, - NULL, - TEST_IFCFG_WIFI_WPA_EAP_TLS, - "wifi-wpa-eap-tls-verify-8021x", - NM_SETTING_802_1X_CA_CERT); - - /* Client Cert */ - verify_cert_or_key (CK_CLIENT_CERT, - s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT, - NULL, - TEST_IFCFG_WIFI_WPA_EAP_TLS, - "wifi-wpa-eap-tls-verify-8021x", - NM_SETTING_802_1X_CLIENT_CERT); - - /* Private Key Password */ - password = nm_setting_802_1x_get_private_key_password (s_8021x); - ASSERT (password != NULL, - "wifi-wpa-eap-tls-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD); - - ASSERT (strcmp (password, expected_privkey_password) == 0, - "wifi-wpa-eap-tls-verify-8021x", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WPA_EAP_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD); - - /* Private key */ - verify_cert_or_key (CK_PRIV_KEY, - s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, - expected_privkey_password, - TEST_IFCFG_WIFI_WPA_EAP_TLS, - "wifi-wpa-eap-tls-verify-8021x", - NM_SETTING_802_1X_PRIVATE_KEY); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wpa-eap-ttls-tls" -#define TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS_CA_CERT TEST_IFCFG_DIR"/network-scripts/test_ca_cert.pem" -/* Also use TLS defines from the previous test */ - -static void -test_read_wifi_wpa_eap_ttls_tls (void) -{ - NMConnection *connection; - NMSettingWireless *s_wireless; - NMSettingIP4Config *s_ip4; - NMSetting8021x *s_8021x; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp, *password; - const char *expected_identity = "Chuck Shumer"; - const char *expected_privkey_password = "test1"; - - connection = connection_from_file (TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wpa-eap-ttls-tls-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wpa-eap-ttls-tls-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, error->message); - - ASSERT (unmanaged == NULL, - "wifi-wpa-eap-ttls-tls-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wpa-eap-ttls-tls-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wifi-wpa-eap-ttls-tls-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wifi-wpa-eap-ttls-tls-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* ===== 802.1x SETTING ===== */ - s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X)); - ASSERT (s_8021x != NULL, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME); - - /* EAP methods */ - ASSERT (nm_setting_802_1x_get_num_eap_methods (s_8021x) == 1, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - tmp = nm_setting_802_1x_get_eap_method (s_8021x, 0); - ASSERT (tmp != NULL, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: missing %s / %s eap method", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - ASSERT (strcmp (tmp, "ttls") == 0, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - - /* CA Cert */ - verify_cert_or_key (CK_CA_CERT, - s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS_CA_CERT, - NULL, - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - "wifi-wpa-eap-ttls-tls-verify-8021x", - NM_SETTING_802_1X_CA_CERT); - - /* Inner auth method */ - tmp = nm_setting_802_1x_get_phase2_autheap (s_8021x); - ASSERT (tmp != NULL, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: missing %s / %s eap method", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE2_AUTHEAP); - ASSERT (strcmp (tmp, "tls") == 0, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE2_AUTHEAP); - - /* Inner CA Cert */ - verify_cert_or_key (CK_CA_CERT, - s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, - NULL, - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - "wifi-wpa-eap-ttls-tls-verify-8021x", - NM_SETTING_802_1X_PHASE2_CA_CERT); - - /* Inner Client Cert */ - verify_cert_or_key (CK_CLIENT_CERT, - s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT, - NULL, - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - "wifi-wpa-eap-ttls-tls-verify-8021x", - NM_SETTING_802_1X_PHASE2_CLIENT_CERT); - - /* Inner Private Key Password */ - password = nm_setting_802_1x_get_phase2_private_key_password (s_8021x); - ASSERT (password != NULL, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD); - - ASSERT (strcmp (password, expected_privkey_password) == 0, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD); - - /* Inner private key */ - verify_cert_or_key (CK_PRIV_KEY, - s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, - expected_privkey_password, - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - "wifi-wpa-eap-ttls-tls-verify-8021x", - NM_SETTING_802_1X_PHASE2_PRIVATE_KEY); - - /* Identity */ - tmp = nm_setting_802_1x_get_identity (s_8021x); - ASSERT (tmp != NULL, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_IDENTITY); - ASSERT (strcmp (tmp, expected_identity) == 0, - "wifi-wpa-eap-ttls-tls-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_IDENTITY); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-wep-eap-ttls-chap" -#define TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP_CA_CERT TEST_IFCFG_DIR"/network-scripts/test_ca_cert.pem" - -static void -test_read_wifi_wep_eap_ttls_chap (void) -{ - NMConnection *connection; - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSetting8021x *s_8021x; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_password = "foobar baz"; - const char *expected_identity = "David Smith"; - const char *expected_key_mgmt = "ieee8021x"; - - connection = connection_from_file (TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wifi-wep-eap-ttls-chap-read", "failed to read %s: %s", TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wifi-wep-eap-ttls-chap-verify", "failed to verify %s: %s", TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, error->message); - - ASSERT (unmanaged == NULL, - "wifi-wep-eap-ttls-chap-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP); - - /* ===== WIRELESS SETTING ===== */ - - s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)); - ASSERT (s_wireless != NULL, - "wifi-wep-eap-ttls-chap-verify-wireless", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_WIRELESS_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wifi-wep-eap-ttls-chap-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wifi-wep-eap-ttls-chap-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* ===== 802.1x SETTING ===== */ - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY)); - ASSERT (s_wsec != NULL, - "wifi-wep-eap-ttls-chap-verify-wireless-security", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME); - - /* Key management */ - tmp = nm_setting_wireless_security_get_key_mgmt (s_wsec); - ASSERT (tmp != NULL, - "wifi-wep-eap-ttls-chap-verify-wireless-security", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - ASSERT (strcmp (tmp, expected_key_mgmt) == 0, - "wifi-wep-eap-ttls-chap-verify-wireless-security", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WPA_PSK, - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT); - - /* ===== 802.1x SETTING ===== */ - s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X)); - ASSERT (s_8021x != NULL, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME); - - /* EAP methods */ - ASSERT (nm_setting_802_1x_get_num_eap_methods (s_8021x) == 1, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - tmp = nm_setting_802_1x_get_eap_method (s_8021x, 0); - ASSERT (tmp != NULL, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: missing %s / %s eap method", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - ASSERT (strcmp (tmp, "ttls") == 0, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_EAP); - - /* CA Cert */ - verify_cert_or_key (CK_CA_CERT, - s_8021x, - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP_CA_CERT, - NULL, - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - "wifi-wep-eap-ttls-chap-verify-8021x", - NM_SETTING_802_1X_CA_CERT); - - /* Inner auth method */ - tmp = nm_setting_802_1x_get_phase2_auth (s_8021x); - ASSERT (tmp != NULL, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: missing %s / %s eap method", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE2_AUTH); - ASSERT (strcmp (tmp, "chap") == 0, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PHASE2_AUTH); - - /* Password */ - tmp = nm_setting_802_1x_get_identity (s_8021x); - ASSERT (tmp != NULL, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_IDENTITY); - ASSERT (strcmp (tmp, expected_identity) == 0, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_IDENTITY); - - /* Password */ - tmp = nm_setting_802_1x_get_password (s_8021x); - ASSERT (tmp != NULL, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PASSWORD); - ASSERT (strcmp (tmp, expected_password) == 0, - "wifi-wep-eap-ttls-chap-verify-8021x", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, - NM_SETTING_802_1X_SETTING_NAME, - NM_SETTING_802_1X_PASSWORD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_QETH_STATIC TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-qeth-static" - -static void -test_read_wired_qeth_static (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System test-wired-qeth-static"; - const GByteArray *array; - const char *expected_channel0 = "0.0.0600"; - const char *expected_channel1 = "0.0.0601"; - const char *expected_channel2 = "0.0.0602"; - const GPtrArray *subchannels; - - connection = connection_from_file (TEST_IFCFG_WIRED_QETH_STATIC, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "wired-qeth-static-read", "failed to read %s: %s", TEST_IFCFG_WIRED_QETH_STATIC, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "wired-qeth-static-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_QETH_STATIC, error->message); - - ASSERT (unmanaged == NULL, - "wired-qeth-static-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_QETH_STATIC); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "wired-qeth-static-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "wired-qeth-static-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "wired-qeth-static-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "wired-qeth-static-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wired_get_mac_address (s_wired); - ASSERT (array == NULL, - "wired-qeth-static-verify-wired", "failed to verify %s: unexpected %s / %s key", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - - /* Subchannels */ - subchannels = nm_setting_wired_get_s390_subchannels (s_wired); - ASSERT (subchannels != NULL, - "wired-qeth-static-verify-wired", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_S390_SUBCHANNELS); - ASSERT (subchannels->len == 3, - "wired-qeth-static-verify-wired", "failed to verify %s: invalid %s / %s key (not 3 elements)", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_S390_SUBCHANNELS); - - tmp = (const char *) g_ptr_array_index (subchannels, 0); - ASSERT (strcmp (tmp, expected_channel0) == 0, - "wired-qeth-static-verify-wired", "failed to verify %s: unexpected subchannel #0", - TEST_IFCFG_WIRED_QETH_STATIC); - - tmp = (const char *) g_ptr_array_index (subchannels, 1); - ASSERT (strcmp (tmp, expected_channel1) == 0, - "wired-qeth-static-verify-wired", "failed to verify %s: unexpected subchannel #1", - TEST_IFCFG_WIRED_QETH_STATIC); - - tmp = (const char *) g_ptr_array_index (subchannels, 2); - ASSERT (strcmp (tmp, expected_channel2) == 0, - "wired-qeth-static-verify-wired", "failed to verify %s: unexpected subchannel #2", - TEST_IFCFG_WIRED_QETH_STATIC); - - /* Nettype */ - tmp = nm_setting_wired_get_s390_nettype (s_wired); - ASSERT (tmp != NULL, - "wired-qeth-static-verify-wired", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_S390_NETTYPE); - ASSERT (strcmp (tmp, "qeth") == 0, - "wired-qeth-static-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_S390_NETTYPE); - - /* port name */ - tmp = nm_setting_wired_get_s390_option_by_key (s_wired, "portname"); - ASSERT (tmp != NULL, - "wired-qeth-static-verify-wired", "failed to verify %s: missing %s s390 option 'portname'", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME); - ASSERT (strcmp (tmp, "OSAPORT") == 0, - "wired-qeth-static-verify-wired", "failed to verify %s: unexpected %s s390 option 'portname' value", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME); - - /* port number */ - tmp = nm_setting_wired_get_s390_option_by_key (s_wired, "portno"); - ASSERT (tmp != NULL, - "wired-qeth-static-verify-wired", "failed to verify %s: missing %s s390 option 'portno'", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME); - ASSERT (strcmp (tmp, "0") == 0, - "wired-qeth-static-verify-wired", "failed to verify %s: unexpected %s s390 option 'portno' value", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME); - - /* layer */ - tmp = nm_setting_wired_get_s390_option_by_key (s_wired, "layer2"); - ASSERT (tmp != NULL, - "wired-qeth-static-verify-wired", "failed to verify %s: missing %s s390 option 'layer2'", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME); - ASSERT (strcmp (tmp, "1") == 0, - "wired-qeth-static-verify-wired", "failed to verify %s: unexpected %s s390 option 'layer2' value", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "wired-qeth-static-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, - "wired-qeth-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_WIRED_QETH_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_WIRED_CTC_STATIC TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ctc-static" - -static void -test_read_wired_ctc_static (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const char *expected_id = "System test-wired-ctc-static"; - const char *expected_channel0 = "0.0.1b00"; - const char *expected_channel1 = "0.0.1b01"; - const GPtrArray *subchannels; - gboolean success; - - connection = connection_from_file (TEST_IFCFG_WIRED_CTC_STATIC, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - g_assert_no_error (error); - g_assert (connection); - - success = nm_connection_verify (connection, &error); - g_assert_no_error (error); - g_assert (success); - g_assert (unmanaged == NULL); - - /* ===== CONNECTION SETTING ===== */ - s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION); - g_assert (s_con != NULL); - g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, expected_id); - - /* ===== WIRED SETTING ===== */ - s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED); - g_assert (s_wired != NULL); - - g_assert (nm_setting_wired_get_mac_address (s_wired) == NULL); - - /* Subchannels */ - subchannels = nm_setting_wired_get_s390_subchannels (s_wired); - g_assert (subchannels != NULL); - g_assert_cmpint (subchannels->len, ==, 2); - - g_assert_cmpstr (g_ptr_array_index (subchannels, 0), ==, expected_channel0); - g_assert_cmpstr (g_ptr_array_index (subchannels, 1), ==, expected_channel1); - - /* Nettype */ - g_assert_cmpstr (nm_setting_wired_get_s390_nettype (s_wired), ==, "ctc"); - - /* port name */ - tmp = nm_setting_wired_get_s390_option_by_key (s_wired, "ctcprot"); - g_assert (tmp != NULL); - g_assert_cmpstr (tmp, ==, "0"); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -static void -test_write_wired_static (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4, *reread_s_ip4; - NMSettingIP6Config *s_ip6, *reread_s_ip6; - static unsigned char tmpmac[] = { 0x31, 0x33, 0x33, 0x37, 0xbe, 0xcd }; - GByteArray *mac; - guint32 mtu = 1492; - char *uuid; - const guint32 ip1 = htonl (0x01010103); - const guint32 ip2 = htonl (0x01010105); - const guint32 gw = htonl (0x01010101); - const guint32 dns1 = htonl (0x04020201); - const guint32 dns2 = htonl (0x04020202); - const guint32 prefix = 24; - const char *dns_search1 = "foobar.com"; - const char *dns_search2 = "lab.foobar.com"; - const char *dns_search3 = "foobar6.com"; - const char *dns_search4 = "lab6.foobar.com"; - struct in6_addr ip6, ip6_1, ip6_2; - struct in6_addr route1_dest, route2_dest, route1_nexthop, route2_nexthop; - struct in6_addr dns6_1, dns6_2; - const guint32 route1_prefix = 64, route2_prefix = 0; - const guint32 route1_metric = 99, route2_metric = 1; - NMIP4Address *addr; - NMIP6Address *addr6; - NMIP6Route *route6; - gboolean success; - GError *error = NULL; - char *testfile = NULL; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - - inet_pton (AF_INET6, "1003:1234:abcd::1", &ip6); - inet_pton (AF_INET6, "2003:1234:abcd::2", &ip6_1); - inet_pton (AF_INET6, "3003:1234:abcd::3", &ip6_2); - inet_pton (AF_INET6, "2222:aaaa:bbbb:cccc::", &route1_dest); - inet_pton (AF_INET6, "2222:aaaa:bbbb:cccc:dddd:eeee:5555:6666", &route1_nexthop); - inet_pton (AF_INET6, "::", &route2_dest); - inet_pton (AF_INET6, "2222:aaaa::9999", &route2_nexthop); - inet_pton (AF_INET6, "fade:0102:0103::face", &dns6_1); - inet_pton (AF_INET6, "cafe:ffff:eeee:dddd:cccc:bbbb:aaaa:feed", &dns6_2); - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-static-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-static-write", "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 Wired Static", - 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 (); - ASSERT (s_wired != NULL, - "wired-static-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); - 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); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-static-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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); - - addr = nm_ip4_address_new (); - nm_ip4_address_set_address (addr, ip2); - 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); - - nm_setting_ip4_config_add_dns (s_ip4, dns1); - nm_setting_ip4_config_add_dns (s_ip4, dns2); - - nm_setting_ip4_config_add_dns_search (s_ip4, dns_search1); - nm_setting_ip4_config_add_dns_search (s_ip4, dns_search2); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-static-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_ip6)); - - g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, - NULL); - - /* Add addresses */ - addr6 = nm_ip6_address_new (); - nm_ip6_address_set_address (addr6, &ip6); - nm_ip6_address_set_prefix (addr6, 11); - nm_setting_ip6_config_add_address (s_ip6, addr6); - nm_ip6_address_unref (addr6); - - addr6 = nm_ip6_address_new (); - nm_ip6_address_set_address (addr6, &ip6_1); - nm_ip6_address_set_prefix (addr6, 22); - nm_setting_ip6_config_add_address (s_ip6, addr6); - nm_ip6_address_unref (addr6); - - addr6 = nm_ip6_address_new (); - nm_ip6_address_set_address (addr6, &ip6_2); - nm_ip6_address_set_prefix (addr6, 33); - nm_setting_ip6_config_add_address (s_ip6, addr6); - nm_ip6_address_unref (addr6); - - /* Add routes */ - route6 = nm_ip6_route_new (); - nm_ip6_route_set_dest (route6, &route1_dest); - nm_ip6_route_set_prefix (route6, route1_prefix); - nm_ip6_route_set_next_hop (route6, &route1_nexthop); - nm_ip6_route_set_metric (route6, route1_metric); - nm_setting_ip6_config_add_route (s_ip6, route6); - nm_ip6_route_unref (route6); - - route6 = nm_ip6_route_new (); - nm_ip6_route_set_dest (route6, &route2_dest); - nm_ip6_route_set_prefix (route6, route2_prefix); - nm_ip6_route_set_next_hop (route6, &route2_nexthop); - nm_ip6_route_set_metric (route6, route2_metric); - nm_setting_ip6_config_add_route (s_ip6, route6); - nm_ip6_route_unref (route6); - - /* DNS servers */ - nm_setting_ip6_config_add_dns (s_ip6, &dns6_1); - nm_setting_ip6_config_add_dns (s_ip6, &dns6_2); - - /* DNS domains */ - nm_setting_ip6_config_add_dns_search (s_ip6, dns_search3); - nm_setting_ip6_config_add_dns_search (s_ip6, dns_search4); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wired-static-write", "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, - "wired-static-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wired-static-write", "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, - "wired-static-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wired-static-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - /* FIXME: currently DNS domains from IPv6 setting are stored in 'DOMAIN' key in ifcfg-file - * However after re-reading they are dropped into IPv4 setting. - * So, in order to comparison succeeded, move DNS domains back to IPv6 setting. - */ - reread_s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (reread, NM_TYPE_SETTING_IP4_CONFIG)); - reread_s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (reread, NM_TYPE_SETTING_IP6_CONFIG)); - nm_setting_ip6_config_add_dns_search (reread_s_ip6, nm_setting_ip4_config_get_dns_search (reread_s_ip4, 2)); - nm_setting_ip6_config_add_dns_search (reread_s_ip6, nm_setting_ip4_config_get_dns_search (reread_s_ip4, 3)); - nm_setting_ip4_config_remove_dns_search (reread_s_ip4, 3); - nm_setting_ip4_config_remove_dns_search (reread_s_ip4, 2); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wired-static-write", "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); -} - -static void -test_write_wired_dhcp (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 (); - ASSERT (connection != NULL, - "wired-dhcp-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-dhcp-write", "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 Wired DHCP", - 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 (); - ASSERT (s_wired != NULL, - "wired-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wired)); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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_DHCP_HOSTNAME, "awesome-hostname", - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TRUE, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE, - NULL); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wired-dhcp-write", "failed to verify connection: %s", - (error && error->message) ? error->message : "(unknown)"); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - /* Save the ifcfg */ - success = writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", - &testfile, - &error); - ASSERT (success == TRUE, - "wired-dhcp-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wired-dhcp-write", "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, - "wired-dhcp-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wired-dhcp-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wired-dhcp-write", "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); -} - -static void -test_write_wired_static_ip6_only (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - static unsigned char tmpmac[] = { 0x31, 0x33, 0x33, 0x37, 0xbe, 0xcd }; - GByteArray *mac; - char *uuid; - struct in6_addr ip6; - struct in6_addr dns6; - NMIP6Address *addr6; - gboolean success; - GError *error = NULL; - char *testfile = NULL; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - - inet_pton (AF_INET6, "1003:1234:abcd::1", &ip6); - inet_pton (AF_INET6, "fade:0102:0103::face", &dns6); - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-static-ip6-only-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-static-ip6-only-write", "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 Wired Static IP6 Only", - 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 (); - ASSERT (s_wired != NULL, - "wired-static-ip6-only-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); - 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, NULL); - g_byte_array_free (mac, TRUE); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-static-ip6-only-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - - g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, - NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-static-ip6-only-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_ip6)); - - g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, - NULL); - - /* Add addresses */ - addr6 = nm_ip6_address_new (); - nm_ip6_address_set_address (addr6, &ip6); - nm_ip6_address_set_prefix (addr6, 11); - nm_setting_ip6_config_add_address (s_ip6, addr6); - nm_ip6_address_unref (addr6); - - /* DNS server */ - nm_setting_ip6_config_add_dns (s_ip6, &dns6); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wired-static-ip6-only-write", "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, - "wired-static-ip6-only-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wired-static-ip6-only-write", "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, - "wired-static-ip6-only-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wired-static-ip6-only-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wired-static-ip6-only-write", "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_READ_WRITE_STATIC_ROUTES_LEGACY TEST_IFCFG_DIR"/network-scripts/ifcfg-test-static-routes-legacy" - -static void -test_read_write_static_routes_legacy (void) -{ - NMConnection *connection, *reread; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *testfile = NULL; - char *keyfile = NULL; - char *keyfile2 = NULL; - char *routefile = NULL; - char *routefile2 = NULL; - char *route6file = NULL; - char *route6file2 = NULL; - gboolean ignore_error = FALSE; - gboolean success; - GError *error = NULL; - const char *tmp; - - connection = connection_from_file (TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "read-write-static-routes-legacy-read", "failed to read %s: %s", - TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "read-write-static-routes-legacy-verify", "failed to verify %s: %s", - TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "read-write-static-routes-legacy-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "read-write-static-routes-legacy-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "read_write-static-routes-legacy-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "read-write-static-routes-legacy-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, - NM_SETTING_WIRED_SETTING_NAME); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "read-write-static-routes-legacy-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "read-write-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE, - "read-write-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT); - - /* Save the ifcfg; use a special different scratch dir to ensure that - * we can clean up after the written connection in both the original - * source tree and for 'make distcheck'. - */ - success = writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/tmp", - &testfile, - &error); - ASSERT (success == TRUE, - "read-write-static-routes-legacy-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "read-write-static-routes-legacy-write", "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, - &keyfile2, - &routefile2, - &route6file2, - &error, - &ignore_error); - unlink (testfile); - unlink (routefile2); - unlink (route6file2); - - ASSERT (reread != NULL, - "read-write-static-routes-legacy-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (routefile2 != NULL, - "read-write-static-routes-legacy-reread", "expected routefile for '%s'", testfile); - - ASSERT (nm_connection_verify (reread, &error), - "read-write-static-routes-legacy-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "read-write-static-routes-legacy-write", "written and re-read connection weren't the same."); - - g_free (testfile); - g_free (unmanaged); - g_free (keyfile); - g_free (keyfile2); - g_free (routefile); - g_free (routefile2); - g_free (route6file); - g_free (route6file2); - g_object_unref (connection); - g_object_unref (reread); -} - -static void -test_write_wired_static_routes (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - static unsigned char tmpmac[] = { 0x31, 0x33, 0x33, 0x37, 0xbe, 0xcd }; - GByteArray *mac; - guint32 mtu = 1492; - char *uuid; - const guint32 ip1 = htonl (0x01010103); - const guint32 ip2 = htonl (0x01010105); - const guint32 gw = htonl (0x01010101); - const guint32 dns1 = htonl (0x04020201); - const guint32 dns2 = htonl (0x04020202); - const guint32 route_dst1 = htonl (0x01020300); - const guint32 route_dst2= htonl (0x03020100); - const guint32 route_gw1 = htonl (0xdeadbeef); - const guint32 route_gw2 = htonl (0xcafeabbe); - const guint32 prefix = 24; - const char *dns_search1 = "foobar.com"; - const char *dns_search2 = "lab.foobar.com"; - NMIP4Address *addr; - NMIP4Route *route; - 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, - "wired-static-routes-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-static-routes-write", "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 Wired Static Routes", - 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 (); - ASSERT (s_wired != NULL, - "wired-static-routes-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); - 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); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-static-routes-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, - 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); - - addr = nm_ip4_address_new (); - nm_ip4_address_set_address (addr, ip2); - 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); - - /* Write out routes */ - route = nm_ip4_route_new (); - nm_ip4_route_set_dest (route, route_dst1); - nm_ip4_route_set_prefix (route, prefix); - nm_ip4_route_set_next_hop (route, route_gw1); - nm_setting_ip4_config_add_route (s_ip4, route); - nm_ip4_route_unref (route); - - route = nm_ip4_route_new (); - nm_ip4_route_set_dest (route, route_dst2); - nm_ip4_route_set_prefix (route, prefix); - nm_ip4_route_set_next_hop (route, route_gw2); - nm_ip4_route_set_metric (route, 77); - nm_setting_ip4_config_add_route (s_ip4, route); - nm_ip4_route_unref (route); - - nm_setting_ip4_config_add_dns (s_ip4, dns1); - nm_setting_ip4_config_add_dns (s_ip4, dns2); - - nm_setting_ip4_config_add_dns_search (s_ip4, dns_search1); - nm_setting_ip4_config_add_dns_search (s_ip4, dns_search2); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wired-static-routes-write", "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, - "wired-static-routes-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wired-static-routes-write", "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, - "wired-static-routes-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (routefile != NULL, - "wired-static-routes-write-reread", "expected routefile for '%s'", testfile); - unlink (routefile); - - ASSERT (nm_connection_verify (reread, &error), - "wired-static-routes-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wired-static-routes-write", "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); -} - -static void -test_write_wired_dhcp_8021x_peap_mschapv2 (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - NMSetting8021x *s_8021x; - 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, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "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 Wired DHCP 802.1x PEAP MSCHAPv2", - 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 (); - ASSERT (s_wired != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wired)); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - /* 802.1x setting */ - s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_8021x)); - - g_object_set (s_8021x, - NM_SETTING_802_1X_IDENTITY, "Bob Saget", - NM_SETTING_802_1X_PASSWORD, "Kids, it was back in October 2008...", - NM_SETTING_802_1X_PHASE1_PEAPVER, "1", - NM_SETTING_802_1X_PHASE1_PEAPLABEL, "1", - NM_SETTING_802_1X_PHASE2_AUTH, "mschapv2", - NULL); - - nm_setting_802_1x_add_eap_method (s_8021x, "peap"); - - success = nm_setting_802_1x_set_ca_cert (s_8021x, - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2_CA_CERT, - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wired-dhcp-8021x-peap-mschapv2write", "failed to verify connection: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wired-dhcp-8021x-peap-mschapv2write", "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, - "wired-dhcp-8021x-peap-mschapv2write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "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, - "wired-dhcp-8021x-peap-mschapv2write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (keyfile != NULL, - "wired-dhcp-8021x-peap-mschapv2write-reread", "expected keyfile for '%s'", testfile); - unlink (keyfile); - - ASSERT (nm_connection_verify (reread, &error), - "wired-dhcp-8021x-peap-mschapv2write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wired-dhcp-8021x-peap-mschapv2write", "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); -} - -static void -test_write_wifi_open (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 }; - GByteArray *bssid; - const unsigned char bssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }; - guint32 channel = 9, mtu = 1345; - GByteArray *mac; - const unsigned char mac_data[] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; - shvarFile *ifcfg; - char *tmp; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-open-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-open-write", "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 Wifi Open", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-open-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - bssid = g_byte_array_sized_new (sizeof (bssid_data)); - g_byte_array_append (bssid, bssid_data, sizeof (bssid_data)); - mac = g_byte_array_sized_new (sizeof (mac_data)); - g_byte_array_append (mac, mac_data, sizeof (mac_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_BSSID, bssid, - NM_SETTING_WIRELESS_MAC_ADDRESS, mac, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_BAND, "bg", - NM_SETTING_WIRELESS_CHANNEL, channel, - NM_SETTING_WIRELESS_MTU, mtu, - NULL); - - g_byte_array_free (ssid, TRUE); - g_byte_array_free (bssid, TRUE); - g_byte_array_free (mac, TRUE); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-open-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-open-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-open-write", "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, - "wifi-open-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-open-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - - /* Now make sure that the ESSID item isn't double-quoted (rh #606518) */ - ifcfg = svNewFile (testfile); - ASSERT (ifcfg != NULL, - "wifi-open-write-reread", "failed to load %s as shvarfile", testfile); - - tmp = svGetValue (ifcfg, "ESSID", TRUE); - ASSERT (tmp != NULL, - "wifi-open-write-reread", "failed to read ESSID key from %s", testfile); - - g_message ("%s", tmp); - ASSERT (strncmp (tmp, "\"\"", 2) != 0, - "wifi-open-write-reread", "unexpected ESSID double-quote in %s", testfile); - - g_free (tmp); - svCloseFile (ifcfg); - - unlink (testfile); - - ASSERT (reread != NULL, - "wifi-open-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-open-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-open-write", "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); -} - -static void -test_write_wifi_open_hex_ssid (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd }; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-open-hex-ssid-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-open-hex-ssid-write", "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 Wifi Open Hex SSID", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-open-hex-ssid-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NULL); - - g_byte_array_free (ssid, TRUE); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-open-hex-ssid-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-open-hex-ssid-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-open-hex-ssid-write", "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, - "wifi-open-hex-ssid-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-open-hex-ssid-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (reread != NULL, - "wifi-open-hex-ssid-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-open-hex-ssid-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-open-hex-ssid-write", "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); -} - -static void -test_write_wifi_wep (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = "blahblah"; - struct stat statbuf; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-write", "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 Wifi WEP", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", - NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, 2, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "shared", - NULL); - nm_setting_wireless_security_set_wep_key (s_wsec, 0, "0123456789abcdef0123456789"); - nm_setting_wireless_security_set_wep_key (s_wsec, 1, "11111111111111111111111111"); - nm_setting_wireless_security_set_wep_key (s_wsec, 2, "aaaaaaaaaaaaaaaaaaaaaaaaaa"); - nm_setting_wireless_security_set_wep_key (s_wsec, 3, "BBBBBBBBBBBBBBBBBBBBBBBBBB"); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-wep-write", "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, - "wifi-wep-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-wep-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (keyfile != NULL, - "wifi-wep-write-reread", "expected keyfile for '%s'", testfile); - - ASSERT (stat (keyfile, &statbuf) == 0, - "wifi-wep-write-reread", "couldn't stat() '%s'", keyfile); - ASSERT (S_ISREG (statbuf.st_mode), - "wifi-wep-write-reread", "keyfile '%s' wasn't a normal file", keyfile); - ASSERT ((statbuf.st_mode & 0077) == 0, - "wifi-wep-write-reread", "keyfile '%s' wasn't readable only by its owner", keyfile); - - unlink (keyfile); - - ASSERT (reread != NULL, - "wifi-wep-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-wep-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-wep-write", "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); -} - -static void -test_write_wifi_wep_adhoc (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = "blahblah"; - struct stat statbuf; - NMIP4Address *addr; - const guint32 ip1 = htonl (0x01010103); - const guint32 gw = htonl (0x01010101); - const guint32 dns1 = htonl (0x04020201); - const guint32 prefix = 24; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-adhoc-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-adhoc-write", "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 Wifi WEP AdHoc", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "adhoc", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", NULL); - nm_setting_wireless_security_set_wep_key (s_wsec, 0, "0123456789abcdef0123456789"); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP Address */ - 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); - - nm_setting_ip4_config_add_dns (s_ip4, dns1); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-wep-adhoc-write", "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, - "wifi-wep-adhoc-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-wep-adhoc-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (keyfile != NULL, - "wifi-wep-adhoc-write-reread", "expected keyfile for '%s'", testfile); - - ASSERT (stat (keyfile, &statbuf) == 0, - "wifi-wep-adhoc-write-reread", "couldn't stat() '%s'", keyfile); - ASSERT (S_ISREG (statbuf.st_mode), - "wifi-wep-adhoc-write-reread", "keyfile '%s' wasn't a normal file", keyfile); - ASSERT ((statbuf.st_mode & 0077) == 0, - "wifi-wep-adhoc-write-reread", "keyfile '%s' wasn't readable only by its owner", keyfile); - - unlink (keyfile); - - ASSERT (reread != NULL, - "wifi-wep-adhoc-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-wep-adhoc-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-wep-adhoc-write", "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); -} - -static void -test_write_wifi_wep_passphrase (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = "blahblah"; - struct stat statbuf; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-passphrase-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-passphrase-write", "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 Wifi WEP Passphrase", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-passphrase-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-passphrase-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", - NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, 0, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "shared", - NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, NM_WEP_KEY_TYPE_PASSPHRASE, - NULL); - nm_setting_wireless_security_set_wep_key (s_wsec, 0, "asdfdjaslfjasd;flasjdfl;aksdf"); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-passphrase-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-wep-passphrase-write", "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, - "wifi-wep-passphrase-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-wep-passphrase-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (keyfile != NULL, - "wifi-wep-passphrase-write-reread", "expected keyfile for '%s'", testfile); - - ASSERT (stat (keyfile, &statbuf) == 0, - "wifi-wep-passphrase-write-reread", "couldn't stat() '%s'", keyfile); - ASSERT (S_ISREG (statbuf.st_mode), - "wifi-wep-passphrase-write-reread", "keyfile '%s' wasn't a normal file", keyfile); - ASSERT ((statbuf.st_mode & 0077) == 0, - "wifi-wep-passphrase-write-reread", "keyfile '%s' wasn't readable only by its owner", keyfile); - - unlink (keyfile); - - ASSERT (reread != NULL, - "wifi-wep-passphrase-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-wep-passphrase-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-wep-passphrase-write", "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); -} - -static void -test_write_wifi_wep_40_ascii (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = "blahblah40"; - struct stat statbuf; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-40-ascii-write", "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 Wifi WEP 40 ASCII", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", - NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, 2, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "shared", - NULL); - nm_setting_wireless_security_set_wep_key (s_wsec, 0, "lorem"); - nm_setting_wireless_security_set_wep_key (s_wsec, 1, "ipsum"); - nm_setting_wireless_security_set_wep_key (s_wsec, 2, "dolor"); - nm_setting_wireless_security_set_wep_key (s_wsec, 3, "donec"); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-wep-40-ascii-write", "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, - "wifi-wep-40-ascii-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-wep-40-ascii-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (keyfile != NULL, - "wifi-wep-40-ascii-write-reread", "expected keyfile for '%s'", testfile); - - ASSERT (stat (keyfile, &statbuf) == 0, - "wifi-wep-40-ascii-write-reread", "couldn't stat() '%s'", keyfile); - ASSERT (S_ISREG (statbuf.st_mode), - "wifi-wep-40-ascii-write-reread", "keyfile '%s' wasn't a normal file", keyfile); - ASSERT ((statbuf.st_mode & 0077) == 0, - "wifi-wep-40-ascii-write-reread", "keyfile '%s' wasn't readable only by its owner", keyfile); - - unlink (keyfile); - - ASSERT (reread != NULL, - "wifi-wep-40-ascii-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-wep-40-ascii-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-wep-40-ascii-write", "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); -} - -static void -test_write_wifi_wep_104_ascii (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = "blahblah104"; - struct stat statbuf; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-104-ascii-write", "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 Wifi WEP 104 ASCII", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", - NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, 0, - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", - NULL); - nm_setting_wireless_security_set_wep_key (s_wsec, 0, "LoremIpsumSit"); - nm_setting_wireless_security_set_wep_key (s_wsec, 1, "AlfaBetaGamma"); - nm_setting_wireless_security_set_wep_key (s_wsec, 2, "WEP-104 ASCII"); - nm_setting_wireless_security_set_wep_key (s_wsec, 3, "thisismyascii"); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-wep-104-ascii-write", "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, - "wifi-wep-104-ascii-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-wep-104-ascii-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (keyfile != NULL, - "wifi-wep-104-ascii-write-reread", "expected keyfile for '%s'", testfile); - - ASSERT (stat (keyfile, &statbuf) == 0, - "wifi-wep-104-ascii-write-reread", "couldn't stat() '%s'", keyfile); - ASSERT (S_ISREG (statbuf.st_mode), - "wifi-wep-104-ascii-write-reread", "keyfile '%s' wasn't a normal file", keyfile); - ASSERT ((statbuf.st_mode & 0077) == 0, - "wifi-wep-104-ascii-write-reread", "keyfile '%s' wasn't readable only by its owner", keyfile); - - unlink (keyfile); - - ASSERT (reread != NULL, - "wifi-wep-104-ascii-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-wep-104-ascii-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-wep-104-ascii-write", "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); -} - -static void -test_write_wifi_leap (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = "blahblah"; - struct stat statbuf; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-leap-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-leap-write", "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 Wifi LEAP", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-leap-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-leap-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", - NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "leap", - NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, "Bill Smith", - NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, "foobar22", - NULL); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-leap-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-leap-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-leap-write", "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, - "wifi-leap-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-leap-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (keyfile != NULL, - "wifi-leap-write-reread", "expected keyfile for '%s'", testfile); - - ASSERT (stat (keyfile, &statbuf) == 0, - "wifi-leap-write-reread", "couldn't stat() '%s'", keyfile); - ASSERT (S_ISREG (statbuf.st_mode), - "wifi-leap-write-reread", "keyfile '%s' wasn't a normal file", keyfile); - ASSERT ((statbuf.st_mode & 0077) == 0, - "wifi-leap-write-reread", "keyfile '%s' wasn't readable only by its owner", keyfile); - - unlink (keyfile); - - ASSERT (reread != NULL, - "wifi-leap-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-leap-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-leap-write", "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); -} - -static void -test_write_wifi_wpa_psk (const char *name, - const char *test_name, - gboolean wep_group, - gboolean wpa, - gboolean wpa2, - const char *psk) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *uuid, *tmp; - gboolean success; - GError *error = NULL; - char *testfile = NULL; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GByteArray *ssid; - const unsigned char ssid_data[] = "blahblah"; - - g_return_if_fail (psk != NULL); - - connection = nm_connection_new (); - ASSERT (connection != NULL, - test_name, "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - test_name, "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, name, - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - test_name, "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - test_name, "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", - NM_SETTING_WIRELESS_SECURITY_PSK, psk, - NULL); - - if (wep_group) { - nm_setting_wireless_security_add_group (s_wsec, "wep40"); - nm_setting_wireless_security_add_group (s_wsec, "wep104"); - } - if (wpa) { - nm_setting_wireless_security_add_proto (s_wsec, "wpa"); - nm_setting_wireless_security_add_pairwise (s_wsec, "tkip"); - nm_setting_wireless_security_add_group (s_wsec, "tkip"); - } - if (wpa2) { - nm_setting_wireless_security_add_proto (s_wsec, "rsn"); - nm_setting_wireless_security_add_pairwise (s_wsec, "ccmp"); - nm_setting_wireless_security_add_group (s_wsec, "ccmp"); - } - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - test_name, "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - test_name, "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - test_name, "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, - test_name, "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - test_name, "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - tmp = g_strdup_printf ("%s-reread", test_name); - ASSERT (keyfile != NULL, - tmp, "expected keyfile for '%s'", testfile); - unlink (keyfile); - - ASSERT (reread != NULL, - tmp, "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - tmp, "failed to verify %s: %s", testfile, error->message); - g_free (tmp); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - test_name, "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); -} - -static void -test_write_wifi_wpa_psk_adhoc (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = "blahblah"; - NMIP4Address *addr; - const guint32 ip1 = htonl (0x01010103); - const guint32 gw = htonl (0x01010101); - const guint32 dns1 = htonl (0x04020201); - const guint32 prefix = 24; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wpa-psk-adhoc-write", "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 Wifi WPA PSK", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "adhoc", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NM_SETTING_WIRELESS_CHANNEL, 11, - NM_SETTING_WIRELESS_BAND, "bg", - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-none", - NM_SETTING_WIRELESS_SECURITY_PSK, "7d308b11df1b4243b0f78e5f3fc68cdbb9a264ed0edf4c188edf329ff5b467f0", - NULL); - - nm_setting_wireless_security_add_proto (s_wsec, "wpa"); - nm_setting_wireless_security_add_group (s_wsec, "tkip"); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP Address */ - 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); - - nm_setting_ip4_config_add_dns (s_ip4, dns1); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-wpa-psk-adhoc-write", "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, - "wifi-wpa-psk-adhoc-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-wpa-psk-adhoc-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (keyfile != NULL, - "wifi-wpa-psk-adhoc-write-reread", "expected keyfile for '%s'", testfile); - unlink (keyfile); - - ASSERT (reread != NULL, - "wifi-wpa-psk-adhoc-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-wpa-psk-adhoc-write-reread", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-wpa-psk-adhoc-write", "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); -} - -static void -test_write_wifi_wpa_eap_tls (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - NMSetting8021x *s_8021x; - 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; - GByteArray *ssid; - const char *ssid_data = "blahblah"; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wpa-eap-tls-write", "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 Wifi WPA EAP-TLS", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (strlen (ssid_data)); - g_byte_array_append (ssid, (const unsigned char *) ssid_data, strlen (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", NULL); - nm_setting_wireless_security_add_proto (s_wsec, "wpa"); - nm_setting_wireless_security_add_pairwise (s_wsec, "tkip"); - nm_setting_wireless_security_add_group (s_wsec, "tkip"); - - /* Wireless security setting */ - s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_8021x)); - - g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, "Bill Smith", NULL); - - nm_setting_802_1x_add_eap_method (s_8021x, "tls"); - - success = nm_setting_802_1x_set_ca_cert (s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wifi-wpa-eap-tls-write", "failed to set CA certificate '%s': %s", - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, error->message); - - success = nm_setting_802_1x_set_client_cert (s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT, - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wifi-wpa-eap-tls-write", "failed to set client certificate '%s': %s", - TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT, error->message); - - success = nm_setting_802_1x_set_private_key (s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, - "test1", - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wifi-wpa-eap-tls-write", "failed to set private key '%s': %s", - TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, error->message); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-wpa-eap-tls-write", "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, - "wifi-wpa-eap-tls-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-wpa-eap-tls-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (keyfile != NULL, - "wifi-wpa-eap-tls-write-reread", "expected keyfile for '%s'", testfile); - unlink (keyfile); - - ASSERT (reread != NULL, - "wifi-wpa-eap-tls-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-wpa-eap-tls-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-wpa-eap-tls-write", "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); -} - -static void -test_write_wifi_wpa_eap_ttls_tls (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - NMSetting8021x *s_8021x; - 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; - GByteArray *ssid; - const char *ssid_data = "blahblah"; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wpa-eap-ttls-tls-write", "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 Wifi WPA EAP-TTLS (TLS)", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (strlen (ssid_data)); - g_byte_array_append (ssid, (const unsigned char *) ssid_data, strlen (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", NULL); - nm_setting_wireless_security_add_proto (s_wsec, "rsn"); - nm_setting_wireless_security_add_pairwise (s_wsec, "ccmp"); - nm_setting_wireless_security_add_group (s_wsec, "ccmp"); - - /* Wireless security setting */ - s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_8021x)); - - nm_setting_802_1x_add_eap_method (s_8021x, "ttls"); - - g_object_set (s_8021x, - NM_SETTING_802_1X_IDENTITY, "Bill Smith", - NM_SETTING_802_1X_ANONYMOUS_IDENTITY, "foobar22", - NM_SETTING_802_1X_PHASE2_AUTHEAP, "tls", - NULL); - - success = nm_setting_802_1x_set_ca_cert (s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wifi-wpa-eap-ttls-tls-write", "failed to set CA certificate '%s': %s", - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, error->message); - - /* Phase 2 TLS stuff */ - - /* phase2 CA cert */ - success = nm_setting_802_1x_set_phase2_ca_cert (s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wifi-wpa-eap-ttls-tls-write", "failed to set inner CA certificate '%s': %s", - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, error->message); - - /* phase2 client cert */ - success = nm_setting_802_1x_set_phase2_client_cert (s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT, - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wifi-wpa-eap-ttls-tls-write", "failed to set inner client certificate '%s': %s", - TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT, error->message); - - /* phase2 private key */ - success = nm_setting_802_1x_set_phase2_private_key (s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, - "test1", - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wifi-wpa-eap-ttls-tls-write", "failed to set private key '%s': %s", - TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, error->message); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-wpa-eap-ttls-tls-write", "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, - "wifi-wpa-eap-ttls-tls-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-wpa-eap-ttls-tls-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (reread != NULL, - "wifi-wpa-eap-ttls-tls-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (keyfile != NULL, - "wifi-wpa-eap-ttls-tls-write-reread", "expected keyfile for '%s'", testfile); - unlink (keyfile); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-wpa-eap-ttls-tls-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-wpa-eap-ttls-tls-write", "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); -} - -static void -test_write_wifi_wpa_eap_ttls_mschapv2 (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - NMSetting8021x *s_8021x; - 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; - GByteArray *ssid; - const char *ssid_data = "blahblah"; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "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 Wifi WPA EAP-TTLS (MSCHAPv2)", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (strlen (ssid_data)); - g_byte_array_append (ssid, (const unsigned char *) ssid_data, strlen (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", NULL); - nm_setting_wireless_security_add_proto (s_wsec, "wpa"); - nm_setting_wireless_security_add_proto (s_wsec, "rsn"); - nm_setting_wireless_security_add_pairwise (s_wsec, "tkip"); - nm_setting_wireless_security_add_pairwise (s_wsec, "ccmp"); - nm_setting_wireless_security_add_group (s_wsec, "tkip"); - nm_setting_wireless_security_add_group (s_wsec, "ccmp"); - - /* Wireless security setting */ - s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_8021x)); - - nm_setting_802_1x_add_eap_method (s_8021x, "ttls"); - - g_object_set (s_8021x, - NM_SETTING_802_1X_IDENTITY, "Bill Smith", - NM_SETTING_802_1X_PASSWORD, ";alkdfja;dslkfjsad;lkfjsadf", - NM_SETTING_802_1X_ANONYMOUS_IDENTITY, "foobar22", - NM_SETTING_802_1X_PHASE2_AUTHEAP, "mschapv2", - NULL); - - success = nm_setting_802_1x_set_ca_cert (s_8021x, - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, - NM_SETTING_802_1X_CK_SCHEME_PATH, - NULL, - &error); - ASSERT (success == TRUE, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to set CA certificate '%s': %s", - TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT, error->message); - - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wifi-wpa-eap-ttls-mschapv2-write", "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, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "didn't get ifcfg file path back after writing connection"); - - /* re-read the connection for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - - ASSERT (reread != NULL, - "wifi-wpa-eap-ttls-mschapv2-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (keyfile != NULL, - "wifi-wpa-eap-ttls-mschapv2-write-reread", "expected keyfile for '%s'", testfile); - unlink (keyfile); - - ASSERT (nm_connection_verify (reread, &error), - "wifi-wpa-eap-ttls-mschapv2-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wifi-wpa-eap-ttls-mschapv2-write", "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); -} - -static void -test_write_wifi_wpa_then_open (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - 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; - GByteArray *ssid; - const unsigned char ssid_data[] = "blahblah"; - - /* Test that writing out a WPA config then changing that to an open - * config doesn't leave various WPA-related keys lying around in the ifcfg. - */ - - 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, "random wifi connection", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - g_assert (s_wifi); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, - NULL); - - g_byte_array_free (ssid, TRUE); - - /* Wireless security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - g_assert (s_wsec); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", - NM_SETTING_WIRELESS_SECURITY_PSK, "some cool PSK", - NULL); - - nm_setting_wireless_security_add_proto (s_wsec, "wpa"); - nm_setting_wireless_security_add_pairwise (s_wsec, "tkip"); - nm_setting_wireless_security_add_group (s_wsec, "tkip"); - - nm_setting_wireless_security_add_proto (s_wsec, "rsn"); - nm_setting_wireless_security_add_pairwise (s_wsec, "ccmp"); - nm_setting_wireless_security_add_group (s_wsec, "ccmp"); - - /* 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, NULL); - - /* 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); - - 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_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - g_assert_no_error (error); - g_assert (reread); - - success = nm_connection_verify (reread, &error); - g_assert_no_error (error); - - success = nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT); - g_assert (success); - - g_free (unmanaged); - unmanaged = NULL; - g_free (routefile); - routefile = NULL; - g_free (route6file); - route6file = NULL; - g_object_unref (reread); - - /* Now change the connection to open and recheck */ - s_wifi = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS); - g_assert (s_wifi); - g_object_set (s_wifi, NM_SETTING_WIRELESS_SEC, NULL, NULL); - nm_connection_remove_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY); - - /* Write it back out */ - success = writer_update_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", - testfile, - keyfile, - &error); - g_assert_no_error (error); - g_assert (success); - - unlink (keyfile); - g_free (keyfile); - keyfile = NULL; - - /* re-read it for comparison */ - reread = connection_from_file (testfile, - NULL, - TYPE_WIRELESS, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - unlink (testfile); - g_assert_no_error (error); - - g_assert (reread); - - /* No keyfile since it's an open connection this time */ - g_assert (keyfile); - g_assert (g_file_test (keyfile, G_FILE_TEST_EXISTS) == FALSE); - - success = nm_connection_verify (reread, &error); - g_assert_no_error (error); - - success = nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT); - g_assert (success); - - unlink (testfile); - g_free (testfile); - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (reread); - - g_object_unref (connection); -} - -#define TEST_IFCFG_IBFT_DHCP TEST_IFCFG_DIR"/network-scripts/ifcfg-test-ibft-dhcp" - -static void -test_read_ibft_dhcp (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - char expected_mac_address[ETH_ALEN] = { 0x00, 0x33, 0x21, 0x98, 0xb9, 0xf1 }; - const char *expected_id = "System test-ibft-dhcp"; - guint64 expected_timestamp = 0; - - connection = connection_from_file (TEST_IFCFG_IBFT_DHCP, - NULL, - TYPE_ETHERNET, - TEST_IFCFG_DIR "/iscsiadm-test-dhcp", - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "ibft-dhcp-read", "failed to read %s: %s", TEST_IFCFG_IBFT_DHCP, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "ibft-dhcp-verify", "failed to verify %s: %s", TEST_IFCFG_IBFT_DHCP, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "ibft-dhcp-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "ibft-dhcp-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "ibft-dhcp-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ - - /* Timestamp */ - ASSERT (nm_setting_connection_get_timestamp (s_con) == expected_timestamp, - "ibft-dhcp-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_TIMESTAMP); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "ibft-dhcp-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* Read-only */ - ASSERT (nm_setting_connection_get_read_only (s_con) == TRUE, - "ibft-dhcp-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_READ_ONLY); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "ibft-dhcp-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_WIRED_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wired_get_mac_address (s_wired); - ASSERT (array != NULL, - "ibft-dhcp-verify-wired", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (array->len == ETH_ALEN, - "ibft-dhcp-verify-wired", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (memcmp (array->data, &expected_mac_address[0], sizeof (expected_mac_address)) == 0, - "ibft-dhcp-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - - ASSERT (nm_setting_wired_get_mtu (s_wired) == 0, - "ibft-dhcp-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MTU); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "ibft-dhcp-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "ibft-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_DHCP, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_IBFT_STATIC TEST_IFCFG_DIR"/network-scripts/ifcfg-test-ibft-static" - -static void -test_read_ibft_static (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - GError *error = NULL; - const char *tmp; - const GByteArray *array; - char expected_mac_address[ETH_ALEN] = { 0x00, 0x33, 0x21, 0x98, 0xb9, 0xf0 }; - const char *expected_id = "System test-ibft-static"; - guint64 expected_timestamp = 0; - const char *expected_dns1 = "10.16.255.2"; - const char *expected_dns2 = "10.16.255.3"; - struct in_addr addr; - const char *expected_address1 = "192.168.32.72"; - const char *expected_address1_gw = "192.168.35.254"; - NMIP4Address *ip4_addr; - - connection = connection_from_file (TEST_IFCFG_IBFT_STATIC, - NULL, - TYPE_ETHERNET, - TEST_IFCFG_DIR "/iscsiadm-test-static", - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "ibft-static-read", "failed to read %s: %s", TEST_IFCFG_IBFT_STATIC, error->message); - - ASSERT (nm_connection_verify (connection, &error), - "ibft-static-verify", "failed to verify %s: %s", TEST_IFCFG_IBFT_STATIC, error->message); - - /* ===== CONNECTION SETTING ===== */ - - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - ASSERT (s_con != NULL, - "ibft-static-verify-connection", "failed to verify %s: missing %s setting", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_CONNECTION_SETTING_NAME); - - /* ID */ - tmp = nm_setting_connection_get_id (s_con); - ASSERT (tmp != NULL, - "ibft-static-verify-connection", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - ASSERT (strcmp (tmp, expected_id) == 0, - "ibft-static-verify-connection", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_ID); - - /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ - - /* Timestamp */ - ASSERT (nm_setting_connection_get_timestamp (s_con) == expected_timestamp, - "ibft-static-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_TIMESTAMP); - - /* Autoconnect */ - ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE, - "ibft-static-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT); - - /* Read-only */ - ASSERT (nm_setting_connection_get_read_only (s_con) == TRUE, - "ibft-static-verify-connection", "failed to verify %s: unexpected %s /%s key value", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_READ_ONLY); - - /* ===== WIRED SETTING ===== */ - - s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)); - ASSERT (s_wired != NULL, - "ibft-static-verify-wired", "failed to verify %s: missing %s setting", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_WIRED_SETTING_NAME); - - /* MAC address */ - array = nm_setting_wired_get_mac_address (s_wired); - ASSERT (array != NULL, - "ibft-static-verify-wired", "failed to verify %s: missing %s / %s key", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (array->len == ETH_ALEN, - "ibft-static-verify-wired", "failed to verify %s: unexpected %s / %s key value length", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - ASSERT (memcmp (array->data, &expected_mac_address[0], sizeof (expected_mac_address)) == 0, - "ibft-static-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MAC_ADDRESS); - - ASSERT (nm_setting_wired_get_mtu (s_wired) == 0, - "ibft-static-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_WIRED_MTU); - - /* ===== IPv4 SETTING ===== */ - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG)); - ASSERT (s_ip4 != NULL, - "ibft-static-verify-ip4", "failed to verify %s: missing %s setting", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME); - - /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, - "ibft-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); - - /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, - "ibft-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET, expected_dns1, &addr) > 0, - "ibft-static-verify-ip4", "failed to verify %s: couldn't convert DNS IP address #1", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_dns (s_ip4, 0) == addr.s_addr, - "ibft-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (inet_pton (AF_INET, expected_dns2, &addr) > 0, - "ibft-static-verify-ip4", "failed to verify %s: couldn't convert DNS IP address #2", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_dns (s_ip4, 1) == addr.s_addr, - "ibft-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1, - "ibft-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value", - TEST_IFCFG_IBFT_STATIC, - 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, - "ibft-static-verify-ip4", "failed to verify %s: missing IP4 address #1", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == 22, - "ibft-static-verify-ip4", "failed to verify %s: unexpected IP4 address #1 prefix", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1, &addr) > 0, - "ibft-static-verify-ip4", "failed to verify %s: couldn't convert IP address #1", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "ibft-static-verify-ip4", "failed to verify %s: unexpected IP4 address #1", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1_gw, &addr) > 0, - "ibft-static-verify-ip4", "failed to verify %s: couldn't convert IP address #1 gateway", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - ASSERT (nm_ip4_address_get_gateway (ip4_addr) == addr.s_addr, - "ibft-static-verify-ip4", "failed to verify %s: unexpected IP4 address #1 gateway", - TEST_IFCFG_IBFT_STATIC, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -static void -test_read_ibft_malformed (const char *name, const char *iscsiadm_path) -{ - NMConnection *connection; - 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_IBFT_STATIC, - NULL, - TYPE_ETHERNET, - iscsiadm_path, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection == NULL, - name, "unexpectedly able to read %s", TEST_IFCFG_IBFT_STATIC); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); -} - -static void -test_write_wired_qeth_dhcp (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *uuid; - GPtrArray *subchans; - 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, - "wired-qeth-dhcp-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-qeth-dhcp-write", "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 Wired qeth Static", - 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 (); - ASSERT (s_wired != NULL, - "wired-qeth-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wired)); - - subchans = g_ptr_array_sized_new (3); - g_ptr_array_add (subchans, "0.0.600"); - g_ptr_array_add (subchans, "0.0.601"); - g_ptr_array_add (subchans, "0.0.602"); - g_object_set (s_wired, - NM_SETTING_WIRED_S390_SUBCHANNELS, subchans, - NM_SETTING_WIRED_S390_NETTYPE, "qeth", - NULL); - g_ptr_array_free (subchans, TRUE); - - nm_setting_wired_add_s390_option (s_wired, "portname", "FOOBAR"); - nm_setting_wired_add_s390_option (s_wired, "portno", "1"); - nm_setting_wired_add_s390_option (s_wired, "layer2", "0"); - nm_setting_wired_add_s390_option (s_wired, "protocol", "blahbalh"); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-qeth-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, - NULL); - - /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-qeth-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); - 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); - - /* Verify */ - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wired-qeth-dhcp-write", "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, - "wired-qeth-dhcp-write", "failed to write connection to disk: %s", - (error && error->message) ? error->message : "(unknown)"); - - ASSERT (testfile != NULL, - "wired-qeth-dhcp-write", "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, - "wired-qeth-dhcp-write-reread", "failed to read %s: %s", testfile, error->message); - - ASSERT (nm_connection_verify (reread, &error), - "wired-qeth-dhcp-write-reread-verify", "failed to verify %s: %s", testfile, error->message); - - ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, - "wired-qeth-dhcp-write", "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); -} - -static void -test_write_wired_ctc_dhcp (void) -{ - NMConnection *connection; - NMConnection *reread; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - char *uuid; - GPtrArray *subchans; - gboolean success; - GError *error = NULL; - char *testfile = NULL; - char *unmanaged = NULL; - char *keyfile = NULL; - char *routefile = NULL; - char *route6file = NULL; - gboolean ignore_error = FALSE; - shvarFile *ifcfg; - char *tmp; - - 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 Wired ctc Static", - NM_SETTING_CONNECTION_UUID, uuid, - 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)); - - subchans = g_ptr_array_sized_new (2); - g_ptr_array_add (subchans, "0.0.600"); - g_ptr_array_add (subchans, "0.0.601"); - g_object_set (s_wired, - NM_SETTING_WIRED_S390_SUBCHANNELS, subchans, - NM_SETTING_WIRED_S390_NETTYPE, "ctc", - NULL); - g_ptr_array_free (subchans, TRUE); - nm_setting_wired_add_s390_option (s_wired, "ctcprot", "0"); - - /* 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, NULL); - - /* 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); - - /* Verify */ - 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 != NULL); - - /* Ensure the CTCPROT item gets written out as it's own option */ - ifcfg = svNewFile (testfile); - g_assert (ifcfg); - - tmp = svGetValue (ifcfg, "CTCPROT", TRUE); - g_assert (tmp); - g_assert_cmpstr (tmp, ==, "0"); - g_free (tmp); - - /* And that it's not in the generic OPTIONS string */ - tmp = svGetValue (ifcfg, "OPTIONS", TRUE); - g_assert (tmp == NULL); - g_free (tmp); - - svCloseFile (ifcfg); - - /* 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 (success); - - success = nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT); - g_assert (success); - - 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); -} - - -static void -test_write_wired_pppoe (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingPPPOE *s_pppoe; - NMSettingPPP *s_ppp; - char *uuid; - gboolean success; - GError *error = NULL; - char *testfile = NULL; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-pppoe-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-pppoe-write", "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 Wired PPPoE", - 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 (); - ASSERT (s_wired != NULL, - "wired-pppoe-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_wired)); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-pppoe-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, - NULL); - - /* PPPoE setting */ - s_pppoe = (NMSettingPPPOE *) nm_setting_pppoe_new (); - ASSERT (s_pppoe != NULL, - "wired-pppoe-write", "failed to allocate new %s setting", - NM_SETTING_PPPOE_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_pppoe)); - - g_object_set (G_OBJECT (s_pppoe), - NM_SETTING_PPPOE_SERVICE, "stupid-service", - NM_SETTING_PPPOE_USERNAME, "Bill Smith", - NM_SETTING_PPPOE_PASSWORD, "test1", - NULL); - - /* PPP setting */ - s_ppp = (NMSettingPPP *) nm_setting_ppp_new (); - ASSERT (s_ppp != NULL, - "wired-pppoe-write", "failed to allocate new %s setting", - NM_SETTING_PPP_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_ppp)); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "wired-pppoe-write", "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 == FALSE, - "wired-pppoe-write", "unexpected success writing connection to disk"); - - g_object_unref (connection); -} - -static void -test_write_vpn (void) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; - NMSettingVPN *s_vpn; - char *uuid; - gboolean success; - GError *error = NULL; - char *testfile = NULL; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "vpn-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "vpn-write", "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 VPN", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_VPN_SETTING_NAME, - NULL); - g_free (uuid); - - /* VPN setting */ - s_vpn = (NMSettingVPN *) nm_setting_vpn_new (); - ASSERT (s_vpn != NULL, - "vpn-write", "failed to allocate new %s setting", - NM_SETTING_VPN_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_vpn)); - - g_object_set (s_vpn, - NM_SETTING_VPN_SERVICE_TYPE, "awesomevpn", - NM_SETTING_VPN_USER_NAME, "Bill Smith", - NULL); - - nm_setting_vpn_add_data_item (s_vpn, "server", "vpn.somewhere.com"); - nm_setting_vpn_add_secret (s_vpn, "password", "sup3rs3cr3t"); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "vpn-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, - NULL); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "vpn-write", "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 == FALSE, - "vpn-write", "unexpected success writing connection to disk"); - - g_object_unref (connection); -} - -static void -test_write_mobile_broadband (gboolean gsm) -{ - NMConnection *connection; - NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; - NMSettingGsm *s_gsm; - NMSettingCdma *s_cdma; - NMSettingPPP *s_ppp; - NMSettingSerial *s_serial; - char *uuid; - gboolean success; - GError *error = NULL; - char *testfile = NULL; - - connection = nm_connection_new (); - ASSERT (connection != NULL, - "mobile-broadband-write", "failed to allocate new connection"); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "mobile-broadband-write", "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, gsm ? "Test Write GSM" : "Test Write CDMA", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, gsm ? NM_SETTING_GSM_SETTING_NAME : NM_SETTING_CDMA_SETTING_NAME, - NULL); - g_free (uuid); - - if (gsm) { - /* GSM setting */ - s_gsm = (NMSettingGsm *) nm_setting_gsm_new (); - ASSERT (s_gsm != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_GSM_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_gsm)); - - g_object_set (s_gsm, NM_SETTING_GSM_NUMBER, "*99#", NULL); - } else { - /* CDMA setting */ - s_cdma = (NMSettingCdma *) nm_setting_cdma_new (); - ASSERT (s_cdma != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_CDMA_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_cdma)); - - g_object_set (s_cdma, NM_SETTING_CDMA_NUMBER, "#777", NULL); - } - - /* Serial setting */ - s_serial = (NMSettingSerial *) nm_setting_serial_new (); - ASSERT (s_serial != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_SERIAL_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_serial)); - - g_object_set (s_serial, - NM_SETTING_SERIAL_BAUD, 115200, - NM_SETTING_SERIAL_BITS, 8, - NM_SETTING_SERIAL_PARITY, 'n', - NM_SETTING_SERIAL_STOPBITS, 1, - NULL); - - /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); - 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, - NULL); - - /* PPP setting */ - s_ppp = (NMSettingPPP *) nm_setting_ppp_new (); - ASSERT (s_ppp != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_PPP_SETTING_NAME); - nm_connection_add_setting (connection, NM_SETTING (s_ppp)); - - ASSERT (nm_connection_verify (connection, &error) == TRUE, - "mobile-broadband-write", "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 == FALSE, - "mobile-broadband-write", "unexpected success writing connection to disk"); - - g_object_unref (connection); -} - -#define TEST_IFCFG_BRIDGE_MAIN TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bridge-main" - -static void -test_read_bridge_main (void) -{ - NMConnection *connection; - 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_BRIDGE_MAIN, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection == NULL, - "bridge-main-read", "unexpected success reading %s", TEST_IFCFG_BRIDGE_MAIN); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); -} - -#define TEST_IFCFG_BRIDGE_COMPONENT TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bridge-component" - -static void -test_read_bridge_component (void) -{ - NMConnection *connection; - 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_BRIDGE_COMPONENT, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection != NULL, - "bridge-component-read", "unexpected failure reading %s", TEST_IFCFG_BRIDGE_COMPONENT); - - ASSERT (unmanaged != NULL, - "bridge-component-read", "missing unmanaged spec from %s", TEST_IFCFG_BRIDGE_COMPONENT); - - ASSERT (g_strcmp0 (unmanaged, "mac:00:22:15:59:62:97") == 0, - "bridge-component-read", "unexpected unmanaged spec from %s", TEST_IFCFG_BRIDGE_COMPONENT); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); - g_object_unref (connection); -} - -#define TEST_IFCFG_VLAN_INTERFACE TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-interface" - -static void -test_read_vlan_interface (void) -{ - NMConnection *connection; - 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_VLAN_INTERFACE, - NULL, - TYPE_ETHERNET, - NULL, - &unmanaged, - &keyfile, - &routefile, - &route6file, - &error, - &ignore_error); - ASSERT (connection == NULL, - "vlan-interface-read", "unexpected success reading %s", TEST_IFCFG_VLAN_INTERFACE); - - g_free (unmanaged); - g_free (keyfile); - g_free (routefile); - g_free (route6file); -} - -#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" - - -#define TEST_IFCFG_WIRED_STATIC TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-static" -#define TEST_IFCFG_WIRED_STATIC_BOOTPROTO TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-static-bootproto" - -#define TEST_IFCFG_WIRED_IPV4_MANUAL_1 TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv4-manual-1" -#define TEST_IFCFG_WIRED_IPV4_MANUAL_2 TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv4-manual-2" -#define TEST_IFCFG_WIRED_IPV4_MANUAL_3 TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv4-manual-3" -#define TEST_IFCFG_WIRED_IPV4_MANUAL_4 TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv4-manual-4" - -#define DEFAULT_HEX_PSK "7d308b11df1b4243b0f78e5f3fc68cdbb9a264ed0edf4c188edf329ff5b467f0" - -int main (int argc, char **argv) -{ - GError *error = NULL; - char *base; - - g_type_init (); - - if (!nm_utils_init (&error)) - FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message); - - /* The tests */ - test_read_unmanaged (); - test_read_minimal (); - test_read_wired_static (TEST_IFCFG_WIRED_STATIC, "System test-wired-static"); - test_read_wired_static (TEST_IFCFG_WIRED_STATIC_BOOTPROTO, "System test-wired-static-bootproto"); - test_read_wired_static_no_prefix (8); - test_read_wired_static_no_prefix (16); - test_read_wired_static_no_prefix (24); - test_read_wired_dhcp (); - test_read_wired_global_gateway (); - test_read_wired_never_default (); - test_read_wired_defroute_no (); - test_read_wired_defroute_no_gatewaydev_yes (); - test_read_wired_static_routes (); - test_read_wired_static_routes_legacy (); - test_read_wired_ipv4_manual (TEST_IFCFG_WIRED_IPV4_MANUAL_1, "System test-wired-ipv4-manual-1"); - test_read_wired_ipv4_manual (TEST_IFCFG_WIRED_IPV4_MANUAL_2, "System test-wired-ipv4-manual-2"); - test_read_wired_ipv4_manual (TEST_IFCFG_WIRED_IPV4_MANUAL_3, "System test-wired-ipv4-manual-3"); - test_read_wired_ipv4_manual (TEST_IFCFG_WIRED_IPV4_MANUAL_4, "System test-wired-ipv4-manual-4"); - test_read_wired_ipv6_manual (); - test_read_wired_ipv6_only (); - test_read_wired_dhcp6_only (); - test_read_onboot_no (); - test_read_wired_8021x_peap_mschapv2 (); - test_read_wifi_open (); - test_read_wifi_open_auto (); - test_read_wifi_open_ssid_hex (); - test_read_wifi_open_ssid_bad (TEST_IFCFG_WIFI_OPEN_SSID_BAD_HEX, "wifi-open-ssid-bad-hex-read"); - test_read_wifi_open_ssid_bad (TEST_IFCFG_WIFI_OPEN_SSID_LONG_HEX, "wifi-open-ssid-long-hex-read"); - test_read_wifi_open_ssid_bad (TEST_IFCFG_WIFI_OPEN_SSID_LONG_QUOTED, "wifi-open-ssid-long-quoted-read"); - test_read_wifi_open_ssid_quoted (); - test_read_wifi_wep (); - test_read_wifi_wep_adhoc (); - test_read_wifi_wep_passphrase (); - test_read_wifi_wep_40_ascii (); - test_read_wifi_wep_104_ascii (); - test_read_wifi_leap (); - test_read_wifi_wpa_psk (); - test_read_wifi_wpa_psk_unquoted (); - test_read_wifi_wpa_psk_unquoted2 (); - test_read_wifi_wpa_psk_adhoc (); - test_read_wifi_wpa_psk_hex (); - test_read_wifi_wpa_eap_tls (); - test_read_wifi_wpa_eap_ttls_tls (); - test_read_wifi_wep_eap_ttls_chap (); - test_read_wired_qeth_static (); - test_read_wired_ctc_static (); - - test_write_wired_static (); - test_write_wired_static_ip6_only (); - test_write_wired_static_routes (); - test_read_write_static_routes_legacy (); - test_write_wired_dhcp (); - test_write_wired_dhcp_8021x_peap_mschapv2 (); - test_write_wifi_open (); - test_write_wifi_open_hex_ssid (); - test_write_wifi_wep (); - test_write_wifi_wep_adhoc (); - test_write_wifi_wep_passphrase (); - test_write_wifi_wep_40_ascii (); - test_write_wifi_wep_104_ascii (); - test_write_wifi_leap (); - test_write_wifi_wpa_psk ("Test Write Wifi WPA PSK", - "wifi-wpa-psk-write", - FALSE, - TRUE, - FALSE, - DEFAULT_HEX_PSK); - test_write_wifi_wpa_psk ("Test Write Wifi WPA2 PSK", - "wifi-wpa2-psk-write", - FALSE, - FALSE, - TRUE, - DEFAULT_HEX_PSK); - test_write_wifi_wpa_psk ("Test Write Wifi WPA WPA2 PSK", - "wifi-wpa-wpa2-psk-write", - FALSE, - TRUE, - TRUE, - DEFAULT_HEX_PSK); - test_write_wifi_wpa_psk ("Test Write Wifi WEP WPA WPA2 PSK", - "wifi-wep-wpa-wpa2-psk-write", - TRUE, - TRUE, - TRUE, - DEFAULT_HEX_PSK); - test_write_wifi_wpa_psk ("Test Write Wifi WPA WPA2 PSK Passphrase", - "wifi-wpa-wpa2-psk-passphrase-write", - FALSE, - TRUE, - TRUE, - "really insecure passphrase04!"); - test_write_wifi_wpa_psk_adhoc (); - test_write_wifi_wpa_eap_tls (); - test_write_wifi_wpa_eap_ttls_tls (); - test_write_wifi_wpa_eap_ttls_mschapv2 (); - test_write_wifi_wpa_then_open (); - test_write_wired_qeth_dhcp (); - test_write_wired_ctc_dhcp (); - - /* iSCSI / ibft */ - test_read_ibft_dhcp (); - test_read_ibft_static (); - test_read_ibft_malformed ("ibft-bad-record-read", TEST_IFCFG_DIR "/iscsiadm-test-bad-record"); - test_read_ibft_malformed ("ibft-bad-entry-read", TEST_IFCFG_DIR "/iscsiadm-test-bad-entry"); - test_read_ibft_malformed ("ibft-bad-ipaddr-read", TEST_IFCFG_DIR "/iscsiadm-test-bad-ipaddr"); - test_read_ibft_malformed ("ibft-bad-gateway-read", TEST_IFCFG_DIR "/iscsiadm-test-bad-gateway"); - test_read_ibft_malformed ("ibft-bad-dns1-read", TEST_IFCFG_DIR "/iscsiadm-test-bad-dns1"); - test_read_ibft_malformed ("ibft-bad-dns2-read", TEST_IFCFG_DIR "/iscsiadm-test-bad-dns2"); - - /* 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 (); - test_read_vlan_interface (); - - base = g_path_get_basename (argv[0]); - fprintf (stdout, "%s: SUCCESS\n", base); - g_free (base); - return 0; -} - |