about summary refs log tree commit diff
path: root/src/tests
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2014-07-06 02:16:10 +0200
committerMichael Biebl <biebl@debian.org>2014-07-06 02:16:10 +0200
commit33491bc4279481db8ae47213e34a6d695a0e8830 (patch)
tree097d2b0fdff3fae6885381ae5e57a182cd8cbbba /src/tests
parent59c3714a494c3b3765657c0551ad82842d98a7d2 (diff)
Imported Upstream version 0.9.10.0 upstream/0.9.10.0
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/Makefile.am74
-rw-r--r--src/tests/Makefile.in342
-rw-r--r--src/tests/test-dcb.c357
-rw-r--r--src/tests/test-dhcp-options.c296
-rw-r--r--src/tests/test-general.c614
-rw-r--r--src/tests/test-ip4-config.c355
-rw-r--r--src/tests/test-ip6-config.c338
-rw-r--r--src/tests/test-policy-hosts.c176
-rw-r--r--src/tests/test-resolvconf-capture.c226
-rw-r--r--src/tests/test-wifi-ap-utils.c1440
10 files changed, 2392 insertions, 1826 deletions
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index 77e6c0f5..ee5be17d 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -1,20 +1,25 @@
-if ENABLE_TESTS
-
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_builddir)/include \
 	-I$(top_srcdir)/libnm-util \
 	-I$(top_builddir)/libnm-util \
+	-I$(top_srcdir)/src/logging \
+	-I$(top_srcdir)/src/platform \
 	-I$(top_srcdir)/src/dhcp-manager \
 	-I$(top_srcdir)/src \
 	-I$(top_builddir)/src \
+	-DG_LOG_DOMAIN=\""NetworkManager"\" \
+	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
 	$(GLIB_CFLAGS) \
 	$(DBUS_CFLAGS)
 
 noinst_PROGRAMS = \
 	test-dhcp-options \
-	test-policy-hosts \
-	test-wifi-ap-utils
+	test-general \
+	test-ip4-config \
+	test-ip6-config \
+	test-dcb \
+	test-resolvconf-capture
 
 ####### DHCP options test #######
 
@@ -27,32 +32,47 @@ test_dhcp_options_CPPFLAGS = \
 	-DDHCPCD_PATH=\"$(DHCPCD_PATH)\"
 
 test_dhcp_options_LDADD = \
-	$(top_builddir)/libnm-util/libnm-util.la \
-	$(top_builddir)/src/dhcp-manager/libdhcp-manager.la \
-	$(top_builddir)/src/libtest-dhcp.la \
-	$(GLIB_LIBS) \
-	$(DBUS_LIBS)
+	$(top_builddir)/src/libNetworkManager.la
+
+####### ip4 config test #######
+
+test_ip4_config_SOURCES = \
+	test-ip4-config.c
+
+test_ip4_config_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
+
+####### ip6 config test #######
+
+test_ip6_config_SOURCES = \
+	test-ip6-config.c
+
+test_ip6_config_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
+
+####### DCB test #######
+
+test_dcb_SOURCES = \
+	test-dcb.c
+
+test_dcb_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
 
-####### policy /etc/hosts test #######
+####### resolv.conf capture test #######
 
-test_policy_hosts_SOURCES = \
-	test-policy-hosts.c
+test_resolvconf_capture_SOURCES = \
+	test-resolvconf-capture.c
 
-test_policy_hosts_LDADD = \
-	-ldl \
-	$(top_builddir)/src/libtest-policy-hosts.la \
-	$(GLIB_LIBS)
+test_resolvconf_capture_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
 
-####### wifi ap utils test #######
+####### general test #######
 
-test_wifi_ap_utils_SOURCES = \
-	test-wifi-ap-utils.c
+test_general_SOURCES = \
+	test-general.c
 
-test_wifi_ap_utils_LDADD = \
-	$(top_builddir)/libnm-util/libnm-util.la \
-	$(top_builddir)/src/libtest-wifi-ap-utils.la \
-	$(GLIB_LIBS) \
-	$(DBUS_LIBS)
+test_general_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
 
 ####### secret agent interface test #######
 
@@ -60,9 +80,5 @@ EXTRA_DIST = test-secret-agent.py
 
 ###########################################
 
-check-local: test-dhcp-options test-policy-hosts test-wifi-ap-utils
-	$(abs_builddir)/test-dhcp-options
-	$(abs_builddir)/test-policy-hosts
-	$(abs_builddir)/test-wifi-ap-utils
+TESTS = test-dhcp-options test-ip4-config test-ip6-config test-dcb test-resolvconf-capture test-general
 
-endif
diff --git a/src/tests/Makefile.in b/src/tests/Makefile.in
index 177cc4e9..b9af7c31 100644
--- a/src/tests/Makefile.in
+++ b/src/tests/Makefile.in
@@ -78,14 +78,18 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-dhcp-options$(EXEEXT) \
-@ENABLE_TESTS_TRUE@	test-policy-hosts$(EXEEXT) \
-@ENABLE_TESTS_TRUE@	test-wifi-ap-utils$(EXEEXT)
+noinst_PROGRAMS = test-dhcp-options$(EXEEXT) test-general$(EXEEXT) \
+	test-ip4-config$(EXEEXT) test-ip6-config$(EXEEXT) \
+	test-dcb$(EXEEXT) test-resolvconf-capture$(EXEEXT)
+TESTS = test-dhcp-options$(EXEEXT) test-ip4-config$(EXEEXT) \
+	test-ip6-config$(EXEEXT) test-dcb$(EXEEXT) \
+	test-resolvconf-capture$(EXEEXT) test-general$(EXEEXT)
 subdir = src/tests
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/build-aux/depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \
+	$(top_srcdir)/m4/compiler_warnings.m4 \
 	$(top_srcdir)/m4/gettext.m4 \
 	$(top_srcdir)/m4/gnome-code-coverage.m4 \
 	$(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \
@@ -104,33 +108,35 @@ CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 PROGRAMS = $(noinst_PROGRAMS)
-am__test_dhcp_options_SOURCES_DIST = test-dhcp-options.c
-@ENABLE_TESTS_TRUE@am_test_dhcp_options_OBJECTS = test_dhcp_options-test-dhcp-options.$(OBJEXT)
-test_dhcp_options_OBJECTS = $(am_test_dhcp_options_OBJECTS)
-am__DEPENDENCIES_1 =
-@ENABLE_TESTS_TRUE@test_dhcp_options_DEPENDENCIES =  \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/libnm-util/libnm-util.la \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/src/dhcp-manager/libdhcp-manager.la \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/src/libtest-dhcp.la \
-@ENABLE_TESTS_TRUE@	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_dcb_OBJECTS = test-dcb.$(OBJEXT)
+test_dcb_OBJECTS = $(am_test_dcb_OBJECTS)
+test_dcb_DEPENDENCIES = $(top_builddir)/src/libNetworkManager.la
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-am__test_policy_hosts_SOURCES_DIST = test-policy-hosts.c
-@ENABLE_TESTS_TRUE@am_test_policy_hosts_OBJECTS =  \
-@ENABLE_TESTS_TRUE@	test-policy-hosts.$(OBJEXT)
-test_policy_hosts_OBJECTS = $(am_test_policy_hosts_OBJECTS)
-@ENABLE_TESTS_TRUE@test_policy_hosts_DEPENDENCIES = $(top_builddir)/src/libtest-policy-hosts.la \
-@ENABLE_TESTS_TRUE@	$(am__DEPENDENCIES_1)
-am__test_wifi_ap_utils_SOURCES_DIST = test-wifi-ap-utils.c
-@ENABLE_TESTS_TRUE@am_test_wifi_ap_utils_OBJECTS =  \
-@ENABLE_TESTS_TRUE@	test-wifi-ap-utils.$(OBJEXT)
-test_wifi_ap_utils_OBJECTS = $(am_test_wifi_ap_utils_OBJECTS)
-@ENABLE_TESTS_TRUE@test_wifi_ap_utils_DEPENDENCIES =  \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/libnm-util/libnm-util.la \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/src/libtest-wifi-ap-utils.la \
-@ENABLE_TESTS_TRUE@	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_dhcp_options_OBJECTS =  \
+	test_dhcp_options-test-dhcp-options.$(OBJEXT)
+test_dhcp_options_OBJECTS = $(am_test_dhcp_options_OBJECTS)
+test_dhcp_options_DEPENDENCIES =  \
+	$(top_builddir)/src/libNetworkManager.la
+am_test_general_OBJECTS = test-general.$(OBJEXT)
+test_general_OBJECTS = $(am_test_general_OBJECTS)
+test_general_DEPENDENCIES = $(top_builddir)/src/libNetworkManager.la
+am_test_ip4_config_OBJECTS = test-ip4-config.$(OBJEXT)
+test_ip4_config_OBJECTS = $(am_test_ip4_config_OBJECTS)
+test_ip4_config_DEPENDENCIES =  \
+	$(top_builddir)/src/libNetworkManager.la
+am_test_ip6_config_OBJECTS = test-ip6-config.$(OBJEXT)
+test_ip6_config_OBJECTS = $(am_test_ip6_config_OBJECTS)
+test_ip6_config_DEPENDENCIES =  \
+	$(top_builddir)/src/libNetworkManager.la
+am_test_resolvconf_capture_OBJECTS =  \
+	test-resolvconf-capture.$(OBJEXT)
+test_resolvconf_capture_OBJECTS =  \
+	$(am_test_resolvconf_capture_OBJECTS)
+test_resolvconf_capture_DEPENDENCIES =  \
+	$(top_builddir)/src/libNetworkManager.la
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -165,11 +171,12 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(test_dhcp_options_SOURCES) $(test_policy_hosts_SOURCES) \
-	$(test_wifi_ap_utils_SOURCES)
-DIST_SOURCES = $(am__test_dhcp_options_SOURCES_DIST) \
-	$(am__test_policy_hosts_SOURCES_DIST) \
-	$(am__test_wifi_ap_utils_SOURCES_DIST)
+SOURCES = $(test_dcb_SOURCES) $(test_dhcp_options_SOURCES) \
+	$(test_general_SOURCES) $(test_ip4_config_SOURCES) \
+	$(test_ip6_config_SOURCES) $(test_resolvconf_capture_SOURCES)
+DIST_SOURCES = $(test_dcb_SOURCES) $(test_dhcp_options_SOURCES) \
+	$(test_general_SOURCES) $(test_ip4_config_SOURCES) \
+	$(test_ip6_config_SOURCES) $(test_resolvconf_capture_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -194,6 +201,28 @@ am__define_uniq_tagged_files = \
   done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = { \
+  $(am__tty_colors_dummy); \
+  if test "X$(AM_COLOR_TESTS)" = Xno; then \
+    am__color_tests=no; \
+  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+    am__color_tests=yes; \
+  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+    am__color_tests=yes; \
+  fi; \
+  if test $$am__color_tests = yes; then \
+    red=''; \
+    grn=''; \
+    lgn=''; \
+    blu=''; \
+    mgn=''; \
+    brg=''; \
+    std=''; \
+  fi; \
+}
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ALL_LINGUAS = @ALL_LINGUAS@
@@ -220,12 +249,15 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_GLIB_100_CFLAGS = @DBUS_GLIB_100_CFLAGS@
+DBUS_GLIB_100_LIBS = @DBUS_GLIB_100_LIBS@
 DBUS_LIBS = @DBUS_LIBS@
 DBUS_SYS_DIR = @DBUS_SYS_DIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DHCLIENT_PATH = @DHCLIENT_PATH@
 DHCPCD_PATH = @DHCPCD_PATH@
+DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@
 DLLTOOL = @DLLTOOL@
 DNSMASQ_PATH = @DNSMASQ_PATH@
 DSYMUTIL = @DSYMUTIL@
@@ -250,7 +282,6 @@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
 GNUTLS_LIBS = @GNUTLS_LIBS@
 GREP = @GREP@
 GTKDOC_CHECK = @GTKDOC_CHECK@
-GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
 GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
 GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
 GTKDOC_MKPDF = @GTKDOC_MKPDF@
@@ -295,12 +326,16 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
 LIBICONV = @LIBICONV@
 LIBINTL = @LIBINTL@
 LIBM = @LIBM@
+LIBNDP_CFLAGS = @LIBNDP_CFLAGS@
+LIBNDP_LIBS = @LIBNDP_LIBS@
 LIBNL_CFLAGS = @LIBNL_CFLAGS@
 LIBNL_LIBS = @LIBNL_LIBS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@
 LIBSOUP_LIBS = @LIBSOUP_LIBS@
+LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@
+LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@
 LIBTOOL = @LIBTOOL@
 LIPO = @LIPO@
 LN_S = @LN_S@
@@ -317,6 +352,8 @@ MOC = @MOC@
 MSGFMT = @MSGFMT@
 MSGFMT_015 = @MSGFMT_015@
 MSGMERGE = @MSGMERGE@
+NEWT_CFLAGS = @NEWT_CFLAGS@
+NEWT_LIBS = @NEWT_LIBS@
 NM = @NM@
 NMEDIT = @NMEDIT@
 NM_MAJOR_VERSION = @NM_MAJOR_VERSION@
@@ -344,11 +381,16 @@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POLKIT_CFLAGS = @POLKIT_CFLAGS@
 POLKIT_LIBS = @POLKIT_LIBS@
 POSUB = @POSUB@
+PPPD_PATH = @PPPD_PATH@
 PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@
+PPPOE_PATH = @PPPOE_PATH@
 QT_CFLAGS = @QT_CFLAGS@
 QT_LIBS = @QT_LIBS@
 RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
 SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
@@ -363,6 +405,7 @@ UDEV_BASE_DIR = @UDEV_BASE_DIR@
 USE_NLS = @USE_NLS@
 UUID_CFLAGS = @UUID_CFLAGS@
 UUID_LIBS = @UUID_LIBS@
+VALGRIND_RULES = @VALGRIND_RULES@
 VAPIGEN = @VAPIGEN@
 VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@
 VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@
@@ -425,6 +468,7 @@ psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
+subdirs = @subdirs@
 sysconfdir = @sysconfdir@
 systemdsystemunitdir = @systemdsystemunitdir@
 target_alias = @target_alias@
@@ -435,58 +479,78 @@ with_dhclient = @with_dhclient@
 with_dhcpcd = @with_dhcpcd@
 with_netconfig = @with_netconfig@
 with_resolvconf = @with_resolvconf@
-@ENABLE_TESTS_TRUE@AM_CPPFLAGS = \
-@ENABLE_TESTS_TRUE@	-I$(top_srcdir)/include \
-@ENABLE_TESTS_TRUE@	-I$(top_builddir)/include \
-@ENABLE_TESTS_TRUE@	-I$(top_srcdir)/libnm-util \
-@ENABLE_TESTS_TRUE@	-I$(top_builddir)/libnm-util \
-@ENABLE_TESTS_TRUE@	-I$(top_srcdir)/src/dhcp-manager \
-@ENABLE_TESTS_TRUE@	-I$(top_srcdir)/src \
-@ENABLE_TESTS_TRUE@	-I$(top_builddir)/src \
-@ENABLE_TESTS_TRUE@	$(GLIB_CFLAGS) \
-@ENABLE_TESTS_TRUE@	$(DBUS_CFLAGS)
+with_valgrind = @with_valgrind@
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/include \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/libnm-util \
+	-I$(top_builddir)/libnm-util \
+	-I$(top_srcdir)/src/logging \
+	-I$(top_srcdir)/src/platform \
+	-I$(top_srcdir)/src/dhcp-manager \
+	-I$(top_srcdir)/src \
+	-I$(top_builddir)/src \
+	-DG_LOG_DOMAIN=\""NetworkManager"\" \
+	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
+	$(GLIB_CFLAGS) \
+	$(DBUS_CFLAGS)
 
 
 ####### DHCP options test #######
-@ENABLE_TESTS_TRUE@test_dhcp_options_SOURCES = \
-@ENABLE_TESTS_TRUE@	test-dhcp-options.c
+test_dhcp_options_SOURCES = \
+	test-dhcp-options.c
+
+test_dhcp_options_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	-DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \
+	-DDHCPCD_PATH=\"$(DHCPCD_PATH)\"
+
+test_dhcp_options_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
+
+
+####### ip4 config test #######
+test_ip4_config_SOURCES = \
+	test-ip4-config.c
 
-@ENABLE_TESTS_TRUE@test_dhcp_options_CPPFLAGS = \
-@ENABLE_TESTS_TRUE@	$(AM_CPPFLAGS) \
-@ENABLE_TESTS_TRUE@	-DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \
-@ENABLE_TESTS_TRUE@	-DDHCPCD_PATH=\"$(DHCPCD_PATH)\"
+test_ip4_config_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
 
-@ENABLE_TESTS_TRUE@test_dhcp_options_LDADD = \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/libnm-util/libnm-util.la \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/src/dhcp-manager/libdhcp-manager.la \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/src/libtest-dhcp.la \
-@ENABLE_TESTS_TRUE@	$(GLIB_LIBS) \
-@ENABLE_TESTS_TRUE@	$(DBUS_LIBS)
 
+####### ip6 config test #######
+test_ip6_config_SOURCES = \
+	test-ip6-config.c
 
-####### policy /etc/hosts test #######
-@ENABLE_TESTS_TRUE@test_policy_hosts_SOURCES = \
-@ENABLE_TESTS_TRUE@	test-policy-hosts.c
+test_ip6_config_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
 
-@ENABLE_TESTS_TRUE@test_policy_hosts_LDADD = \
-@ENABLE_TESTS_TRUE@	-ldl \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/src/libtest-policy-hosts.la \
-@ENABLE_TESTS_TRUE@	$(GLIB_LIBS)
 
+####### DCB test #######
+test_dcb_SOURCES = \
+	test-dcb.c
 
-####### wifi ap utils test #######
-@ENABLE_TESTS_TRUE@test_wifi_ap_utils_SOURCES = \
-@ENABLE_TESTS_TRUE@	test-wifi-ap-utils.c
+test_dcb_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
 
-@ENABLE_TESTS_TRUE@test_wifi_ap_utils_LDADD = \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/libnm-util/libnm-util.la \
-@ENABLE_TESTS_TRUE@	$(top_builddir)/src/libtest-wifi-ap-utils.la \
-@ENABLE_TESTS_TRUE@	$(GLIB_LIBS) \
-@ENABLE_TESTS_TRUE@	$(DBUS_LIBS)
+
+####### resolv.conf capture test #######
+test_resolvconf_capture_SOURCES = \
+	test-resolvconf-capture.c
+
+test_resolvconf_capture_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
+
+
+####### general test #######
+test_general_SOURCES = \
+	test-general.c
+
+test_general_LDADD = \
+	$(top_builddir)/src/libNetworkManager.la
 
 
 ####### secret agent interface test #######
-@ENABLE_TESTS_TRUE@EXTRA_DIST = test-secret-agent.py
+EXTRA_DIST = test-secret-agent.py
 all: all-am
 
 .SUFFIXES:
@@ -531,17 +595,29 @@ clean-noinstPROGRAMS:
 	echo " rm -f" $$list; \
 	rm -f $$list
 
+test-dcb$(EXEEXT): $(test_dcb_OBJECTS) $(test_dcb_DEPENDENCIES) $(EXTRA_test_dcb_DEPENDENCIES) 
+	@rm -f test-dcb$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(test_dcb_OBJECTS) $(test_dcb_LDADD) $(LIBS)
+
 test-dhcp-options$(EXEEXT): $(test_dhcp_options_OBJECTS) $(test_dhcp_options_DEPENDENCIES) $(EXTRA_test_dhcp_options_DEPENDENCIES) 
 	@rm -f test-dhcp-options$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(test_dhcp_options_OBJECTS) $(test_dhcp_options_LDADD) $(LIBS)
 
-test-policy-hosts$(EXEEXT): $(test_policy_hosts_OBJECTS) $(test_policy_hosts_DEPENDENCIES) $(EXTRA_test_policy_hosts_DEPENDENCIES) 
-	@rm -f test-policy-hosts$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(test_policy_hosts_OBJECTS) $(test_policy_hosts_LDADD) $(LIBS)
+test-general$(EXEEXT): $(test_general_OBJECTS) $(test_general_DEPENDENCIES) $(EXTRA_test_general_DEPENDENCIES) 
+	@rm -f test-general$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(test_general_OBJECTS) $(test_general_LDADD) $(LIBS)
+
+test-ip4-config$(EXEEXT): $(test_ip4_config_OBJECTS) $(test_ip4_config_DEPENDENCIES) $(EXTRA_test_ip4_config_DEPENDENCIES) 
+	@rm -f test-ip4-config$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(test_ip4_config_OBJECTS) $(test_ip4_config_LDADD) $(LIBS)
+
+test-ip6-config$(EXEEXT): $(test_ip6_config_OBJECTS) $(test_ip6_config_DEPENDENCIES) $(EXTRA_test_ip6_config_DEPENDENCIES) 
+	@rm -f test-ip6-config$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(test_ip6_config_OBJECTS) $(test_ip6_config_LDADD) $(LIBS)
 
-test-wifi-ap-utils$(EXEEXT): $(test_wifi_ap_utils_OBJECTS) $(test_wifi_ap_utils_DEPENDENCIES) $(EXTRA_test_wifi_ap_utils_DEPENDENCIES) 
-	@rm -f test-wifi-ap-utils$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(test_wifi_ap_utils_OBJECTS) $(test_wifi_ap_utils_LDADD) $(LIBS)
+test-resolvconf-capture$(EXEEXT): $(test_resolvconf_capture_OBJECTS) $(test_resolvconf_capture_DEPENDENCIES) $(EXTRA_test_resolvconf_capture_DEPENDENCIES) 
+	@rm -f test-resolvconf-capture$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(test_resolvconf_capture_OBJECTS) $(test_resolvconf_capture_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -549,8 +625,11 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-policy-hosts.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wifi-ap-utils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dcb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-general.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-ip4-config.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-ip6-config.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-resolvconf-capture.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dhcp_options-test-dhcp-options.Po@am__quote@
 
 .c.o:
@@ -646,6 +725,99 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
+check-TESTS: $(TESTS)
+	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
+	srcdir=$(srcdir); export srcdir; \
+	list=' $(TESTS) '; \
+	$(am__tty_colors); \
+	if test -n "$$list"; then \
+	  for tst in $$list; do \
+	    if test -f ./$$tst; then dir=./; \
+	    elif test -f $$tst; then dir=; \
+	    else dir="$(srcdir)/"; fi; \
+	    if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *[\ \	]$$tst[\ \	]*) \
+		xpass=`expr $$xpass + 1`; \
+		failed=`expr $$failed + 1`; \
+		col=$$red; res=XPASS; \
+	      ;; \
+	      *) \
+		col=$$grn; res=PASS; \
+	      ;; \
+	      esac; \
+	    elif test $$? -ne 77; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *[\ \	]$$tst[\ \	]*) \
+		xfail=`expr $$xfail + 1`; \
+		col=$$lgn; res=XFAIL; \
+	      ;; \
+	      *) \
+		failed=`expr $$failed + 1`; \
+		col=$$red; res=FAIL; \
+	      ;; \
+	      esac; \
+	    else \
+	      skip=`expr $$skip + 1`; \
+	      col=$$blu; res=SKIP; \
+	    fi; \
+	    echo "$${col}$$res$${std}: $$tst"; \
+	  done; \
+	  if test "$$all" -eq 1; then \
+	    tests="test"; \
+	    All=""; \
+	  else \
+	    tests="tests"; \
+	    All="All "; \
+	  fi; \
+	  if test "$$failed" -eq 0; then \
+	    if test "$$xfail" -eq 0; then \
+	      banner="$$All$$all $$tests passed"; \
+	    else \
+	      if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+	      banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+	    fi; \
+	  else \
+	    if test "$$xpass" -eq 0; then \
+	      banner="$$failed of $$all $$tests failed"; \
+	    else \
+	      if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+	      banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+	    fi; \
+	  fi; \
+	  dashes="$$banner"; \
+	  skipped=""; \
+	  if test "$$skip" -ne 0; then \
+	    if test "$$skip" -eq 1; then \
+	      skipped="($$skip test was not run)"; \
+	    else \
+	      skipped="($$skip tests were not run)"; \
+	    fi; \
+	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$skipped"; \
+	  fi; \
+	  report=""; \
+	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+	    report="Please report to $(PACKAGE_BUGREPORT)"; \
+	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$report"; \
+	  fi; \
+	  dashes=`echo "$$dashes" | sed s/./=/g`; \
+	  if test "$$failed" -eq 0; then \
+	    col="$$grn"; \
+	  else \
+	    col="$$red"; \
+	  fi; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
+	  test "$$failed" -eq 0; \
+	else :; fi
+
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -676,9 +848,8 @@ distdir: $(DISTFILES)
 	    || exit 1; \
 	  fi; \
 	done
