summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-06-19 07:47:20 +0200
committerThomas Haller <thaller@redhat.com>2019-06-20 16:06:44 +0200
commit74641be816a201fdb704a7a8084a791ea5c76c9f (patch)
treea7210659ef1602fbfa941d8ea18c6a560c732995
parentf182d4fa20634ae8691757721b0e925ddb0af4cb (diff)
downloadNetworkManager-74641be816a201fdb704a7a8084a791ea5c76c9f.tar.gz
settings: drop ibft settings pluginth/drop-ibft-settings-plugin
The functionality of the ibft settings plugin is now handled by nm-initrd-generator. There is no need for it anymore, drop it. Note that ibft called iscsiadm, which requires CAP_SYS_ADMIN to work ([1]). We really want to drop this capability, so the current solution of a settings plugin (as it is implemented) is wrong. The solution instead is nm-initrd-generator. Also, on Fedora the ibft was disabled and probably on most other distributions as well. This was only used on RHEL. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1371201#c7
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am71
-rw-r--r--NEWS2
-rw-r--r--config.h.meson3
-rw-r--r--configure.ac11
-rw-r--r--contrib/fedora/rpm/NetworkManager.spec12
-rwxr-xr-xcontrib/fedora/rpm/build_clean.sh1
-rwxr-xr-xcontrib/scripts/nm-ci-run.sh2
-rw-r--r--data/NetworkManager.service.in3
-rw-r--r--man/NetworkManager.conf.xml13
-rw-r--r--meson.build8
-rw-r--r--meson_options.txt1
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/settings/nm-settings.c27
-rw-r--r--src/settings/plugins/ibft/meson.build41
-rw-r--r--src/settings/plugins/ibft/nms-ibft-connection.c76
-rw-r--r--src/settings/plugins/ibft/nms-ibft-connection.h40
-rw-r--r--src/settings/plugins/ibft/nms-ibft-plugin.c154
-rw-r--r--src/settings/plugins/ibft/nms-ibft-plugin.h35
-rw-r--r--src/settings/plugins/ibft/nms-ibft-reader.c534
-rw-r--r--src/settings/plugins/ibft/nms-ibft-reader.h41
-rwxr-xr-xsrc/settings/plugins/ibft/tests/iscsiadm-test-bad-dns121
-rwxr-xr-xsrc/settings/plugins/ibft/tests/iscsiadm-test-bad-dns221
-rwxr-xr-xsrc/settings/plugins/ibft/tests/iscsiadm-test-bad-entry20
-rwxr-xr-xsrc/settings/plugins/ibft/tests/iscsiadm-test-bad-gateway21
-rwxr-xr-xsrc/settings/plugins/ibft/tests/iscsiadm-test-bad-ipaddr21
-rwxr-xr-xsrc/settings/plugins/ibft/tests/iscsiadm-test-bad-record18
-rwxr-xr-xsrc/settings/plugins/ibft/tests/iscsiadm-test-dhcp33
-rwxr-xr-xsrc/settings/plugins/ibft/tests/iscsiadm-test-static35
-rwxr-xr-xsrc/settings/plugins/ibft/tests/iscsiadm-test-vlan19
-rw-r--r--src/settings/plugins/ibft/tests/meson.build16
-rw-r--r--src/settings/plugins/ibft/tests/test-ibft.c291
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c2
-rw-r--r--src/settings/plugins/meson.build4
-rwxr-xr-xtools/create-exports-NetworkManager.sh13
35 files changed, 16 insertions, 1597 deletions
diff --git a/.gitignore b/.gitignore
index e30ef9eb95..08fd833f3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -232,7 +232,6 @@ test-*.trs
/src/platform/tests/test-platform-general
/src/platform/tests/test-route-fake
/src/platform/tests/test-route-linux
-/src/settings/plugins/ibft/tests/test-ibft
/src/settings/plugins/ifcfg-rh/nmdbus-ifcfg-rh.[ch]
/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
/src/settings/plugins/ifupdown/tests/test-ifupdown
@@ -334,6 +333,7 @@ test-*.trs
/src/platform/tests/platform
/src/platform/tests/test-general
/src/rdisc/
+/src/settings/plugins/ibft/tests/test-ibft
/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils
/src/settings/plugins/ifnet
/src/settings/plugins/keyfile/tests/test-keyfile
diff --git a/Makefile.am b/Makefile.am
index e6d491fd39..20592ea028 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -141,7 +141,6 @@ DISTCHECK_CONFIGURE_FLAGS = \
--with-wext=no \
--enable-ifcfg-rh \
--enable-ifupdown \
- --enable-config-plugin-ibft \
--disable-dependency-tracking \
$(NULL)
@@ -2715,76 +2714,6 @@ EXTRA_DIST += \
src/settings/plugins/keyfile/tests/meson.build
###############################################################################
-# src/settings/plugins/ibft
-###############################################################################
-
-if CONFIG_PLUGIN_IBFT
-
-core_plugins += src/settings/plugins/ibft/libnm-settings-plugin-ibft.la
-
-noinst_LTLIBRARIES += src/settings/plugins/ibft/libnms-ibft-core.la
-
-src_settings_plugins_ibft_libnms_ibft_core_la_CPPFLAGS = $(src_cppflags_base)
-
-src_settings_plugins_ibft_libnms_ibft_core_la_SOURCES = \
- src/settings/plugins/ibft/nms-ibft-reader.c \
- src/settings/plugins/ibft/nms-ibft-reader.h
-
-$(src_settings_plugins_ibft_libnms_ibft_core_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
-
-src_settings_plugins_ibft_libnm_settings_plugin_ibft_la_SOURCES = \
- src/settings/plugins/ibft/nms-ibft-plugin.c \
- src/settings/plugins/ibft/nms-ibft-plugin.h \
- src/settings/plugins/ibft/nms-ibft-connection.c \
- src/settings/plugins/ibft/nms-ibft-connection.h
-
-src_settings_plugins_ibft_libnm_settings_plugin_ibft_la_CPPFLAGS = $(src_cppflags_base)
-
-src_settings_plugins_ibft_libnm_settings_plugin_ibft_la_LDFLAGS = \
- -module -avoid-version \
- -Wl,--version-script="$(srcdir)/linker-script-settings.ver"
-
-src_settings_plugins_ibft_libnm_settings_plugin_ibft_la_LIBADD = \
- src/settings/plugins/ibft/libnms-ibft-core.la
-
-$(src_settings_plugins_ibft_libnm_settings_plugin_ibft_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
-
-check_programs += src/settings/plugins/ibft/tests/test-ibft
-
-src_settings_plugins_ibft_tests_test_ibft_CPPFLAGS = $(src_cppflags_base_test)
-
-src_settings_plugins_ibft_tests_test_ibft_LDFLAGS = \
- $(GLIB_LIBS) \
- $(CODE_COVERAGE_LDFLAGS) \
- $(SANITIZER_EXEC_LDFLAGS)
-
-src_settings_plugins_ibft_tests_test_ibft_LDADD = \
- src/settings/plugins/ibft/libnms-ibft-core.la \
- src/libNetworkManagerTest.la
-
-$(src_settings_plugins_ibft_tests_test_ibft_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
-
-check-local-symbols-settings-ibft: src/settings/plugins/ibft/libnm-settings-plugin-ibft.la
- $(call check_so_symbols,$(builddir)/src/settings/plugins/ibft/.libs/libnm-settings-plugin-ibft.so)
-
-check_local += check-local-symbols-settings-ibft
-
-endif
-
-EXTRA_DIST += \
- src/settings/plugins/ibft/tests/iscsiadm-test-dhcp \
- src/settings/plugins/ibft/tests/iscsiadm-test-static \
- src/settings/plugins/ibft/tests/iscsiadm-test-bad-ipaddr \
- src/settings/plugins/ibft/tests/iscsiadm-test-bad-gateway \
- src/settings/plugins/ibft/tests/iscsiadm-test-bad-dns1 \
- src/settings/plugins/ibft/tests/iscsiadm-test-bad-dns2 \
- src/settings/plugins/ibft/tests/iscsiadm-test-bad-entry \
- src/settings/plugins/ibft/tests/iscsiadm-test-bad-record \
- src/settings/plugins/ibft/tests/iscsiadm-test-vlan \
- src/settings/plugins/ibft/meson.build \
- src/settings/plugins/ibft/tests/meson.build
-
-###############################################################################
# src/settings/plugins/ifcfg-rh
###############################################################################
diff --git a/NEWS b/NEWS
index 3a9e32d7b7..5c99beb3d0 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
* Rework parsing team JSON config in libnm and stricter validate settings.
With this NetworkManager rejects settings that it considers invalid while
still allowing setting arbitrary JSON config directly.
+* Drop ibft settings plugin. This functionality is now covered by using
+ nm-initrd-generator from initrd to pre-generate in-memory profiles.
=============================================
NetworkManager-1.18
diff --git a/config.h.meson b/config.h.meson
index d4efd49f56..94504a48cf 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -212,9 +212,6 @@
/* Define if you have PPP support */
#mesondefine WITH_PPP
-/* Whether compilation of ibft setting plugin is enabled */
-#mesondefine WITH_SETTINGS_PLUGIN_IBFT
-
/* Define if you have iwd support */
#mesondefine WITH_IWD
diff --git a/configure.ac b/configure.ac
index 70b8bfb46f..605646d927 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,7 +138,6 @@ AC_GNU_SOURCE
AC_CHECK_FUNCS([__secure_getenv secure_getenv])
# Alternative configuration plugins
-AC_ARG_ENABLE(config-plugin-ibft, AS_HELP_STRING([--enable-config-plugin-ibft], [enable ibft configuration plugin]))
AC_ARG_ENABLE(ifcfg-rh, AS_HELP_STRING([--enable-ifcfg-rh], [enable ifcfg-rh configuration plugin (Fedora/RHEL)]))
AC_ARG_ENABLE(ifupdown, AS_HELP_STRING([--enable-ifupdown], [enable ifupdown configuration plugin (Debian/Ubuntu)]))
# Default alternative plugins by distribution
@@ -147,10 +146,7 @@ AS_IF([test -z "$enable_ifupdown" -a -f /etc/debian_version], enable_
# Otherwise plugins default to "no"
AS_IF([test -z "$enable_ifcfg_rh"], enable_ifcfg_rh=no)
AS_IF([test -z "$enable_ifupdown"], enable_ifupdown=no)
-# Disable obsolete ibft plugin by default
-AS_IF([test -z "$enable_config_plugin_ibft"], enable_config_plugin_ibft="no")
# Create automake conditionals
-AM_CONDITIONAL(CONFIG_PLUGIN_IBFT, test "$enable_config_plugin_ibft" = "yes")
AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_RH, test "$enable_ifcfg_rh" = "yes")
AM_CONDITIONAL(CONFIG_PLUGIN_IFUPDOWN, test "$enable_ifupdown" = "yes")
@@ -162,7 +158,6 @@ if test -z "$config_plugins_default" -o "$config_plugins_default" = no; then
config_plugins_default=''
test "$enable_ifcfg_rh" = "yes" && config_plugins_default="$config_plugins_default,ifcfg-rh"
test "$enable_ifupdown" = "yes" && config_plugins_default="$config_plugins_default,ifupdown"
- test "$enable_config_plugin_ibft" = "yes" && config_plugins_default="$config_plugins_default,ibft"
config_plugins_default="${config_plugins_default#,}"
fi
@@ -171,11 +166,6 @@ test "$enable_ifupdown" = "yes" && distro_plugins="$distro_plugins,ifu
distro_plugins="${distro_plugins#,}"
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_PLUGINS, "$config_plugins_default", [Default configuration option for main.plugins setting])
-if test "${enable_config_plugin_ibft}" = yes; then
- AC_DEFINE(WITH_SETTINGS_PLUGIN_IBFT, 1, [Whether compilation of ibft setting plugin is enabled])
-else
- AC_DEFINE(WITH_SETTINGS_PLUGIN_IBFT, 0, [Whether compilation of ibft setting plugin is enabled])
-fi
if test "$enable_ifcfg_rh" = "yes"; then
DISTRO_NETWORK_SERVICE=network.service
@@ -1303,7 +1293,6 @@ echo " iwd: $ac_with_iwd"
echo
echo "Configuration plugins (main.plugins=${config_plugins_default})"
-echo " ibft: ${enable_config_plugin_ibft}"
echo " ifcfg-rh: ${enable_ifcfg_rh}"
echo " ifupdown: ${enable_ifupdown}"
echo
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec
index c3551fd710..b775f1dfa9 100644
--- a/contrib/fedora/rpm/NetworkManager.spec
+++ b/contrib/fedora/rpm/NetworkManager.spec
@@ -106,13 +106,7 @@
%global dns_rc_manager_default file
%endif
-%if 0%{?rhel}
-%global config_plugins_default ifcfg-rh,ibft
-%global ibft_enabled yes
-%else
%global config_plugins_default ifcfg-rh
-%global ibft_enabled no
-%endif
%if 0%{?fedora}
# Altough eBPF would be available on Fedora's kernel, it seems
@@ -573,11 +567,6 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
-Dtests=yes \
-Dvalgrind=no \
-Difcfg_rh=true \
-%if %{ibft_enabled} != yes
- -Dibft=false \
-%else
- -Dibft=true \
-%endif
-Difupdown=false \
%if %{with ppp}
-Dpppd_plugin_dir=%{_libdir}/pppd/%{ppp_version} \
@@ -695,7 +684,6 @@ intltoolize --automake --copy --force
%endif
--with-valgrind=no \
--enable-ifcfg-rh=yes \
- --enable-config-plugin-ibft=%{ibft_enabled} \
--enable-ifupdown=no \
%if %{with ppp}
--with-pppd-plugin-dir=%{_libdir}/pppd/%{ppp_version} \
diff --git a/contrib/fedora/rpm/build_clean.sh b/contrib/fedora/rpm/build_clean.sh
index bbed81f2a7..8a22792e20 100755
--- a/contrib/fedora/rpm/build_clean.sh
+++ b/contrib/fedora/rpm/build_clean.sh
@@ -150,7 +150,6 @@ if [[ $NO_DIST != 1 ]]; then
--enable-introspection \
--enable-ifcfg-rh \
--enable-ifupdown \
- --enable-config-plugin-ibft \
--with-config-logging-backend-default=syslog \
--with-libaudit=yes-disabled-by-default \
--enable-polkit=yes \
diff --git a/contrib/scripts/nm-ci-run.sh b/contrib/scripts/nm-ci-run.sh
index dd8fd28457..52dffe2672 100755
--- a/contrib/scripts/nm-ci-run.sh
+++ b/contrib/scripts/nm-ci-run.sh
@@ -163,7 +163,6 @@ run_autotools() {
--with-resolvconf=/bin/nowhere/resolvconf \
\
--enable-ifcfg-rh=yes \
- --enable-config-plugin-ibft=yes \
--enable-ifupdown=yes \
\
#end
@@ -240,7 +239,6 @@ run_meson() {
-D resolvconf=/bin/nowhere/resolvconf \
\
-D ifcfg_rh=false \
- -D ibft=true \
-D ifupdown=true \
\
#end
diff --git a/data/NetworkManager.service.in b/data/NetworkManager.service.in
index ff90456ffd..2f442bf233 100644
--- a/data/NetworkManager.service.in
+++ b/data/NetworkManager.service.in
@@ -16,9 +16,6 @@ Restart=on-failure
KillMode=process
CapabilityBoundingSet=CAP_NET_ADMIN CAP_DAC_OVERRIDE CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID CAP_SYS_MODULE CAP_AUDIT_WRITE CAP_KILL CAP_SYS_CHROOT
-# ibft settings plugin calls iscsiadm which needs CAP_SYS_ADMIN
-#CapabilityBoundingSet=CAP_SYS_ADMIN
-
ProtectSystem=true
ProtectHome=read-only
diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml
index ec49fcdb88..e56de21022 100644
--- a/man/NetworkManager.conf.xml
+++ b/man/NetworkManager.conf.xml
@@ -1323,17 +1323,8 @@ enable=nm-version-min:1.3,nm-version-min:1.2.6,nm-version-min:1.0.16
<term><varname>ibft</varname>, <varname>no-ibft</varname></term>
<listitem>
<para>
- This plugin allows to read iBFT configuration (iSCSI Boot Firmware Table).
- The configuration is read using <filename>/sbin/iscsiadm</filename>. Users are
- expected to configure iBFT connections via the firmware interfaces.
- If ibft support is available, it is automatically enabled after
- <literal>ifcfg-rh</literal>. This can be disabled by <literal>no-ibft</literal>.
- You can also explicitly specify <literal>ibft</literal> to load the
- plugin without <literal>ifcfg-rh</literal> or to change the plugin order.
- </para>
- <para>
- Note that ibft plugin uses <filename>/sbin/iscsiadm</filename> and thus requires
- CAP_SYS_ADMIN capability.
+ These plugins are deprecated and their selection has no effect.
+ This is now handled by nm-initrd-generator.
</para>
</listitem>
</varlistentry>
diff --git a/meson.build b/meson.build
index 6aa4ba5331..bfeaa3eb74 100644
--- a/meson.build
+++ b/meson.build
@@ -233,9 +233,6 @@ endif
enable_ifcfg_rh = get_option('ifcfg_rh') or (distro == 'redhat')
enable_ifupdown = get_option('ifupdown') or (distro == 'debian')
-enable_ibft = get_option('ibft')
-
-config_h.set10('WITH_SETTINGS_PLUGIN_IBFT', enable_ibft)
config_plugins_default = get_option('config_plugins_default')
if config_plugins_default == ''
@@ -249,10 +246,6 @@ if config_plugins_default == ''
config_plugins += ['ifupdown']
endif
- if enable_ibft
- config_plugins += ['ibft']
- endif
-
config_plugins_default = ','.join(config_plugins)
endif
config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_PLUGINS', config_plugins_default)
@@ -937,7 +930,6 @@ output += ' ovs: ' + enable_ovs.to_string() + '\n'
output += ' nmcli: ' + enable_nmcli.to_string() + '\n'
output += ' nmtui: ' + enable_nmtui.to_string() + '\n'
output += '\nConfiguration_plugins (main.plugins=' + config_plugins_default + ')\n'
-output += ' ibft: ' + enable_ibft.to_string() + '\n'
output += ' ifcfg-rh: ' + enable_ifcfg_rh.to_string() + '\n'
output += ' ifupdown: ' + enable_ifupdown.to_string() + '\n'
output += '\nHandlers for /etc/resolv.conf:\n' + resolv_conf_summary
diff --git a/meson_options.txt b/meson_options.txt
index e2d53c252c..3c9a84a8ad 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -41,7 +41,6 @@ option('ebpf', type: 'combo', choices : ['auto', 'true', 'false'], description:
# configuration plugins
option('config_plugins_default', type: 'string', value: '', description: 'Default configuration option for main.plugins setting, used as fallback if the configuration option is unset')
-option('ibft', type: 'boolean', value: false, description: 'enable ibft configuration plugin')
option('ifcfg_rh', type: 'boolean', value: false, description: 'enable ifcfg-rh configuration plugin (Fedora/RHEL)')
option('ifupdown', type: 'boolean', value: false, description: 'enable ifupdown configuration plugin (Debian/Ubuntu)')
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0da49c6d4e..90ed9ebdbe 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -172,6 +172,5 @@ src/nm-config.c
src/nm-iface-helper.c
src/nm-logging.c
src/nm-manager.c
-src/settings/plugins/ibft/nms-ibft-plugin.c
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index 1c259be98a..4d1915e24c 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -1341,16 +1341,6 @@ load_plugins (NMSettings *self, const char *const*plugins, GError **error)
{
const char *const*iter;
gboolean success = TRUE;
- gboolean add_ibft = FALSE;
- gboolean has_no_ibft;
- gssize idx_no_ibft, idx_ibft;
-
- idx_ibft = nm_utils_strv_find_first ((char **) plugins, -1, "ibft");
- idx_no_ibft = nm_utils_strv_find_first ((char **) plugins, -1, "no-ibft");
- has_no_ibft = idx_no_ibft >= 0 && idx_no_ibft > idx_ibft;
-#if WITH_SETTINGS_PLUGIN_IBFT
- add_ibft = idx_no_ibft < 0 && idx_ibft < 0;
-#endif
for (iter = plugins; iter && *iter; iter++) {
const char *pname = *iter;
@@ -1360,16 +1350,11 @@ load_plugins (NMSettings *self, const char *const*plugins, GError **error)
continue;
}
- if (NM_IN_STRSET (pname, "ifcfg-suse", "ifnet")) {
+ if (NM_IN_STRSET (pname, "ifcfg-suse", "ifnet", "ibft", "no-ibft")) {
_LOGW ("skipping deprecated plugin %s", pname);
continue;
}
- if (nm_streq (pname, "no-ibft"))
- continue;
- if (has_no_ibft && nm_streq (pname, "ibft"))
- continue;
-
/* keyfile plugin is built-in now */
if (nm_streq (pname, "keyfile")) {
add_plugin_keyfile (self);
@@ -1387,16 +1372,6 @@ load_plugins (NMSettings *self, const char *const*plugins, GError **error)
success = add_plugin_load_file (self, pname, error);
if (!success)
break;
-
- if ( add_ibft
- && nm_streq (pname, "ifcfg-rh")) {
- /* The plugin ibft is not explicitly mentioned but we just enabled "ifcfg-rh".
- * Enable "ibft" by default after "ifcfg-rh". */
- add_ibft = FALSE;
- success = add_plugin_load_file (self, "ibft", error);
- if (!success)
- break;
- }
}
/* If keyfile plugin was not among configured plugins, add it as the last one */
diff --git a/src/settings/plugins/ibft/meson.build b/src/settings/plugins/ibft/meson.build
deleted file mode 100644
index c33b24cc3b..0000000000
--- a/src/settings/plugins/ibft/meson.build
+++ /dev/null
@@ -1,41 +0,0 @@
-name = 'nm-settings-plugin-ibft'
-
-libnms_ibft_core = static_library(
- 'nms-ibft-core',
- 'nms-ibft-reader.c',
- dependencies: nm_dep,
-)
-
-sources = files(
- 'nms-ibft-connection.c',
- 'nms-ibft-plugin.c',
-)
-
-libnm_settings_plugin_ibft = shared_module(
- name,
- sources: sources,
- dependencies: nm_dep,
- link_with: libnms_ibft_core,
- link_args: ldflags_linker_script_settings,
- link_depends: linker_script_settings,
- install: true,
- install_dir: nm_plugindir,
-)
-
-core_plugins += libnm_settings_plugin_ibft
-
-# FIXME: check_so_symbols replacement
-'''
-run_target(
- 'check-local-symbols-settings-ibft',
- command: [check_so_symbols, libnm_settings_plugin_ibft.full_path()],
- depends: libnm_settings_plugin_ibft,
-)
-
-check-local-symbols-settings-ibft: src/settings/plugins/ibft/libnm-settings-plugin-ibft.la
- $(call check_so_symbols,$(builddir)/src/settings/plugins/ibft/.libs/libnm-settings-plugin-ibft.so)
-'''
-
-if enable_tests
- subdir('tests')
-endif
diff --git a/src/settings/plugins/ibft/nms-ibft-connection.c b/src/settings/plugins/ibft/nms-ibft-connection.c
deleted file mode 100644
index d718c1c23b..0000000000
--- a/src/settings/plugins/ibft/nms-ibft-connection.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* NetworkManager system settings service
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright 2014 Red Hat, Inc.
- */
-
-#include "nm-default.h"
-
-#include "nms-ibft-connection.h"
-
-#include <net/ethernet.h>
-#include <netinet/ether.h>
-#include <glib/gstdio.h>
-
-#include "nms-ibft-reader.h"
-
-/*****************************************************************************/
-
-struct _NMSIbftConnection {
- NMSettingsConnection parent;
-};
-
-struct _NMSIbftConnectionClass {
- NMSettingsConnectionClass parent;
-};
-
-G_DEFINE_TYPE (NMSIbftConnection, nms_ibft_connection, NM_TYPE_SETTINGS_CONNECTION)
-
-/*****************************************************************************/
-
-static void
-nms_ibft_connection_init (NMSIbftConnection *connection)
-{
-}
-
-NMSIbftConnection *
-nms_ibft_connection_new (const GPtrArray *block, GError **error)
-{
- NMConnection *source;
- GObject *object;
-
- source = nms_ibft_reader_get_connection_from_block (block, error);
- if (!source)
- return NULL;
-
- object = g_object_new (NMS_TYPE_IBFT_CONNECTION, NULL);
- /* Update settings with what was read from iscsiadm */
- if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (object),
- source,
- NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED,
- NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE,
- NULL,
- error))
- g_clear_object (&object);
-
- return (NMSIbftConnection *) object;
-}
-
-static void
-nms_ibft_connection_class_init (NMSIbftConnectionClass *ibft_connection_class)
-{
-}
-
diff --git a/src/settings/plugins/ibft/nms-ibft-connection.h b/src/settings/plugins/ibft/nms-ibft-connection.h
deleted file mode 100644
index 957f99ab63..0000000000
--- a/src/settings/plugins/ibft/nms-ibft-connection.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* NetworkManager system settings service
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright 2014 Red Hat, Inc.
- */
-
-#ifndef __NMS_IBFT_CONNECTION_H__
-#define __NMS_IBFT_CONNECTION_H__
-
-#include "settings/nm-settings-connection.h"
-
-#define NMS_TYPE_IBFT_CONNECTION (nms_ibft_connection_get_type ())
-#define NMS_IBFT_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMS_TYPE_IBFT_CONNECTION, NMSIbftConnection))
-#define NMS_IBFT_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMS_TYPE_IBFT_CONNECTION, NMSIbftConnectionClass))
-#define NMS_IS_IBFT_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMS_TYPE_IBFT_CONNECTION))
-#define NMS_IS_IBFT_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMS_TYPE_IBFT_CONNECTION))
-#define NMS_IBFT_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NMS_TYPE_IBFT_CONNECTION, NMSIbftConnectionClass))
-
-typedef struct _NMSIbftConnection NMSIbftConnection;
-typedef struct _NMSIbftConnectionClass NMSIbftConnectionClass;
-
-GType nms_ibft_connection_get_type (void);
-
-NMSIbftConnection *nms_ibft_connection_new (const GPtrArray *block,
- GError **error);
-
-#endif /* __NMS_IBFT_CONNECTION_H__ */
diff --git a/src/settings/plugins/ibft/nms-ibft-plugin.c b/src/settings/plugins/ibft/nms-ibft-plugin.c
deleted file mode 100644
index 008e9ce3e0..0000000000
--- a/src/settings/plugins/ibft/nms-ibft-plugin.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* NetworkManager system settings service
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright 2014 Red Hat, Inc.
- */
-
-#include "nm-default.h"
-
-#include "nms-ibft-plugin.h"
-
-#include <unistd.h>
-#include <gmodule.h>
-
-#include "nm-setting-connection.h"
-#include "settings/nm-settings-plugin.h"
-#include "NetworkManagerUtils.h"
-
-#include "nms-ibft-reader.h"
-#include "nms-ibft-connection.h"
-
-/*****************************************************************************/
-
-typedef struct {
- GHashTable *connections; /* uuid::connection */
- gboolean initialized;
-} NMSIbftPluginPrivate;
-
-struct _NMSIbftPlugin {
- NMSettingsPlugin parent;
- NMSIbftPluginPrivate _priv;
-};
-
-struct _NMSIbftPluginClass {
- NMSettingsPluginClass parent;
-};
-
-G_DEFINE_TYPE (NMSIbftPlugin, nms_ibft_plugin, NM_TYPE_SETTINGS_PLUGIN);
-
-#define NMS_IBFT_PLUGIN_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSIbftPlugin, NMS_IS_IBFT_PLUGIN)
-
-/*****************************************************************************/
-
-static NMSIbftPlugin *nms_ibft_plugin_get (void);
-
-NM_DEFINE_SINGLETON_GETTER (NMSIbftPlugin, nms_ibft_plugin_get, NMS_TYPE_IBFT_PLUGIN);
-
-/*****************************************************************************/
-
-static void
-read_connections (NMSIbftPlugin *self)
-{
- NMSIbftPluginPrivate *priv = NMS_IBFT_PLUGIN_GET_PRIVATE (self);
- nm_auto_free_ibft_blocks GSList *blocks = NULL;
- GSList *iter;
- gs_free_error GError *error = NULL;
- NMSIbftConnection *connection;
-
- if (!nms_ibft_reader_load_blocks ("/sbin/iscsiadm", &blocks, &error)) {
- nm_log_dbg (LOGD_SETTINGS, "ibft: failed to read iscsiadm records: %s", error->message);
- return;
- }
-
- for (iter = blocks; iter; iter = iter->next) {
- connection = nms_ibft_connection_new (iter->data, &error);
- if (!connection) {
- nm_log_warn (LOGD_SETTINGS, "ibft: failed to read iscsiadm record: %s", error->message);
- g_clear_error (&error);
- continue;
- }
-
- nm_log_info (LOGD_SETTINGS, "ibft: read connection '%s'",
- nm_settings_connection_get_id (NM_SETTINGS_CONNECTION (connection)));
- g_hash_table_insert (priv->connections,
- g_strdup (nm_settings_connection_get_uuid (NM_SETTINGS_CONNECTION (connection))),
- connection);
- }
-}
-
-static GSList *
-get_connections (NMSettingsPlugin *config)
-{
- NMSIbftPlugin *self = NMS_IBFT_PLUGIN (config);
- NMSIbftPluginPrivate *priv = NMS_IBFT_PLUGIN_GET_PRIVATE (self);
- GSList *list = NULL;
- GHashTableIter iter;
- NMSIbftConnection *connection;
-
- if (!priv->initialized) {
- read_connections (self);
- priv->initialized = TRUE;
- }
-
- g_hash_table_iter_init (&iter, priv->connections);
- while (g_hash_table_iter_next (&iter, NULL, (gpointer) &connection))
- list = g_slist_prepend (list, connection);
-
- return list;
-}
-
-/*****************************************************************************/
-
-static void
-nms_ibft_plugin_init (NMSIbftPlugin *self)
-{
- NMSIbftPluginPrivate *priv = NMS_IBFT_PLUGIN_GET_PRIVATE (self);
-
- priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref);
-}
-
-static void
-dispose (GObject *object)
-{
- NMSIbftPlugin *self = NMS_IBFT_PLUGIN (object);
- NMSIbftPluginPrivate *priv = NMS_IBFT_PLUGIN_GET_PRIVATE (self);
-
- if (priv->connections) {
- g_hash_table_destroy (priv->connections);
- priv->connections = NULL;
- }
-
- G_OBJECT_CLASS (nms_ibft_plugin_parent_class)->dispose (object);
-}
-
-static void
-nms_ibft_plugin_class_init (NMSIbftPluginClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- NMSettingsPluginClass *plugin_class = NM_SETTINGS_PLUGIN_CLASS (klass);
-
- object_class->dispose = dispose;
-
- plugin_class->get_connections = get_connections;
-}
-
-/*****************************************************************************/
-
-G_MODULE_EXPORT NMSettingsPlugin *
-nm_settings_plugin_factory (void)
-{
- return NM_SETTINGS_PLUGIN (g_object_ref (nms_ibft_plugin_get ()));
-}
diff --git a/src/settings/plugins/ibft/nms-ibft-plugin.h b/src/settings/plugins/ibft/nms-ibft-plugin.h
deleted file mode 100644
index cc53a8c1ea..0000000000
--- a/src/settings/plugins/ibft/nms-ibft-plugin.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* NetworkManager system settings service
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright 2014 Red Hat, Inc.
- */
-
-#ifndef __NMS_IBFT_PLUGIN_H__
-#define __NMS_IBFT_PLUGIN_H__
-
-#define NMS_TYPE_IBFT_PLUGIN (nms_ibft_plugin_get_type ())
-#define NMS_IBFT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMS_TYPE_IBFT_PLUGIN, NMSIbftPlugin))
-#define NMS_IBFT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMS_TYPE_IBFT_PLUGIN, NMSIbftPluginClass))
-#define NMS_IS_IBFT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMS_TYPE_IBFT_PLUGIN))
-#define NMS_IS_IBFT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMS_TYPE_IBFT_PLUGIN))
-#define NMS_IBFT_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NMS_TYPE_IBFT_PLUGIN, NMSIbftPluginClass))
-
-typedef struct _NMSIbftPlugin NMSIbftPlugin;
-typedef struct _NMSIbftPluginClass NMSIbftPluginClass;
-
-GType nms_ibft_plugin_get_type (void);
-
-#endif /* __NMS_IBFT_PLUGIN_H__ */
diff --git a/src/settings/plugins/ibft/nms-ibft-reader.c b/src/settings/plugins/ibft/nms-ibft-reader.c
deleted file mode 100644
index 1dad06db75..0000000000
--- a/src/settings/plugins/ibft/nms-ibft-reader.c
+++ /dev/null
@@ -1,534 +0,0 @@
-/* NetworkManager system settings service
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright 2014 Red Hat, Inc.
- */
-
-#include "nm-default.h"
-
-#include "nms-ibft-reader.h"
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <sys/wait.h>
-#include <sys/inotify.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
-#include "nm-core-internal.h"
-#include "platform/nm-platform.h"
-#include "NetworkManagerUtils.h"
-
-/*****************************************************************************/
-
-#define PARSE_WARNING(msg...) nm_log_warn (LOGD_SETTINGS, " " msg)
-
-/* Removes trailing whitespace and whitespace before and immediately after the '=' */
-static char *
-remove_most_whitespace (const char *src)
-{
- char *s_new, *s2;
- const char *svalue;
-
- src = nm_str_skip_leading_spaces (src);
-
- svalue = strchr (src, '=');
- if (!svalue || svalue == src)
- return NULL;
-
- s_new = g_new (char, strlen (src) + 1);
-
- memcpy (s_new, src, svalue - src);
- s_new[svalue - src] = '\0';
- g_strchomp (s_new);
-
- svalue++;
- while (*svalue && g_ascii_isspace (*svalue))
- svalue++;
-
- s2 = strchr (s_new, '\0');
- s2[0] = '=';
- strcpy (++s2, svalue);
- g_strchomp (s2);
-
- return s_new;
-}
-
-#define TAG_BEGIN "# BEGIN RECORD"
-#define TAG_END "# END RECORD"
-
-/**
- * nms_ibft_reader_load_blocks:
- * @iscsiadm_path: path to iscsiadm program
- * @out_blocks: on return if successful, a #GSList of #GPtrArray, or %NULL on
- * failure
- * @error: location for an error on failure
- *
- * Parses iscsiadm output and returns a #GSList of #GPtrArray in the @out_blocks
- * argument on success, otherwise @out_blocks is set to %NULL. Each #GPtrArray
- * in @out_blocks contains the lines from an iscsiadm interface block.
- *
- * Returns: %TRUE on success, %FALSE on errors
- */
-gboolean
-nms_ibft_reader_load_blocks (const char *iscsiadm_path,
- GSList **out_blocks,
- GError **error)
-{
- const char *argv[4] = { iscsiadm_path, "-m", "fw", NULL };
- const char *envp[1] = { NULL };
- nm_auto_free_ibft_blocks GSList *blocks = NULL;
- gs_free char *out = NULL;
- gs_free char *err = NULL;
- gs_free const char **lines = NULL;
- GPtrArray *block_lines = NULL;
- gsize i;
- int status = 0;
-
- g_return_val_if_fail (iscsiadm_path != NULL, FALSE);
- g_return_val_if_fail (out_blocks != NULL && *out_blocks == NULL, FALSE);
-
- if (!g_spawn_sync ("/", (char **) argv, (char **) envp, 0,
- NULL, NULL, &out, &err, &status, error))
- return FALSE;
-
- if (!WIFEXITED (status)) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
- "iBFT: %s exited abnormally.", iscsiadm_path);
- return FALSE;
- }
-
- if (WEXITSTATUS (status) != 0) {
- if (err) {
- char *nl;
-
- /* the error message contains newlines. concatenate the lines with whitespace */
- for (nl = err; *nl; nl++) {
- if (*nl == '\n')
- *nl = ' ';
- }
- }
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
- "iBFT: %s exited with error %d. Message: '%s'",
- iscsiadm_path, WEXITSTATUS (status), err ?: "(none)");
- return FALSE;
- }
-
- nm_log_dbg (LOGD_SETTINGS, "iBFT records:\n%s", out);
-
- lines = nm_utils_strsplit_set (out, "\n\r");
- for (i = 0; lines && lines[i]; i++) {
- const char *ss = lines[i];
-
- if (!g_ascii_strncasecmp (ss, TAG_BEGIN, NM_STRLEN (TAG_BEGIN))) {
- if (block_lines) {
- PARSE_WARNING ("malformed iscsiadm record: missing END RECORD.");
- nm_clear_pointer (&block_lines, g_ptr_array_unref);
- }
- /* Start new record */
- block_lines = g_ptr_array_new_full (15, g_free);
- } else if (!g_ascii_strncasecmp (ss, TAG_END, NM_STRLEN (TAG_END))) {
- if (block_lines) {
- if (block_lines->len)
- blocks = g_slist_prepend (blocks, g_steal_pointer (&block_lines));
- else
- g_ptr_array_unref (g_steal_pointer (&block_lines));
- }
- } else if (block_lines) {
- char *s = remove_most_whitespace (ss);
-
- if (!s) {
- PARSE_WARNING ("malformed iscsiadm record: no = in '%s'.", ss);
- nm_clear_pointer (&block_lines, g_ptr_array_unref);
- } else
- g_ptr_array_add (block_lines, s);
- }
- }
-
- if (block_lines) {
- PARSE_WARNING ("malformed iscsiadm record: missing # END RECORD.");
- nm_clear_pointer (&block_lines, g_ptr_array_unref);
- }
-
- *out_blocks = g_steal_pointer (&blocks);
- return TRUE;
-}
-
-#define ISCSI_HWADDR_TAG "iface.hwaddress"
-#define ISCSI_BOOTPROTO_TAG "iface.bootproto"
-#define ISCSI_IPADDR_TAG "iface.ipaddress"
-#define ISCSI_SUBNET_TAG "iface.subnet_mask"
-#define ISCSI_GATEWAY_TAG "iface.gateway"
-#define ISCSI_DNS1_TAG "iface.primary_dns"
-#define ISCSI_DNS2_TAG "iface.secondary_dns"
-#define ISCSI_VLAN_ID_TAG "iface.vlan_id"
-#define ISCSI_IFACE_TAG "iface.net_ifacename"
-
-static const char *
-match_iscsiadm_tag (const char *line, const char *tag)
-{
- gsize taglen = strlen (tag);
-
- if (g_ascii_strncasecmp (line, tag, taglen) != 0)
- return NULL;
- if (line[taglen] != '=')
- return NULL;
- return line + taglen + 1;
-}
-
-/**
- * nms_ibft_reader_parse_block:
- * @block: an array of iscsiadm interface block lines
- * @error: return location for errors
- * @...: pairs of key (const char *) : location (const char **) indicating the
- * key to look for and the location to store the retrieved value in
- *
- * Parses an iscsiadm interface block into variables requested by the caller.
- * Callers should verify the returned data is complete and valid. Returned
- * strings are owned by @block and should not be used after @block is freed.
- *
- * Returns: %TRUE if at least , %FALSE on failure
- */
-gboolean
-nms_ibft_reader_parse_block (const GPtrArray *block, GError **error, ...)
-{
- gboolean success = FALSE;
- const char **out_value, *p;
- va_list ap;
- const char *key;
- guint i;
-
- g_return_val_if_fail (block != NULL, FALSE);
- g_return_val_if_fail (block->len > 0, FALSE);
-
- /* Find requested keys and populate return values */
- va_start (ap, error);
- while ((key = va_arg (ap, const char *))) {
- out_value = va_arg (ap, const char **);
- *out_value = NULL;
- for (i = 0; i < block->len; i++) {
- p = match_iscsiadm_tag (g_ptr_array_index (block, i), key);
- if (p) {
- *out_value = p;
- success = TRUE;
- break;
- }
- }
- }
- va_end (ap);
-
- if (!success) {
- g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: failed to match at least one iscsiadm block field");
- }
- return success;
-}
-
-static gboolean
-ip4_setting_add_from_block (const GPtrArray *block,
- NMConnection *connection,
- GError **error)
-{
- NMSettingIPConfig *s_ip4 = NULL;
- NMIPAddress *addr;
- const char *s_method = NULL;
- const char *s_ipaddr = NULL;
- const char *s_gateway = NULL;
- const char *s_dns1 = NULL;
- const char *s_dns2 = NULL;
- const char *s_netmask = NULL;
- guint32 netmask = 0;
- guint32 prefix;
-
- g_assert (block);
-
- if (!nms_ibft_reader_parse_block (block, error,
- ISCSI_BOOTPROTO_TAG, &s_method,
- ISCSI_IPADDR_TAG, &s_ipaddr,
- ISCSI_SUBNET_TAG, &s_netmask,
- ISCSI_GATEWAY_TAG, &s_gateway,
- ISCSI_DNS1_TAG, &s_dns1,
- ISCSI_DNS2_TAG, &s_dns2,
- NULL))
- goto error;
-
- if (!s_method) {
- g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: missing " ISCSI_BOOTPROTO_TAG);
- goto error;
- }
-
- s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
-
- if (!g_ascii_strcasecmp (s_method, "dhcp")) {
- g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
- goto success;
- } else if (g_ascii_strcasecmp (s_method, "static") != 0) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: unknown " ISCSI_BOOTPROTO_TAG " '%s'.",
- s_method);
- goto error;
- }
-
- /* Static configuration stuff */
- g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
-
- /* IP address */
- if (!s_ipaddr || !nm_utils_ipaddr_valid (AF_INET, s_ipaddr)) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: invalid IP address '%s'.",
- s_ipaddr);
- goto error;
- }
-
- /* Subnet/prefix */
- if (!s_netmask || inet_pton (AF_INET, s_netmask, &netmask) != 1) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: invalid subnet mask '%s'.",
- s_netmask);
- goto error;
- }
- prefix = nm_utils_ip4_netmask_to_prefix (netmask);
-
- if (s_gateway && !nm_utils_ipaddr_valid (AF_INET, s_gateway)) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: invalid IP gateway '%s'.",
- s_gateway);
- goto error;
- }
-
- if (s_dns1 && !nm_utils_ipaddr_valid (AF_INET, s_dns1)) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: invalid DNS1 address '%s'.",
- s_dns1);
- goto error;
- }
-
- if (s_dns2 && !nm_utils_ipaddr_valid (AF_INET, s_dns2)) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: invalid DNS2 address '%s'.",
- s_dns2);
- goto error;
- }
-
- addr = nm_ip_address_new (AF_INET, s_ipaddr, prefix, error);
- if (!addr) {
- g_prefix_error (error, "iBFT: malformed iscsiadm record: ");
- goto error;
- }
-
- nm_setting_ip_config_add_address (s_ip4, addr);
- nm_ip_address_unref (addr);
-
- g_object_set (s_ip4, NM_SETTING_IP_CONFIG_GATEWAY, s_gateway, NULL);
-
- if (s_dns1)
- nm_setting_ip_config_add_dns (s_ip4, s_dns1);
- if (s_dns2)
- nm_setting_ip_config_add_dns (s_ip4, s_dns2);
-
-success:
- nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- return TRUE;
-
-error:
- g_clear_object (&s_ip4);
- return FALSE;
-}
-
-static gboolean
-connection_setting_add (const GPtrArray *block,
- NMConnection *connection,
- const char *type,
- const char *prefix,
- const char *iface,
- GError **error)
-{
- NMSetting *s_con;
- char *id, *uuid;
- const char *s_hwaddr = NULL, *s_ip4addr = NULL, *s_vlanid;
-
- if (!nms_ibft_reader_parse_block (block, error,
- ISCSI_VLAN_ID_TAG, &s_vlanid,
- ISCSI_HWADDR_TAG, &s_hwaddr,
- ISCSI_IPADDR_TAG, &s_ip4addr,
- NULL))
- return FALSE;
- if (!s_hwaddr) {
- g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: missing " ISCSI_HWADDR_TAG);
- return FALSE;
- }
-
- id = g_strdup_printf ("iBFT%s%s %s",
- prefix ? " " : "",
- prefix ?: "",
- iface);
-
- uuid = _nm_utils_uuid_generate_from_strings ("ibft",
- s_hwaddr,
- s_vlanid ? "V" : "v",
- s_vlanid ?: "",
- s_ip4addr ? "A" : "DHCP",
- s_ip4addr ?: "",
- NULL);
-
- s_con = nm_setting_connection_new ();
- g_object_set (s_con,
- NM_SETTING_CONNECTION_TYPE, type,
- NM_SETTING_CONNECTION_UUID, uuid,
- NM_SETTING_CONNECTION_ID, id,
- NM_SETTING_CONNECTION_READ_ONLY, TRUE,
- NULL);
-
- g_free (uuid);
- g_free (id);
-
- nm_connection_add_setting (connection, NM_SETTING (s_con));
- return TRUE;
-}
-
-static gboolean
-is_ibft_vlan_device (const GPtrArray *block)
-{
- char *s_vlan_id = NULL;
-
- if (nms_ibft_reader_parse_block (block, NULL, ISCSI_VLAN_ID_TAG, &s_vlan_id, NULL)) {
- g_assert (s_vlan_id);
-
- /* VLAN 0 is normally a valid VLAN ID, but in the iBFT case it
- * means "no VLAN".
- */
- if (_nm_utils_ascii_str_to_int64 (s_vlan_id, 10, 1, 4095, -1) != -1)
- return TRUE;
- }
- return FALSE;
-}
-
-static gboolean
-vlan_setting_add_from_block (const GPtrArray *block,
- NMConnection *connection,
- GError **error)
-{
- NMSetting *s_vlan = NULL;
- const char *vlan_id_str = NULL;
- gint64 vlan_id = -1;
- gboolean success;
-
- g_assert (block);
- g_assert (connection);
-
- /* This won't fail since this function shouldn't be called unless the
- * iBFT VLAN ID exists and is > 0.
- */
- success = nms_ibft_reader_parse_block (block, NULL, ISCSI_VLAN_ID_TAG, &vlan_id_str, NULL);
- g_assert (success);
- g_assert (vlan_id_str);
-
- /* VLAN 0 is normally a valid VLAN ID, but in the iBFT case it means "no VLAN" */
- vlan_id = _nm_utils_ascii_str_to_int64 (vlan_id_str, 10, 1, 4095, -1);
- if (vlan_id == -1) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "Invalid VLAN_ID '%s'", vlan_id_str);
- return FALSE;
- }
-
- s_vlan = nm_setting_vlan_new ();
- g_object_set (s_vlan, NM_SETTING_VLAN_ID, (guint32) vlan_id, NULL);
- nm_connection_add_setting (connection, NM_SETTING (s_vlan));
-
- return TRUE;
-}
-
-static gboolean
-wired_setting_add_from_block (const GPtrArray *block,
- NMConnection *connection,
- GError **error)
-{
- NMSetting *s_wired = NULL;
- const char *hwaddr = NULL;
-
- g_assert (block);
- g_assert (connection);
-
- if (!nms_ibft_reader_parse_block (block, NULL, ISCSI_HWADDR_TAG, &hwaddr, NULL)) {
- g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: missing " ISCSI_HWADDR_TAG);
- return FALSE;
- }
-
- if (!nm_utils_hwaddr_valid (hwaddr, ETH_ALEN)) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: invalid " ISCSI_HWADDR_TAG " '%s'.",
- hwaddr);
- return FALSE;
- }
-
- s_wired = nm_setting_wired_new ();
- g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, hwaddr, NULL);
-
- nm_connection_add_setting (connection, s_wired);
- return TRUE;
-}
-
-NMConnection *
-nms_ibft_reader_get_connection_from_block (const GPtrArray *block, GError **error)
-{
- NMConnection *connection = NULL;
- gboolean is_vlan = FALSE;
- const char *iface = NULL;
-
- g_assert (block);
-
- if (!nms_ibft_reader_parse_block (block, error, ISCSI_IFACE_TAG, &iface, NULL)) {
- g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "iBFT: malformed iscsiadm record: missing " ISCSI_IFACE_TAG);
- return NULL;
- }
-
- connection = nm_simple_connection_new ();
-
- is_vlan = is_ibft_vlan_device (block);
- if (is_vlan && !vlan_setting_add_from_block (block, connection, error))
- goto error;
-
- /* Always have a wired setting; for VLAN it defines the parent */
- if (!wired_setting_add_from_block (block, connection, error))
- goto error;
-
- if (!ip4_setting_add_from_block (block, connection, error))
- goto error;
-
- if (!connection_setting_add (block,
- connection,
- is_vlan ? NM_SETTING_VLAN_SETTING_NAME : NM_SETTING_WIRED_SETTING_NAME,
- is_vlan ? "VLAN" : NULL,
- iface,
- error))
- goto error;
-
- if (!nm_connection_normalize (connection, NULL, NULL, error))
- goto error;
-
- return connection;
-
-error:
- g_object_unref (connection);
- return NULL;
-}
-
diff --git a/src/settings/plugins/ibft/nms-ibft-reader.h b/src/settings/plugins/ibft/nms-ibft-reader.h
deleted file mode 100644
index 60d4b81af6..0000000000
--- a/src/settings/plugins/ibft/nms-ibft-reader.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* NetworkManager system settings service
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright 2014 Red Hat, Inc.
- */
-
-#ifndef __NMS_IBFT_READER_H__
-#define __NMS_IBFT_READER_H__
-
-#include "nm-connection.h"
-
-static inline void
-_nm_auto_free_ibft_blocks (GSList **p_blocks)
-{
- if (*p_blocks)
- g_slist_free_full (*p_blocks, (GDestroyNotify) g_ptr_array_unref);
-}
-#define nm_auto_free_ibft_blocks nm_auto (_nm_auto_free_ibft_blocks)
-
-gboolean nms_ibft_reader_load_blocks (const char *iscsiadm_path,
- GSList **out_blocks,
- GError **error);
-
-NMConnection *nms_ibft_reader_get_connection_from_block (const GPtrArray *block, GError **error);
-
-gboolean nms_ibft_reader_parse_block (const GPtrArray *block, GError **error, ...) G_GNUC_NULL_TERMINATED;
-
-#endif /* __NMS_IBFT_READER_H__ */
diff --git a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-dns1 b/src/settings/plugins/ibft/tests/iscsiadm-test-bad-dns1
deleted file mode 100755
index 54f02da63a..0000000000
--- a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-dns1
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-cat << EOF
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f0
-iface.bootproto = STATIC
-iface.ipaddress = 192.168.32.72
-iface.subnet_mask = 255.255.252.0
-iface.gateway = 192.168.35.254
-iface.primary_dns = 10000.500.250.1
-iface.secondary_dns = 10.16.255.3
-iface.vlan_id = 0
-iface.net_ifacename = eth0
-node.name = iqn.0.2008-11.com.blahblah:iscsi0
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-# END RECORD
-EOF
-
diff --git a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-dns2 b/src/settings/plugins/ibft/tests/iscsiadm-test-bad-dns2
deleted file mode 100755
index ebd7a9caae..0000000000
--- a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-dns2
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-cat << EOF
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f0
-iface.bootproto = STATIC
-iface.ipaddress = 192.168.32.72
-iface.subnet_mask = 255.255.252.0
-iface.gateway = 192.168.35.254
-iface.primary_dns = 10.16.255.2
-iface.secondary_dns = blah.foo.bar.baz
-iface.vlan_id = 0
-iface.net_ifacename = eth0
-node.name = iqn.0.2008-11.com.blahblah:iscsi0
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-# END RECORD
-EOF
-
diff --git a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-entry b/src/settings/plugins/ibft/tests/iscsiadm-test-bad-entry
deleted file mode 100755
index 4e326048e9..0000000000
--- a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-entry
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-cat << EOF
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f0
-iface.bootproto = STATIC
-iface.ipaddress 192.168.32.72
-iface.subnet_mask = 255.255.252.0
-iface.gateway = 192.168.35.254
-iface.primary_dns = 10.16.255.2
-iface.secondary_dns = 10.16.255.3
-iface.vlan_id = 0
-iface.net_ifacename = eth0
-node.name = iqn.0.2008-11.com.blahblah:iscsi0
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-# END RECORD
-
diff --git a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-gateway b/src/settings/plugins/ibft/tests/iscsiadm-test-bad-gateway
deleted file mode 100755
index 5390a6c3db..0000000000
--- a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-gateway
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-cat << EOF
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f0
-iface.bootproto = STATIC
-iface.ipaddress = 192.168.32.72
-iface.subnet_mask = 255.255.252.0
-iface.gateway = bb.cc.dd.ee
-iface.primary_dns = 10.16.255.2
-iface.secondary_dns = 10.16.255.3
-iface.vlan_id = 0
-iface.net_ifacename = eth0
-node.name = iqn.0.2008-11.com.blahblah:iscsi0
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-# END RECORD
-EOF
-
diff --git a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-ipaddr b/src/settings/plugins/ibft/tests/iscsiadm-test-bad-ipaddr
deleted file mode 100755
index b41cd1f165..0000000000
--- a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-ipaddr
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-cat << EOF
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f0
-iface.bootproto = STATIC
-iface.ipaddress = aa.bb.cc.dd
-iface.subnet_mask = 255.255.252.0
-iface.gateway = 192.168.35.254
-iface.primary_dns = 10.16.255.2
-iface.secondary_dns = 10.16.255.3
-iface.vlan_id = 0
-iface.net_ifacename = eth0
-node.name = iqn.0.2008-11.com.blahblah:iscsi0
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-# END RECORD
-EOF
-
diff --git a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-record b/src/settings/plugins/ibft/tests/iscsiadm-test-bad-record
deleted file mode 100755
index 22b34e6f52..0000000000
--- a/src/settings/plugins/ibft/tests/iscsiadm-test-bad-record
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-cat << EOF
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f0
-iface.bootproto = DHCP
-iface.gateway = 10.16.52.254
-iface.primary_dns = 10.16.255.2
-iface.secondary_dns = 10.16.255.3
-iface.vlan_id = 0
-iface.net_ifacename = eth0
-node.name = iqn.0.2008-11.com.blahblah:iscsi0
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-EOF
-
diff --git a/src/settings/plugins/ibft/tests/iscsiadm-test-dhcp b/src/settings/plugins/ibft/tests/iscsiadm-test-dhcp
deleted file mode 100755
index 556b0586e3..0000000000
--- a/src/settings/plugins/ibft/tests/iscsiadm-test-dhcp
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-cat << EOF
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f0
-iface.bootproto = DHCP
-iface.gateway = 10.16.52.254
-iface.primary_dns = 10.16.255.2
-iface.secondary_dns = 10.16.255.3
-iface.vlan_id = 0
-iface.net_ifacename = eth0
-node.name = iqn.0.2008-11.com.blahblah:iscsi0
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-# END RECORD
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f1
-iface.bootproto = DHCP
-iface.gateway = 10.16.52.254
-iface.primary_dns = 10.16.255.2
-iface.secondary_dns = 10.16.255.3
-iface.vlan_id = 0
-iface.net_ifacename = eth1
-node.name = iqn.1.2008-11.com.blahblah:iscsi1
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-# END RECORD
-EOF
-
diff --git a/src/settings/plugins/ibft/tests/iscsiadm-test-static b/src/settings/plugins/ibft/tests/iscsiadm-test-static
deleted file mode 100755
index 51711480e9..0000000000
--- a/src/settings/plugins/ibft/tests/iscsiadm-test-static
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-cat << EOF
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f0
-iface.bootproto = STATIC
-iface.ipaddress = 192.168.32.72
-iface.subnet_mask = 255.255.252.0
-iface.gateway = 192.168.35.254
-iface.primary_dns = 10.16.255.2
-iface.secondary_dns = 10.16.255.3
-iface.vlan_id = 0
-iface.net_ifacename = eth0
-node.name = iqn.0.2008-11.com.blahblah:iscsi0
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-# END RECORD
-# BEGIN RECORD
-iface.initiatorname = iqn.pjones6
-iface.hwaddress = 00:33:21:98:b9:f1
-iface.bootproto = DHCP
-iface.gateway = 10.16.52.254
-iface.primary_dns = 10.16.255.2
-iface.secondary_dns = 10.16.255.3
-iface.vlan_id = 0
-iface.net_ifacename = eth1
-node.name = iqn.1.2008-11.com.blahblah:iscsi1
-node.conn[0].address = 10.16.52.16
-node.conn[0].port = 3260
-node.boot_lun = 00000000
-# END RECORD
-EOF
-
diff --git a/src/settings/plugins/ibft/tests/iscsiadm-test-vlan b/src/settings/plugins/ibft/tests/iscsiadm-test-vlan
deleted file mode 100755
index 59b80bd03d..0000000000
--- a/src/settings/plugins/ibft/tests/iscsiadm-test-vlan
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-cat << EOF
-# BEGIN RECORD 6.2.0.873-21
-iface.initiatorname = iqn.2010-04.org.ipxe:d05faa97-c4be-44f6-a723-efde9aa399a0
-iface.transport_name = tcp
-iface.hwaddress = 00:33:21:98:b9:f0
-iface.bootproto = STATIC
-iface.ipaddress = 192.168.6.200
-iface.subnet_mask = 255.255.255.0
-iface.vlan_id = 123
-iface.net_ifacename = eth0
-node.name = iqn.2003-01.org.x:disk1
-node.conn[0].address = 192.168.6.32
-node.conn[0].port = 3260
-node.boot_lun = 01000000
-# END RECORD
-EOF
-
diff --git a/src/settings/plugins/ibft/tests/meson.build b/src/settings/plugins/ibft/tests/meson.build
deleted file mode 100644
index e2f9ca7e84..0000000000
--- a/src/settings/plugins/ibft/tests/meson.build
+++ /dev/null
@@ -1,16 +0,0 @@
-test_unit = 'test-ibft'
-
-test_ibft_dir = meson.current_source_dir()
-
-exe = executable(
- test_unit,
- test_unit + '.c',
- dependencies: test_nm_dep,
- link_with: libnms_ibft_core,
-)
-
-test(
- 'ibft/' + test_unit,
- test_script,
- args: test_args + [exe.full_path()],
-)
diff --git a/src/settings/plugins/ibft/tests/test-ibft.c b/src/settings/plugins/ibft/tests/test-ibft.c
deleted file mode 100644
index 50800b848e..0000000000
--- a/src/settings/plugins/ibft/tests/test-ibft.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/* NetworkManager system settings service
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright 2014 Red Hat, Inc.
- */
-
-#include "nm-default.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <netinet/ether.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-
-#include "nm-core-internal.h"
-#include "NetworkManagerUtils.h"
-
-#include "settings/plugins/ibft/nms-ibft-reader.h"
-
-#include "nm-test-utils-core.h"
-
-#define TEST_DIR NM_BUILD_SRCDIR"/src/settings/plugins/ibft/tests"
-
-static GPtrArray *
-read_block (const char *iscsiadm_path, const char *expected_mac)
-{
- nm_auto_free_ibft_blocks GSList *blocks = NULL;
- GSList *iter;
- GPtrArray *block = NULL;
- GError *error = NULL;
- gboolean success;
-
- success = nms_ibft_reader_load_blocks (iscsiadm_path, &blocks, &error);
- nmtst_assert_success (success, error);
-
- g_assert (blocks);
- for (iter = blocks; iter; iter = iter->next) {
- const char *s_hwaddr = NULL;
-
- if (!nms_ibft_reader_parse_block (iter->data, NULL, "iface.hwaddress", &s_hwaddr, NULL))
- continue;
- g_assert (s_hwaddr);
- if (nm_utils_hwaddr_matches (s_hwaddr, -1, expected_mac, -1)) {
- block = g_ptr_array_ref (iter->data);
- break;
- }
- }
- g_assert (block);
-
- return block;
-}
-
-static void
-test_read_ibft_dhcp (void)
-{
- NMConnection *connection;
- NMSettingConnection *s_con;
- NMSettingWired *s_wired;
- NMSettingIPConfig *s_ip4;
- GError *error = NULL;
- const char *mac_address;
- const char *expected_mac_address = "00:33:21:98:b9:f1";
- GPtrArray *block;
-
- block = read_block (TEST_DIR "/iscsiadm-test-dhcp", expected_mac_address);
-
- connection = nms_ibft_reader_get_connection_from_block (block, &error);
- g_assert_no_error (error);
- nmtst_assert_connection_verifies_without_normalization (connection);
-
- g_assert (!nm_connection_get_setting_vlan (connection));
-
- /* ===== CONNECTION SETTING ===== */
- s_con = nm_connection_get_setting_connection (connection);
- g_assert (s_con);
- g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_WIRED_SETTING_NAME);
- g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, "iBFT eth1");
- g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, 0);
- g_assert (nm_setting_connection_get_autoconnect (s_con));
- g_assert (nm_setting_connection_get_read_only (s_con));
-
- /* ===== WIRED SETTING ===== */
- s_wired = nm_connection_get_setting_wired (connection);
- g_assert (s_wired);
- mac_address = nm_setting_wired_get_mac_address (s_wired);
- g_assert (mac_address);
- g_assert (nm_utils_hwaddr_matches (mac_address, -1, expected_mac_address, -1));
- g_assert_cmpint (nm_setting_wired_get_mtu (s_wired), ==, 0);
-
- /* ===== IPv4 SETTING ===== */
- s_ip4 = nm_connection_get_setting_ip4_config (connection);
- g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
-
- g_object_unref (connection);
- g_ptr_array_unref (block);
-}
-
-static void
-test_read_ibft_static (void)
-{
- NMConnection *connection;
- NMSettingConnection *s_con;
- NMSettingWired *s_wired;
- NMSettingIPConfig *s_ip4;
- GError *error = NULL;
- const char *mac_address;
- const char *expected_mac_address = "00:33:21:98:b9:f0";
- NMIPAddress *ip4_addr;
- GPtrArray *block;
-
- block = read_block (TEST_DIR "/iscsiadm-test-static", expected_mac_address);
-
- connection = nms_ibft_reader_get_connection_from_block (block, &error);
- g_assert_no_error (error);
- nmtst_assert_connection_verifies_without_normalization (connection);
-
- g_assert (!nm_connection_get_setting_vlan (connection));
-
- /* ===== CONNECTION SETTING ===== */
- s_con = nm_connection_get_setting_connection (connection);
- g_assert (s_con);
- g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_WIRED_SETTING_NAME);
- g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, "iBFT eth0");
- g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, 0);
- g_assert (nm_setting_connection_get_autoconnect (s_con));
- g_assert (nm_setting_connection_get_read_only (s_con));
-
- /* ===== WIRED SETTING ===== */
- s_wired = nm_connection_get_setting_wired (connection);
- g_assert (s_wired);
- mac_address = nm_setting_wired_get_mac_address (s_wired);
- g_assert (mac_address);
- g_assert (nm_utils_hwaddr_matches (mac_address, -1, expected_mac_address, -1));
- g_assert_cmpint (nm_setting_wired_get_mtu (s_wired), ==, 0);
-
- /* ===== IPv4 SETTING ===== */
- s_ip4 = nm_connection_get_setting_ip4_config (connection);
- g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
-
- g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 2);
- g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 0), ==, "10.16.255.2");
- g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 1), ==, "10.16.255.3");
-
- g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1);
- ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
- g_assert (ip4_addr);
- g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.32.72");
- g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 22);
-
- g_assert_cmpstr (nm_setting_ip_config_get_gateway (s_ip4), ==, "192.168.35.254");
-
- g_object_unref (connection);
- g_ptr_array_unref (block);
-}
-
-static void
-test_read_ibft_malformed (gconstpointer user_data)
-{
- const char *iscsiadm_path = user_data;
- nm_auto_free_ibft_blocks GSList *blocks = NULL;
- GError *error = NULL;
- gboolean success;
-
- g_assert (g_file_test (iscsiadm_path, G_FILE_TEST_EXISTS));
-
- NMTST_EXPECT_NM_WARN ("*malformed iscsiadm record*");
-
- success = nms_ibft_reader_load_blocks (iscsiadm_path, &blocks, &error);
- nmtst_assert_success (success, error);
-
- g_assert (!blocks);
-
- g_test_assert_expected_messages ();
-}
-
-static void
-test_read_ibft_bad_address (gconstpointer user_data)
-{
- const char *iscsiadm_path = user_data;
- NMConnection *connection;
- const char *expected_mac_address = "00:33:21:98:b9:f0";
- GPtrArray *block;
- GError *error = NULL;
-
- g_assert (g_file_test (iscsiadm_path, G_FILE_TEST_EXISTS));
-
- block = read_block (iscsiadm_path, expected_mac_address);
-
- connection = nms_ibft_reader_get_connection_from_block (block, &error);
- g_assert_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION);
- g_assert (strstr (error->message, "iBFT: malformed iscsiadm record: invalid"));
- g_clear_error (&error);
- g_assert (connection == NULL);
-
- g_ptr_array_unref (block);
-}
-
-static void
-test_read_ibft_vlan (void)
-{
- NMConnection *connection;
- NMSettingConnection *s_con;
- NMSettingWired *s_wired;
- NMSettingVlan *s_vlan;
- NMSettingIPConfig *s_ip4;
- const char *mac_address;
- const char *expected_mac_address = "00:33:21:98:b9:f0";
- NMIPAddress *ip4_addr;
- GError *error = NULL;
- GPtrArray *block;
-
- block = read_block (TEST_DIR "/iscsiadm-test-vlan", expected_mac_address);
-
- connection = nms_ibft_reader_get_connection_from_block (block, &error);
- g_assert_no_error (error);
- nmtst_assert_connection_verifies_without_normalization (connection);
-
- s_con = nm_connection_get_setting_connection (connection);
- g_assert (s_con);
- g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_VLAN_SETTING_NAME);
-
- /* ===== WIRED SETTING ===== */
- s_wired = nm_connection_get_setting_wired (connection);
- g_assert (s_wired);
- mac_address = nm_setting_wired_get_mac_address (s_wired);
- g_assert (mac_address);
- g_assert (nm_utils_hwaddr_matches (mac_address, -1, expected_mac_address, -1));
-
- /* ===== VLAN SETTING ===== */
- s_vlan = nm_connection_get_setting_vlan (connection);
- g_assert (s_vlan);
- g_assert_cmpint (nm_setting_vlan_get_id (s_vlan), ==, 123);
- g_assert_cmpstr (nm_setting_vlan_get_parent (s_vlan), ==, NULL);
-
- /* ===== IPv4 SETTING ===== */
- s_ip4 = nm_connection_get_setting_ip4_config (connection);
- g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
-
- g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 0);
-
- g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1);
- ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
- g_assert (ip4_addr);
- g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.6.200");
- g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24);
-
- g_assert_cmpstr (nm_setting_ip_config_get_gateway (s_ip4), ==, NULL);
-
- g_object_unref (connection);
- g_ptr_array_unref (block);
-}
-
-NMTST_DEFINE ();
-
-#define TPATH "/settings/plugins/ibft/"
-
-int main (int argc, char **argv)
-{
- nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
-
- g_test_add_func (TPATH "ibft/dhcp", test_read_ibft_dhcp);
- g_test_add_func (TPATH "ibft/static", test_read_ibft_static);
- g_test_add_func (TPATH "ibft/vlan", test_read_ibft_vlan);
- g_test_add_data_func (TPATH "ibft/bad-record-read", TEST_DIR "/iscsiadm-test-bad-record", test_read_ibft_malformed);
- g_test_add_data_func (TPATH "ibft/bad-entry-read", TEST_DIR "/iscsiadm-test-bad-entry", test_read_ibft_malformed);
- g_test_add_data_func (TPATH "ibft/bad-ipaddr-read", TEST_DIR "/iscsiadm-test-bad-ipaddr", test_read_ibft_bad_address);
- g_test_add_data_func (TPATH "ibft/bad-gateway-read", TEST_DIR "/iscsiadm-test-bad-gateway", test_read_ibft_bad_address);
- g_test_add_data_func (TPATH "ibft/bad-dns1-read", TEST_DIR "/iscsiadm-test-bad-dns1", test_read_ibft_bad_address);
- g_test_add_data_func (TPATH "ibft/bad-dns2-read", TEST_DIR "/iscsiadm-test-bad-dns2", test_read_ibft_bad_address);
-
- return g_test_run ();
-}
-
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index b57284bcc9..ca9ff52d8a 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -5704,7 +5704,7 @@ connection_from_file_full (const char *filename,
return g_steal_pointer (&connection);
}
- /* iBFT is handled by the iBFT settings plugin */
+ /* iBFT is handled by nm-initrd-generator during boot. */
bootproto = svGetValueStr_cp (main_ifcfg, "BOOTPROTO");
if (bootproto && !g_ascii_strcasecmp (bootproto, "ibft")) {
NM_SET_OUT (out_ignore_error, TRUE);
diff --git a/src/settings/plugins/meson.build b/src/settings/plugins/meson.build
index a1aa7823aa..83981aaba7 100644
--- a/src/settings/plugins/meson.build
+++ b/src/settings/plugins/meson.build
@@ -1,7 +1,3 @@
-if enable_ibft
- subdir('ibft')
-endif
-
if enable_ifcfg_rh
subdir('ifcfg-rh')
endif
diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh
index 375141aa9d..052968999a 100755
--- a/tools/create-exports-NetworkManager.sh
+++ b/tools/create-exports-NetworkManager.sh
@@ -18,10 +18,15 @@ die() {
# options to yield the most symbols.
_build() {
git clean -fdx
- ./autogen.sh --enable-ld-gc --enable-ifcfg-rh --enable-ifupdown \
- --enable-config-plugin-ibft --enable-teamdctl --enable-wifi \
- --with-modem-manager-1 --with-ofono --with-more-asserts \
- --with-more-logging
+ ./autogen.sh --enable-ld-gc \
+ --enable-ifcfg-rh \
+ --enable-ifupdown \
+ --enable-teamdctl \
+ --enable-wifi \
+ --with-modem-manager-1 \
+ --with-ofono \
+ --with-more-asserts \
+ --with-more-logging
make -j20
}