diff --git a/.travis.yml b/.travis.yml index 0458b63c5..de6ff770a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,11 +104,12 @@ script: -D ofono=true \ -D teamdctl=false \ \ - -D dhcpcanon=/bin/true \ - -D dhclient=/bin/true \ + -D dhclient=/bin/nowhere/dhclient \ + -D dhcpcanon=/bin/nowhere/dhcpcanon \ + -D dhcpcd=/bin/nowhere/dhcpd \ \ - -D netconfig=true \ - -D resolvconf=true \ + -D netconfig=/bin/nowhere/netconfig \ + -D resolvconf=/bin/nowhere/resolvconf \ \ -D ifcfg_rh=false \ -D ibft=true \ @@ -145,8 +146,8 @@ script: --with-dhcpcd=yes \ --with-dhclient=yes \ \ - --with-netconfig=no \ - --with-resolvconf=yes \ + --with-netconfig=/bin/nowhere/netconfig \ + --with-resolvconf=/bin/nowhere/resolvconf \ \ --enable-ifcfg-rh=yes \ --enable-config-plugin-ibft=yes \ diff --git a/Makefile.am b/Makefile.am index c1615108a..5b0feefa4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -120,9 +120,6 @@ config-extra.h: Makefile echo "/* Generated by Makefile.am */" >$@ && \ echo "#define BINDIR \"$(bindir)\"" >>$@ && \ echo "#define DATADIR \"$(datadir)\"" >>$@ && \ - echo "#define DHCLIENT_PATH \"$(DHCLIENT_PATH)\"" >>$@ && \ - echo "#define DHCPCANON_PATH \"$(DHCPCANON_PATH)\"" >>$@ && \ - echo "#define DHCPCD_PATH \"$(DHCPCD_PATH)\"" >>$@ && \ echo "#define LIBEXECDIR \"$(libexecdir)\"" >>$@ && \ echo "#define LOCALSTATEDIR \"$(localstatedir)\"" >>$@ && \ echo "#define NMCONFDIR \"$(nmconfdir)\"" >>$@ && \ @@ -1853,7 +1850,7 @@ $(src_libNetworkManagerTest_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) ############################################################################### src/NetworkManager.ver: src/libNetworkManager.la $(core_plugins) - $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-make "$(srcdir)" + $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-build "$(srcdir)" CLEANFILES += src/NetworkManager.ver @@ -4749,6 +4746,7 @@ EXTRA_DIST += \ meson_options.txt \ meson_post_install.py \ config.h.meson \ + config-extra.h.meson \ docs/meson.build \ \ po/meson.build \ diff --git a/config-extra.h.meson b/config-extra.h.meson index dbe077d4f..34c962fdd 100644 --- a/config-extra.h.meson +++ b/config-extra.h.meson @@ -1,8 +1,5 @@ #mesondefine BINDIR #mesondefine DATADIR -#mesondefine DHCLIENT_PATH -#mesondefine DHCPCANON_PATH -#mesondefine DHCPCD_PATH #mesondefine LIBEXECDIR #mesondefine LOCALSTATEDIR #mesondefine NMCONFDIR diff --git a/config.h.meson b/config.h.meson index ce77952be..e79f9dcb5 100644 --- a/config.h.meson +++ b/config.h.meson @@ -10,14 +10,11 @@ /* Define to path of dhcpcd binary */ #mesondefine DHCPCD_PATH -/* Define if dhcpcd supports IPv6 (6.x+) */ -#mesondefine DHCPCD_SUPPORTS_IPV6 - /* Define to path of dnsmasq binary */ #mesondefine DNSMASQ_PATH /* Define to path of unbound dnssec-trigger-script */ -#mesondefine DNSSEC_TRIGGER_SCRIPT +#mesondefine DNSSEC_TRIGGER_PATH /* Gettext package */ #mesondefine GETTEXT_PACKAGE diff --git a/configure.ac b/configure.ac index d53335ac2..f244d214e 100644 --- a/configure.ac +++ b/configure.ac @@ -603,9 +603,6 @@ if (test "${enable_teamdctl}" = "yes"); then fi # temporary bug workaround LIBTEAMDCTL_CFLAGS=`echo $LIBTEAMDCTL_CFLAGS | sed -e 's:/teamdctl.h::'` - AC_DEFINE(WITH_TEAMDCTL, 1, [Define if you have Teamd control support]) -else - AC_DEFINE(WITH_TEAMDCTL, 0, [Define if you have Teamd control support]) fi AM_CONDITIONAL(WITH_TEAMDCTL, test "${enable_teamdctl}" = "yes") @@ -674,16 +671,6 @@ if test "${have_crypto_nss}" = "yes"; then fi AM_CONDITIONAL(HAVE_CRYPTO_GNUTLS, test "${have_crypto_gnutls}" = 'yes') AM_CONDITIONAL(HAVE_CRYPTO_NSS, test "${have_crypto_nss}" = 'yes') -if test "${have_crypto_gnutls}" = 'yes'; then - AC_DEFINE(HAVE_CRYPTO_GNUTLS, 1, [Define if you have gnutls support]) -else - AC_DEFINE(HAVE_CRYPTO_GNUTLS, 0, [Define if you have gnutls support]) -fi -if test "${have_crypto_nss}" = 'yes'; then - AC_DEFINE(HAVE_CRYPTO_NSS, 1, [Define if you have nss support]) -else - AC_DEFINE(HAVE_CRYPTO_NSS, 0, [Define if you have nss support]) -fi AC_ARG_WITH(crypto, AS_HELP_STRING([--with-crypto=nss|gnutls], @@ -773,12 +760,6 @@ if (test "${with_modem_manager_1}" != "no"); then with_modem_manager_1="yes" fi fi - -if (test "${with_modem_manager_1}" = "yes"); then - AC_DEFINE(WITH_MODEM_MANAGER_1, 1, [Define if you have ModemManager1 support]) -else - AC_DEFINE(WITH_MODEM_MANAGER_1, 0, [Define if you have ModemManager1 support]) -fi AM_CONDITIONAL(WITH_MODEM_MANAGER_1, test "${with_modem_manager_1}" = "yes") # Bluez5 DUN support @@ -822,7 +803,7 @@ if test "$with_dhcpcanon" != "no"; then fi if test "$with_dhcpcanon" != "no"; then AC_DEFINE(WITH_DHCPCANON, 1, [Define if you have dhcpcanon]) - AC_SUBST(DHCPCANON_PATH, $with_dhcpcanon) + AC_DEFINE_UNQUOTED(DHCPCANON_PATH, "$with_dhcpcanon", [Define path to dhcpcanon]) else AC_DEFINE(WITH_DHCPCANON, 0, [Define if you have dhcpcanon]) fi @@ -834,15 +815,12 @@ if test "${enable_ovs}" != "no"; then if test "$have_jansson" = "no"; then AC_MSG_ERROR(Jansson is required for ovs support) fi - AC_DEFINE(WITH_OPENVSWITCH, 1, [Define if you have OpenVSwitch support]) -else - AC_DEFINE(WITH_OPENVSWITCH, 0, [Define if you have OpenVSwitch support]) fi AM_CONDITIONAL(WITH_OPENVSWITCH, test "${enable_ovs}" = "yes") # DHCP client support AC_ARG_WITH([dhclient], - AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient 4.x support])) + AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient support])) if test "$with_dhclient" != "no"; then with_dhclient_="$with_dhclient" AC_PATH_PROGS(with_dhclient, dhclient, no, /sbin:/usr/sbin:/usr/local/sbin) @@ -851,25 +829,17 @@ if test "$with_dhclient" != "no"; then AC_MSG_WARN([dhclient not found, assume path /usr/sbin/dhclient]) with_dhclient=/usr/sbin/dhclient fi - else - if ! $with_dhclient --version 2>&1 | grep -q "^isc-dhclient-4\."; then - AC_MSG_WARN([Seems version of dhclient $with_dhclient is too old, version 4.x or newer is required.]) - fi fi fi if test "$with_dhclient" != "no"; then AC_DEFINE(WITH_DHCLIENT, 1, [Define if you have dhclient]) - AC_SUBST(DHCLIENT_PATH, $with_dhclient) + AC_DEFINE_UNQUOTED(DHCLIENT_PATH, "$with_dhclient", [Define path to dhclient]) else AC_DEFINE(WITH_DHCLIENT, 0, [Define if you have dhclient]) fi AC_ARG_WITH([dhcpcd], AS_HELP_STRING([--with-dhcpcd=yes|no|path], [Enable dhcpcd 4.x support])) -AC_ARG_WITH([dhcpcd-supports-ipv6], - AS_HELP_STRING([--with-dhcpcd-supports-ipv6=yes|no|auto], - [Whether using dhcpcd >= 6.x which has IPv6 support]), - [with_dhcpcd_supports_ipv6=$withval], [with_dhcpcd_supports_ipv6=auto]) if test "$with_dhcpcd" != "no"; then with_dhcpcd_="$with_dhcpcd" AC_PATH_PROGS(with_dhcpcd, dhcpcd, no, /sbin:/usr/sbin:/usr/local/sbin) @@ -877,39 +847,12 @@ if test "$with_dhcpcd" != "no"; then if test "$with_dhcpcd_" == yes; then AC_MSG_WARN([dhcpcd not found, assume path /usr/sbin/dhcpcd]) with_dhcpcd=/usr/sbin/dhcpcd - if test "$with_dhcpcd_supports_ipv6" == auto; then - with_dhcpcd_supports_ipv6=yes - fi - fi - else - if ! $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[456789]]\."; then - AC_MSG_WARN([Seems version of dhcpcd $with_dhcpcd is too old, version 4.x or newer is required]) fi fi fi -if test "$with_dhcpcd" != "no"; then - if $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[6789]]\."; then - if test "$with_dhcpcd_supports_ipv6" == no; then - AC_MSG_WARN([Seems version of dhcpcd $with_dhcpcd supports IPv6, but compiling --with-dhcpcd-supports-ipv6=no]) - else - with_dhcpcd_supports_ipv6=yes - fi - else - if test "$with_dhcpcd_supports_ipv6" == yes; then - AC_MSG_WARN([Seems version of dhcpcd $with_dhcpcd does not support IPv6, but compiling --with-dhcpcd-supports-ipv6=yes]) - else - with_dhcpcd_supports_ipv6=no - fi - fi - if test "$with_dhcpcd_supports_ipv6" != no; then - AC_DEFINE(DHCPCD_SUPPORTS_IPV6, 1, [Define if dhcpcd supports IPv6 (6.x+)]) - fi -else - with_dhcpcd_supports_ipv6=no -fi if test "$with_dhcpcd" != "no"; then AC_DEFINE(WITH_DHCPCD, 1, [Define if you have dhcpcd]) - AC_SUBST(DHCPCD_PATH, $with_dhcpcd) + AC_DEFINE_UNQUOTED(DHCPCD_PATH, "$with_dhcpcd", [Define path to dhcpcd]) else AC_DEFINE(WITH_DHCPCD, 0, [Define if you have dhcpcd]) fi @@ -928,13 +871,12 @@ test -z "$config_dhcp_default" && config_dhcp_defaul AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_DHCP, "$config_dhcp_default", [Default configuration option for main.dhcp setting]) AC_SUBST(NM_CONFIG_DEFAULT_MAIN_DHCP, $config_dhcp_default) -# resolvconf and netconfig support AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support])) AC_ARG_WITH(netconfig, AS_HELP_STRING([--with-netconfig=yes|no], [Enable SUSE netconfig support])) AC_ARG_WITH(config-dns-rc-manager-default, AS_HELP_STRING([--with-config-dns-rc-manager-default=symlink|file|netconfig|resolvconf], [Configure default value for main.rc-manager setting]), [config_dns_rc_manager_default=$withval]) -if test "$config_dns_rc_manager_default" != symlink -a \ +if test "$config_dns_rc_manager_default" != "" -a \ "$config_dns_rc_manager_default" != file -a \ - "$config_dns_rc_manager_default" != "" -a \ + "$config_dns_rc_manager_default" != symlink -a \ "$config_dns_rc_manager_default" != netconfig -a \ "$config_dns_rc_manager_default" != resolvconf; then AC_MSG_WARN([Unknown --with-config-dns-rc-manager-default=$config_dns_rc_manager_default setting.]) @@ -945,21 +887,29 @@ AS_IF([test -z "$with_netconfig" -a -f /etc/SuSE-release], with_netconfig=yes) # Otherwise default to "no" AS_IF([test -z "$with_resolvconf"], with_resolvconf=no) AS_IF([test -z "$with_netconfig"], with_netconfig=no) -# Find resolvconf and netconfig + if test "$with_resolvconf" = "yes"; then - AC_PATH_PROGS(with_resolvconf, resolvconf, no, /sbin:/usr/sbin:/usr/local/sbin) + AC_PATH_PROGS(with_resolvconf, resolvconf, 'yes', /sbin:/usr/sbin:/usr/local/sbin) + if test "$with_resolvconf" = "yes"; then + AC_MSG_ERROR(cannot find resolvconf in path. Set the path explicitly via --with-resolvconf=PATH.) + fi fi if test "$with_resolvconf" != "no"; then AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=resolvconf) fi + if test "$with_netconfig" = "yes"; then - AC_PATH_PROGS(with_netconfig, netconfig, no, /sbin:/usr/sbin:/usr/local/sbin) + AC_PATH_PROGS(with_netconfig, netconfig, yes, /sbin:/usr/sbin:/usr/local/sbin) + if test "$with_netconfig" = "yes"; then + AC_MSG_ERROR(cannot find netconfig in path. Set the path explicitly via --with-netconfig=PATH.) + fi fi if test "$with_netconfig" != "no"; then AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=netconfig) fi + AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=symlink) -# Define resolvconf and netconfig paths + if test "$with_resolvconf" != "no"; then AC_DEFINE_UNQUOTED(RESOLVCONF_PATH, "$with_resolvconf", [Path to resolvconf]) fi @@ -998,13 +948,13 @@ AC_SUBST(DNSMASQ_PATH) AC_ARG_WITH(dnssec_trigger, AS_HELP_STRING([--with-dnssec-trigger=/path/to/dnssec-trigger-script], [path to unbound dnssec-trigger-script])) if test "x${with_dnssec_trigger}" = x; then - AC_PATH_PROG(DNSSEC_TRIGGER_SCRIPT, dnssec-trigger-script, /usr/libexec/dnssec-trigger-script, + AC_PATH_PROG(DNSSEC_TRIGGER_PATH, dnssec-trigger-script, /usr/libexec/dnssec-trigger-script, /usr/local/libexec:/usr/local/lib:/usr/local/lib/dnssec-trigger:/usr/libexec:/usr/lib:/usr/lib/dnssec-trigger) else - DNSSEC_TRIGGER_SCRIPT="$with_dnssec_trigger" + DNSSEC_TRIGGER_PATH="$with_dnssec_trigger" fi -AC_DEFINE_UNQUOTED(DNSSEC_TRIGGER_SCRIPT, "$DNSSEC_TRIGGER_SCRIPT", [Define to path of unbound dnssec-trigger-script]) -AC_SUBST(DNSSEC_TRIGGER_SCRIPT) +AC_DEFINE_UNQUOTED(DNSSEC_TRIGGER_PATH, "$DNSSEC_TRIGGER_PATH", [Define to path of unbound dnssec-trigger-script]) +AC_SUBST(DNSSEC_TRIGGER_PATH) # system CA certificates path AC_ARG_WITH(system-ca-path, @@ -1356,7 +1306,7 @@ echo echo "Features:" echo " wext: $ac_with_wext" echo " wifi: $enable_wifi" -echo " ppp: $enable_ppp ${PPPD_PLUGIN_DIR}" +echo " ppp: $enable_ppp ${PPPD_PATH} plugins:${PPPD_PLUGIN_DIR}" echo " modemmanager-1: $with_modem_manager_1" echo " ofono: $with_ofono" echo " concheck: $enable_concheck" @@ -1384,7 +1334,6 @@ echo "DHCP clients (default $config_dhcp_default):" echo " dhcpcanon: $with_dhcpcanon" echo " dhclient: $with_dhclient" echo " dhcpcd: $with_dhcpcd" -echo " dhcpcd-supports-ipv6: $with_dhcpcd_supports_ipv6" echo echo "Miscellaneous:" diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 18edf64a9..f24cc8b70 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -685,9 +685,9 @@ fi %config(noreplace) %{_sysconfdir}/%{name}/NetworkManager.conf %{_bindir}/nm-online %{_libexecdir}/nm-ifup -%ghost %{_sbindir}/ifup +%ghost %attr(755, root, root) %{_sbindir}/ifup %{_libexecdir}/nm-ifdown -%ghost %{_sbindir}/ifdown +%ghost %attr(755, root, root) %{_sbindir}/ifdown %{_libexecdir}/nm-dhcp-helper %{_libexecdir}/nm-dispatcher %{_libexecdir}/nm-iface-helper diff --git a/libnm-core/meson.build b/libnm-core/meson.build index eb6fcce94..ac13a1be0 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -16,6 +16,7 @@ libnm_core_headers = files( 'nm-setting-connection.h', 'nm-setting-dcb.h', 'nm-setting-dummy.h', + 'nm-setting-ethtool.h', 'nm-setting-generic.h', 'nm-setting-gsm.h', 'nm-setting-infiniband.h', diff --git a/meson.build b/meson.build index 5ff8d9546..d2cef289f 100644 --- a/meson.build +++ b/meson.build @@ -50,7 +50,7 @@ nm_pkgdatadir = join_paths(nm_datadir, nm_name) nm_pkgincludedir = join_paths(nm_includedir, nm_name) nm_pkglibdir = join_paths(nm_prefix, 'lib', nm_name) nm_pkgrundir = join_paths(nm_runstatedir, nm_name) -nm_pkgstatedir = join_paths(nm_localstatedir, nm_name) +nm_pkgstatedir = join_paths(nm_localstatedir, 'lib', nm_name) nm_vpndir = join_paths(nm_libdir, nm_name) nm_plugindir = join_paths(nm_libdir, nm_name, dist_version) @@ -505,11 +505,14 @@ enable_ppp = get_option('ppp') if enable_ppp assert(cc.has_header('pppd/pppd.h'), 'couldn\'t find pppd.h. pppd development headers are required') - locations = get_option('pppd') - pppd = find_program(locations, required: false) - assert(pppd.found(), 'pppd required but not found, please provide a valid pppd path or use -Dppp=false to disable it') + pppd_path = get_option('pppd') + if pppd_path == '' + pppd = find_program('pppd', '/sbin/pppd', '/usr/sbin/pppd', required: false) + assert(pppd.found(), 'pppd required but not found, please provide a valid pppd path or use -Dppp=false to disable it') + pppd_path = pppd.path() + endif - config_h.set_quoted('PPPD_PATH', pppd.path()) + config_h.set_quoted('PPPD_PATH', pppd_path) pppd_plugin_dir = get_option('pppd_plugin_dir') if pppd_plugin_dir == '' @@ -536,81 +539,39 @@ config_h.set10('WITH_BLUEZ5_DUN', enable_bluez5_dun) enable_ofono = get_option('ofono') config_h.set10('WITH_OFONO', enable_ofono) -# DHCP client support with dhcpcanon -locations = get_option('dhcpcanon') -enable_dhcpcanon = (locations != ['no']) -if enable_dhcpcanon - dhcpcanon = find_program(locations, required: false) - enable_dhcpcanon = dhcpcanon.found() - - if enable_dhcpcanon - config_h.set_quoted('DHCPCANON_PATH', dhcpcanon.path()) - endif -endif -config_h.set10('WITH_DHCPCANON', enable_dhcpcanon) - # DHCP client support -locations = get_option('dhclient') -enable_dhclient = (locations != ['no']) -if enable_dhclient - dhclient = find_program(locations, required: false) - enable_dhclient = dhclient.found() - - if enable_dhclient - res = run_command(dhclient, '--version') - # FIXME: dhcp outputs the version string through stderr!? - if not res.stderr().strip().contains('isc-dhclient-4.') - message('Seems version of dhclient ' + dhclient.path() + ' is too old, version 4.x or newer is required') - endif - config_h.set_quoted('DHCLIENT_PATH', dhclient.path()) - endif -endif -config_h.set10('WITH_DHCLIENT', enable_dhclient) - -locations = get_option('dhcpcd') -enable_dhcpcd = (locations != ['no']) -enable_dhcpcd_supports_ipv6 = false -if enable_dhcpcd - dhcpcd = find_program(locations, required: false) - enable_dhcpcd = dhcpcd.found() - - if enable_dhcpcd - res = run_command(dhcpcd, '--version').stdout().strip() - dhcpcd_version = res.split(' ')[1] - if not dhcpcd_version.version_compare('> 4') - message('Seems version of dhcpcd ' + dhcpcd.path() + ' is too old, version 4.x or newer is required') - endif - - enable_dhcpcd_supports_ipv6 = get_option('dhcpcd_supports_ipv6') - if dhcpcd_version.version_compare('> 6') - if not enable_dhcpcd_supports_ipv6 - message('Seems version of dhcpcd ' + dhcpcd.path() + ' supports IPv6, but compiling without IPv6 support.') - endif - else - if enable_dhcpcd_supports_ipv6 - message('Seems version of dhcpcd ' + dhcpcd.path() +' does not support IPv6, but compiling with IPv6 support.') - endif - endif - config_h.set('DHCPCD_SUPPORTS_IPV6', enable_dhcpcd_supports_ipv6) - config_h.set_quoted('DHCPCD_PATH', dhcpcd.path()) - endif -endif -config_h.set10('WITH_DHCPCD', enable_dhcpcd) - config_dhcp_default = get_option('config_dhcp_default') -if config_dhcp_default == 'dhcpcanon' and not enable_dhcpcanon - error(config_dhcp_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') -endif - -if config_dhcp_default == 'dhclient' and not enable_dhclient - error(config_dhcp_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') -endif - -if config_dhcp_default == 'dhcpcd' and not enable_dhcpcd - error(config_dhcp_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') -endif - config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_DHCP', config_dhcp_default) +dhcp_summary = '' +foreach client : [ 'dhclient', 'dhcpcd', 'dhcpcanon' ] + client_path = get_option(client) + client_enable = (client_path != 'no') + if client_enable + if client_path == '' + client_prog = find_program(client, + '/sbin/' + client, + '/usr/sbin/pppd/' + client, + '/usr/local/sbin/' + client, + required : false) + if client_prog.found() + client_path = client_prog.path() + else + client_path = '/usr/sbin/' + client + message('@0@ not found, assume path @1@'.format(client, client_path)) + endif + endif + config_h.set_quoted(client.to_upper() + '_PATH', client_path) + endif + if config_dhcp_default == client and not client_enable + error(client + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') + endif + config_h.set10('WITH_' + client.to_upper(), client_enable) + dhcp_summary += (' ' + client + ': ' + client_enable.to_string()) + if (client_enable) + dhcp_summary += (' ' + client_path) + endif + dhcp_summary += '\n' +endforeach # OpenVSwitch integration enable_ovs = get_option('ovs') @@ -618,53 +579,70 @@ if enable_ovs assert(jansson_dep.found(), 'jansson is needed for OpenVSwitch integration. Use -Dovs=false to disable it') endif -# resolvconf and netconfig support -locations = get_option('resolvconf') -enable_resolvconf = (locations != ['no']) -if enable_resolvconf - resolvconf = find_program(locations, required: false) - enable_resolvconf = resolvconf.found() - - if enable_resolvconf - config_h.set_quoted('RESOLVCONF_PATH', resolvconf.path()) - endif -endif - -locations = get_option('netconfig') -enable_netconfig = (locations != ['no']) -if enable_netconfig - netconfig = find_program(locations, required: false) - enable_netconfig = netconfig.found() - - if enable_netconfig - config_h.set_quoted('NETCONFIG_PATH', netconfig.path()) - endif -endif - +# DNS resolv.conf managers config_dns_rc_manager_default = get_option('config_dns_rc_manager_default') -if config_dns_rc_manager_default == 'resolvconf' and not enable_resolvconf - error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting') -endif - -if config_dns_rc_manager_default == 'netconfig' and not enable_netconfig - error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting') -endif - config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default) +resolv_conf_summary = '' +foreach prog_name : ['resolvconf', 'netconfig'] + prog_path = get_option(prog_name) + prog_enable = (prog_path != 'no') -# iptables path -config_h.set_quoted('IPTABLES_PATH', find_program(get_option('iptables')).path()) + if prog_enable + if prog_path == '' + prog = find_program(prog_name, + '/usr/' + prog_name, + '/usr/sbin/' + prog_name, + '/usr/local/sbin' + prog_name, + required : false) + if prog.found() + prog_path = prog.path() + else + prog_enable = false + endif + endif + endif -# dnsmasq path -config_h.set_quoted('DNSMASQ_PATH', find_program(get_option('dnsmasq')).path()) + if prog_enable + config_h.set_quoted(prog_name.to_upper() + '_PATH', prog_path) + elif config_dns_rc_manager_default == prog_name + error(prog_name + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting') + endif -# dnssec-trigger-script path -dnssec_trigger_script = find_program(get_option('dnssec_trigger'), required: false) -if dnssec_trigger_script.found() - config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', dnssec_trigger_script.path()) -else - config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', join_paths(nm_libexecdir, 'dnssec-trigger-script')) -endif + resolv_conf_summary += ' ' + prog_name + ': ' + prog_enable.to_string() + if prog_enable + resolv_conf_summary += ' ' + prog_path + endif + resolv_conf_summary += '\n' +endforeach + +# external misc tools paths +default_paths = ['/sbin', '/usr/sbin'] +dnssec_ts_paths = ['/usr/local/libexec', + '/usr/local/lib', + '/usr/local/lib/dnssec-trigger', + '/usr/libexec', + '/usr/lib', + '/usr/lib/dnssec-trigger'] + +# 0: cmdline option, 1: paths, 2: fallback +progs = [['iptables', default_paths, '/sbin/iptables'], + ['dnsmasq', default_paths, ''], + ['dnssec_trigger', dnssec_ts_paths, join_paths(nm_libexecdir, 'dnssec-trigger-script') ], + ] + +foreach prog : progs + path = get_option(prog[0]) + if path == '' + search_paths = [ prog[0] ] + foreach path : prog[1] + search_paths += (path + '/' + prog[0]) + endforeach + exe = find_program(search_paths, required : false) + path = exe.found() ? exe.path() : prog[2] + endif + name = prog[0].to_upper() + '_PATH' + config_h.set_quoted(name, path) +endforeach # system CA certificates path system_ca_path = get_option('system_ca_path') @@ -890,15 +868,6 @@ config_extra_h = configuration_data() config_extra_h.set_quoted('BINDIR', nm_bindir) config_extra_h.set_quoted('DATADIR', nm_datadir) -if enable_dhclient - config_extra_h.set_quoted('DHCLIENT_PATH', dhclient.path()) -endif -if enable_dhcpcanon - config_extra_h.set_quoted('DHCPCANON_PATH', dhcpcanon.path()) -endif -if enable_dhcpcd - config_extra_h.set_quoted('DHCPCD_PATH', dhcpcd.path()) -endif config_extra_h.set_quoted('LIBEXECDIR', nm_libexecdir) config_extra_h.set_quoted('LOCALSTATEDIR', nm_localstatedir) config_extra_h.set_quoted('NMCONFDIR', nm_pkgconfdir) @@ -969,7 +938,7 @@ output += ' wifi: ' + enable_wifi.to_string() + '\n' output += ' iwd: ' + enable_iwd.to_string() + '\n' output += ' pppd: ' + enable_ppp.to_string() if enable_ppp - output += ' ' + pppd.path() + output += ' ' + pppd_path + ' plugins:' + pppd_plugin_dir endif output += '\n' output += ' modemmanager-1: ' + enable_modem_manager.to_string() + '\n' @@ -984,35 +953,11 @@ output += '\nConfiguration_plugins (main.plugins=' + config_plugins_default + ') 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' -output += ' resolvconf: ' + enable_resolvconf.to_string() -if enable_resolvconf - output += ' ' + resolvconf.path() -endif -output += '\n' -output += ' netconfig: ' + enable_netconfig.to_string() -if enable_netconfig - output += ' ' + netconfig.path() -endif +output += '\nHandlers for /etc/resolv.conf:\n' + resolv_conf_summary output += '\n' output += ' config-dns-rc-manager-default: ' + config_dns_rc_manager_default + '\n' -output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' -output += ' dhcpcanon: ' + enable_dhcpcanon.to_string() -if enable_dhcpcanon - output += ' ' + dhcpcanon.path() -endif +output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' + dhcp_summary output += '\n' -output += ' dhclient: ' + enable_dhclient.to_string() -if enable_dhclient - output += ' ' + dhclient.path() -endif -output += '\n' -output += ' dhcpcd: ' + enable_dhcpcd.to_string() -if enable_dhcpcd - output += ' ' + dhcpcd.path() -endif -output += '\n' -output += ' dhcpcd-supports-ipv6: ' + enable_dhcpcd_supports_ipv6.to_string() + '\n' output += '\nMiscellaneous:\n' output += ' have introspection: ' + enable_introspection.to_string() + '\n' output += ' build documentation and manpages: ' + enable_docs.to_string() + '\n' diff --git a/meson_options.txt b/meson_options.txt index 25ec7ae4e..7f06d53a7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,9 +7,9 @@ option('dbus_ifaces_dir', type: 'string', value: '', description: 'where D-Bus i option('dbus_sys_dir', type: 'string', value: '', description: 'where D-Bus system service directory is') option('polkit_dir', type: 'string', value: '', description: 'where PolicyKit policy directory is') option('kernel_firmware_dir', type: 'string', value: '/lib/firmware', description: 'where kernel firmware directory is (default is /lib/firmware)') -option('iptables', type: 'array', value: ['iptables', '/sbin/iptables', '/usr/sbin/iptables'], description: 'path to iptables') -option('dnsmasq', type: 'array', value: ['dnsmasq', '/sbin/dnsmasq', '/usr/sbin/dnsmasq'], description: 'path to dnsmasq') -option('dnssec_trigger', type: 'array', value: ['dnssec-trigger-script', '/usr/local/libexec/dnssec-trigger-script', '/usr/local/lib/dnssec-trigger-script', '/usr/local/lib/dnssec-trigger/dnssec-trigger-script', '/usr/libexec/dnssec-trigger-script', '/usr/lib/dnssec-trigger-script', '/usr/lib/dnssec-trigger/dnssec-trigger-script'], description: 'path to unbound dnssec-trigger-script') +option('iptables', type: 'string', value: '', description: 'path to iptables') +option('dnsmasq', type: 'string', value: '', description: 'path to dnsmasq') +option('dnssec_trigger', type: 'string', value: '', description: 'path to unbound dnssec-trigger-script') # platform option('dist_version', type: 'string', value: '', description: 'Define the NM\'s distribution version string') @@ -30,7 +30,7 @@ option('wext', type: 'boolean', value: true, description: 'Enable or disable Lin option('wifi', type: 'boolean', value: true, description: 'enable Wi-Fi support') option('iwd', type: 'boolean', value: false, description: 'enable iwd support (experimental)') option('ppp', type: 'boolean', value: true, description: 'enable PPP/PPPoE support') -option('pppd', type: 'array', value: ['pppd', '/sbin/pppd', '/usr/sbin/pppd'], description: 'path to pppd binary') +option('pppd', type: 'string', value: '', description: 'path to pppd binary') option('pppd_plugin_dir', type: 'string', value: '', description: 'path to the pppd plugins directory') option('modem_manager', type: 'boolean', value: true, description: 'Enable new ModemManager1 interface support') option('ofono', type: 'boolean', value: false, description: 'Enable oFono support (experimental)') @@ -49,16 +49,15 @@ option('ifcfg_rh', type: 'boolean', value: false, description: 'enable ifcfg-rh option('ifupdown', type: 'boolean', value: false, description: 'enable ifupdown configuration plugin (Debian/Ubuntu)') # handlers for resolv.conf -option('resolvconf', type: 'array', value: ['resolvconf', '/sbin/resolvconf', '/usr/sbin/resolvconf', '/usr/local/sbin/resolvconf'], description: 'Enable resolvconf support') -option('netconfig', type: 'array', value: ['netconfig', '/sbin/netconfig', '/usr/sbin/netconfig', '/usr/local/sbin/netconfig'], description: 'Enable SUSE netconfig support') +option('resolvconf', type: 'string', value: '', description: 'Enable resolvconf support') +option('netconfig', type: 'string', value: '', description: 'Enable SUSE netconfig support') option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'file', 'netconfig', 'resolvconf'], value: 'symlink', description: 'Configure default value for main.rc-manager setting') # dhcp clients -option('dhcpcanon', type: 'array', value: ['dhcpcanon', '/sbin/dhcpcanon', '/usr/sbin/dhcpcanon', '/usr/local/sbin/dhcpcanon', '/usr/bin/dhcpcanon', '/usr/local/bin/dhcpcanon'], description: 'Enable dhcpcanon support (experimental)') -option('dhclient', type: 'array', value: ['dhclient', '/sbin/dhclient', '/usr/sbin/dhclient', '/usr/local/sbin/dhclient'], description: 'Enable dhclient 4.x support') -option('dhcpcd', type: 'array', value: ['dhcpcd', '/sbin/dhcpcd', '/usr/sbin/dhcpcd', '/usr/local/sbin/dhcpcd'], description: 'Enable dhcpcd 4.x support') +option('dhclient', type: 'string', value: '', description: 'Enable dhclient support') +option('dhcpcanon', type: 'string', value: '', description: 'Enable dhcpcanon support (experimental)') +option('dhcpcd', type: 'string', value: '', description: 'Enable dhcpcd support') option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', 'dhcpcd', 'internal'], value: 'internal', description: 'Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset') -option('dhcpcd_supports_ipv6', type: 'boolean', value: true, description: 'Whether using dhcpcd >= 6.x which has IPv6 support') # miscellaneous option('introspection', type: 'boolean', value: true, description: 'Enable introspection for this build') diff --git a/src/dhcp/nm-dhcp-dhcpcd.c b/src/dhcp/nm-dhcp-dhcpcd.c index de04bbda8..98ab5342c 100644 --- a/src/dhcp/nm-dhcp-dhcpcd.c +++ b/src/dhcp/nm-dhcp-dhcpcd.c @@ -133,13 +133,11 @@ ip4_start (NMDhcpClient *client, g_ptr_array_add (argv, (gpointer) "-c"); /* Set script file */ g_ptr_array_add (argv, (gpointer) nm_dhcp_helper_path); -#ifdef DHCPCD_SUPPORTS_IPV6 /* IPv4-only for now. NetworkManager knows better than dhcpcd when to * run IPv6, and dhcpcd's automatic Router Solicitations cause problems * with devices that don't expect them. */ g_ptr_array_add (argv, (gpointer) "-4"); -#endif hostname = nm_dhcp_client_get_hostname (client); diff --git a/src/dns/nm-dns-unbound.c b/src/dns/nm-dns-unbound.c index e06128aa9..b900f29e2 100644 --- a/src/dns/nm-dns-unbound.c +++ b/src/dns/nm-dns-unbound.c @@ -43,7 +43,7 @@ update (NMDnsPlugin *plugin, const CList *ip_config_lst_head, const char *hostname) { - char *argv[] = { DNSSEC_TRIGGER_SCRIPT, "--async", "--update", NULL }; + char *argv[] = { DNSSEC_TRIGGER_PATH, "--async", "--update", NULL }; int status; /* TODO: We currently call a script installed with the dnssec-trigger diff --git a/src/meson.build b/src/meson.build index 83fc3eaca..f46366a90 100644 --- a/src/meson.build +++ b/src/meson.build @@ -143,7 +143,7 @@ sources = files( 'nm-sleep-monitor.c' ) -deps = [ +nm_deps = [ dl_dep, libndp_dep, libudev_dep, @@ -153,70 +153,29 @@ deps = [ ] if enable_concheck - deps += libcurl_dep + nm_deps += libcurl_dep endif if enable_libaudit - deps += libaudit_dep + nm_deps += libaudit_dep endif if enable_libpsl - deps += libpsl_dep + nm_deps += libpsl_dep endif if enable_selinux - deps += selinux_dep + nm_deps += selinux_dep endif libnetwork_manager = static_library( nm_name, sources: sources, - dependencies: deps, + dependencies: nm_deps, c_args: cflags, link_with: [libnetwork_manager_base, libsystemd_nm] ) -ldflags = ['-rdynamic'] - -# FIXME: this doesn't work and it depends on libtool -''' -src/NetworkManager.ver: src/libNetworkManager.la $(core_plugins) - $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-make "$(srcdir)" - -src_NetworkManager_LDFLAGS = \ - -rdynamic \ - -Wl,--version-script="src/NetworkManager.ver" - -nm = find_program('gcc-nm', 'nm') -create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh') - -symbol_map_name = 'NetworkManager.ver' - -linker_script = custom_target( - symbol_map_name, - input: meson.source_root(), - output: symbol_map_name, - capture: true, - #command: ['NM=' + nm.path(), create_exports_networkmanager, '--called-from-make', '@INPUT@'] - command: [create_exports_networkmanager, '--called-from-make', '@INPUT@'] -) - -ldflags += '-Wl,--version-script,@0@'.format(linker_script) -''' - -network_manager = executable( - nm_name, - 'main.c', - dependencies: deps, - c_args: cflags, - link_with: libnetwork_manager, - link_args: ldflags, - #FIXME - #link_depends: linker_script, - install: true, - install_dir: nm_sbindir -) - deps = [ dl_dep, libndp_dep, @@ -287,3 +246,30 @@ endif subdir('devices') subdir('settings/plugins') + +# NetworkManager binary + +create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh') +symbol_map_name = 'NetworkManager.ver' + +ver_script = custom_target( + symbol_map_name, + input: meson.source_root(), + output: symbol_map_name, + depends: [ libnetwork_manager, core_plugins ], + command: [create_exports_networkmanager, '--called-from-build', '@INPUT@'] +) + +ldflags = ['-rdynamic', '-Wl,--version-script,@0@'.format(ver_script.full_path())] + +network_manager = executable( + nm_name, + 'main.c', + dependencies: nm_deps, + c_args: nm_cflags, + link_with: libnetwork_manager, + link_args: ldflags, + link_depends: ver_script, + install: true, + install_dir: nm_sbindir +) diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index 5d9689a52..e4bce09b2 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -18,7 +18,7 @@ libnmdbus_ifcfg_rh = static_library( dependencies: glib_dep, ) -sources = files( +core_sources = files( 'nm-inotify-helper.c', 'nms-ifcfg-rh-reader.c', 'nms-ifcfg-rh-utils.c', @@ -32,11 +32,11 @@ deps = [ libnms_ifcfg_rh_core = static_library( 'nms-ifcfg-rh-core', - sources: sources, + sources: core_sources, dependencies: deps, ) -sources = [dbus_sources] + files('nms-ifcfg-rh-connection.c') +sources = [dbus_sources] + core_sources + files('nms-ifcfg-rh-connection.c', 'nms-ifcfg-rh-plugin.c') libnm_settings_plugin_ifcfg_rh = shared_module( 'nm-settings-plugin-ifcfg-rh', diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh index 3c2494e1d..7d359005b 100755 --- a/tools/create-exports-NetworkManager.sh +++ b/tools/create-exports-NetworkManager.sh @@ -35,7 +35,7 @@ call_nm() { } get_symbols_nm () { - call_nm ./src/.libs/libNetworkManager.a | + call_nm ./src/${libs}libNetworkManager.a | sed -n 's/^[tTDGRBS] //p' | _sort } @@ -47,9 +47,9 @@ EOF } get_symbols_missing() { - (for f in $(find ./src/settings/plugins/*/.libs/ \ - ./src/devices/*/.libs/ \ - ./src/ppp/.libs/ -name '*.so'); do + (for f in $(find ./src/settings/plugins/*/${libs} \ + ./src/devices/*/${libs} \ + ./src/ppp/${libs} -name '*.so'); do call_nm "$f" | sed -n 's/^\([U]\) \(\(nm_\|nmp_\|_nm\|NM\|_NM\|c_siphash_\).*\)$/\2/p' done) | @@ -90,16 +90,25 @@ local: EOF } -test -f ./src/.libs/libNetworkManager.a || die "must be called from NetworkManager \$(top_builddir) after building the tree" +if [ -f "build.ninja" ]; then + from_meson=1 + libs= +else + libs=.libs/ +fi + +test -f ./src/${libs}libNetworkManager.a || die "must be called from NetworkManager top build dir after building the tree" case "$1" in rebuild) + [ -n "$from_meson" ] && die "can't do a build when called from meson" do_rebuild ;; build) + [ -n "$from_meson" ] && die "can't do a build when called from meson" do_build ;; - '--called-from-make') + --called-from-build) if test -z "${NM_BUILD_NO_CREATE_EXPORTS+x}"; then do_update else