-@ENABLE_TESTS_FALSE@check-local:
 check-am: all-am
-	$(MAKE) $(AM_MAKEFLAGS) check-local
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
 all-am: Makefile $(PROGRAMS)
 installdirs:
@@ -785,7 +956,7 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
 	clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
 	ctags ctags-am distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
@@ -800,13 +971,6 @@ uninstall-am:
 	tags tags-am uninstall uninstall-am
 
 
-###########################################
-
-@ENABLE_TESTS_TRUE@check-local: test-dhcp-options test-policy-hosts test-wifi-ap-utils
-@ENABLE_TESTS_TRUE@	$(abs_builddir)/test-dhcp-options
-@ENABLE_TESTS_TRUE@	$(abs_builddir)/test-policy-hosts
-@ENABLE_TESTS_TRUE@	$(abs_builddir)/test-wifi-ap-utils
-
 # 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/src/tests/test-dcb.c b/src/tests/test-dcb.c
new file mode 100644
index 00000000..c28f05b9
--- /dev/null
+++ b/src/tests/test-dcb.c
@@ -0,0 +1,357 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * 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, 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) 2013 Red Hat, Inc.
+ *
+ */
+
+#include <glib.h>
+#include <string.h>
+
+#include "nm-dcb.h"
+
+typedef struct {
+	guint num;
+	const char *cmds[];
+} DcbExpected;
+
+static gboolean
+test_dcb_func (char **argv, guint which, gpointer user_data, GError **error)
+{
+	DcbExpected *e = user_data;
+	char *f;
+
+	g_assert (argv[0] == NULL);
+	argv[0] = (which == DCBTOOL) ? "dcbtool" : "fcoeadm";
+
+	f = g_strjoinv (" ", argv);
+	if (e->cmds[e->num] == NULL)
+		g_assert_cmpstr (f, ==, NULL);
+	g_assert_cmpstr (e->cmds[e->num], !=, NULL);
+	g_assert_cmpstr (f, ==, e->cmds[e->num++]);
+	g_free (f);
+	return TRUE;
+}
+
+#define DCB_FLAGS_ALL (NM_SETTING_DCB_FLAG_ENABLE | \
+                       NM_SETTING_DCB_FLAG_ADVERTISE | \
+                       NM_SETTING_DCB_FLAG_WILLING)
+
+static void
+test_dcb_fcoe (void)
+{
+	static DcbExpected expected = { 0,
+		{ "dcbtool sc eth0 app:fcoe e:1 a:1 w:1",
+		  "dcbtool sc eth0 app:fcoe appcfg:40",
+		  "dcbtool sc eth0 app:iscsi e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:fip e:0 a:0 w:0",
+		  "dcbtool sc eth0 pfc e:0 a:0 w:0",
+		  "dcbtool sc eth0 pg e:0",
+		  NULL },
+	};
+	NMSettingDcb *s_dcb;
+	GError *error = NULL;
+	gboolean success;
+
+	s_dcb = (NMSettingDcb *) nm_setting_dcb_new ();
+	g_object_set (G_OBJECT (s_dcb),
+	              NM_SETTING_DCB_APP_FCOE_FLAGS, DCB_FLAGS_ALL,
+	              NM_SETTING_DCB_APP_FCOE_PRIORITY, 6,
+	              NULL);
+
+	success = _dcb_setup ("eth0", s_dcb, test_dcb_func, &expected, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	g_assert_cmpstr (expected.cmds[expected.num], ==, NULL);
+	g_object_unref (s_dcb);
+}
+
+static void
+test_dcb_iscsi (void)
+{
+	static DcbExpected expected = { 0,
+		{ "dcbtool sc eth0 app:fcoe e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:iscsi e:1 a:0 w:1",
+		  "dcbtool sc eth0 app:iscsi appcfg:08",
+		  "dcbtool sc eth0 app:fip e:0 a:0 w:0",
+		  "dcbtool sc eth0 pfc e:0 a:0 w:0",
+		  "dcbtool sc eth0 pg e:0",
+		  NULL },
+	};
+	NMSettingDcb *s_dcb;
+	GError *error = NULL;
+	gboolean success;
+
+	s_dcb = (NMSettingDcb *) nm_setting_dcb_new ();
+	g_object_set (G_OBJECT (s_dcb),
+	              NM_SETTING_DCB_APP_ISCSI_FLAGS, (NM_SETTING_DCB_FLAG_ENABLE | NM_SETTING_DCB_FLAG_WILLING),
+	              NM_SETTING_DCB_APP_ISCSI_PRIORITY, 3,
+	              NULL);
+
+	success = _dcb_setup ("eth0", s_dcb, test_dcb_func, &expected, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	g_assert_cmpstr (expected.cmds[expected.num], ==, NULL);
+	g_object_unref (s_dcb);
+}
+
+static void
+test_dcb_fip (void)
+{
+	static DcbExpected expected = { 0,
+		{ "dcbtool sc eth0 app:fcoe e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:iscsi e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:fip e:1 a:1 w:0",
+		  "dcbtool sc eth0 app:fip appcfg:01",
+		  "dcbtool sc eth0 pfc e:0 a:0 w:0",
+		  "dcbtool sc eth0 pg e:0",
+		  NULL },
+	};
+	NMSettingDcb *s_dcb;
+	GError *error = NULL;
+	gboolean success;
+
+	s_dcb = (NMSettingDcb *) nm_setting_dcb_new ();
+	g_object_set (G_OBJECT (s_dcb),
+	              NM_SETTING_DCB_APP_FIP_FLAGS, (NM_SETTING_DCB_FLAG_ENABLE | NM_SETTING_DCB_FLAG_ADVERTISE),
+	              NM_SETTING_DCB_APP_FIP_PRIORITY, 0,
+	              NULL);
+
+	success = _dcb_setup ("eth0", s_dcb, test_dcb_func, &expected, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	g_assert_cmpstr (expected.cmds[expected.num], ==, NULL);
+	g_object_unref (s_dcb);
+}
+
+static void
+test_dcb_fip_default_prio (void)
+{
+	static DcbExpected expected = { 0,
+		{ "dcbtool sc eth0 app:fcoe e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:iscsi e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:fip e:1 a:1 w:0",
+		  "dcbtool sc eth0 pfc e:0 a:0 w:0",
+		  "dcbtool sc eth0 pg e:0",
+		  NULL },
+	};
+	NMSettingDcb *s_dcb;
+	GError *error = NULL;
+	gboolean success;
+
+	s_dcb = (NMSettingDcb *) nm_setting_dcb_new ();
+	g_object_set (G_OBJECT (s_dcb),
+	              NM_SETTING_DCB_APP_FIP_FLAGS, (NM_SETTING_DCB_FLAG_ENABLE | NM_SETTING_DCB_FLAG_ADVERTISE),
+	              NM_SETTING_DCB_APP_FIP_PRIORITY, -1,
+	              NULL);
+
+	success = _dcb_setup ("eth0", s_dcb, test_dcb_func, &expected, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	g_assert_cmpstr (expected.cmds[expected.num], ==, NULL);
+	g_object_unref (s_dcb);
+}
+
+static void
+test_dcb_pfc (void)
+{
+	static DcbExpected expected = { 0,
+		{ "dcbtool sc eth0 app:fcoe e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:iscsi e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:fip e:0 a:0 w:0",
+		  "dcbtool sc eth0 pfc e:1 a:1 w:1",
+		  "dcbtool sc eth0 pfc pfcup:01101100",
+		  "dcbtool sc eth0 pg e:0",
+		  NULL },
+	};
+	NMSettingDcb *s_dcb;
+	GError *error = NULL;
+	gboolean success;
+
+	s_dcb = (NMSettingDcb *) nm_setting_dcb_new ();
+	g_object_set (G_OBJECT (s_dcb),
+	              NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS, DCB_FLAGS_ALL,
+	              NULL);
+
+	nm_setting_dcb_set_priority_flow_control (s_dcb, 0, FALSE);
+	nm_setting_dcb_set_priority_flow_control (s_dcb, 1, TRUE);
+	nm_setting_dcb_set_priority_flow_control (s_dcb, 2, TRUE);
+	nm_setting_dcb_set_priority_flow_control (s_dcb, 3, FALSE);
+	nm_setting_dcb_set_priority_flow_control (s_dcb, 4, TRUE);
+	nm_setting_dcb_set_priority_flow_control (s_dcb, 5, TRUE);
+	nm_setting_dcb_set_priority_flow_control (s_dcb, 6, FALSE);
+	nm_setting_dcb_set_priority_flow_control (s_dcb, 7, FALSE);
+
+	success = _dcb_setup ("eth0", s_dcb, test_dcb_func, &expected, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	g_assert_cmpstr (expected.cmds[expected.num], ==, NULL);
+	g_object_unref (s_dcb);
+}
+
+static void
+test_dcb_priority_groups (void)
+{
+	static DcbExpected expected = { 0,
+		{ "dcbtool sc eth0 app:fcoe e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:iscsi e:0 a:0 w:0",
+		  "dcbtool sc eth0 app:fip e:0 a:0 w:0",
+		  "dcbtool sc eth0 pfc e:0 a:0 w:0",
+		  "dcbtool sc eth0 pg e:1 a:1 w:1" \
+		      " pgid:765f3210" \
+		      " pgpct:10,40,5,10,5,20,7,3" \
+		      " uppct:100,50,33,25,20,16,14,12" \
+		      " strict:01010101" \
+		      " up2tc:01201201",
+		  NULL },
+	};
+	NMSettingDcb *s_dcb;
+	GError *error = NULL;
+	gboolean success;
+	guint i;
+
+	s_dcb = (NMSettingDcb *) nm_setting_dcb_new ();
+	g_object_set (G_OBJECT (s_dcb),
+	              NM_SETTING_DCB_PRIORITY_GROUP_FLAGS, DCB_FLAGS_ALL,
+	              NULL);
+
+	for (i = 0; i < 8; i++) {
+		/* Make sure at least one 15/f is present in the group IDs */
+		nm_setting_dcb_set_priority_group_id (s_dcb, i, (i == 3) ? 15 : 7 - i);
+		nm_setting_dcb_set_priority_bandwidth (s_dcb, i, 100 / (i + 1));
+		nm_setting_dcb_set_priority_strict_bandwidth (s_dcb, i, i % 2);
+		nm_setting_dcb_set_priority_traffic_class (s_dcb, i, i % 3);
+	}
+
+	nm_setting_dcb_set_priority_group_bandwidth (s_dcb, 0, 10);
+	nm_setting_dcb_set_priority_group_bandwidth (s_dcb, 1, 40);
+	nm_setting_dcb_set_priority_group_bandwidth (s_dcb, 2, 5);
+	nm_setting_dcb_set_priority_group_bandwidth (s_dcb, 3, 10);
+	nm_setting_dcb_set_priority_group_bandwidth (s_dcb, 4, 5);
+	nm_setting_dcb_set_priority_group_bandwidth (s_dcb, 5, 20);
+	nm_setting_dcb_set_priority_group_bandwidth (s_dcb, 6, 7);
+	nm_setting_dcb_set_priority_group_bandwidth (s_dcb, 7, 3);
+
+	success = _dcb_setup ("eth0", s_dcb, test_dcb_func, &expected, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	g_assert_cmpstr (expected.cmds[expected.num], ==, NULL);
+	g_object_unref (s_dcb);
+}
+
+static void
+test_dcb_cleanup (void)
+{
+	static DcbExpected expected = { 0,
+		{ "fcoeadm -d eth0",
+		  "dcbtool sc eth0 app:fcoe e:0",
+		  "dcbtool sc eth0 app:iscsi e:0",
+		  "dcbtool sc eth0 app:fip e:0",
+		  "dcbtool sc eth0 pfc e:0",
+		  "dcbtool sc eth0 pg e:0",
+		  "dcbtool sc eth0 dcb off",
+		  NULL },
+	};
+	GError *error = NULL;
+	gboolean success;
+
+	success = _fcoe_cleanup ("eth0", test_dcb_func, &expected, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	success = _dcb_cleanup ("eth0", test_dcb_func, &expected, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	g_assert_cmpstr (expected.cmds[expected.num], ==, NULL);
+}
+
+static void
+test_fcoe_create (void)
+{
+	static DcbExpected expected1 = { 0,
+		{ "fcoeadm -m fabric -c eth0", NULL },
+	};
+	static DcbExpected expected2 = { 0,
+		{ "fcoeadm -m vn2vn -c eth0", NULL },
+	};
+	GError *error = NULL;
+	gboolean success;
+	NMSettingDcb *s_dcb;
+
+	s_dcb = (NMSettingDcb *) nm_setting_dcb_new ();
+	g_object_set (G_OBJECT (s_dcb),
+	              NM_SETTING_DCB_APP_FCOE_FLAGS, DCB_FLAGS_ALL,
+	              NULL);
+
+	/* Default mode is fabric */
+	success = _fcoe_setup ("eth0", s_dcb, test_dcb_func, &expected1, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	/* Test VN2VN */
+	g_object_set (G_OBJECT (s_dcb), NM_SETTING_DCB_APP_FCOE_MODE, NM_SETTING_DCB_FCOE_MODE_VN2VN, NULL);
+	success = _fcoe_setup ("eth0", s_dcb, test_dcb_func, &expected2, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	g_object_unref (s_dcb);
+}
+
+static void
+test_fcoe_cleanup (void)
+{
+	static DcbExpected expected = { 0,
+		{ "fcoeadm -d eth0", NULL },
+	};
+	GError *error = NULL;
+	gboolean success;
+
+	success = _fcoe_cleanup ("eth0", test_dcb_func, &expected, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+}
+
+/*******************************************/
+
+int
+main (int argc, char **argv)
+{
+	g_test_init (&argc, &argv, NULL);
+
+#if !GLIB_CHECK_VERSION (2, 35, 0)
+	g_type_init ();
+#endif
+
+	g_test_add_func ("/dcb/fcoe", test_dcb_fcoe);
+	g_test_add_func ("/dcb/iscsi", test_dcb_iscsi);
+	g_test_add_func ("/dcb/fip", test_dcb_fip);
+	g_test_add_func ("/dcb/fip-default-priority", test_dcb_fip_default_prio);
+	g_test_add_func ("/dcb/pfc", test_dcb_pfc);
+	g_test_add_func ("/dcb/priority-groups", test_dcb_priority_groups);
+	g_test_add_func ("/dcb/cleanup", test_dcb_cleanup);
+	g_test_add_func ("/fcoe/create", test_fcoe_create);
+	g_test_add_func ("/fcoe/cleanup", test_fcoe_cleanup);
+
+	return g_test_run ();
+}
+
diff --git a/src/tests/test-dhcp-options.c b/src/tests/test-dhcp-options.c
index 9463ed5b..5df17e58 100644
--- a/src/tests/test-dhcp-options.c
+++ b/src/tests/test-dhcp-options.c
@@ -25,10 +25,12 @@
 #include <arpa/inet.h>
 #include <string.h>
 
-#include "nm-test-helpers.h"
 #include <nm-utils.h>
 
 #include "nm-dhcp-manager.h"
+#include "nm-logging.h"
+
+#include "nm-test-utils.h"
 
 typedef struct {
 	const char *name;
@@ -97,13 +99,14 @@ static Option generic_options[] = {
 };
 
 static void
-test_generic_options (const char *client)
+test_generic_options (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
-	NMIP4Address *addr;
-	NMIP4Route *route;
-	struct in_addr tmp;
+	const NMPlatformIP4Address *address;
+	const NMPlatformIP4Route *route;
+	guint32 tmp;
 	const char *expected_addr = "192.168.1.106";
 	const char *expected_gw = "192.168.1.1";
 	const char *expected_dns1 = "216.254.95.2";
@@ -123,25 +126,24 @@ test_generic_options (const char *client)
 	/* IP4 address */
 	ASSERT (nm_ip4_config_get_num_addresses (ip4_config) == 1,
 	        "dhcp-generic", "unexpected number of IP addresses");
-	addr = nm_ip4_config_get_address (ip4_config, 0);
+	address = nm_ip4_config_get_address (ip4_config, 0);
 
 	ASSERT (inet_pton (AF_INET, expected_addr, &tmp) > 0,
 	        "dhcp-generic", "couldn't convert expected IP address");
-	ASSERT (nm_ip4_address_get_address (addr) == tmp.s_addr,
+	ASSERT (address->address == tmp,
 	        "dhcp-generic", "unexpected IP address");
+	ASSERT (address->peer_address == 0,
+	        "dhcp-generic", "unexpected PTP address");
 
-	ASSERT (nm_ip4_address_get_prefix (addr) == 24,
+	ASSERT (address->plen == 24,
 	        "dhcp-generic", "unexpected IP address prefix length");
 
 	/* Gateway */
 	ASSERT (inet_pton (AF_INET, expected_gw, &tmp) > 0,
 	        "dhcp-generic", "couldn't convert expected IP gateway");
-	ASSERT (nm_ip4_address_get_gateway (addr) == tmp.s_addr,
+	ASSERT (nm_ip4_config_get_gateway (ip4_config) == tmp,
 	        "dhcp-generic", "unexpected IP gateway");
 
-	ASSERT (nm_ip4_config_get_ptp_address (ip4_config) == 0,
-	        "dhcp-generic", "unexpected PTP address");
-
 	ASSERT (nm_ip4_config_get_num_wins (ip4_config) == 0,
 	        "dhcp-generic", "unexpected number of WINS servers");
 
@@ -161,11 +163,11 @@ test_generic_options (const char *client)
 	        "dhcp-generic", "unexpected number of domain name servers");
 	ASSERT (inet_pton (AF_INET, expected_dns1, &tmp) > 0,
 	        "dhcp-generic", "couldn't convert expected DNS server address #1");
-	ASSERT (nm_ip4_config_get_nameserver (ip4_config, 0) == tmp.s_addr,
+	ASSERT (nm_ip4_config_get_nameserver (ip4_config, 0) == tmp,
 	        "dhcp-generic", "unexpected domain name server #1");
 	ASSERT (inet_pton (AF_INET, expected_dns2, &tmp) > 0,
 	        "dhcp-generic", "couldn't convert expected DNS server address #2");
-	ASSERT (nm_ip4_config_get_nameserver (ip4_config, 1) == tmp.s_addr,
+	ASSERT (nm_ip4_config_get_nameserver (ip4_config, 1) == tmp,
 	        "dhcp-generic", "unexpected domain name server #2");
 
 	/* Routes */
@@ -176,34 +178,34 @@ test_generic_options (const char *client)
 	route = nm_ip4_config_get_route (ip4_config, 0);
 	ASSERT (inet_pton (AF_INET, expected_route1_dest, &tmp) > 0,
 	        "dhcp-generic", "couldn't convert expected route destination #1");
-	ASSERT (nm_ip4_route_get_dest (route) == tmp.s_addr,
+	ASSERT (route->network == tmp,
 	        "dhcp-generic", "unexpected route #1 destination");
 
 	ASSERT (inet_pton (AF_INET, expected_route1_gw, &tmp) > 0,
 	        "dhcp-generic", "couldn't convert expected route next hop #1");
-	ASSERT (nm_ip4_route_get_next_hop (route) == tmp.s_addr,
+	ASSERT (route->gateway == tmp,
 	        "dhcp-generic", "unexpected route #1 next hop");
 
-	ASSERT (nm_ip4_route_get_prefix (route) == 32,
+	ASSERT (route->plen == 32,
 	        "dhcp-generic", "unexpected route #1 prefix");
-	ASSERT (nm_ip4_route_get_metric (route) == 0,
+	ASSERT (route->metric == 0,
 	        "dhcp-generic", "unexpected route #1 metric");
 
 	/* Route #2 */
 	route = nm_ip4_config_get_route (ip4_config, 1);
 	ASSERT (inet_pton (AF_INET, expected_route2_dest, &tmp) > 0,
 	        "dhcp-generic", "couldn't convert expected route destination #2");
-	ASSERT (nm_ip4_route_get_dest (route) == tmp.s_addr,
+	ASSERT (route->network == tmp,
 	        "dhcp-generic", "unexpected route #2 destination");
 
 	ASSERT (inet_pton (AF_INET, expected_route2_gw, &tmp) > 0,
 	        "dhcp-generic", "couldn't convert expected route next hop #2");
-	ASSERT (nm_ip4_route_get_next_hop (route) == tmp.s_addr,
+	ASSERT (route->gateway == tmp,
 	        "dhcp-generic", "unexpected route #2 next hop");
 
-	ASSERT (nm_ip4_route_get_prefix (route) == 32,
+	ASSERT (route->plen == 32,
 	        "dhcp-generic", "unexpected route #2 prefix");
-	ASSERT (nm_ip4_route_get_metric (route) == 0,
+	ASSERT (route->metric == 0,
 	        "dhcp-generic", "unexpected route #2 metric");
 
 	g_hash_table_destroy (options);
@@ -215,12 +217,13 @@ static Option wins_options[] = {
 };
 
 static void
-test_wins_options (const char *client)
+test_wins_options (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
-	NMIP4Address *addr;
-	struct in_addr tmp;
+	const NMPlatformIP4Address *address;
+	guint32 tmp;
 	const char *expected_wins1 = "63.12.199.5";
 	const char *expected_wins2 = "150.4.88.120";
 
@@ -234,17 +237,18 @@ test_wins_options (const char *client)
 	/* IP4 address */
 	ASSERT (nm_ip4_config_get_num_addresses (ip4_config) == 1,
 	        "dhcp-wins", "unexpected number of IP addresses");
-	addr = nm_ip4_config_get_address (ip4_config, 0);
+	address = nm_ip4_config_get_address (ip4_config, 0);
+	ASSERT (address != NULL, "dhcp-wins", "unexpectedly did not get address #0");
 
 	ASSERT (nm_ip4_config_get_num_wins (ip4_config) == 2,
 	        "dhcp-wins", "unexpected number of WINS servers");
 	ASSERT (inet_pton (AF_INET, expected_wins1, &tmp) > 0,
 	        "dhcp-wins", "couldn't convert expected WINS server address #1");
-	ASSERT (nm_ip4_config_get_wins (ip4_config, 0) == tmp.s_addr,
+	ASSERT (nm_ip4_config_get_wins (ip4_config, 0) == tmp,
 	        "dhcp-wins", "unexpected WINS server #1");
 	ASSERT (inet_pton (AF_INET, expected_wins2, &tmp) > 0,
 	        "dhcp-wins", "couldn't convert expected WINS server address #1");
-	ASSERT (nm_ip4_config_get_wins (ip4_config, 1) == tmp.s_addr,
+	ASSERT (nm_ip4_config_get_wins (ip4_config, 1) == tmp,
 	        "dhcp-wins", "unexpected WINS server #1");
 
 	g_hash_table_destroy (options);
@@ -258,24 +262,24 @@ ip4_test_route (const char *test,
                 const char *expected_gw,
                 guint expected_prefix)
 {
-	NMIP4Route *route;
-	struct in_addr tmp;
+	const NMPlatformIP4Route *route;
+	guint32 tmp;
 
 	route = nm_ip4_config_get_route (ip4_config, route_num);
 	ASSERT (inet_pton (AF_INET, expected_dest, &tmp) > 0,
 	        test, "couldn't convert expected route destination #1");
-	ASSERT (nm_ip4_route_get_dest (route) == tmp.s_addr,
+	ASSERT (route->network == tmp,
 	        test, "unexpected route %d destination", route_num + 1);
 
 	ASSERT (inet_pton (AF_INET, expected_gw, &tmp) > 0,
 	        test, "couldn't convert expected route next hop %d",
 	        route_num + 1);
-	ASSERT (nm_ip4_route_get_next_hop (route) == tmp.s_addr,
+	ASSERT (route->gateway == tmp,
 	        test, "unexpected route %d next hop", route_num + 1);
 
-	ASSERT (nm_ip4_route_get_prefix (route) == expected_prefix,
+	ASSERT (route->plen == expected_prefix,
 	        test, "unexpected route %d prefix", route_num + 1);
-	ASSERT (nm_ip4_route_get_metric (route) == 0,
+	ASSERT (route->metric == 0,
 	        test, "unexpected route %d metric", route_num + 1);
 }
 
@@ -284,21 +288,20 @@ ip4_test_gateway (const char *test,
                   NMIP4Config *ip4_config,
                   const char *expected_gw)
 {
-	NMIP4Address *addr;
-	struct in_addr tmp;
+	guint32 tmp;
 
 	ASSERT (nm_ip4_config_get_num_addresses (ip4_config) == 1,
 	        test, "unexpected number of IP addresses");
-	addr = nm_ip4_config_get_address (ip4_config, 0);
 	ASSERT (inet_pton (AF_INET, expected_gw, &tmp) > 0,
 	        test, "couldn't convert expected IP gateway");
-	ASSERT (nm_ip4_address_get_gateway (addr) == tmp.s_addr,
+	ASSERT (nm_ip4_config_get_gateway (ip4_config) == tmp,
 	        test, "unexpected IP gateway");
 }
 
 static void
-test_classless_static_routes_1 (const char *client)
+test_classless_static_routes_1 (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "192.168.10.0";
@@ -330,8 +333,9 @@ test_classless_static_routes_1 (const char *client)
 }
 
 static void
-test_classless_static_routes_2 (const char *client)
+test_classless_static_routes_2 (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "192.168.10.0";
@@ -363,8 +367,9 @@ test_classless_static_routes_2 (const char *client)
 }
 
 static void
-test_fedora_dhclient_classless_static_routes (const char *client)
+test_fedora_dhclient_classless_static_routes (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "129.210.177.128";
@@ -400,8 +405,9 @@ test_fedora_dhclient_classless_static_routes (const char *client)
 }
 
 static void
-test_dhclient_invalid_classless_routes_1 (const char *client)
+test_dhclient_invalid_classless_routes_1 (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "192.168.10.0";
@@ -415,9 +421,12 @@ test_dhclient_invalid_classless_routes_1 (const char *client)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_manager_test_ip4_options_to_config (client, "eth0", options, "rebind");
 	ASSERT (ip4_config != NULL,
 	        "dhcp-dhclient-classless-invalid-1", "failed to parse DHCP4 options");
+	g_test_assert_expected_messages ();
 
 	/* IP4 routes */
 	ASSERT (nm_ip4_config_get_num_routes (ip4_config) == 1,
@@ -430,8 +439,9 @@ test_dhclient_invalid_classless_routes_1 (const char *client)
 }
 
 static void
-test_dhcpcd_invalid_classless_routes_1 (const char *client)
+test_dhcpcd_invalid_classless_routes_1 (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "10.1.1.5";
@@ -447,9 +457,12 @@ test_dhcpcd_invalid_classless_routes_1 (const char *client)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_manager_test_ip4_options_to_config (client, "eth0", options, "rebind");
 	ASSERT (ip4_config != NULL,
 	        "dhcp-dhcpcd-classless-invalid-1", "failed to parse DHCP4 options");
+	g_test_assert_expected_messages ();
 
 	/* Test falling back to old-style static routes if the classless static
 	 * routes are invalid.
@@ -465,8 +478,9 @@ test_dhcpcd_invalid_classless_routes_1 (const char *client)
 }
 
 static void
-test_dhclient_invalid_classless_routes_2 (const char *client)
+test_dhclient_invalid_classless_routes_2 (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "10.1.1.5";
@@ -481,9 +495,12 @@ test_dhclient_invalid_classless_routes_2 (const char *client)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_manager_test_ip4_options_to_config (client, "eth0", options, "rebind");
 	ASSERT (ip4_config != NULL,
 	        "dhcp-dhclient-classless-invalid-2", "failed to parse DHCP4 options");
+	g_test_assert_expected_messages ();
 
 	/* Test falling back to old-style static routes if the classless static
 	 * routes are invalid.
@@ -499,8 +516,9 @@ test_dhclient_invalid_classless_routes_2 (const char *client)
 }
 
 static void
-test_dhcpcd_invalid_classless_routes_2 (const char *client)
+test_dhcpcd_invalid_classless_routes_2 (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "10.1.1.5";
@@ -515,9 +533,12 @@ test_dhcpcd_invalid_classless_routes_2 (const char *client)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_manager_test_ip4_options_to_config (client, "eth0", options, "rebind");
 	ASSERT (ip4_config != NULL,
 	        "dhcp-dhcpcd-classless-invalid-2", "failed to parse DHCP4 options");
+	g_test_assert_expected_messages ();
 
 	/* Test falling back to old-style static routes if the classless static
 	 * routes are invalid.
@@ -535,8 +556,9 @@ test_dhcpcd_invalid_classless_routes_2 (const char *client)
 }
 
 static void
-test_dhclient_invalid_classless_routes_3 (const char *client)
+test_dhclient_invalid_classless_routes_3 (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "192.168.10.0";
@@ -549,9 +571,12 @@ test_dhclient_invalid_classless_routes_3 (const char *client)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	                       "*ignoring invalid classless static routes*");
 	ip4_config = nm_dhcp_manager_test_ip4_options_to_config (client, "eth0", options, "rebind");
 	ASSERT (ip4_config != NULL,
 	        "dhcp-dhclient-classless-invalid-3", "failed to parse DHCP4 options");
+	g_test_assert_expected_messages ();
 
 	/* IP4 routes */
 	ASSERT (nm_ip4_config_get_num_routes (ip4_config) == 1,
@@ -563,8 +588,9 @@ test_dhclient_invalid_classless_routes_3 (const char *client)
 }
 
 static void
-test_dhcpcd_invalid_classless_routes_3 (const char *client)
+test_dhcpcd_invalid_classless_routes_3 (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "192.168.10.0";
@@ -577,9 +603,12 @@ test_dhcpcd_invalid_classless_routes_3 (const char *client)
 	options = fill_table (generic_options, NULL);
 	options = fill_table (data, options);
 
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	                       "*DHCP provided invalid classless static route*");
 	ip4_config = nm_dhcp_manager_test_ip4_options_to_config (client, "eth0", options, "rebind");
 	ASSERT (ip4_config != NULL,
 	        "dhcp-dhcpcd-classless-invalid-3", "failed to parse DHCP4 options");
+	g_test_assert_expected_messages ();
 
 	/* IP4 routes */
 	ASSERT (nm_ip4_config_get_num_routes (ip4_config) == 1,
@@ -591,8 +620,9 @@ test_dhcpcd_invalid_classless_routes_3 (const char *client)
 }
 
 static void
-test_dhclient_gw_in_classless_routes (const char *client)
+test_dhclient_gw_in_classless_routes (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "192.168.10.0";
@@ -623,8 +653,9 @@ test_dhclient_gw_in_classless_routes (const char *client)
 }
 
 static void
-test_dhcpcd_gw_in_classless_routes (const char *client)
+test_dhcpcd_gw_in_classless_routes (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_route1_dest = "192.168.10.0";
@@ -660,8 +691,9 @@ static Option escaped_searches_options[] = {
 };
 
 static void
-test_escaped_domain_searches (const char *client)
+test_escaped_domain_searches (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 	const char *expected_search0 = "host1";
@@ -694,17 +726,21 @@ static Option invalid_escaped_searches_options[] = {
 };
 
 static void
-test_invalid_escaped_domain_searches (const char *client)
+test_invalid_escaped_domain_searches (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
 
 	options = fill_table (generic_options, NULL);
 	options = fill_table (invalid_escaped_searches_options, options);
 
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	                       "*invalid domain search*");
 	ip4_config = nm_dhcp_manager_test_ip4_options_to_config (client, "eth0", options, "rebind");
 	ASSERT (ip4_config != NULL,
 	        "dhcp-invalid-escaped-domain-searches", "failed to parse DHCP4 options");
+	g_test_assert_expected_messages ();
 
 	/* domain searches */
 	ASSERT (nm_ip4_config_get_num_searches (ip4_config) == 0,
@@ -718,7 +754,7 @@ test_ip4_missing_prefix (const char *client, const char *ip, guint32 expected_pr
 {
 	GHashTable *options;
 	NMIP4Config *ip4_config;
-	NMIP4Address *addr;
+	const NMPlatformIP4Address *address;
 
 	options = fill_table (generic_options, NULL);
 	g_hash_table_insert (options, "new_ip_address", string_to_byte_array_gvalue (ip));
@@ -731,23 +767,48 @@ test_ip4_missing_prefix (const char *client, const char *ip, guint32 expected_pr
 	ASSERT (nm_ip4_config_get_num_addresses (ip4_config) == 1,
 	        "dhcp-ip4-missing-prefix", "unexpected number of IP4 addresses (not 1)");
 
-	addr = nm_ip4_config_get_address (ip4_config, 0);
-	ASSERT (addr != NULL,
+	address = nm_ip4_config_get_address (ip4_config, 0);
+	ASSERT (address,
 	        "dhcp-ip4-missing-prefix", "missing IP4 address #1");
 
-	ASSERT (nm_ip4_address_get_prefix (addr) == expected_prefix,
+	ASSERT (address->plen == expected_prefix,
 	        "dhcp-ip4-missing-prefix", "unexpected IP4 address prefix %d (expected %d)",
-	        nm_ip4_address_get_prefix (addr), expected_prefix);
+	        address->plen, expected_prefix);
 
 	g_hash_table_destroy (options);
 }
 
 static void
-test_ip4_prefix_classless (const char *client)
+test_ip4_missing_prefix_24 (gconstpointer test_data)
+{
+	const char *client = test_data;
+
+	test_ip4_missing_prefix (client, "192.168.1.10", 24);
+}
+
+static void
+test_ip4_missing_prefix_16 (gconstpointer test_data)
+{
+	const char *client = test_data;
+
+	test_ip4_missing_prefix (client, "172.16.54.50", 16);
+}
+
+static void
+test_ip4_missing_prefix_8 (gconstpointer test_data)
+{
+	const char *client = test_data;
+
+	test_ip4_missing_prefix (client, "10.1.2.3", 8);
+}
+
+static void
+test_ip4_prefix_classless (gconstpointer test_data)
 {
+	const char *client = test_data;
 	GHashTable *options;
 	NMIP4Config *ip4_config;
-	NMIP4Address *addr;
+	const NMPlatformIP4Address *address;
 
 	/* Ensure that the missing-subnet-mask handler doesn't mangle classless
 	 * subnet masks at all.  The handler should trigger only if the server
@@ -765,30 +826,28 @@ test_ip4_prefix_classless (const char *client)
 	ASSERT (nm_ip4_config_get_num_addresses (ip4_config) == 1,
 	        "dhcp-ip4-prefix-classless", "unexpected number of IP4 addresses (not 1)");
 
-	addr = nm_ip4_config_get_address (ip4_config, 0);
-	ASSERT (addr != NULL,
+	address = nm_ip4_config_get_address (ip4_config, 0);
+	ASSERT (address,
 	        "dhcp-ip4-prefix-classless", "missing IP4 address #1");
 
-	ASSERT (nm_ip4_address_get_prefix (addr) == 22,
+	ASSERT (address->plen == 22,
 	        "dhcp-ip4-prefix-classless", "unexpected IP4 address prefix %d (expected 22)",
-	        nm_ip4_address_get_prefix (addr));
+	        address->plen);
 
 	g_hash_table_destroy (options);
 }
 
+NMTST_DEFINE ();
+
 int main (int argc, char **argv)
 {
-	GError *error = NULL;
-	char *base;
+	char *path;
 	const char *clients[2][2] = { {DHCLIENT_PATH, "dhclient"}, {DHCPCD_PATH, "dhcpcd"} };
 	guint32 i;
 
-	g_type_init ();
+	nmtst_init_assert_logging (&argc, &argv);
+	nm_logging_setup ("WARN", "DEFAULT", NULL, NULL);
 
-	if (!nm_utils_init (&error))
-		FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message);
-
-	/* The tests */
 	for (i = 0; i < 2; i++) {
 		const char *client_path = clients[i][0];
 		const char *client = clients[i][1];
@@ -796,30 +855,83 @@ int main (int argc, char **argv)
 		if (!client_path || !strlen (client_path))
 			continue;
 
-		test_generic_options (client);
-		test_wins_options (client);
-		test_classless_static_routes_1 (client);
-		test_classless_static_routes_2 (client);
-		test_fedora_dhclient_classless_static_routes (client);
-		test_dhclient_invalid_classless_routes_1 (client);
-		test_dhcpcd_invalid_classless_routes_1 (client);
-		test_dhclient_invalid_classless_routes_2 (client);
-		test_dhcpcd_invalid_classless_routes_2 (client);
-		test_dhclient_invalid_classless_routes_3 (client);
-		test_dhcpcd_invalid_classless_routes_3 (client);
-		test_dhclient_gw_in_classless_routes (client);
-		test_dhcpcd_gw_in_classless_routes (client);
-		test_escaped_domain_searches (client);
-		test_invalid_escaped_domain_searches (client);
-		test_ip4_missing_prefix (client, "192.168.1.10", 24);
-		test_ip4_missing_prefix (client, "172.16.54.50", 16);
-		test_ip4_missing_prefix (client, "10.1.2.3", 8);
-		test_ip4_prefix_classless (client);
+		path = g_strdup_printf ("/dhcp/%s/generic-options", client);
+		g_test_add_data_func (path, client, test_generic_options);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/wins-options", client);
+		g_test_add_data_func (path, client, test_wins_options);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/classless-static-routes-1", client);
+		g_test_add_data_func (path, client, test_classless_static_routes_1);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/classless-static-routes-2", client);
+		g_test_add_data_func (path, client, test_classless_static_routes_2);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/fedora-dhclient-classless-static-routes", client);
+		g_test_add_data_func (path, client, test_fedora_dhclient_classless_static_routes);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/dhclient-invalid-classless-routes-1", client);
+		g_test_add_data_func (path, client, test_dhclient_invalid_classless_routes_1);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/dhcpcd-invalid-classless-routes-1", client);
+		g_test_add_data_func (path, client, test_dhcpcd_invalid_classless_routes_1);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/dhclient-invalid-classless-routes-2", client);
+		g_test_add_data_func (path, client, test_dhclient_invalid_classless_routes_2);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/dhcpcd-invalid-classless-routes-2", client);
+		g_test_add_data_func (path, client, test_dhcpcd_invalid_classless_routes_2);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/dhclient-invalid-classless-routes-3", client);
+		g_test_add_data_func (path, client, test_dhclient_invalid_classless_routes_3);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/dhcpcd-invalid-classless-routes-3", client);
+		g_test_add_data_func (path, client, test_dhcpcd_invalid_classless_routes_3);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/dhclient-gw-in-classless-routes", client);
+		g_test_add_data_func (path, client, test_dhclient_gw_in_classless_routes);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/dhcpcd-gw-in-classless-routes", client);
+		g_test_add_data_func (path, client, test_dhcpcd_gw_in_classless_routes);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/escaped-domain-searches", client);
+		g_test_add_data_func (path, client, test_escaped_domain_searches);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/invalid-escaped-domain-searches", client);
+		g_test_add_data_func (path, client, test_invalid_escaped_domain_searches);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/ip4-missing-prefix-24", client);
+		g_test_add_data_func (path, client, test_ip4_missing_prefix_24);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/ip4-missing-prefix-16", client);
+		g_test_add_data_func (path, client, test_ip4_missing_prefix_16);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/ip4-missing-prefix-8", client);
+		g_test_add_data_func (path, client, test_ip4_missing_prefix_8);
+		g_free (path);
+
+		path = g_strdup_printf ("/dhcp/%s/ip4-prefix-classless", client);
+		g_test_add_data_func (path, client, test_ip4_prefix_classless);
+		g_free (path);
 	}
 
-	base = g_path_get_basename (argv[0]);
-	fprintf (stdout, "%s: SUCCESS\n", base);
-	g_free (base);
-	return 0;
+	return g_test_run ();
 }
 
diff --git a/src/tests/test-general.c b/src/tests/test-general.c
new file mode 100644
index 00000000..11c03f0d
--- /dev/null
+++ b/src/tests/test-general.c
@@ -0,0 +1,614 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * 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, 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) 2014 Red Hat, Inc.
+ *
+ */
+
+#include <glib.h>
+#include <string.h>
+#include <errno.h>
+#include <netinet/ether.h>
+
+#include "NetworkManagerUtils.h"
+#include "nm-utils.h"
+
+
+static void
+test_nm_utils_ascii_str_to_int64_check (const char *str, guint base, gint64 min,
+                                        gint64 max, gint64 fallback, int exp_errno,
+                                        gint64 exp_val)
+{
+	gint64 v;
+
+	errno = 1;
+	v = nm_utils_ascii_str_to_int64 (str, base, min, max, fallback);
+	g_assert_cmpint (errno, ==, exp_errno);
+	g_assert_cmpint (v, ==, exp_val);
+}
+
+static void
+test_nm_utils_ascii_str_to_int64_do (const char *str, guint base, gint64 min,
+                                     gint64 max, gint64 fallback, int exp_errno,
+                                     gint64 exp_val)
+{
+	const char *sign = "";
+	const char *val;
+	static const char *whitespaces[] = {
+		"",
+		" ",
+		"\r\n\t",
+		" \r\n\t ",
+		" \r\n\t \t\r\n\t",
+		NULL,
+	};
+	static const char *nulls[] = {
+		"",
+		"0",
+		"00",
+		"0000",
+		"0000000000000000",
+		"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+		"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+		NULL,
+	};
+	const char **ws_pre, **ws_post, **null;
+	int i;
+
+	if (str == NULL || exp_errno != 0) {
+		test_nm_utils_ascii_str_to_int64_check (str, base, min, max, fallback, exp_errno, exp_val);
+		return;
+	}
+
+	if (strncmp (str, "-", 1) == 0)
+		sign = "-";
+
+	val = str + strlen (sign);
+
+	for (ws_pre = whitespaces; *ws_pre; ws_pre++) {
+		for (ws_post = whitespaces; *ws_post; ws_post++) {
+			for (null = nulls; *null; null++) {
+				for (i = 0; ; i++) {
+					char *s;
+					const char *str_base = "";
+
+					if (base == 16) {
+						if (i == 1)
+							str_base = "0x";
+						else if (i > 1)
+							break;
+					} else if (base == 8) {
+						if (i == 1)
+							str_base = "0";
+						else if (i > 1)
+							break;
+					} else if (base == 0) {
+						if (i > 0)
+							break;
+						/* with base==0, a leading zero would be interpreted as octal. Only test without *null */
+						if ((*null)[0])
+							break;
+					} else {
+						if (i > 0)
+							break;
+					}
+
+					s = g_strdup_printf ("%s%s%s%s%s%s", *ws_pre, sign, str_base, *null, val, *ws_post);
+
+					test_nm_utils_ascii_str_to_int64_check (s, base, min, max, fallback, exp_errno, exp_val);
+					g_free (s);
+				}
+			}
+		}
+	}
+}
+
+static void
+test_nm_utils_ascii_str_to_int64 (void)
+{
+	test_nm_utils_ascii_str_to_int64_do (NULL, 10, 0, 10000, -1, EINVAL, -1);
+	test_nm_utils_ascii_str_to_int64_do ("", 10, 0, 10000, -1, EINVAL, -1);
+	test_nm_utils_ascii_str_to_int64_do ("1x", 10, 0, 10000, -1, EINVAL, -1);
+	test_nm_utils_ascii_str_to_int64_do ("4711", 10, 0, 10000, -1, 0, 4711);
+	test_nm_utils_ascii_str_to_int64_do ("10000", 10, 0, 10000, -1, 0, 10000);
+	test_nm_utils_ascii_str_to_int64_do ("10001", 10, 0, 10000, -1, ERANGE, -1);
+	test_nm_utils_ascii_str_to_int64_do ("FF", 16, 0, 10000, -1, 0, 255);
+	test_nm_utils_ascii_str_to_int64_do ("FF", 10, 0, 10000, -2, EINVAL, -2);
+	test_nm_utils_ascii_str_to_int64_do ("9223372036854775807", 10, 0, G_MAXINT64, -2, 0, G_MAXINT64);
+	test_nm_utils_ascii_str_to_int64_do ("7FFFFFFFFFFFFFFF", 16, 0, G_MAXINT64, -2, 0, G_MAXINT64);
+	test_nm_utils_ascii_str_to_int64_do ("9223372036854775808", 10, 0, G_MAXINT64, -2, ERANGE, -2);
+	test_nm_utils_ascii_str_to_int64_do ("-9223372036854775808", 10, G_MININT64, 0, -2, 0, G_MININT64);
+	test_nm_utils_ascii_str_to_int64_do ("-9223372036854775808", 10, G_MININT64+1, 0, -2, ERANGE, -2);
+	test_nm_utils_ascii_str_to_int64_do ("-9223372036854775809", 10, G_MININT64, 0, -2, ERANGE, -2);
+	test_nm_utils_ascii_str_to_int64_do ("1.0", 10, 1, 1, -1, EINVAL, -1);
+	test_nm_utils_ascii_str_to_int64_do ("1x0", 16, -10, 10, -100, EINVAL, -100);
+	test_nm_utils_ascii_str_to_int64_do ("0", 16, -10, 10, -100, 0, 0);
+	test_nm_utils_ascii_str_to_int64_do ("10001111", 2, -1000, 1000, -100000, 0, 0x8F);
+	test_nm_utils_ascii_str_to_int64_do ("-10001111", 2, -1000, 1000, -100000, 0, -0x8F);
+	test_nm_utils_ascii_str_to_int64_do ("1111111", 2, G_MININT64, G_MAXINT64, -1, 0, 0x7F);
+	test_nm_utils_ascii_str_to_int64_do ("111111111111111", 2, G_MININT64, G_MAXINT64, -1, 0, 0x7FFF);
+	test_nm_utils_ascii_str_to_int64_do ("11111111111111111111111111111111111111111111111", 2, G_MININT64, G_MAXINT64, -1, 0, 0x7FFFFFFFFFFF);
+	test_nm_utils_ascii_str_to_int64_do ("111111111111111111111111111111111111111111111111111111111111111", 2, G_MININT64, G_MAXINT64, -1, 0, 0x7FFFFFFFFFFFFFFF);
+	test_nm_utils_ascii_str_to_int64_do ("100000000000000000000000000000000000000000000000000000000000000", 2, G_MININT64, G_MAXINT64, -1, 0,  0x4000000000000000);
+	test_nm_utils_ascii_str_to_int64_do ("1000000000000000000000000000000000000000000000000000000000000000", 2, G_MININT64, G_MAXINT64, -1, ERANGE, -1);
+	test_nm_utils_ascii_str_to_int64_do ("-100000000000000000000000000000000000000000000000000000000000000", 2, G_MININT64, G_MAXINT64, -1, 0,  -0x4000000000000000);
+	test_nm_utils_ascii_str_to_int64_do ("111111111111111111111111111111111111111111111111111111111111111",  2, G_MININT64, G_MAXINT64, -1, 0, 0x7FFFFFFFFFFFFFFF);
+	test_nm_utils_ascii_str_to_int64_do ("-100000000000000000000000000000000000000000000000000000000000000",  2, G_MININT64, G_MAXINT64, -1, 0,  -0x4000000000000000);
+	test_nm_utils_ascii_str_to_int64_do ("0x70",  10, G_MININT64, G_MAXINT64, -1, EINVAL, -1);
+	test_nm_utils_ascii_str_to_int64_do ("4711",  0, G_MININT64, G_MAXINT64, -1, 0, 4711);
+	test_nm_utils_ascii_str_to_int64_do ("04711",  0, G_MININT64, G_MAXINT64, -1, 0, 04711);
+	test_nm_utils_ascii_str_to_int64_do ("0x4711",  0, G_MININT64, G_MAXINT64, -1, 0, 0x4711);
+	test_nm_utils_ascii_str_to_int64_do ("080",  0, G_MININT64, G_MAXINT64, -1, EINVAL, -1);
+	test_nm_utils_ascii_str_to_int64_do ("070",  0, G_MININT64, G_MAXINT64, -1, 0, 7*8);
+	test_nm_utils_ascii_str_to_int64_do ("0x70",  0, G_MININT64, G_MAXINT64, -1, 0, 0x70);
+}
+
+/* Reference implementation for nm_utils_ip6_address_clear_host_address.
+ * Taken originally from set_address_masked(), src/rdisc/nm-lndp-rdisc.c
+ **/
+static void
+ip6_address_clear_host_address_reference (struct in6_addr *dst, struct in6_addr *src, guint8 plen)
+{
+	guint nbytes = plen / 8;
+	guint nbits = plen % 8;
+
+	g_return_if_fail (plen <= 128);
+	g_assert (src);
+	g_assert (dst);
+
+	if (plen >= 128)
+		*dst = *src;
+	else {
+		memset (dst, 0, sizeof (*dst));
+		memcpy (dst, src, nbytes);
+		dst->s6_addr[nbytes] = (src->s6_addr[nbytes] & (0xFF << (8 - nbits)));
+	}
+}
+
+static void
+_randomize_in6_addr (struct in6_addr *addr, GRand *rand)
+{
+	int i;
+
+	for (i=0; i < 4; i++)
+		((guint32 *)addr)[i] = g_rand_int (rand);
+}
+
+static void
+test_nm_utils_ip6_address_clear_host_address (void)
+{
+	GRand *rand = g_rand_new ();
+	int plen, i;
+
+	g_rand_set_seed (rand, 0);
+
+	for (plen = 0; plen <= 128; plen++) {
+		for (i =0; i<50; i++) {
+			struct in6_addr addr_src, addr_ref;
+			struct in6_addr addr1, addr2;
+
+			_randomize_in6_addr (&addr_src, rand);
+			_randomize_in6_addr (&addr_ref, rand);
+			_randomize_in6_addr (&addr1, rand);
+			_randomize_in6_addr (&addr2, rand);
+
+			addr1 = addr_src;
+			ip6_address_clear_host_address_reference (&addr_ref, &addr1, plen);
+
+			_randomize_in6_addr (&addr1, rand);
+			_randomize_in6_addr (&addr2, rand);
+			addr1 = addr_src;
+			nm_utils_ip6_address_clear_host_address (&addr2, &addr1, plen);
+			g_assert_cmpint (memcmp (&addr1, &addr_src, sizeof (struct in6_addr)), ==, 0);
+			g_assert_cmpint (memcmp (&addr2, &addr_ref, sizeof (struct in6_addr)), ==, 0);
+
+			/* test for self assignment/inplace update. */
+			_randomize_in6_addr (&addr1, rand);
+			addr1 = addr_src;
+			nm_utils_ip6_address_clear_host_address (&addr1, &addr1, plen);
+			g_assert_cmpint (memcmp (&addr1, &addr_ref, sizeof (struct in6_addr)), ==, 0);
+		}
+	}
+
+	g_rand_free (rand);
+}
+
+/*******************************************/
+
+static NMConnection *
+_match_connection_new (void)
+{
+	NMConnection *connection;
+	NMSettingConnection *s_con;
+	NMSettingWired *s_wired;
+	NMSettingIP4Config *s_ip4;
+	NMSettingIP6Config *s_ip6;
+	char *uuid;
+
+	connection = nm_connection_new ();
+
+	s_con = (NMSettingConnection *) nm_setting_connection_new ();
+	nm_connection_add_setting (connection, (NMSetting *) s_con);
+	uuid = nm_utils_uuid_generate ();
+	g_object_set (G_OBJECT (s_con),
+	              NM_SETTING_CONNECTION_ID, "blahblah",
+	              NM_SETTING_CONNECTION_UUID, uuid,
+	              NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
+	              NM_SETTING_CONNECTION_AUTOCONNECT, FALSE,
+	              NULL);
+	g_free (uuid);
+
+	s_wired = (NMSettingWired *) nm_setting_wired_new ();
+	nm_connection_add_setting (connection, (NMSetting *) s_wired);
+
+	s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+	nm_connection_add_setting (connection, (NMSetting *) s_ip4);
+	g_object_set (G_OBJECT (s_ip4),
+	              NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+	              NULL);
+
+	s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+	nm_connection_add_setting (connection, (NMSetting *) s_ip6);
+	g_object_set (G_OBJECT (s_ip6),
+	              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+	              NULL);
+
+	return connection;
+}
+
+static void
+test_connection_match_basic (void)
+{
+	NMConnection *orig, *copy, *matched;
+	GSList *connections = NULL;
+	NMSettingIP4Config *s_ip4;
+
+	orig = _match_connection_new ();
+	copy = nm_connection_duplicate (orig);
+	connections = g_slist_append (connections, copy);
+
+	matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
+	g_assert (matched == copy);
+
+	/* Now change a material property like IPv4 method and ensure matching fails */
+	s_ip4 = nm_connection_get_setting_ip4_config (orig);
+	g_assert (s_ip4);
+	g_object_set (G_OBJECT (s_ip4),
+	              NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
+	              NULL);
+	matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
+	g_assert (matched == NULL);
+
+	g_slist_free (connections);
+	g_object_unref (orig);
+	g_object_unref (copy);
+}
+
+static void
+test_connection_match_ip6_method (void)
+{
+	NMConnection *orig, *copy, *matched;
+	GSList *connections = NULL;
+	NMSettingIP6Config *s_ip6;
+
+	orig = _match_connection_new ();
+	copy = nm_connection_duplicate (orig);
+	connections = g_slist_append (connections, copy);
+
+	/* Check that if the generated connection is IPv6 method=link-local, and the
+	 * candidate is both method=auto and may-faily=true, that the candidate is
+	 * matched.
+	 */
+	s_ip6 = nm_connection_get_setting_ip6_config (orig);
+	g_assert (s_ip6);
+	g_object_set (G_OBJECT (s_ip6),
+	              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
+	              NULL);
+
+	s_ip6 = nm_connection_get_setting_ip6_config (copy);
+	g_assert (s_ip6);
+	g_object_set (G_OBJECT (s_ip6),
+	              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+	              NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+	              NULL);
+
+	matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
+	g_assert (matched == copy);
+
+	g_slist_free (connections);
+	g_object_unref (orig);
+	g_object_unref (copy);
+}
+
+static void
+test_connection_match_ip6_method_ignore (void)
+{
+	NMConnection *orig, *copy, *matched;
+	GSList *connections = NULL;
+	NMSettingIP6Config *s_ip6;
+
+	orig = _match_connection_new ();
+	copy = nm_connection_duplicate (orig);
+	connections = g_slist_append (connections, copy);
+
+	/* Check that if the generated connection is IPv6 method=link-local, and the
+	 * candidate is method=ignore, that the candidate is matched.
+	 */
+	s_ip6 = nm_connection_get_setting_ip6_config (orig);
+	g_assert (s_ip6);
+	g_object_set (G_OBJECT (s_ip6),
+	              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
+	              NULL);
+
+	s_ip6 = nm_connection_get_setting_ip6_config (copy);
+	g_assert (s_ip6);
+	g_object_set (G_OBJECT (s_ip6),
+	              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+	              NULL);
+
+	matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
+	g_assert (matched == copy);
+
+	g_slist_free (connections);
+	g_object_unref (orig);
+	g_object_unref (copy);
+}
+
+static void
+test_connection_match_ip6_method_ignore_auto (void)
+{
+	NMConnection *orig, *copy, *matched;
+	GSList *connections = NULL;
+	NMSettingIP6Config *s_ip6;
+
+	orig = _match_connection_new ();
+	copy = nm_connection_duplicate (orig);
+	connections = g_slist_append (connections, copy);
+
+	/* Check that if the generated connection is IPv6 method=auto, and the
+	 * candidate is method=ignore, that the candidate is matched.
+	 */
+	s_ip6 = nm_connection_get_setting_ip6_config (orig);
+	g_assert (s_ip6);
+	g_object_set (G_OBJECT (s_ip6),
+	              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+	              NULL);
+
+	s_ip6 = nm_connection_get_setting_ip6_config (copy);
+	g_assert (s_ip6);
+	g_object_set (G_OBJECT (s_ip6),
+	              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+	              NULL);
+
+	matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
+	g_assert (matched == copy);
+
+	g_slist_free (connections);
+	g_object_unref (orig);
+	g_object_unref (copy);
+}
+
+
+static void
+test_connection_match_ip4_method (void)
+{
+	NMConnection *orig, *copy, *matched;
+	GSList *connections = NULL;
+	NMSettingIP4Config *s_ip4;
+
+	orig = _match_connection_new ();
+	copy = nm_connection_duplicate (orig);
+	connections = g_slist_append (connections, copy);
+
+	/* Check that if the generated connection is IPv4 method=disabled, and the
+	 * candidate is both method=auto and may-faily=true, and the device has no
+	 * carrier that the candidate is matched.
+	 */
+	s_ip4 = nm_connection_get_setting_ip4_config (orig);
+	g_assert (s_ip4);
+	g_object_set (G_OBJECT (s_ip4),
+	              NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
+	              NULL);
+
+	s_ip4 = nm_connection_get_setting_ip4_config (copy);
+	g_assert (s_ip4);
+	g_object_set (G_OBJECT (s_ip4),
+	              NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+	              NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+	              NULL);
+
+	matched = nm_utils_match_connection (connections, orig, FALSE, NULL, NULL);
+	g_assert (matched == copy);
+
+	/* Ensure when carrier=true matching fails */
+	matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
+	g_assert (matched == NULL);
+
+	g_slist_free (connections);
+	g_object_unref (orig);
+	g_object_unref (copy);
+}
+
+static void
+test_connection_match_interface_name (void)
+{
+	NMConnection *orig, *copy, *matched;
+	GSList *connections = NULL;
+	NMSettingConnection *s_con;
+
+	orig = _match_connection_new ();
+	copy = nm_connection_duplicate (orig);
+	connections = g_slist_append (connections, copy);
+
+	/* Check that if the generated connection has an interface name and the
+	 * candidate's interface name is NULL, that the candidate is matched.
+	 */
+	s_con = nm_connection_get_setting_connection (orig);
+	g_assert (s_con);
+	g_object_set (G_OBJECT (s_con),
+	              NM_SETTING_CONNECTION_INTERFACE_NAME, "em1",
+	              NULL);
+
+	s_con = nm_connection_get_setting_connection (copy);
+	g_assert (s_con);
+	g_object_set (G_OBJECT (s_con),
+	              NM_SETTING_CONNECTION_INTERFACE_NAME, NULL,
+	              NULL);
+
+	matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
+	g_assert (matched == copy);
+
+	g_slist_free (connections);
+	g_object_unref (orig);
+	g_object_unref (copy);
+}
+
+static void
+test_connection_match_wired (void)
+{
+	NMConnection *orig, *copy, *matched;
+	GSList *connections = NULL;
+	NMSettingWired *s_wired;
+	GPtrArray *subchan_arr = g_ptr_array_sized_new (3);
+	GByteArray *mac;
+
+	g_ptr_array_add (subchan_arr, "0.0.8000");
+	g_ptr_array_add (subchan_arr, "0.0.8001");
+	g_ptr_array_add (subchan_arr, "0.0.8002");
+
+	orig = _match_connection_new ();
+	copy = nm_connection_duplicate (orig);
+	connections = g_slist_append (connections, copy);
+
+	mac = nm_utils_hwaddr_atoba ("52:54:00:ab:db:23", ARPHRD_ETHER);
+	s_wired = nm_connection_get_setting_wired (orig);
+	g_assert (s_wired);
+	g_object_set (G_OBJECT (s_wired),
+	              NM_SETTING_WIRED_PORT, "tp",           /* port is not compared */
+	              NM_SETTING_WIRED_MAC_ADDRESS, mac,     /* we allow MAC address just in one connection */
+	              NM_SETTING_WIRED_S390_SUBCHANNELS, subchan_arr,
+	              NM_SETTING_WIRED_S390_NETTYPE, "qeth",
+	              NULL);
+	g_byte_array_free (mac, TRUE);
+
+	s_wired = nm_connection_get_setting_wired (copy);
+	g_assert (s_wired);
+	g_object_set (G_OBJECT (s_wired),
+	              NM_SETTING_WIRED_S390_SUBCHANNELS, subchan_arr,
+	              NM_SETTING_WIRED_S390_NETTYPE, "qeth",
+	              NULL);
+
+	matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
+	g_assert (matched == copy);
+
+	g_slist_free (connections);
+	g_ptr_array_free (subchan_arr, TRUE);
+	g_object_unref (orig);
+	g_object_unref (copy);
+}
+
+static void
+test_connection_no_match_ip4_addr (void)
+{
+	NMConnection *orig, *copy, *matched;
+	GSList *connections = NULL;
+	NMSettingIP4Config *s_ip4;
+	NMSettingIP6Config *s_ip6;
+	NMIP4Address *nm_addr;
+	guint32 addr, gw;
+
+	orig = _match_connection_new ();
+	copy = nm_connection_duplicate (orig);
+	connections = g_slist_append (connections, copy);
+
+	/* Check that if we have two differences, ipv6.method (exception we allow) and
+	 * ipv4.addresses (which is fatal), we don't match the connections.
+	 */
+	s_ip6 = nm_connection_get_setting_ip6_config (orig);
+	g_assert (s_ip6);
+	g_object_set (G_OBJECT (s_ip6),
+	              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
+	              NULL);
+
+	s_ip6 = nm_connection_get_setting_ip6_config (copy);
+	g_assert (s_ip6);
+	g_object_set (G_OBJECT (s_ip6),
+	              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+	              NULL);
+
+
+	s_ip4 = nm_connection_get_setting_ip4_config (orig);
+	g_assert (s_ip4);
+	g_object_set (G_OBJECT (s_ip4),
+	              NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+	              NULL);
+	nm_addr = nm_ip4_address_new ();
+	inet_pton (AF_INET, "1.1.1.4", &addr);
+	inet_pton (AF_INET, "1.1.1.254", &gw);
+	nm_ip4_address_set_address (nm_addr, addr);
+	nm_ip4_address_set_prefix (nm_addr, 24);
+	nm_ip4_address_set_gateway (nm_addr, gw);
+	nm_setting_ip4_config_add_address (s_ip4, nm_addr);
+	nm_ip4_address_unref (nm_addr);
+
+	s_ip4 = nm_connection_get_setting_ip4_config (copy);
+	g_assert (s_ip4);
+	g_object_set (G_OBJECT (s_ip4),
+	              NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+	              NULL);
+	nm_addr = nm_ip4_address_new ();
+	inet_pton (AF_INET, "2.2.2.4", &addr);
+	inet_pton (AF_INET, "2.2.2.254", &gw);
+	nm_ip4_address_set_address (nm_addr, addr);
+	nm_ip4_address_set_prefix (nm_addr, 24);
+	nm_ip4_address_set_gateway (nm_addr, gw);
+	nm_setting_ip4_config_add_address (s_ip4, nm_addr);
+	nm_ip4_address_unref (nm_addr);
+
+	matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
+	g_assert (matched != copy);
+
+	g_slist_free (connections);
+	g_object_unref (orig);
+	g_object_unref (copy);
+}
+
+/*******************************************/
+
+int
+main (int argc, char **argv)
+{
+	g_test_init (&argc, &argv, NULL);
+
+#if !GLIB_CHECK_VERSION (2, 35, 0)
+	g_type_init ();
+#endif
+
+	g_test_add_func ("/general/nm_utils_ascii_str_to_int64", test_nm_utils_ascii_str_to_int64);
+	g_test_add_func ("/general/nm_utils_ip6_address_clear_host_address", test_nm_utils_ip6_address_clear_host_address);
+
+	g_test_add_func ("/general/connection-match/basic", test_connection_match_basic);
+	g_test_add_func ("/general/connection-match/ip6-method", test_connection_match_ip6_method);
+	g_test_add_func ("/general/connection-match/ip6-method-ignore", test_connection_match_ip6_method_ignore);
+	g_test_add_func ("/general/connection-match/ip6-method-ignore-auto", test_connection_match_ip6_method_ignore_auto);
+	g_test_add_func ("/general/connection-match/ip4-method", test_connection_match_ip4_method);
+	g_test_add_func ("/general/connection-match/con-interface-name", test_connection_match_interface_name);
+	g_test_add_func ("/general/connection-match/wired", test_connection_match_wired);
+	g_test_add_func ("/general/connection-match/no-match-ip4-addr", test_connection_no_match_ip4_addr);
+
+	return g_test_run ();
+}
+
diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c
new file mode 100644
index 00000000..3eee5f13
--- /dev/null
+++ b/src/tests/test-ip4-config.c
@@ -0,0 +1,355 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * 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, 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) 2013 - 2014 Red Hat, Inc.
+ *
+ */
+
+#include <glib.h>
+#include <string.h>
+#include <arpa/inet.h>
+
+#include "nm-ip4-config.h"
+
+static void
+addr_init (NMPlatformIP4Address *a, const char *addr, const char *peer, guint plen)
+{
+	memset (a, 0, sizeof (*a));
+	g_assert (inet_pton (AF_INET, addr, (void *) &a->address) == 1);
+	if (peer)
+		g_assert (inet_pton (AF_INET, peer, (void *) &a->peer_address) == 1);
+	a->plen = plen;
+}
+
+static void
+route_new (NMPlatformIP4Route *route, const char *network, guint plen, const char *gw)
+{
+	guint n;
+
+	g_assert (route);
+	memset (route, 0, sizeof (*route));
+	g_assert (inet_pton (AF_INET, network, (void *) &n) == 1);
+	route->network = n;
+	route->plen = plen;
+	if (gw) {
+		n = 0;
+		g_assert (inet_pton (AF_INET, gw, (void *) &n) == 1);
+		route->gateway = n;
+	}
+}
+
+static guint32
+addr_to_num (const char *addr)
+{
+	guint n;
+
+	g_assert (inet_pton (AF_INET, addr, (void *) &n) == 1);
+	return n;
+}
+
+static NMIP4Config *
+build_test_config (void)
+{
+	NMIP4Config *config;
+	NMPlatformIP4Address addr;
+	NMPlatformIP4Route route;
+
+	/* Build up the config to subtract */
+	config = nm_ip4_config_new ();
+
+	addr_init (&addr, "192.168.1.10", "1.2.3.4", 24);
+	nm_ip4_config_add_address (config, &addr);
+	
+	route_new (&route, "10.0.0.0", 8, "192.168.1.1");
+	nm_ip4_config_add_route (config, &route);
+
+	route_new (&route, "172.16.0.0", 16, "192.168.1.1");
+	nm_ip4_config_add_route (config, &route);
+
+	nm_ip4_config_set_gateway (config, addr_to_num ("192.168.1.1"));
+
+	nm_ip4_config_add_nameserver (config, addr_to_num ("4.2.2.1"));
+	nm_ip4_config_add_nameserver (config, addr_to_num ("4.2.2.2"));
+	nm_ip4_config_add_domain (config, "foobar.com");
+	nm_ip4_config_add_domain (config, "baz.com");
+	nm_ip4_config_add_search (config, "blahblah.com");
+	nm_ip4_config_add_search (config, "beatbox.com");
+
+	nm_ip4_config_add_nis_server (config, addr_to_num ("1.2.3.9"));
+	nm_ip4_config_add_nis_server (config, addr_to_num ("1.2.3.10"));
+
+	nm_ip4_config_add_wins (config, addr_to_num ("4.2.3.9"));
+	nm_ip4_config_add_wins (config, addr_to_num ("4.2.3.10"));
+
+	return config;
+}
+
+static void
+test_subtract (void)
+{
+	NMIP4Config *src, *dst;
+	NMPlatformIP4Address addr;
+	NMPlatformIP4Route route;
+	const NMPlatformIP4Address *test_addr;
+	const NMPlatformIP4Route *test_route;
+	const char *expected_addr = "192.168.1.12";
+	guint32 expected_addr_plen = 24;
+	const char *expected_route_dest = "8.7.6.5";
+	guint32 expected_route_plen = 8;
+	const char *expected_route_next_hop = "192.168.1.1";
+	guint32 expected_ns1 = addr_to_num ("8.8.8.8");
+	guint32 expected_ns2 = addr_to_num ("8.8.8.9");
+	const char *expected_domain = "wonderfalls.com";
+	const char *expected_search = "somewhere.com";
+	guint32 expected_nis = addr_to_num ("1.2.3.13");
+	guint32 expected_wins = addr_to_num ("2.3.4.5");
+	guint32 expected_mss = 1400;
+	guint32 expected_mtu = 1492;
+
+	src = build_test_config ();
+
+	/* add a couple more things to the test config */
+	dst = build_test_config ();
+	addr_init (&addr, expected_addr, NULL, expected_addr_plen);
+	nm_ip4_config_add_address (dst, &addr);
+	
+	route_new (&route, expected_route_dest, expected_route_plen, expected_route_next_hop);
+	nm_ip4_config_add_route (dst, &route);
+
+	nm_ip4_config_add_nameserver (dst, expected_ns1);
+	nm_ip4_config_add_nameserver (dst, expected_ns2);
+	nm_ip4_config_add_domain (dst, expected_domain);
+	nm_ip4_config_add_search (dst, expected_search);
+
+	nm_ip4_config_add_nis_server (dst, expected_nis);
+	nm_ip4_config_add_wins (dst, expected_wins);
+
+	nm_ip4_config_set_mss (dst, expected_mss);
+	nm_ip4_config_set_mtu (dst, expected_mtu);
+
+	nm_ip4_config_subtract (dst, src);
+
+	/* ensure what's left is what we expect */
+	g_assert_cmpuint (nm_ip4_config_get_num_addresses (dst), ==, 1);
+	test_addr = nm_ip4_config_get_address (dst, 0);
+	g_assert (test_addr != NULL);
+	g_assert_cmpuint (test_addr->address, ==, addr_to_num (expected_addr));
+	g_assert_cmpuint (test_addr->peer_address, ==, 0);
+	g_assert_cmpuint (test_addr->plen, ==, expected_addr_plen);
+
+	g_assert_cmpuint (nm_ip4_config_get_gateway (dst), ==, 0);
+
+	g_assert_cmpuint (nm_ip4_config_get_num_routes (dst), ==, 1);
+	test_route = nm_ip4_config_get_route (dst, 0);
+	g_assert (test_route != NULL);
+	g_assert_cmpuint (test_route->network, ==, addr_to_num (expected_route_dest));
+	g_assert_cmpuint (test_route->plen, ==, expected_route_plen);
+	g_assert_cmpuint (test_route->gateway, ==, addr_to_num (expected_route_next_hop));
+
+	g_assert_cmpuint (nm_ip4_config_get_num_nameservers (dst), ==, 2);
+	g_assert_cmpuint (nm_ip4_config_get_nameserver (dst, 0), ==, expected_ns1);
+	g_assert_cmpuint (nm_ip4_config_get_nameserver (dst, 1), ==, expected_ns2);
+
+	g_assert_cmpuint (nm_ip4_config_get_num_domains (dst), ==, 1);
+	g_assert_cmpstr (nm_ip4_config_get_domain (dst, 0), ==, expected_domain);
+	g_assert_cmpuint (nm_ip4_config_get_num_searches (dst), ==, 1);
+	g_assert_cmpstr (nm_ip4_config_get_search (dst, 0), ==, expected_search);
+
+	g_assert_cmpuint (nm_ip4_config_get_num_nis_servers (dst), ==, 1);
+	g_assert_cmpuint (nm_ip4_config_get_nis_server (dst, 0), ==, expected_nis);
+
+	g_assert_cmpuint (nm_ip4_config_get_num_wins (dst), ==, 1);
+	g_assert_cmpuint (nm_ip4_config_get_wins (dst, 0), ==, expected_wins);
+
+	g_assert_cmpuint (nm_ip4_config_get_mss (dst), ==, expected_mss);
+	g_assert_cmpuint (nm_ip4_config_get_mtu (dst), ==, expected_mtu);
+
+	g_object_unref (src);
+	g_object_unref (dst);
+}
+
+static void
+test_compare_with_source (void)
+{
+	NMIP4Config *a, *b;
+	NMPlatformIP4Address addr;
+	NMPlatformIP4Route route;
+
+	a = nm_ip4_config_new ();
+	b = nm_ip4_config_new ();
+
+	/* Address */
+	addr_init (&addr, "1.2.3.4", NULL, 24);
+	addr.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip4_config_add_address (a, &addr);
+
+	addr.source = NM_PLATFORM_SOURCE_VPN;
+	nm_ip4_config_add_address (b, &addr);
+
+	/* Route */
+	route_new (&route, "10.0.0.0", 8, "192.168.1.1");
+	route.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip4_config_add_route (a, &route);
+
+	route.source = NM_PLATFORM_SOURCE_VPN;
+	nm_ip4_config_add_route (b, &route);
+
+	/* Assert that the configs are basically the same, eg that the source is ignored */
+	g_assert (nm_ip4_config_equal (a, b));
+
+	g_object_unref (a);
+	g_object_unref (b);
+}
+
+static void
+test_add_address_with_source (void)
+{
+	NMIP4Config *a;
+	NMPlatformIP4Address addr;
+	const NMPlatformIP4Address *test_addr;
+
+	a = nm_ip4_config_new ();
+
+	/* Test that a higher priority source is not overwritten */
+	addr_init (&addr, "1.2.3.4", NULL, 24);
+	addr.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip4_config_add_address (a, &addr);
+
+	test_addr = nm_ip4_config_get_address (a, 0);
+	g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	addr.source = NM_PLATFORM_SOURCE_VPN;
+	nm_ip4_config_add_address (a, &addr);
+
+	test_addr = nm_ip4_config_get_address (a, 0);
+	g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	/* Test that a lower priority address source is overwritten */
+	nm_ip4_config_del_address (a, 0);
+	addr.source = NM_PLATFORM_SOURCE_KERNEL;
+	nm_ip4_config_add_address (a, &addr);
+
+	test_addr = nm_ip4_config_get_address (a, 0);
+	g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_KERNEL);
+
+	addr.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip4_config_add_address (a, &addr);
+
+	test_addr = nm_ip4_config_get_address (a, 0);
+	g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	g_object_unref (a);
+}
+
+static void
+test_add_route_with_source (void)
+{
+	NMIP4Config *a;
+	NMPlatformIP4Route route;
+	const NMPlatformIP4Route *test_route;
+
+	a = nm_ip4_config_new ();
+
+	/* Test that a higher priority source is not overwritten */
+	route_new (&route, "1.2.3.4", 24, "1.2.3.1");
+	route.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip4_config_add_route (a, &route);
+
+	test_route = nm_ip4_config_get_route (a, 0);
+	g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	route.source = NM_PLATFORM_SOURCE_VPN;
+	nm_ip4_config_add_route (a, &route);
+
+	test_route = nm_ip4_config_get_route (a, 0);
+	g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	/* Test that a lower priority address source is overwritten */
+	nm_ip4_config_del_route (a, 0);
+	route.source = NM_PLATFORM_SOURCE_KERNEL;
+	nm_ip4_config_add_route (a, &route);
+
+	test_route = nm_ip4_config_get_route (a, 0);
+	g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_KERNEL);
+
+	route.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip4_config_add_route (a, &route);
+
+	test_route = nm_ip4_config_get_route (a, 0);
+	g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	g_object_unref (a);
+}
+
+static void
+test_merge_subtract_mss_mtu (void)
+{
+	NMIP4Config *cfg1, *cfg2, *cfg3;
+	guint32 expected_mss2 = 1400;
+	guint32 expected_mtu2 = 1492;
+	guint32 expected_mss3 = 555;
+	guint32 expected_mtu3 = 666;
+
+	cfg1 = build_test_config ();
+	cfg2 = build_test_config ();
+	cfg3 = build_test_config ();
+
+	/* add MSS, MTU to configs to test them */
+	nm_ip4_config_set_mss (cfg2, expected_mss2);
+	nm_ip4_config_set_mtu (cfg2, expected_mtu2);
+	nm_ip4_config_set_mss (cfg3, expected_mss3);
+	nm_ip4_config_set_mtu (cfg3, expected_mtu3);
+
+	nm_ip4_config_merge (cfg1, cfg2);
+	/* ensure MSS and MTU are in cfg1 */
+	g_assert_cmpuint (nm_ip4_config_get_mss (cfg1), ==, expected_mss2);
+	g_assert_cmpuint (nm_ip4_config_get_mtu (cfg1), ==, expected_mtu2);
+
+	nm_ip4_config_merge (cfg1, cfg3);
+	/* ensure again the same MSS and MTU are in cfg1 */
+	g_assert_cmpuint (nm_ip4_config_get_mss (cfg1), ==, expected_mss2);
+	g_assert_cmpuint (nm_ip4_config_get_mtu (cfg1), ==, expected_mtu2);
+
+	nm_ip4_config_subtract (cfg1, cfg2);
+	/* ensure MSS and MTU are zero in cfg1 */
+	g_assert_cmpuint (nm_ip4_config_get_mss (cfg1), ==, 0);
+	g_assert_cmpuint (nm_ip4_config_get_mtu (cfg1), ==, 0);
+
+	g_object_unref (cfg1);
+	g_object_unref (cfg2);
+	g_object_unref (cfg3);
+}
+
+/*******************************************/
+
+int
+main (int argc, char **argv)
+{
+	g_test_init (&argc, &argv, NULL);
+
+#if !GLIB_CHECK_VERSION (2, 35, 0)
+	g_type_init ();
+#endif
+
+	g_test_add_func ("/ip4-config/subtract", test_subtract);
+	g_test_add_func ("/ip4-config/compare-with-source", test_compare_with_source);
+	g_test_add_func ("/ip4-config/add-address-with-source", test_add_address_with_source);
+	g_test_add_func ("/ip4-config/add-route-with-source", test_add_route_with_source);
+	g_test_add_func ("/ip4-config/merge-subtract-mss-mtu", test_merge_subtract_mss_mtu);
+
+	return g_test_run ();
+}
+
diff --git a/src/tests/test-ip6-config.c b/src/tests/test-ip6-config.c
new file mode 100644
index 00000000..75fe28ee
--- /dev/null
+++ b/src/tests/test-ip6-config.c
@@ -0,0 +1,338 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * 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, 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) 2013 Red Hat, Inc.
+ *
+ */
+
+#include <glib.h>
+#include <string.h>
+#include <arpa/inet.h>
+
+#include "nm-ip6-config.h"
+
+#include "nm-logging.h"
+#include "nm-test-utils.h"
+
+static NMIP6Config *
+build_test_config (void)
+{
+	NMIP6Config *config;
+
+	/* Build up the config to subtract */
+	config = nm_ip6_config_new ();
+
+	nm_ip6_config_add_address (config, nmtst_platform_ip6_address ("abcd:1234:4321::cdde", "1:2:3:4::5", 64));
+	nm_ip6_config_add_route (config, nmtst_platform_ip6_route ("abcd:1234:4321::", 24, "abcd:1234:4321:cdde::2"));
+	nm_ip6_config_add_route (config, nmtst_platform_ip6_route ("2001:abba::", 16, "2001:abba::2234"));
+
+	nm_ip6_config_set_gateway (config, nmtst_inet6_from_string ("3001:abba::3234"));
+
+	nm_ip6_config_add_nameserver (config, nmtst_inet6_from_string ("1:2:3:4::1"));
+	nm_ip6_config_add_nameserver (config, nmtst_inet6_from_string ("1:2:3:4::2"));
+	nm_ip6_config_add_domain (config, "foobar.com");
+	nm_ip6_config_add_domain (config, "baz.com");
+	nm_ip6_config_add_search (config, "blahblah.com");
+	nm_ip6_config_add_search (config, "beatbox.com");
+
+	return config;
+}
+
+static void
+test_subtract (void)
+{
+	NMIP6Config *src, *dst;
+	const NMPlatformIP6Address *test_addr;
+	const NMPlatformIP6Route *test_route;
+	const char *expected_addr = "1122:3344:5566::7788";
+	guint32 expected_addr_plen = 96;
+	const char *expected_route_dest = "9991:8882:7773::";
+	guint32 expected_route_plen = 24;
+	const char *expected_route_next_hop = "1119:2228:3337:4446::5555";
+	struct in6_addr expected_ns1;
+	struct in6_addr expected_ns2;
+	const char *expected_domain = "wonderfalls.com";
+	const char *expected_search = "somewhere.com";
+	struct in6_addr tmp;
+
+	src = build_test_config ();
+
+	/* add a couple more things to the test config */
+	dst = build_test_config ();
+	nm_ip6_config_add_address (dst, nmtst_platform_ip6_address (expected_addr, NULL, expected_addr_plen));
+	nm_ip6_config_add_route (dst, nmtst_platform_ip6_route (expected_route_dest, expected_route_plen, expected_route_next_hop));
+
+	expected_ns1 = *nmtst_inet6_from_string ("2222:3333:4444::5555");
+	nm_ip6_config_add_nameserver (dst, &expected_ns1);
+	expected_ns2 = *nmtst_inet6_from_string ("2222:3333:4444::5556");
+	nm_ip6_config_add_nameserver (dst, &expected_ns2);
+
+	nm_ip6_config_add_domain (dst, expected_domain);
+	nm_ip6_config_add_search (dst, expected_search);
+
+	nm_ip6_config_subtract (dst, src);
+
+	/* ensure what's left is what we expect */
+	g_assert_cmpuint (nm_ip6_config_get_num_addresses (dst), ==, 1);
+	test_addr = nm_ip6_config_get_address (dst, 0);
+	g_assert (test_addr != NULL);
+	tmp = *nmtst_inet6_from_string (expected_addr);
+	g_assert (memcmp (&test_addr->address, &tmp, sizeof (tmp)) == 0);
+	g_assert (memcmp (&test_addr->peer_address, &in6addr_any, sizeof (tmp)) == 0);
+	g_assert_cmpuint (test_addr->plen, ==, expected_addr_plen);
+
+	g_assert (nm_ip6_config_get_gateway (dst) == NULL);
+
+	g_assert_cmpuint (nm_ip6_config_get_num_routes (dst), ==, 1);
+	test_route = nm_ip6_config_get_route (dst, 0);
+	g_assert (test_route != NULL);
+
+	tmp = *nmtst_inet6_from_string (expected_route_dest);
+	g_assert (memcmp (&test_route->network, &tmp, sizeof (tmp)) == 0);
+	g_assert_cmpuint (test_route->plen, ==, expected_route_plen);
+	tmp = *nmtst_inet6_from_string  (expected_route_next_hop);
+	g_assert (memcmp (&test_route->gateway, &tmp, sizeof (tmp)) == 0);
+
+	g_assert_cmpuint (nm_ip6_config_get_num_nameservers (dst), ==, 2);
+	g_assert (memcmp (nm_ip6_config_get_nameserver (dst, 0), &expected_ns1, sizeof (expected_ns1)) == 0);
+	g_assert (memcmp (nm_ip6_config_get_nameserver (dst, 1), &expected_ns2, sizeof (expected_ns2)) == 0);
+
+	g_assert_cmpuint (nm_ip6_config_get_num_domains (dst), ==, 1);
+	g_assert_cmpstr (nm_ip6_config_get_domain (dst, 0), ==, expected_domain);
+	g_assert_cmpuint (nm_ip6_config_get_num_searches (dst), ==, 1);
+	g_assert_cmpstr (nm_ip6_config_get_search (dst, 0), ==, expected_search);
+
+	g_object_unref (src);
+	g_object_unref (dst);
+}
+
+static void
+test_compare_with_source (void)
+{
+	NMIP6Config *a, *b;
+	NMPlatformIP6Address addr;
+	NMPlatformIP6Route route;
+
+	a = nm_ip6_config_new ();
+	b = nm_ip6_config_new ();
+
+	/* Address */
+	addr = *nmtst_platform_ip6_address ("1122:3344:5566::7788", NULL, 64);
+	addr.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip6_config_add_address (a, &addr);
+
+	addr.source = NM_PLATFORM_SOURCE_VPN;
+	nm_ip6_config_add_address (b, &addr);
+
+	/* Route */
+	route = *nmtst_platform_ip6_route ("abcd:1234:4321::", 24, "abcd:1234:4321:cdde::2");
+	route.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip6_config_add_route (a, &route);
+
+	route.source = NM_PLATFORM_SOURCE_VPN;
+	nm_ip6_config_add_route (b, &route);
+
+	/* Assert that the configs are basically the same, eg that the source is ignored */
+	g_assert (nm_ip6_config_equal (a, b));
+
+	g_object_unref (a);
+	g_object_unref (b);
+}
+
+static void
+test_add_address_with_source (void)
+{
+	NMIP6Config *a;
+	NMPlatformIP6Address addr;
+	const NMPlatformIP6Address *test_addr;
+
+	a = nm_ip6_config_new ();
+
+	/* Test that a higher priority source is not overwritten */
+	addr = *nmtst_platform_ip6_address ("1122:3344:5566::7788", NULL, 64);
+	addr.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip6_config_add_address (a, &addr);
+
+	test_addr = nm_ip6_config_get_address (a, 0);
+	g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	addr.source = NM_PLATFORM_SOURCE_VPN;
+	nm_ip6_config_add_address (a, &addr);
+
+	test_addr = nm_ip6_config_get_address (a, 0);
+	g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	/* Test that a lower priority address source is overwritten */
+	nm_ip6_config_del_address (a, 0);
+	addr.source = NM_PLATFORM_SOURCE_KERNEL;
+	nm_ip6_config_add_address (a, &addr);
+
+	test_addr = nm_ip6_config_get_address (a, 0);
+	g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_KERNEL);
+
+	addr.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip6_config_add_address (a, &addr);
+
+	test_addr = nm_ip6_config_get_address (a, 0);
+	g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	g_object_unref (a);
+}
+
+static void
+test_add_route_with_source (void)
+{
+	NMIP6Config *a;
+	NMPlatformIP6Route route;
+	const NMPlatformIP6Route *test_route;
+
+	a = nm_ip6_config_new ();
+
+	/* Test that a higher priority source is not overwritten */
+	route = *nmtst_platform_ip6_route ("abcd:1234:4321::", 24, "abcd:1234:4321:cdde::2");
+	route.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip6_config_add_route (a, &route);
+
+	test_route = nm_ip6_config_get_route (a, 0);
+	g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	route.source = NM_PLATFORM_SOURCE_VPN;
+	nm_ip6_config_add_route (a, &route);
+
+	test_route = nm_ip6_config_get_route (a, 0);
+	g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	/* Test that a lower priority address source is overwritten */
+	nm_ip6_config_del_route (a, 0);
+	route.source = NM_PLATFORM_SOURCE_KERNEL;
+	nm_ip6_config_add_route (a, &route);
+
+	test_route = nm_ip6_config_get_route (a, 0);
+	g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_KERNEL);
+
+	route.source = NM_PLATFORM_SOURCE_USER;
+	nm_ip6_config_add_route (a, &route);
+
+	test_route = nm_ip6_config_get_route (a, 0);
+	g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+
+	g_object_unref (a);
+}
+
+static void
+test_nm_ip6_config_addresses_sort_check (NMIP6Config *config, NMSettingIP6ConfigPrivacy use_tempaddr, int repeat)
+{
+	int addr_count = nm_ip6_config_get_num_addresses (config);
+	int i, irepeat;
+	NMIP6Config *copy = nmtst_ip6_config_clone (config);
+	NMIP6Config *copy2 = nmtst_ip6_config_clone (config);
+	int *idx = g_new (int, addr_count);
+
+	/* initialize the array of indeces, and keep shuffling them for every @repeat iteration. */
+	for (i = 0; i < addr_count; i++)
+		idx[i] = i;
+
+	for (irepeat = 0; irepeat < repeat; irepeat++) {
+		/* randomly shuffle the addresses. */
+		nm_ip6_config_reset_addresses (copy);
+		for (i = 0; i < addr_count; i++) {
+			int j = g_rand_int_range (nmtst_get_rand (), i, addr_count);
+
+			NMTST_SWAP (idx[i], idx[j]);
+			nm_ip6_config_add_address (copy, nm_ip6_config_get_address (config, idx[i]));
+		}
+
+		/* reorder them again */
+		nm_ip6_config_addresses_sort (copy, use_tempaddr);
+
+		/* check equality using nm_ip6_config_equal() */
+		if (!nm_ip6_config_equal (copy, config)) {
+			g_message ("%s", "SORTING yields unexpected output:");
+			for (i = 0; i < addr_count; i++) {
+				g_message ("   >> [%d] = %s", i, nm_platform_ip6_address_to_string (nm_ip6_config_get_address (config, i)));
+				g_message ("   << [%d] = %s", i, nm_platform_ip6_address_to_string (nm_ip6_config_get_address (copy, i)));
+			}
+			g_assert_not_reached ();
+		}
+
+		/* also check equality using nm_ip6_config_replace() */
+		g_assert (nm_ip6_config_replace (copy2, copy, NULL) == FALSE);
+	}
+
+	g_free (idx);
+	g_object_unref (copy);
+	g_object_unref (copy2);
+}
+
+static void
+test_nm_ip6_config_addresses_sort (void)
+{
+	NMIP6Config *config = build_test_config ();
+
+#define ADDR_ADD(...) nm_ip6_config_add_address (config, nmtst_platform_ip6_address_full (__VA_ARGS__))
+
+	nm_ip6_config_reset_addresses (config);
+	ADDR_ADD("2607:f0d0:1002:51::4",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, 0);
+	ADDR_ADD("2607:f0d0:1002:51::5",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, 0);
+	ADDR_ADD("2607:f0d0:1002:51::6",     NULL,  64, 0, NM_PLATFORM_SOURCE_RDISC,  0, 0, 0, IFA_F_MANAGETEMPADDR);
+	ADDR_ADD("2607:f0d0:1002:51::3",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, IFA_F_SECONDARY);
+	ADDR_ADD("2607:f0d0:1002:51::8",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, IFA_F_SECONDARY);
+	ADDR_ADD("2607:f0d0:1002:51::0",     NULL,  64, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, IFA_F_SECONDARY);
+	ADDR_ADD("fec0::1",                  NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
+	ADDR_ADD("fe80::208:74ff:feda:625c", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
+	ADDR_ADD("fe80::208:74ff:feda:625d", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
+	ADDR_ADD("::1",                      NULL, 128, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, 0);
+	ADDR_ADD("2607:f0d0:1002:51::2",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, IFA_F_TENTATIVE);
+	test_nm_ip6_config_addresses_sort_check (config, NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN, 8);
+	test_nm_ip6_config_addresses_sort_check (config, NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED, 8);
+	test_nm_ip6_config_addresses_sort_check (config, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR, 8);
+
+	nm_ip6_config_reset_addresses (config);
+	ADDR_ADD("2607:f0d0:1002:51::3",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, IFA_F_SECONDARY);
+	ADDR_ADD("2607:f0d0:1002:51::4",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, 0);
+	ADDR_ADD("2607:f0d0:1002:51::5",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, 0);
+	ADDR_ADD("2607:f0d0:1002:51::8",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, IFA_F_SECONDARY);
+	ADDR_ADD("2607:f0d0:1002:51::0",     NULL,  64, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, IFA_F_SECONDARY);
+	ADDR_ADD("2607:f0d0:1002:51::6",     NULL,  64, 0, NM_PLATFORM_SOURCE_RDISC,  0, 0, 0, IFA_F_MANAGETEMPADDR);
+	ADDR_ADD("fec0::1",                  NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
+	ADDR_ADD("fe80::208:74ff:feda:625c", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
+	ADDR_ADD("fe80::208:74ff:feda:625d", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
+	ADDR_ADD("::1",                      NULL, 128, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, 0);
+	ADDR_ADD("2607:f0d0:1002:51::2",     NULL,  64, 0, NM_PLATFORM_SOURCE_USER,   0, 0, 0, IFA_F_TENTATIVE);
+	test_nm_ip6_config_addresses_sort_check (config, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR, 8);
+
+#undef ADDR_ADD
+	g_object_unref (config);
+}
+
+/*******************************************/
+
+NMTST_DEFINE();
+
+int
+main (int argc, char **argv)
+{
+	nmtst_init_with_logging (&argc, &argv, NULL, "ALL");
+
+	g_test_add_func ("/ip6-config/subtract", test_subtract);
+	g_test_add_func ("/ip6-config/compare-with-source", test_compare_with_source);
+	g_test_add_func ("/ip6-config/add-address-with-source", test_add_address_with_source);
+	g_test_add_func ("/ip6-config/add-route-with-source", test_add_route_with_source);
+	g_test_add_func ("/ip6-config/test_nm_ip6_config_addresses_sort", test_nm_ip6_config_addresses_sort);
+
+	return g_test_run ();
+}
+
diff --git a/src/tests/test-policy-hosts.c b/src/tests/test-policy-hosts.c
deleted file mode 100644
index 68175890..00000000
--- a/src/tests/test-policy-hosts.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/*
- * 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, 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) 2010 Red Hat, Inc.
- *
- */
-
-#include <glib.h>
-#include <string.h>
-
-#include "nm-policy-hosts.h"
-
-#define DEBUG 0
-
-static void
-test_generic (const char *before, const char *after)
-{
-	GString *newc;
-
-	/* Get the new /etc/hosts contents */
-	newc = nm_policy_get_etc_hosts (before, strlen (before));
-
-	if (after == NULL) {
-		/* No change to /etc/hosts required */
-#if DEBUG
-		if (newc != NULL) {
-			g_message ("\n- NEW ---------------------------------\n"
-			           "%s"
-			           "+ EXPECTED NONE +++++++++++++++++++++++++\n",
-			           newc->str);
-		}
-#endif
-		g_assert (newc == NULL);
-	} else {
-		g_assert (newc != NULL);
-
-#if DEBUG
-		g_message ("\n- NEW ---------------------------------\n"
-		           "%s"
-		           "+ EXPECTED ++++++++++++++++++++++++++++++\n"
-		           "%s"
-		           "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
-		           newc->str, after);
-#endif
-		g_assert (strcmp (newc->str, after) == 0);
-		g_string_free (newc, TRUE);
-	}
-}
-
-/*******************************************/
-
-static const char *generic_before = \
-	"# Do not remove the following line, or various programs\n"
-	"# that require network functionality will fail.\n"
-	"127.0.0.1	localhost.localdomain localhost\n"
-	"::1		localhost6.localdomain6 localhost6\n"
-	"127.0.0.1	lcmd.us.intellitxt.com\n";
-
-static void
-test_hosts_generic (void)
-{
-	test_generic (generic_before, NULL);
-}
-
-/*******************************************/
-
-static const char *generic_no_boilerplate_before = \
-	"127.0.0.1	localhost.localdomain localhost\n"
-	"::1		localhost6.localdomain6 localhost6\n"
-	"127.0.0.1	lcmd.us.intellitxt.com\n";
-
-static void
-test_hosts_generic_no_boilerplate (void)
-{
-	test_generic (generic_no_boilerplate_before, NULL);
-}
-
-/*******************************************/
-
-static const char *leftover_before = \
-	"# Do not remove the following line, or various programs\n"
-	"# that require network functionality will fail.\n"
-	"192.168.1.2	comet	# Added by NetworkManager\n"
-	"127.0.0.1	localhost.localdomain	localhost\n"
-	"::1	localhost6.localdomain6	localhost6\n"
-	"192.168.1.3	comet\n"
-	"3001:abba::3234	comet\n"
-	"\n"
-	"127.0.0.1	lcmd.us.intellitxt.com\n";
-
-static const char *leftover_after = \
-	"# Do not remove the following line, or various programs\n"
-	"# that require network functionality will fail.\n"
-	"127.0.0.1	localhost.localdomain	localhost\n"
-	"::1	localhost6.localdomain6	localhost6\n"
-	"192.168.1.3	comet\n"
-	"3001:abba::3234	comet\n"
-	"\n"
-	"127.0.0.1	lcmd.us.intellitxt.com\n";
-
-static void
-test_hosts_leftover (void)
-{
-	test_generic (leftover_before, leftover_after);
-}
-
-/*******************************************/
-
-static const char *leftover_double_newline_before = \
-	"# Do not remove the following line, or various programs\n"
-	"# that require network functionality will fail.\n"
-	"192.168.1.2	comet	# Added by NetworkManager\n"
-	"127.0.0.1	localhost.localdomain	localhost\n"
-	"::1	localhost6.localdomain6	localhost6\n"
-	"192.168.1.3	comet\n"
-	"3001:abba::3234	comet\n"
-	"\n"
-	"127.0.0.1	lcmd.us.intellitxt.com\n"
-	"\n";
-
-static const char *leftover_double_newline_after = \
-	"# Do not remove the following line, or various programs\n"
-	"# that require network functionality will fail.\n"
-	"127.0.0.1	localhost.localdomain	localhost\n"
-	"::1	localhost6.localdomain6	localhost6\n"
-	"192.168.1.3	comet\n"
-	"3001:abba::3234	comet\n"
-	"\n"
-	"127.0.0.1	lcmd.us.intellitxt.com\n"
-	"\n";
-
-static void
-test_hosts_leftover_double_newline (void)
-{
-	test_generic (leftover_double_newline_before, leftover_double_newline_after);
-}
-
-/*******************************************/
-
-#if GLIB_CHECK_VERSION(2,25,12)
-typedef GTestFixtureFunc TCFunc;
-#else
-typedef void (*TCFunc)(void);
-#endif
-
-#define TESTCASE(t, d) g_test_create_case (#t, 0, d, NULL, (TCFunc) t, NULL)
-
-int main (int argc, char **argv)
-{
-	GTestSuite *suite;
-
-	g_test_init (&argc, &argv, NULL);
-
-	suite = g_test_get_root ();
-
-	g_test_suite_add (suite, TESTCASE (test_hosts_generic, NULL));
-	g_test_suite_add (suite, TESTCASE (test_hosts_generic_no_boilerplate, NULL));
-	g_test_suite_add (suite, TESTCASE (test_hosts_leftover, NULL));
-	g_test_suite_add (suite, TESTCASE (test_hosts_leftover_double_newline, NULL));
-
-	return g_test_run ();
-}
-
diff --git a/src/tests/test-resolvconf-capture.c b/src/tests/test-resolvconf-capture.c
new file mode 100644
index 00000000..cde4bbe5
--- /dev/null
+++ b/src/tests/test-resolvconf-capture.c
@@ -0,0 +1,226 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * 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, 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) 2013 Red Hat, Inc.
+ *
+ */
+
+#include <glib.h>
+#include <string.h>
+
+#include "NetworkManagerUtils.h"
+#include "nm-platform.h"
+
+static void
+test_capture_empty (void)
+{
+	GArray *ns4 = g_array_new (FALSE, FALSE, sizeof (guint32));
+	GArray *ns6 = g_array_new (FALSE, FALSE, sizeof (struct in6_addr));
+
+	g_assert (nm_ip4_config_capture_resolv_conf (ns4, "") == FALSE);
+	g_assert_cmpint (ns4->len, ==, 0);
+
+	g_assert (nm_ip6_config_capture_resolv_conf (ns6, "") == FALSE);
+	g_assert_cmpint (ns6->len, ==, 0);
+
+	g_array_free (ns4, TRUE);
+	g_array_free (ns6, TRUE);
+}
+
+static void
+assert_dns4_entry (const GArray *a, guint i, const char *s)
+{
+	guint32 n, m;
+
+	g_assert (inet_aton (s, (void *) &n) != 0);
+	m = g_array_index (a, guint32, i);
+	g_assert_cmpint (m, ==, n);
+}
+
+static void
+assert_dns6_entry (const GArray *a, guint i, const char *s)
+{
+	struct in6_addr n = IN6ADDR_ANY_INIT;
+	struct in6_addr *m;
+
+	g_assert (inet_pton (AF_INET6, s, (void *) &n) == 1);
+	m = &g_array_index (a, struct in6_addr, i);
+	g_assert (IN6_ARE_ADDR_EQUAL (&n, m));
+}
+
+static void
+test_capture_basic4 (void)
+{
+	GArray *ns4 = g_array_new (FALSE, FALSE, sizeof (guint32));
+	const char *rc =
+"# neato resolv.conf\r\n"
+"domain foobar.com\r\n"
+"search foobar.com\r\n"
+"nameserver 4.2.2.1\r\n"
+"nameserver 4.2.2.2\r\n";
+
+	g_assert (nm_ip4_config_capture_resolv_conf (ns4, rc));
+	g_assert_cmpint (ns4->len, ==, 2);
+	assert_dns4_entry (ns4, 0, "4.2.2.1");
+	assert_dns4_entry (ns4, 1, "4.2.2.2");
+
+	g_array_free (ns4, TRUE);
+}
+
+static void
+test_capture_dup4 (void)
+{
+	GArray *ns4 = g_array_new (FALSE, FALSE, sizeof (guint32));
+	const char *rc =
+"# neato resolv.conf\r\n"
+"domain foobar.com\r\n"
+"search foobar.com\r\n"
+"nameserver 4.2.2.1\r\n"
+"nameserver 4.2.2.1\r\n"
+"nameserver 4.2.2.2\r\n";
+
+	/* Check that duplicates are ignored */
+	g_assert (nm_ip4_config_capture_resolv_conf (ns4, rc));
+	g_assert_cmpint (ns4->len, ==, 2);
+	assert_dns4_entry (ns4, 0, "4.2.2.1");
+	assert_dns4_entry (ns4, 1, "4.2.2.2");
+
+	g_array_free (ns4, TRUE);
+}
+
+static void
+test_capture_basic6 (void)
+{
+	GArray *ns6 = g_array_new (FALSE, FALSE, sizeof (struct in6_addr));
+	const char *rc =
+"# neato resolv.conf\r\n"
+"domain foobar.com\r\n"
+"search foobar.com\r\n"
+"nameserver 2001:4860:4860::8888\r\n"
+"nameserver 2001:4860:4860::8844\r\n";
+
+	g_assert (nm_ip6_config_capture_resolv_conf (ns6, rc));
+	g_assert_cmpint (ns6->len, ==, 2);
+	assert_dns6_entry (ns6, 0, "2001:4860:4860::8888");
+	assert_dns6_entry (ns6, 1, "2001:4860:4860::8844");
+
+	g_array_free (ns6, TRUE);
+}
+
+static void
+test_capture_dup6 (void)
+{
+	GArray *ns6 = g_array_new (FALSE, FALSE, sizeof (struct in6_addr));
+	const char *rc =
+"# neato resolv.conf\r\n"
+"domain foobar.com\r\n"
+"search foobar.com\r\n"
+"nameserver 2001:4860:4860::8888\r\n"
+"nameserver 2001:4860:4860::8888\r\n"
+"nameserver 2001:4860:4860::8844\r\n";
+
+	/* Check that duplicates are ignored */
+	g_assert (nm_ip6_config_capture_resolv_conf (ns6, rc));
+	g_assert_cmpint (ns6->len, ==, 2);
+	assert_dns6_entry (ns6, 0, "2001:4860:4860::8888");
+	assert_dns6_entry (ns6, 1, "2001:4860:4860::8844");
+
+	g_array_free (ns6, TRUE);
+}
+
+static void
+test_capture_addr4_with_6 (void)
+{
+	GArray *ns4 = g_array_new (FALSE, FALSE, sizeof (guint32));
+	const char *rc =
+"# neato resolv.conf\r\n"
+"domain foobar.com\r\n"
+"search foobar.com\r\n"
+"nameserver 4.2.2.1\r\n"
+"nameserver 4.2.2.2\r\n"
+"nameserver 2001:4860:4860::8888\r\n";
+
+	g_assert (nm_ip4_config_capture_resolv_conf (ns4, rc));
+	g_assert_cmpint (ns4->len, ==, 2);
+	assert_dns4_entry (ns4, 0, "4.2.2.1");
+	assert_dns4_entry (ns4, 1, "4.2.2.2");
+
+	g_array_free (ns4, TRUE);
+}
+
+static void
+test_capture_addr6_with_4 (void)
+{
+	GArray *ns6 = g_array_new (FALSE, FALSE, sizeof (struct in6_addr));
+	const char *rc =
+"# neato resolv.conf\r\n"
+"domain foobar.com\r\n"
+"search foobar.com\r\n"
+"nameserver 4.2.2.1\r\n"
+"nameserver 2001:4860:4860::8888\r\n"
+"nameserver 2001:4860:4860::8844\r\n";
+
+	g_assert (nm_ip6_config_capture_resolv_conf (ns6, rc));
+	g_assert_cmpint (ns6->len, ==, 2);
+	assert_dns6_entry (ns6, 0, "2001:4860:4860::8888");
+	assert_dns6_entry (ns6, 1, "2001:4860:4860::8844");
+
+	g_array_free (ns6, TRUE);
+}
+
+static void
+test_capture_format (void)
+{
+	GArray *ns4 = g_array_new (FALSE, FALSE, sizeof (guint32));
+	const char *rc =
+" nameserver 4.2.2.1\r\n"     /* bad */
+"nameserver4.2.2.1\r\n"       /* bad */
+"nameserver     4.2.2.3\r"  /* good */
+"nameserver\t\t4.2.2.4\r\n"   /* good */
+"nameserver  4.2.2.5\t\t\r\n"; /* good */
+
+	g_assert (nm_ip4_config_capture_resolv_conf (ns4, rc));
+	g_assert_cmpint (ns4->len, ==, 3);
+	assert_dns4_entry (ns4, 0, "4.2.2.3");
+	assert_dns4_entry (ns4, 1, "4.2.2.4");
+	assert_dns4_entry (ns4, 2, "4.2.2.5");
+
+	g_array_free (ns4, TRUE);
+}
+
+/*******************************************/
+
+int
+main (int argc, char **argv)
+{
+	g_test_init (&argc, &argv, NULL);
+
+#if !GLIB_CHECK_VERSION (2,35,0)
+	g_type_init ();
+#endif
+
+	g_test_add_func ("/resolvconf-capture/empty", test_capture_empty);
+	g_test_add_func ("/resolvconf-capture/basic4", test_capture_basic4);
+	g_test_add_func ("/resolvconf-capture/dup4", test_capture_dup4);
+	g_test_add_func ("/resolvconf-capture/basic6", test_capture_basic6);
+	g_test_add_func ("/resolvconf-capture/dup6", test_capture_dup6);
+	g_test_add_func ("/resolvconf-capture/addr4-with-6", test_capture_addr4_with_6);
+	g_test_add_func ("/resolvconf-capture/addr6-with-4", test_capture_addr6_with_4);
+	g_test_add_func ("/resolvconf-capture/format", test_capture_format);
+
+	return g_test_run ();
+}
+
diff --git a/src/tests/test-wifi-ap-utils.c b/src/tests/test-wifi-ap-utils.c
deleted file mode 100644
index faa023fc..00000000
--- a/src/tests/test-wifi-ap-utils.c
+++ /dev/null
@@ -1,1440 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/*
- * 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, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright (C) 2011 Red Hat, Inc.
- *
- */
-
-#include <glib.h>
-#include <string.h>
-
-#include "nm-wifi-ap-utils.h"
-#include "nm-dbus-glib-types.h"
-
-#include "nm-setting-connection.h"
-#include "nm-setting-wireless.h"
-#include "nm-setting-wireless-security.h"
-#include "nm-setting-8021x.h"
-
-#define DEBUG 1
-
-/*******************************************/
-
-#define COMPARE(src, expected, success, error, edomain, ecode) \
-{ \
-	if (expected) { \
-		if (!success) { \
-			g_assert (error != NULL); \
-			g_warning ("Failed to complete connection: (%d) %s", error->code, error->message); \
-		} \
-		g_assert (success == TRUE); \
-		g_assert (error == NULL); \
-\
-		success = nm_connection_compare (src, expected, NM_SETTING_COMPARE_FLAG_EXACT); \
-		if (success == FALSE && DEBUG) { \
-			g_message ("\n- COMPLETED ---------------------------------\n"); \
-			nm_connection_dump (src); \
-			g_message ("+ EXPECTED ++++++++++++++++++++++++++++++++++++\n"); \
-			nm_connection_dump (expected); \
-			g_message ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"); \
-		} \
-		g_assert (success == TRUE); \
-	} else { \
-		if (success) { \
-			g_message ("\n- COMPLETED ---------------------------------\n"); \
-			nm_connection_dump (src); \
-		} \
-		g_assert (success == FALSE); \
-		g_assert_error (error, edomain, ecode); \
-	} \
- \
-	g_clear_error (&error); \
-}
-
-static gboolean
-complete_connection (const char *ssid,
-                     const guint8 bssid[ETH_ALEN],
-                     NM80211Mode mode,
-                     guint32 flags,
-                     guint32 wpa_flags,
-                     guint32 rsn_flags,
-                     gboolean lock_bssid,
-                     NMConnection *src,
-                     GError **error)
-{
-	GByteArray *tmp;
-	gboolean success;
-	NMSettingWireless *s_wifi;
-
-	/* Add a wifi setting if one doesn't exist */
-	s_wifi = nm_connection_get_setting_wireless (src);
-	if (!s_wifi) {
-		s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
-		nm_connection_add_setting (src, NM_SETTING (s_wifi));
-	}
-
-	tmp = g_byte_array_sized_new (strlen (ssid));
-	g_byte_array_append (tmp, (const guint8 *) ssid, strlen (ssid));
-
-	success = nm_ap_utils_complete_connection (tmp,
-	                                           bssid,
-	                                           mode,
-	                                           flags,
-	                                           wpa_flags,
-	                                           rsn_flags,
-	                                           src,
-	                                           lock_bssid,
-	                                           error);
-	g_byte_array_free (tmp, TRUE);
-	return success;
-}
-
-typedef struct {
-	const char *key;
-	const char *str;
-	guint32     uint;
-} KeyData;
-
-static void
-set_items (NMSetting *setting, const KeyData *items)
-{
-	const KeyData *item;
-	GParamSpec *pspec;
-	GByteArray *tmp;
-
-	for (item = items; item && item->key; item++) {
-		g_assert (item->key);
-		pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), item->key);
-		g_assert (pspec);
-
-		if (pspec->value_type == G_TYPE_STRING) {
-			g_assert (item->uint == 0);
-			if (item->str)
-				g_object_set (G_OBJECT (setting), item->key, item->str, NULL);
-		} else if (pspec->value_type == G_TYPE_UINT) {
-			g_assert (item->str == NULL);
-			g_object_set (G_OBJECT (setting), item->key, item->uint, NULL);
-		} else if (pspec->value_type == G_TYPE_INT) {
-			gint foo = (gint) item->uint;
-
-			g_assert (item->str == NULL);
-			g_object_set (G_OBJECT (setting), item->key, foo, NULL);
-		} else if (pspec->value_type == G_TYPE_BOOLEAN) {
-			gboolean foo = !! (item->uint);
-
-			g_assert (item->str == NULL);
-			g_object_set (G_OBJECT (setting), item->key, foo, NULL);
-		} else if (pspec->value_type == DBUS_TYPE_G_UCHAR_ARRAY) {
-			g_assert (item->str);
-			tmp = g_byte_array_sized_new (strlen (item->str));
-			g_byte_array_append (tmp, (const guint8 *) item->str, strlen (item->str));
-			g_object_set (G_OBJECT (setting), item->key, tmp, NULL);
-			g_byte_array_free (tmp, TRUE);
-		} else {
-			/* Special types, check based on property name */
-			if (!strcmp (item->key, NM_SETTING_WIRELESS_SECURITY_PROTO))
-				nm_setting_wireless_security_add_proto (NM_SETTING_WIRELESS_SECURITY (setting), item->str);
-			else if (!strcmp (item->key, NM_SETTING_WIRELESS_SECURITY_PAIRWISE))
-				nm_setting_wireless_security_add_pairwise (NM_SETTING_WIRELESS_SECURITY (setting), item->str);
-			else if (!strcmp (item->key, NM_SETTING_WIRELESS_SECURITY_GROUP))
-				nm_setting_wireless_security_add_group (NM_SETTING_WIRELESS_SECURITY (setting), item->str);
-			else if (!strcmp (item->key, NM_SETTING_802_1X_EAP))
-				nm_setting_802_1x_add_eap_method (NM_SETTING_802_1X (setting), item->str);
-		}
-	}
-}
-
-static NMSettingWireless *
-fill_wifi_empty (NMConnection *connection)
-{
-	NMSettingWireless *s_wifi;
-
-	s_wifi = nm_connection_get_setting_wireless (connection);
-	if (!s_wifi) {
-		s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
-		nm_connection_add_setting (connection, NM_SETTING (s_wifi));
-	}
-	return s_wifi;
-}
-
-static NMSettingWireless *
-fill_wifi (NMConnection *connection, const KeyData items[])
-{
-	NMSettingWireless *s_wifi;
-
-	s_wifi = nm_connection_get_setting_wireless (connection);
-	if (!s_wifi) {
-		s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
-		nm_connection_add_setting (connection, NM_SETTING (s_wifi));
-	}
-
-	set_items (NM_SETTING (s_wifi), items);
-	return s_wifi;
-}
-
-static NMSettingWirelessSecurity *
-fill_wsec (NMConnection *connection, const KeyData items[])
-{
-	NMSettingWirelessSecurity *s_wsec;
-
-	s_wsec = nm_connection_get_setting_wireless_security (connection);
-	if (!s_wsec) {
-		s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
-		nm_connection_add_setting (connection, NM_SETTING (s_wsec));
-	}
-
-	set_items (NM_SETTING (s_wsec), items);
-	return s_wsec;
-}
-
-static NMSetting8021x *
-fill_8021x (NMConnection *connection, const KeyData items[])
-{
-	NMSetting8021x *s_8021x;
-
-	s_8021x = nm_connection_get_setting_802_1x (connection);
-	if (!s_8021x) {
-		s_8021x = (NMSetting8021x *) nm_setting_802_1x_new ();
-		nm_connection_add_setting (connection, NM_SETTING (s_8021x));
-	}
-
-	set_items (NM_SETTING (s_8021x), items);
-	return s_8021x;
-}
-
-static NMConnection *
-create_basic (const char *ssid,
-              const guint8 *bssid,
-              NM80211Mode mode,
-              gboolean set_security)
-{
-	NMConnection *connection;
-	NMSettingWireless *s_wifi = NULL;
-	GByteArray *tmp;
-
-	connection = nm_connection_new ();
-
-	s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
-	nm_connection_add_setting (connection, NM_SETTING (s_wifi));
-
-	/* SSID */
-	tmp = g_byte_array_sized_new (strlen (ssid));
-	g_byte_array_append (tmp, (const guint8 *) ssid, strlen (ssid));
-	g_object_set (G_OBJECT (s_wifi), NM_SETTING_WIRELESS_SSID, tmp, NULL);
-	g_byte_array_free (tmp, TRUE);
-
-	/* BSSID */
-	if (bssid) {
-		tmp = g_byte_array_sized_new (ETH_ALEN);
-		g_byte_array_append (tmp, bssid, ETH_ALEN);
-		g_object_set (G_OBJECT (s_wifi), NM_SETTING_WIRELESS_BSSID, tmp, NULL);
-		g_byte_array_free (tmp, TRUE);
-	}
-
-	if (mode == NM_802_11_MODE_INFRA)
-		g_object_set (G_OBJECT (s_wifi), NM_SETTING_WIRELESS_MODE, "infrastructure", NULL);
-	else if (mode == NM_802_11_MODE_ADHOC)
-		g_object_set (G_OBJECT (s_wifi), NM_SETTING_WIRELESS_MODE, "adhoc", NULL);
-	else
-		g_assert_not_reached ();
-
-	if (set_security)
-		g_object_set (G_OBJECT (s_wifi), NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NULL);
-
-	return connection;
-}
-
-/*******************************************/
-
-static void
-test_lock_bssid (void)
-{
-	NMConnection *src, *expected;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const char *ssid = "blahblah";
-	gboolean success;
-	GError *error = NULL;
-
-	src = nm_connection_new ();
-	success = complete_connection (ssid, bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_NONE,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               TRUE,
-	                               src, &error);
-	expected = create_basic (ssid, bssid, NM_802_11_MODE_INFRA, FALSE);
-	COMPARE (src, expected, success, error, 0, 0);
-
-	g_object_unref (src);
-	g_object_unref (expected);
-}
-
-/*******************************************/
-
-static void
-test_open_ap_empty_connection (void)
-{
-	NMConnection *src, *expected;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const char *ssid = "blahblah";
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that an empty source connection is correctly filled with the
-	 * SSID and Infra modes of the given AP details.
-	 */
-
-	src = nm_connection_new ();
-	success = complete_connection (ssid, bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_NONE,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-	expected = create_basic (ssid, NULL, NM_802_11_MODE_INFRA, FALSE);
-	COMPARE (src, expected, success, error, 0, 0);
-
-	g_object_unref (src);
-	g_object_unref (expected);
-}
-
-/*******************************************/
-
-static void
-test_open_ap_leap_connection_1 (gboolean add_wifi)
-{
-	NMConnection *src;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_wsec[] = { { NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, "Bill Smith", 0 }, { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that a basic connection filled with a LEAP username is
-	 * rejected when completion is attempted with an open AP.  LEAP requires
-	 * the AP to have the Privacy bit set.
-	 */
-
-	src = nm_connection_new ();
-	if (add_wifi)
-		fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-
-	success = complete_connection ("blahblah", bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_NONE,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-	/* We expect failure */
-	COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_open_ap_leap_connection_2 (void)
-{
-	NMConnection *src;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_wsec[] = { { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 }, { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that a basic connection specifying IEEE8021x security (ie, Dynamic
-	 * WEP or LEAP) is rejected when completion is attempted with an open AP.
-	 */
-
-	src = nm_connection_new ();
-	fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-
-	success = complete_connection ("blahblah", bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_NONE,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-	/* We expect failure */
-	COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_open_ap_wep_connection (gboolean add_wifi)
-{
-	NMConnection *src;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, "11111111111111111111111111", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, NULL, 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that a static WEP connection is rejected when completion is
-	 * attempted with an open AP.
-	 */
-
-	src = nm_connection_new ();
-	if (add_wifi)
-		fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	success = complete_connection ("blahblah", bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_NONE,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-	/* We expect failure */
-	COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_ap_wpa_psk_connection_base (const char *key_mgmt,
-                                 const char *auth_alg,
-                                 guint32 flags,
-                                 guint32 wpa_flags,
-                                 guint32 rsn_flags,
-                                 gboolean add_wifi,
-                                 NMConnection *expected)
-{
-	NMConnection *src;
-	const char *ssid = "blahblah";
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData exp_wifi[] = {
-		{ NM_SETTING_WIRELESS_SSID, ssid, 0 },
-		{ NM_SETTING_WIRELESS_MODE, "infrastructure", 0 },
-		{ NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, 0 },
-		{ NULL } };
-	const KeyData both_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, key_mgmt, 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, auth_alg, 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_PSK, "asdfasdfasdfasdfasdfafs", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	src = nm_connection_new ();
-	if (add_wifi)
-		fill_wifi_empty (src);
-	fill_wsec (src, both_wsec);
-	success = complete_connection (ssid, bssid, NM_802_11_MODE_INFRA,
-	                               flags, wpa_flags, rsn_flags,
-	                               FALSE, src, &error);
-	if (expected) {
-		fill_wifi (expected, exp_wifi);
-		fill_wsec (expected, both_wsec);
-	}
-	COMPARE (src, expected, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
-
-	g_object_unref (src);
-}
-
-static void
-test_open_ap_wpa_psk_connection_1 (void)
-{
-	/* Test that a WPA-PSK connection filling only the PSK itself and *not*
-	 * filling the wifi setting is rejected when completion is attempted with
-	 * an open AP.
-	 */
-	test_ap_wpa_psk_connection_base (NULL, NULL,
-	                                 NM_802_11_AP_FLAGS_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 FALSE, NULL);
-}
-
-static void
-test_open_ap_wpa_psk_connection_2 (void)
-{
-	/* Test that a WPA-PSK connection filling only the PSK itself and also
-	 * filling the wifi setting is rejected when completion is attempted with
-	 * an open AP.
-	 */
-	test_ap_wpa_psk_connection_base (NULL, NULL,
-	                                 NM_802_11_AP_FLAGS_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 TRUE, NULL);
-}
-
-static void
-test_open_ap_wpa_psk_connection_3 (void)
-{
-	/* Test that a WPA-PSK connection filling the PSK and setting the auth alg
-	 * to 'open' is rejected when completion is attempted with an open AP.
-	 */
-	test_ap_wpa_psk_connection_base (NULL, "open",
-	                                 NM_802_11_AP_FLAGS_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 FALSE, NULL);
-}
-
-static void
-test_open_ap_wpa_psk_connection_4 (void)
-{
-	/* Test that a WPA-PSK connection filling the PSK and setting the auth alg
-	 * to 'shared' is rejected when completion is attempted with an open AP.
-	 * Shared auth cannot be used with WPA.
-	 */
-	test_ap_wpa_psk_connection_base (NULL, "shared",
-	                                 NM_802_11_AP_FLAGS_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 FALSE, NULL);
-}
-
-static void
-test_open_ap_wpa_psk_connection_5 (void)
-{
-	/* Test that a WPA-PSK connection filling the PSK, the auth algorithm, and
-	 * key management is rejected when completion is attempted with an open AP.
-	 */
-	test_ap_wpa_psk_connection_base ("wpa-psk", "open",
-	                                 NM_802_11_AP_FLAGS_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 FALSE, NULL);
-}
-
-/*******************************************/
-
-static void
-test_ap_wpa_eap_connection_base (const char *key_mgmt,
-                                 const char *auth_alg,
-                                 guint32 flags,
-                                 guint32 wpa_flags,
-                                 guint32 rsn_flags,
-                                 gboolean add_wifi,
-                                 guint error_domain,
-                                 guint error_code)
-{
-	NMConnection *src;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_empty[] = { { NULL } };
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, key_mgmt, 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, auth_alg, 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	src = nm_connection_new ();
-	if (add_wifi)
-		fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	fill_8021x (src, src_empty);
-	success = complete_connection ("blahblah", bssid, NM_802_11_MODE_INFRA,
-	                               flags, wpa_flags, rsn_flags,
-	                               FALSE, src, &error);
-	/* Failure expected */
-	COMPARE (src, NULL, success, error, error_domain, error_code);
-
-	g_object_unref (src);
-}
-
-enum {
-	IDX_NONE = 0,
-	IDX_OPEN,
-	IDX_PRIV,
-	IDX_WPA_PSK_PTKIP_GTKIP,
-	IDX_WPA_PSK_PTKIP_PCCMP_GTKIP,
-	IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP,
-	IDX_WPA_RSN_PSK_PCCMP_GCCMP,
-	IDX_RSN_PSK_PCCMP_GCCMP,
-	IDX_RSN_PSK_PTKIP_PCCMP_GTKIP,
-	IDX_WPA_8021X,
-	IDX_RSN_8021X,
-};
-
-static guint32
-flags_for_idx (guint32 idx)
-{
-	if (idx == IDX_OPEN)
-		return NM_802_11_AP_FLAGS_NONE;
-	else if (   idx == IDX_PRIV
-	         || idx == IDX_WPA_PSK_PTKIP_GTKIP
-	         || idx == IDX_WPA_PSK_PTKIP_PCCMP_GTKIP
-	         || idx == IDX_RSN_PSK_PCCMP_GCCMP
-	         || idx == IDX_RSN_PSK_PTKIP_PCCMP_GTKIP
-	         || idx == IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP
-	         || idx == IDX_WPA_RSN_PSK_PCCMP_GCCMP
-	         || idx == IDX_WPA_8021X
-	         || idx == IDX_RSN_8021X)
-		return NM_802_11_AP_FLAGS_PRIVACY;
-	else
-		g_assert_not_reached ();
-}
-
-static guint32
-wpa_flags_for_idx (guint32 idx)
-{
-	if (idx == IDX_OPEN || idx == IDX_PRIV ||  idx == IDX_RSN_8021X
-	    || idx == IDX_RSN_PSK_PCCMP_GCCMP || idx == IDX_RSN_PSK_PTKIP_PCCMP_GTKIP)
-		return NM_802_11_AP_SEC_NONE;
-	else if (idx == IDX_WPA_PSK_PTKIP_GTKIP)
-		return NM_802_11_AP_SEC_PAIR_TKIP | NM_802_11_AP_SEC_GROUP_TKIP | NM_802_11_AP_SEC_KEY_MGMT_PSK;
-	else if (idx == IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP)
-		return NM_802_11_AP_SEC_PAIR_TKIP | NM_802_11_AP_SEC_PAIR_CCMP | NM_802_11_AP_SEC_GROUP_TKIP | NM_802_11_AP_SEC_KEY_MGMT_PSK;
-	else if (IDX_WPA_RSN_PSK_PCCMP_GCCMP)
-		return NM_802_11_AP_SEC_PAIR_CCMP | NM_802_11_AP_SEC_GROUP_CCMP | NM_802_11_AP_SEC_KEY_MGMT_PSK;
-	else if (idx == IDX_WPA_8021X)
-		return NM_802_11_AP_SEC_PAIR_TKIP | NM_802_11_AP_SEC_GROUP_TKIP | NM_802_11_AP_SEC_KEY_MGMT_802_1X;
-	else
-		g_assert_not_reached ();
-}
-
-static guint32
-rsn_flags_for_idx (guint32 idx)
-{
-	if (idx == IDX_OPEN || idx == IDX_PRIV || idx == IDX_WPA_8021X
-	    || idx == IDX_WPA_PSK_PTKIP_GTKIP || idx == IDX_WPA_PSK_PTKIP_PCCMP_GTKIP)
-		return NM_802_11_AP_SEC_NONE;
-	else if (idx == IDX_RSN_PSK_PCCMP_GCCMP)
-		return NM_802_11_AP_SEC_PAIR_CCMP | NM_802_11_AP_SEC_GROUP_CCMP | NM_802_11_AP_SEC_KEY_MGMT_PSK;
-	else if (idx == IDX_RSN_PSK_PTKIP_PCCMP_GTKIP)
-		return NM_802_11_AP_SEC_PAIR_TKIP | NM_802_11_AP_SEC_PAIR_CCMP | NM_802_11_AP_SEC_GROUP_TKIP | NM_802_11_AP_SEC_KEY_MGMT_PSK;
-	else if (idx == IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP)
-		return NM_802_11_AP_SEC_PAIR_TKIP | NM_802_11_AP_SEC_PAIR_CCMP | NM_802_11_AP_SEC_GROUP_TKIP | NM_802_11_AP_SEC_KEY_MGMT_PSK;
-	else if (idx == IDX_WPA_RSN_PSK_PCCMP_GCCMP)
-		return NM_802_11_AP_SEC_PAIR_CCMP | NM_802_11_AP_SEC_GROUP_CCMP | NM_802_11_AP_SEC_KEY_MGMT_PSK;
-	else if (idx == IDX_RSN_8021X)
-		return NM_802_11_AP_SEC_PAIR_CCMP | NM_802_11_AP_SEC_GROUP_CCMP | NM_802_11_AP_SEC_KEY_MGMT_802_1X;
-	else
-		g_assert_not_reached ();
-}
-
-static guint32
-error_domain_for_idx (guint32 idx, guint num)
-{
-	if (idx == IDX_OPEN)
-		return NM_SETTING_WIRELESS_SECURITY_ERROR;
-	else if (idx == IDX_PRIV) {
-		if (num <= 3)
-			return NM_SETTING_802_1X_ERROR;
-		else
-			return NM_SETTING_WIRELESS_SECURITY_ERROR;
-	} else if (idx == IDX_WPA_PSK_PTKIP_GTKIP || idx == IDX_WPA_PSK_PTKIP_PCCMP_GTKIP
-	           || idx == IDX_WPA_RSN_PSK_PCCMP_GCCMP || idx == IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP
-	           || idx == IDX_RSN_PSK_PTKIP_PCCMP_GTKIP || idx == IDX_RSN_PSK_PCCMP_GCCMP)
-		return NM_SETTING_WIRELESS_SECURITY_ERROR;
-	else
-		g_assert_not_reached ();
-}
-
-static guint32
-error_code_for_idx (guint32 idx, guint num)
-{
-	if (idx == IDX_OPEN)
-		return NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY;
-	else if (idx == IDX_PRIV) {
-		if (num <= 3)
-			return NM_SETTING_802_1X_ERROR_MISSING_PROPERTY;
-		else
-			return NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY;
-	} else if (idx == IDX_WPA_PSK_PTKIP_GTKIP || idx == IDX_WPA_PSK_PTKIP_PCCMP_GTKIP
-	           || idx == IDX_WPA_RSN_PSK_PCCMP_GCCMP || idx == IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP
-	           || idx == IDX_RSN_PSK_PTKIP_PCCMP_GTKIP || idx == IDX_RSN_PSK_PCCMP_GCCMP)
-		return NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY;
-	else
-		g_assert_not_reached ();
-}
-
-static void
-test_ap_wpa_eap_connection_1 (guint32 idx)
-{
-	test_ap_wpa_eap_connection_base (NULL, NULL,
-	                                 flags_for_idx (idx),
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 FALSE,
-	                                 error_domain_for_idx (idx, 1),
-	                                 error_code_for_idx (idx, 1));
-}
-
-static void
-test_ap_wpa_eap_connection_2 (guint idx)
-{
-	test_ap_wpa_eap_connection_base (NULL, NULL,
-	                                 flags_for_idx (idx),
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 TRUE,
-	                                 error_domain_for_idx (idx, 2),
-	                                 error_code_for_idx (idx, 2));
-}
-
-static void
-test_ap_wpa_eap_connection_3 (guint idx)
-{
-	test_ap_wpa_eap_connection_base (NULL, "open",
-	                                 flags_for_idx (idx),
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 FALSE,
-	                                 error_domain_for_idx (idx, 3),
-	                                 error_code_for_idx (idx, 3));
-}
-
-static void
-test_ap_wpa_eap_connection_4 (guint idx)
-{
-	test_ap_wpa_eap_connection_base (NULL, "shared",
-	                                 flags_for_idx (idx),
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 FALSE,
-	                                 error_domain_for_idx (idx, 4),
-	                                 error_code_for_idx (idx, 4));
-}
-
-static void
-test_ap_wpa_eap_connection_5 (guint idx)
-{
-	test_ap_wpa_eap_connection_base ("wpa-eap", "open",
-	                                 flags_for_idx (idx),
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 FALSE,
-	                                 error_domain_for_idx (idx, 5),
-	                                 error_code_for_idx (idx, 5));
-}
-
-/*******************************************/
-
-static void
-test_priv_ap_empty_connection (void)
-{
-	NMConnection *src, *expected;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const char *ssid = "blahblah";
-	const KeyData exp_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that an empty connection is completed to a valid Static WEP
-	 * connection when completed with an AP with the Privacy bit set.
-	 */
-
-	src = nm_connection_new ();
-	success = complete_connection (ssid, bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-
-	/* Static WEP connection expected */
-	expected = create_basic (ssid, NULL, NM_802_11_MODE_INFRA, TRUE);
-	fill_wsec (expected, exp_wsec);
-	COMPARE (src, expected, success, error, 0, 0);
-
-	g_object_unref (src);
-	g_object_unref (expected);
-}
-
-/*******************************************/
-
-static void
-test_priv_ap_leap_connection_1 (gboolean add_wifi)
-{
-	NMConnection *src, *expected;
-	const char *ssid = "blahblah";
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const char *leap_username = "Bill Smith";
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, leap_username, 0 },
-	    { NULL } };
-	const KeyData exp_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "leap", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, leap_username, 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that an minimal LEAP connection specifying only key management and
-	 * the LEAP username is completed to a full LEAP connection when completed
-	 * with an AP with the Privacy bit set.
-	 */
-
-	src = nm_connection_new ();
-	if (add_wifi)
-		fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	success = complete_connection (ssid, bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-	/* We expect success here; since LEAP APs just set the 'privacy' flag
-	 * there's no way to determine from the AP's beacon whether it's static WEP,
-	 * dynamic WEP, or LEAP.
-	 */
-	expected = create_basic (ssid, NULL, NM_802_11_MODE_INFRA, TRUE);
-	fill_wsec (expected, exp_wsec);
-	COMPARE (src, expected, success, error, 0, 0);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_priv_ap_leap_connection_2 (void)
-{
-	NMConnection *src;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "leap", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that an minimal LEAP connection specifying only key management and
-	 * the LEAP auth alg is completed to a full LEAP connection when completed
-	 * with an AP with the Privacy bit set.
-	 */
-
-	src = nm_connection_new ();
-	fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	success = complete_connection ("blahblah", bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-	/* We expect failure here, we need a LEAP username */
-	COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_priv_ap_dynamic_wep_1 (void)
-{
-	NMConnection *src, *expected;
-	const char *ssid = "blahblah";
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NULL } };
-	const KeyData both_8021x[] = {
-	    { NM_SETTING_802_1X_EAP, "peap", 0 },
-	    { NM_SETTING_802_1X_IDENTITY, "Bill Smith", 0 },
-	    { NM_SETTING_802_1X_PHASE2_AUTH, "mschapv2", 0 },
-	    { NULL } };
-	const KeyData exp_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_PAIRWISE, "wep40", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_PAIRWISE, "wep104", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_GROUP, "wep40", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_GROUP, "wep104", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that an minimal Dynamic WEP connection specifying key management,
-	 * the auth algorithm, and valid 802.1x setting is completed to a valid
-	 * Dynamic WEP connection when completed with an AP with the Privacy bit set.
-	 */
-
-	src = nm_connection_new ();
-	fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	fill_8021x (src, both_8021x);
-	success = complete_connection (ssid, bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-
-	/* We expect a completed Dynamic WEP connection */
-	expected = create_basic (ssid, NULL, NM_802_11_MODE_INFRA, TRUE);
-	fill_wsec (expected, exp_wsec);
-	fill_8021x (expected, both_8021x);
-	COMPARE (src, expected, success, error, 0, 0);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_priv_ap_dynamic_wep_2 (void)
-{
-	NMConnection *src, *expected;
-	const char *ssid = "blahblah";
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NULL } };
-	const KeyData both_8021x[] = {
-	    { NM_SETTING_802_1X_EAP, "peap", 0 },
-	    { NM_SETTING_802_1X_IDENTITY, "Bill Smith", 0 },
-	    { NM_SETTING_802_1X_PHASE2_AUTH, "mschapv2", 0 },
-	    { NULL } };
-	const KeyData exp_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_PAIRWISE, "wep40", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_PAIRWISE, "wep104", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_GROUP, "wep40", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_GROUP, "wep104", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that an minimal Dynamic WEP connection specifying only the auth
-	 * algorithm and a valid 802.1x setting is completed to a valid Dynamic
-	 * WEP connection when completed with an AP with the Privacy bit set.
-	 */
-
-	src = nm_connection_new ();
-	fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	fill_8021x (src, both_8021x);
-	success = complete_connection (ssid, bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-
-	/* We expect a completed Dynamic WEP connection */
-	expected = create_basic (ssid, NULL, NM_802_11_MODE_INFRA, TRUE);
-	fill_wsec (expected, exp_wsec);
-	fill_8021x (expected, both_8021x);
-	COMPARE (src, expected, success, error, 0, 0);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_priv_ap_dynamic_wep_3 (void)
-{
-	NMConnection *src;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "shared", 0 },
-	    { NULL } };
-	const KeyData src_8021x[] = {
-	    { NM_SETTING_802_1X_EAP, "peap", 0 },
-	    { NM_SETTING_802_1X_IDENTITY, "Bill Smith", 0 },
-	    { NM_SETTING_802_1X_PHASE2_AUTH, "mschapv2", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Ensure that a basic connection specifying 'shared' auth and an 802.1x
-	 * setting is rejected, as 802.1x is incompatible with 'shared' auth.
-	 */
-
-	src = nm_connection_new ();
-	fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	fill_8021x (src, src_8021x);
-	success = complete_connection ("blahblah", bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
-	                               FALSE,
-	                               src, &error);
-	/* Expect failure; shared is not compatible with dynamic WEP */
-	COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_priv_ap_wpa_psk_connection_1 (void)
-{
-	/* Test that a basic WPA-PSK connection is rejected when completion is
-	 * attempted with an AP with just the Privacy bit set.  Lack of WPA/RSN
-	 * flags means the AP provides Static/Dynamic WEP or LEAP, not WPA.
-	 */
-	test_ap_wpa_psk_connection_base (NULL, NULL,
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 FALSE, NULL);
-}
-
-static void
-test_priv_ap_wpa_psk_connection_2 (void)
-{
-	/* Test that a basic WPA-PSK connection is rejected when completion is
-	 * attempted with an AP with just the Privacy bit set.  Lack of WPA/RSN
-	 * flags means the AP provides Static/Dynamic WEP or LEAP, not WPA.
-	 */
-	test_ap_wpa_psk_connection_base (NULL, NULL,
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 TRUE, NULL);
-}
-
-static void
-test_priv_ap_wpa_psk_connection_3 (void)
-{
-	/* Test that a basic WPA-PSK connection specifying only the auth algorithm
-	 * is rejected when completion is attempted with an AP with just the Privacy
-	 * bit set.  Lack of WPA/RSN flags means the AP provides Static/Dynamic WEP
-	 * or LEAP, not WPA.
-	 */
-	test_ap_wpa_psk_connection_base (NULL, "open",
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 FALSE, NULL);
-}
-
-static void
-test_priv_ap_wpa_psk_connection_4 (void)
-{
-	/* Test that a basic WPA-PSK connection specifying only the auth algorithm
-	 * is rejected when completion is attempted with an AP with just the Privacy
-	 * bit set.  Lack of WPA/RSN flags means the AP provides Static/Dynamic WEP
-	 * or LEAP, not WPA.  Second, 'shared' auth is incompatible with WPA.
-	 */
-	test_ap_wpa_psk_connection_base (NULL, "shared",
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 FALSE, NULL);
-}
-
-static void
-test_priv_ap_wpa_psk_connection_5 (void)
-{
-	/* Test that a WPA-PSK connection specifying both the key management and
-	 * auth algorithm is rejected when completion is attempted with an AP with
-	 * just the Privacy bit set.  Lack of WPA/RSN flags means the AP provides
-	 * Static/Dynamic WEP or LEAP, not WPA.
-	 */
-	test_ap_wpa_psk_connection_base ("wpa-psk", "open",
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 NM_802_11_AP_SEC_NONE,
-	                                 FALSE, NULL);
-}
-
-/*******************************************/
-
-static void
-test_wpa_ap_empty_connection (guint idx)
-{
-	NMConnection *src, *expected;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const char *ssid = "blahblah";
-	const KeyData exp_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that a basic WPA-PSK connection specifying just key management and
-	 * the auth algorithm is completed successfully when given an AP with WPA
-	 * or RSN flags.
-	 */
-
-	src = nm_connection_new ();
-	success = complete_connection (ssid, bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               wpa_flags_for_idx (idx),
-	                               rsn_flags_for_idx (idx),
-	                               FALSE, src, &error);
-
-	/* WPA connection expected */
-	expected = create_basic (ssid, NULL, NM_802_11_MODE_INFRA, TRUE);
-	fill_wsec (expected, exp_wsec);
-	COMPARE (src, expected, success, error, 0, 0);
-
-	g_object_unref (src);
-	g_object_unref (expected);
-}
-
-/*******************************************/
-
-static void
-test_wpa_ap_leap_connection_1 (guint idx)
-{
-	NMConnection *src;
-	const char *ssid = "blahblah";
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const char *leap_username = "Bill Smith";
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, leap_username, 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that completion of a LEAP connection with a WPA-enabled AP is
-	 * rejected since WPA APs (usually) do not support LEAP.
-	 */
-
-	src = nm_connection_new ();
-	fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	success = complete_connection (ssid, bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               wpa_flags_for_idx (idx),
-	                               rsn_flags_for_idx (idx),
-	                               FALSE,
-	                               src, &error);
-	/* Expect failure here; WPA APs don't support old-school LEAP */
-	COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_wpa_ap_leap_connection_2 (guint idx)
-{
-	NMConnection *src;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "leap", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that completion of a LEAP connection with a WPA-enabled AP is
-	 * rejected since WPA APs (usually) do not support LEAP.
-	 */
-
-	src = nm_connection_new ();
-	fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	success = complete_connection ("blahblah", bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               wpa_flags_for_idx (idx),
-	                               rsn_flags_for_idx (idx),
-	                               FALSE,
-	                               src, &error);
-	/* We expect failure here, we need a LEAP username */
-	COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_wpa_ap_dynamic_wep_connection (guint idx)
-{
-	NMConnection *src;
-	const guint8 bssid[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
-	const KeyData src_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", 0 },
-	    { NULL } };
-	gboolean success;
-	GError *error = NULL;
-
-	/* Test that completion of a Dynamic WEP connection with a WPA-enabled AP is
-	 * rejected since WPA APs (usually) do not support Dynamic WEP.
-	 */
-
-	src = nm_connection_new ();
-	fill_wifi_empty (src);
-	fill_wsec (src, src_wsec);
-	success = complete_connection ("blahblah", bssid,
-	                               NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
-	                               wpa_flags_for_idx (idx),
-	                               rsn_flags_for_idx (idx),
-	                               FALSE,
-	                               src, &error);
-	/* We expect failure here since Dynamic WEP is incompatible with WPA */
-	COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
-
-	g_object_unref (src);
-}
-
-/*******************************************/
-
-static void
-test_wpa_ap_wpa_psk_connection_1 (guint idx)
-{
-	NMConnection *expected;
-	const KeyData exp_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NULL } };
-
-	expected = nm_connection_new ();
-	fill_wsec (expected, exp_wsec);
-	test_ap_wpa_psk_connection_base (NULL, NULL,
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 FALSE, expected);
-	g_object_unref (expected);
-}
-
-static void
-test_wpa_ap_wpa_psk_connection_2 (guint idx)
-{
-	NMConnection *expected;
-	const KeyData exp_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NULL } };
-
-	expected = nm_connection_new ();
-	fill_wsec (expected, exp_wsec);
-	test_ap_wpa_psk_connection_base (NULL, NULL,
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 TRUE, expected);
-	g_object_unref (expected);
-}
-
-static void
-test_wpa_ap_wpa_psk_connection_3 (guint idx)
-{
-	NMConnection *expected;
-	const KeyData exp_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NULL } };
-
-	expected = nm_connection_new ();
-	fill_wsec (expected, exp_wsec);
-	test_ap_wpa_psk_connection_base (NULL, "open",
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 FALSE, expected);
-	g_object_unref (expected);
-}
-
-static void
-test_wpa_ap_wpa_psk_connection_4 (guint idx)
-{
-	test_ap_wpa_psk_connection_base (NULL, "shared",
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 FALSE, NULL);
-}
-
-static void
-test_wpa_ap_wpa_psk_connection_5 (guint idx)
-{
-	NMConnection *expected;
-	const KeyData exp_wsec[] = {
-	    { NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", 0 },
-	    { NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
-	    { NULL } };
-
-	expected = nm_connection_new ();
-	fill_wsec (expected, exp_wsec);
-	test_ap_wpa_psk_connection_base ("wpa-psk", "open",
-	                                 NM_802_11_AP_FLAGS_PRIVACY,
-	                                 wpa_flags_for_idx (idx),
-	                                 rsn_flags_for_idx (idx),
-	                                 FALSE, expected);
-	g_object_unref (expected);
-}
-
-/*******************************************/
-
-static void
-test_strength_dbm (void)
-{
-	/* boundary conditions first */
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-1), ==, 100);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-40), ==, 100);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-30), ==, 100);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-100), ==, 0);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-200), ==, 0);
-
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-81), ==, 32);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-92), ==, 14);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-74), ==, 44);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-81), ==, 32);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (-66), ==, 57);
-}
-
-static void
-test_strength_percent (void)
-{
-	int i;
-
-	/* boundary conditions first */
-	g_assert_cmpint (nm_ap_utils_level_to_quality (0), ==, 0);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (100), ==, 100);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (110), ==, 100);
-
-	for (i = 0; i <= 100; i++)
-		g_assert_cmpint (nm_ap_utils_level_to_quality (i), ==, i);
-}
-
-static void
-test_strength_wext (void)
-{
-	/* boundary conditions that we assume aren't WEXT first */
-	g_assert_cmpint (nm_ap_utils_level_to_quality (256), ==, 100);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (110), ==, 100);
-
-	/* boundary conditions that we assume are WEXT */
-	g_assert_cmpint (nm_ap_utils_level_to_quality (111), ==, 0);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (150), ==, 0);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (225), ==, 100);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (255), ==, 100);
-
-	g_assert_cmpint (nm_ap_utils_level_to_quality (157), ==, 2);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (200), ==, 74);
-	g_assert_cmpint (nm_ap_utils_level_to_quality (215), ==, 99);
-}
-
-/*******************************************/
-
-#if GLIB_CHECK_VERSION(2,25,12)
-typedef GTestFixtureFunc TCFunc;
-#else
-typedef void (*TCFunc)(void);
-#endif
-
-#define TESTCASE(t, d) g_test_create_case (#t, 0, (gconstpointer) d, NULL, (TCFunc) t, NULL)
-
-int main (int argc, char **argv)
-{
-	GTestSuite *suite;
-	gsize i;
-
-	g_type_init ();
-	g_test_init (&argc, &argv, NULL);
-
-	suite = g_test_get_root ();
-
-	g_test_suite_add (suite, TESTCASE (test_lock_bssid, NULL));
-
-	/* Open AP tests; make sure that connections to be completed that have
-	 * various security-related settings already set cause the completion
-	 * to fail.
-	 */
-	g_test_suite_add (suite, TESTCASE (test_open_ap_empty_connection, NULL));
-	g_test_suite_add (suite, TESTCASE (test_open_ap_leap_connection_1, TRUE));
-	g_test_suite_add (suite, TESTCASE (test_open_ap_leap_connection_1, FALSE));
-	g_test_suite_add (suite, TESTCASE (test_open_ap_leap_connection_2, NULL));
-	g_test_suite_add (suite, TESTCASE (test_open_ap_wep_connection, TRUE));
-	g_test_suite_add (suite, TESTCASE (test_open_ap_wep_connection, FALSE));
-
-	g_test_suite_add (suite, TESTCASE (test_open_ap_wpa_psk_connection_1, NULL));
-	g_test_suite_add (suite, TESTCASE (test_open_ap_wpa_psk_connection_2, NULL));
-	g_test_suite_add (suite, TESTCASE (test_open_ap_wpa_psk_connection_3, NULL));
-	g_test_suite_add (suite, TESTCASE (test_open_ap_wpa_psk_connection_4, NULL));
-	g_test_suite_add (suite, TESTCASE (test_open_ap_wpa_psk_connection_5, NULL));
-
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_1, IDX_OPEN));
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_2, IDX_OPEN));
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_3, IDX_OPEN));
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_4, IDX_OPEN));
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_5, IDX_OPEN));
-
-	/* WEP AP tests */
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_empty_connection, NULL));
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_leap_connection_1, FALSE));
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_leap_connection_2, FALSE));
-
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_dynamic_wep_1, NULL));
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_dynamic_wep_2, NULL));
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_dynamic_wep_3, NULL));
-
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_wpa_psk_connection_1, NULL));
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_wpa_psk_connection_2, NULL));
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_wpa_psk_connection_3, NULL));
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_wpa_psk_connection_4, NULL));
-	g_test_suite_add (suite, TESTCASE (test_priv_ap_wpa_psk_connection_5, NULL));
-
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_1, IDX_PRIV));
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_2, IDX_PRIV));
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_3, IDX_PRIV));
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_4, IDX_PRIV));
-	g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_5, IDX_PRIV));
-
-	/* WPA-PSK tests */
-	for (i = IDX_WPA_PSK_PTKIP_GTKIP; i <= IDX_WPA_RSN_PSK_PCCMP_GCCMP; i++) {
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_empty_connection, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_leap_connection_1, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_leap_connection_2, i));
-
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_dynamic_wep_connection, i));
-
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_1, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_2, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_3, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_4, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_5, i));
-
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_1, i));
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_2, i));
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_3, i));
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_4, i));
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_5, i));
-	}
-
-	/* RSN-PSK tests */
-	for (i = IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP; i <= IDX_RSN_PSK_PTKIP_PCCMP_GTKIP; i++) {
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_empty_connection, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_leap_connection_1, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_leap_connection_2, i));
-
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_dynamic_wep_connection, i));
-
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_1, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_2, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_3, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_4, i));
-		g_test_suite_add (suite, TESTCASE (test_wpa_ap_wpa_psk_connection_5, i));
-
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_1, i));
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_2, i));
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_3, i));
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_4, i));
-		g_test_suite_add (suite, TESTCASE (test_ap_wpa_eap_connection_5, i));
-	}
-
-	/* Scanned signal strength conversion tests */
-	g_test_suite_add (suite, TESTCASE (test_strength_dbm, NULL));
-	g_test_suite_add (suite, TESTCASE (test_strength_percent, NULL));
-	g_test_suite_add (suite, TESTCASE (test_strength_wext, NULL));
-
-	return g_test_run ();
-}
-