mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 07:08:02 +02:00
all: merge branch 'th/connectivity-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/343
This commit is contained in:
commit
6cf1262ac5
18 changed files with 442 additions and 332 deletions
82
Makefile.am
82
Makefile.am
|
|
@ -48,6 +48,7 @@ check_local =
|
||||||
VAPIGEN_VAPIS =
|
VAPIGEN_VAPIS =
|
||||||
dbusservice_DATA =
|
dbusservice_DATA =
|
||||||
dbusactivation_DATA =
|
dbusactivation_DATA =
|
||||||
|
systemdsystemunit_DATA =
|
||||||
|
|
||||||
INTROSPECTION_GIRS =
|
INTROSPECTION_GIRS =
|
||||||
INTROSPECTION_SCANNER_ARGS =
|
INTROSPECTION_SCANNER_ARGS =
|
||||||
|
|
@ -158,6 +159,39 @@ DISTCLEANFILES += intltool-extract intltool-merge intltool-update
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
install-data-hook-dirs:
|
||||||
|
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmconfdir)/conf.d
|
||||||
|
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmconfdir)/system-connections
|
||||||
|
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmconfdir)/dnsmasq.d
|
||||||
|
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmconfdir)/dnsmasq-shared.d
|
||||||
|
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmlibdir)/conf.d
|
||||||
|
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmlibdir)/VPN
|
||||||
|
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmlibdir)/system-connections
|
||||||
|
$(mkinstalldirs) -m 0700 $(DESTDIR)$(nmstatedir)
|
||||||
|
$(mkinstalldirs) -m 0755 $(DESTDIR)$(plugindir)
|
||||||
|
|
||||||
|
install_data_hook += install-data-hook-dirs
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
data_edit = sed \
|
||||||
|
-e 's|@NM_VERSION[@]|$(NM_VERSION)|g' \
|
||||||
|
-e 's|@bindir[@]|$(bindir)|g' \
|
||||||
|
-e 's|@sbindir[@]|$(sbindir)|g' \
|
||||||
|
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
|
-e 's|@nmrundir[@]|$(nmrundir)|g' \
|
||||||
|
-e 's|@nmstatedir[@]|$(nmstatedir)|g' \
|
||||||
|
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
-e 's|@libexecdir[@]|$(libexecdir)|g' \
|
||||||
|
-e 's|@DISTRO_NETWORK_SERVICE[@]|$(DISTRO_NETWORK_SERVICE)|g' \
|
||||||
|
-e 's|@NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT[@]|$(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT)|g' \
|
||||||
|
-e 's|@NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT[@]|$(NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT)|g' \
|
||||||
|
-e 's|@NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT[@]|$(NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT)|g' \
|
||||||
|
-e 's|@NM_CONFIG_DEFAULT_MAIN_RC_MANAGER[@]|$(NM_CONFIG_DEFAULT_MAIN_RC_MANAGER)|g' \
|
||||||
|
-e 's|@NM_CONFIG_DEFAULT_MAIN_DHCP[@]|$(NM_CONFIG_DEFAULT_MAIN_DHCP)|g'
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
polkit_policydir = $(datadir)/polkit-1/actions
|
polkit_policydir = $(datadir)/polkit-1/actions
|
||||||
|
|
||||||
dist_polkit_policy_in_in_files = \
|
dist_polkit_policy_in_in_files = \
|
||||||
|
|
@ -4633,28 +4667,13 @@ EXTRA_DIST += \
|
||||||
# data
|
# data
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
data_edit = sed \
|
|
||||||
-e 's|@NM_VERSION[@]|$(NM_VERSION)|g' \
|
|
||||||
-e 's|@bindir[@]|$(bindir)|g' \
|
|
||||||
-e 's|@sbindir[@]|$(sbindir)|g' \
|
|
||||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
|
||||||
-e 's|@nmrundir[@]|$(nmrundir)|g' \
|
|
||||||
-e 's|@nmstatedir[@]|$(nmstatedir)|g' \
|
|
||||||
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
|
||||||
-e 's|@libexecdir[@]|$(libexecdir)|g' \
|
|
||||||
-e 's|@DISTRO_NETWORK_SERVICE[@]|$(DISTRO_NETWORK_SERVICE)|g' \
|
|
||||||
-e 's|@NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT[@]|$(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT)|g' \
|
|
||||||
-e 's|@NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT[@]|$(NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT)|g' \
|
|
||||||
-e 's|@NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT[@]|$(NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT)|g' \
|
|
||||||
-e 's|@NM_CONFIG_DEFAULT_MAIN_RC_MANAGER[@]|$(NM_CONFIG_DEFAULT_MAIN_RC_MANAGER)|g' \
|
|
||||||
-e 's|@NM_CONFIG_DEFAULT_MAIN_DHCP[@]|$(NM_CONFIG_DEFAULT_MAIN_DHCP)|g'
|
|
||||||
|
|
||||||
if HAVE_SYSTEMD
|
if HAVE_SYSTEMD
|
||||||
|
|
||||||
systemdsystemunit_DATA = \
|
systemdsystemunit_DATA += \
|
||||||
data/NetworkManager.service \
|
data/NetworkManager.service \
|
||||||
data/NetworkManager-wait-online.service \
|
data/NetworkManager-wait-online.service \
|
||||||
data/NetworkManager-dispatcher.service
|
data/NetworkManager-dispatcher.service \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
data/NetworkManager.service: $(srcdir)/data/NetworkManager.service.in
|
data/NetworkManager.service: $(srcdir)/data/NetworkManager.service.in
|
||||||
$(AM_V_GEN) $(data_edit) $< >$@
|
$(AM_V_GEN) $(data_edit) $< >$@
|
||||||
|
|
@ -4687,21 +4706,23 @@ data/server.conf: $(srcdir)/data/server.conf.in
|
||||||
$(AM_V_GEN) $(data_edit) $< >$@
|
$(AM_V_GEN) $(data_edit) $< >$@
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
data/NetworkManager.service.in \
|
|
||||||
data/NetworkManager-wait-online.service.in \
|
|
||||||
data/NetworkManager-wait-online-systemd-pre200.service.in \
|
|
||||||
data/NetworkManager-dispatcher.service.in \
|
|
||||||
data/84-nm-drivers.rules \
|
data/84-nm-drivers.rules \
|
||||||
data/85-nm-unmanaged.rules \
|
data/85-nm-unmanaged.rules \
|
||||||
data/90-nm-thunderbolt.rules \
|
data/90-nm-thunderbolt.rules \
|
||||||
|
data/NetworkManager-dispatcher.service.in \
|
||||||
|
data/NetworkManager-wait-online-systemd-pre200.service.in \
|
||||||
|
data/NetworkManager-wait-online.service.in \
|
||||||
|
data/NetworkManager.service.in \
|
||||||
|
data/meson.build \
|
||||||
data/server.conf.in \
|
data/server.conf.in \
|
||||||
data/meson.build
|
$(NULL)
|
||||||
|
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
data/NetworkManager.service \
|
|
||||||
data/NetworkManager-wait-online.service \
|
|
||||||
data/NetworkManager-dispatcher.service \
|
data/NetworkManager-dispatcher.service \
|
||||||
data/server.conf
|
data/NetworkManager-wait-online.service \
|
||||||
|
data/NetworkManager.service \
|
||||||
|
data/server.conf \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# man
|
# man
|
||||||
|
|
@ -4952,15 +4973,6 @@ dist-hook: $(dist_hook)
|
||||||
install-exec-hook: $(install_exec_hook)
|
install-exec-hook: $(install_exec_hook)
|
||||||
|
|
||||||
install-data-hook: $(install_data_hook)
|
install-data-hook: $(install_data_hook)
|
||||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmconfdir)/conf.d
|
|
||||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmconfdir)/system-connections
|
|
||||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmconfdir)/dnsmasq.d
|
|
||||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmconfdir)/dnsmasq-shared.d
|
|
||||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmlibdir)/conf.d
|
|
||||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmlibdir)/VPN
|
|
||||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmlibdir)/system-connections
|
|
||||||
$(mkinstalldirs) -m 0700 $(DESTDIR)$(nmstatedir)
|
|
||||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(plugindir)
|
|
||||||
|
|
||||||
uninstall-hook: $(uninstall_hook)
|
uninstall-hook: $(uninstall_hook)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,7 @@ configurations using "/etc/sysconfig/network-scripts/rule-NAME" files
|
||||||
(eg, to do policy-based routing).
|
(eg, to do policy-based routing).
|
||||||
|
|
||||||
|
|
||||||
%if 0%{with_nmtui}
|
%if %{with nmtui}
|
||||||
%package tui
|
%package tui
|
||||||
Summary: NetworkManager curses-based UI
|
Summary: NetworkManager curses-based UI
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
|
|
@ -533,6 +533,11 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
|
||||||
-Diwd=true \
|
-Diwd=true \
|
||||||
%else
|
%else
|
||||||
-Diwd=false \
|
-Diwd=false \
|
||||||
|
%endif
|
||||||
|
%if %{with nmtui}
|
||||||
|
-Dnmtui=true \
|
||||||
|
%else
|
||||||
|
-Dnmtui=false \
|
||||||
%endif
|
%endif
|
||||||
-Dvapi=true \
|
-Dvapi=true \
|
||||||
-Dintrospection=true \
|
-Dintrospection=true \
|
||||||
|
|
@ -649,6 +654,11 @@ intltoolize --automake --copy --force
|
||||||
--with-iwd=yes \
|
--with-iwd=yes \
|
||||||
%else
|
%else
|
||||||
--with-iwd=no \
|
--with-iwd=no \
|
||||||
|
%endif
|
||||||
|
%if %{with nmtui}
|
||||||
|
--with-nmtui=yes \
|
||||||
|
%else
|
||||||
|
--with-nmtui=no \
|
||||||
%endif
|
%endif
|
||||||
--enable-vala=yes \
|
--enable-vala=yes \
|
||||||
--enable-introspection \
|
--enable-introspection \
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,3 @@
|
||||||
data_conf = configuration_data()
|
|
||||||
data_conf.set('bindir', nm_bindir)
|
|
||||||
data_conf.set('libexecdir', nm_libexecdir)
|
|
||||||
data_conf.set('sbindir', nm_sbindir)
|
|
||||||
data_conf.set('sysconfdir', nm_sysconfdir)
|
|
||||||
data_conf.set('DISTRO_NETWORK_SERVICE', (enable_ifcfg_rh ? 'network.service' : ''))
|
|
||||||
data_conf.set('NM_MODIFY_SYSTEM_POLICY', (enable_modify_system ? 'yes' : 'auth_admin_keep'))
|
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
input: 'server.conf.in',
|
input: 'server.conf.in',
|
||||||
output: '@BASENAME@',
|
output: '@BASENAME@',
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,11 @@ dispatcher_inc = include_directories('.')
|
||||||
|
|
||||||
name = 'nm-dispatcher'
|
name = 'nm-dispatcher'
|
||||||
|
|
||||||
service_conf = configuration_data()
|
|
||||||
service_conf.set('sbindir', nm_sbindir)
|
|
||||||
service_conf.set('sysconfdir', nm_sysconfdir)
|
|
||||||
service_conf.set('localstatedir', nm_localstatedir)
|
|
||||||
service_conf.set('libexecdir', nm_libexecdir)
|
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
input: 'org.freedesktop.nm_dispatcher.service.in',
|
input: 'org.freedesktop.nm_dispatcher.service.in',
|
||||||
output: '@BASENAME@',
|
output: '@BASENAME@',
|
||||||
install_dir: dbus_system_bus_services_dir,
|
install_dir: dbus_system_bus_services_dir,
|
||||||
configuration: service_conf,
|
configuration: data_conf,
|
||||||
)
|
)
|
||||||
|
|
||||||
install_data(
|
install_data(
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ endif
|
||||||
content_files += configure_file(
|
content_files += configure_file(
|
||||||
input: 'version.xml.in',
|
input: 'version.xml.in',
|
||||||
output: '@BASENAME@',
|
output: '@BASENAME@',
|
||||||
configuration: version_conf,
|
configuration: data_conf,
|
||||||
)
|
)
|
||||||
|
|
||||||
filecopier = find_program('cp')
|
filecopier = find_program('cp')
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ scan_args = [
|
||||||
version_xml = configure_file(
|
version_xml = configure_file(
|
||||||
input: 'version.xml.in',
|
input: 'version.xml.in',
|
||||||
output: '@BASENAME@',
|
output: '@BASENAME@',
|
||||||
configuration: version_conf,
|
configuration: data_conf,
|
||||||
)
|
)
|
||||||
|
|
||||||
gnome.gtkdoc(
|
gnome.gtkdoc(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
version_conf = configuration_data()
|
|
||||||
version_conf.set('VERSION', nm_version)
|
|
||||||
|
|
||||||
subdir('libnm')
|
subdir('libnm')
|
||||||
subdir('api')
|
subdir('api')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,7 @@
|
||||||
common_conf = configuration_data()
|
|
||||||
common_conf.set('NM_VERSION', nm_version)
|
|
||||||
common_conf.set('sysconfdir', nm_sysconfdir)
|
|
||||||
common_conf.set('nmrundir', nm_pkgrundir)
|
|
||||||
common_conf.set('nmstatedir', nm_pkgstatedir)
|
|
||||||
common_conf.set('NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT', config_default_main_auth_polkit)
|
|
||||||
common_conf.set('NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT', config_logging_backend_default)
|
|
||||||
common_conf.set('NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT', config_default_logging_audit)
|
|
||||||
common_conf.set('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
|
|
||||||
common_conf.set('NM_CONFIG_DEFAULT_MAIN_DHCP', config_dhcp_default)
|
|
||||||
|
|
||||||
common_ent_file = configure_file(
|
common_ent_file = configure_file(
|
||||||
input: 'common.ent.in',
|
input: 'common.ent.in',
|
||||||
output: '@BASENAME@',
|
output: '@BASENAME@',
|
||||||
configuration: common_conf,
|
configuration: data_conf,
|
||||||
)
|
)
|
||||||
|
|
||||||
xsltproc_options = [
|
xsltproc_options = [
|
||||||
|
|
|
||||||
25
meson.build
25
meson.build
|
|
@ -774,6 +774,27 @@ if python.found()
|
||||||
config_h.set_quoted('TEST_NM_PYTHON', python.path())
|
config_h.set_quoted('TEST_NM_PYTHON', python.path())
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
data_conf = configuration_data()
|
||||||
|
data_conf.set('DISTRO_NETWORK_SERVICE', (enable_ifcfg_rh ? 'network.service' : ''))
|
||||||
|
data_conf.set('NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT', config_default_logging_audit)
|
||||||
|
data_conf.set('NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT', config_logging_backend_default)
|
||||||
|
data_conf.set('NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT', config_default_main_auth_polkit)
|
||||||
|
data_conf.set('NM_CONFIG_DEFAULT_MAIN_DHCP', config_dhcp_default)
|
||||||
|
data_conf.set('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
|
||||||
|
data_conf.set('NM_MAJOR_VERSION', nm_major_version)
|
||||||
|
data_conf.set('NM_MICRO_VERSION', nm_micro_version)
|
||||||
|
data_conf.set('NM_MINOR_VERSION', nm_minor_version)
|
||||||
|
data_conf.set('NM_MODIFY_SYSTEM_POLICY', (enable_modify_system ? 'yes' : 'auth_admin_keep'))
|
||||||
|
data_conf.set('NM_VERSION', nm_version)
|
||||||
|
data_conf.set('VERSION', nm_version)
|
||||||
|
data_conf.set('bindir', nm_bindir)
|
||||||
|
data_conf.set('libexecdir', nm_libexecdir)
|
||||||
|
data_conf.set('localstatedir', nm_localstatedir)
|
||||||
|
data_conf.set('nmrundir', nm_pkgrundir)
|
||||||
|
data_conf.set('nmstatedir', nm_pkgstatedir)
|
||||||
|
data_conf.set('sbindir', nm_sbindir)
|
||||||
|
data_conf.set('sysconfdir', nm_sysconfdir)
|
||||||
|
|
||||||
# check if we can build setting property documentation
|
# check if we can build setting property documentation
|
||||||
'''
|
'''
|
||||||
build_docs=no
|
build_docs=no
|
||||||
|
|
@ -885,10 +906,10 @@ meson.add_install_script(
|
||||||
nm_pkgconfdir,
|
nm_pkgconfdir,
|
||||||
nm_pkglibdir,
|
nm_pkglibdir,
|
||||||
nm_pkgstatedir,
|
nm_pkgstatedir,
|
||||||
enable_docs ? 'install_docs' : '',
|
|
||||||
nm_mandir,
|
nm_mandir,
|
||||||
enable_ifcfg_rh ? 'create_network_scripts' : '',
|
|
||||||
nm_sysconfdir,
|
nm_sysconfdir,
|
||||||
|
enable_docs ? '1' : '0',
|
||||||
|
enable_ifcfg_rh ? '1' : '0',
|
||||||
)
|
)
|
||||||
|
|
||||||
output = '\nSystem paths:\n'
|
output = '\nSystem paths:\n'
|
||||||
|
|
|
||||||
|
|
@ -99,15 +99,10 @@ libn_dhcp4_dep = declare_dependency(
|
||||||
link_with: libn_dhcp4,
|
link_with: libn_dhcp4,
|
||||||
)
|
)
|
||||||
|
|
||||||
nm_version_macro_conf = configuration_data()
|
|
||||||
nm_version_macro_conf.set('NM_MAJOR_VERSION', nm_major_version)
|
|
||||||
nm_version_macro_conf.set('NM_MINOR_VERSION', nm_minor_version)
|
|
||||||
nm_version_macro_conf.set('NM_MICRO_VERSION', nm_micro_version)
|
|
||||||
|
|
||||||
nm_version_macro_header = configure_file(
|
nm_version_macro_header = configure_file(
|
||||||
input: 'nm-version-macros.h.in',
|
input: 'nm-version-macros.h.in',
|
||||||
output: '@BASENAME@',
|
output: '@BASENAME@',
|
||||||
configuration: nm_version_macro_conf,
|
configuration: data_conf,
|
||||||
)
|
)
|
||||||
|
|
||||||
nm_ethtool_utils_source = files('nm-libnm-core-intern/nm-ethtool-utils.c')
|
nm_ethtool_utils_source = files('nm-libnm-core-intern/nm-ethtool-utils.c')
|
||||||
|
|
|
||||||
|
|
@ -569,4 +569,10 @@ _nm_g_value_unset (GValue *value)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#if !GLIB_CHECK_VERSION (2, 57, 2)
|
||||||
|
#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
#endif /* __NM_GLIB_H__ */
|
#endif /* __NM_GLIB_H__ */
|
||||||
|
|
|
||||||
|
|
@ -135,4 +135,114 @@ extern void _nm_utils_monotonic_timestamp_initialized (const struct timespec *tp
|
||||||
gint64 offset_sec,
|
gint64 offset_sec,
|
||||||
gboolean is_boottime);
|
gboolean is_boottime);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/* This is the default definition of _NMLOG_ENABLED(). Special implementations
|
||||||
|
* might want to undef this and redefine it. */
|
||||||
|
#define _NMLOG_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG_DOMAIN)) )
|
||||||
|
|
||||||
|
#define _LOGT(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#define _LOGD(...) _NMLOG (LOGL_DEBUG, __VA_ARGS__)
|
||||||
|
#define _LOGI(...) _NMLOG (LOGL_INFO , __VA_ARGS__)
|
||||||
|
#define _LOGW(...) _NMLOG (LOGL_WARN , __VA_ARGS__)
|
||||||
|
#define _LOGE(...) _NMLOG (LOGL_ERR , __VA_ARGS__)
|
||||||
|
|
||||||
|
#define _LOGT_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
||||||
|
#define _LOGD_ENABLED(...) _NMLOG_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
|
||||||
|
#define _LOGI_ENABLED(...) _NMLOG_ENABLED (LOGL_INFO , ##__VA_ARGS__)
|
||||||
|
#define _LOGW_ENABLED(...) _NMLOG_ENABLED (LOGL_WARN , ##__VA_ARGS__)
|
||||||
|
#define _LOGE_ENABLED(...) _NMLOG_ENABLED (LOGL_ERR , ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#define _LOGT_err(errsv, ...) _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#define _LOGD_err(errsv, ...) _NMLOG_err (errsv, LOGL_DEBUG, __VA_ARGS__)
|
||||||
|
#define _LOGI_err(errsv, ...) _NMLOG_err (errsv, LOGL_INFO , __VA_ARGS__)
|
||||||
|
#define _LOGW_err(errsv, ...) _NMLOG_err (errsv, LOGL_WARN , __VA_ARGS__)
|
||||||
|
#define _LOGE_err(errsv, ...) _NMLOG_err (errsv, LOGL_ERR , __VA_ARGS__)
|
||||||
|
|
||||||
|
/* _LOGT() and _LOGt() both log with level TRACE, but the latter is disabled by default,
|
||||||
|
* unless building with --with-more-logging. */
|
||||||
|
#if NM_MORE_LOGGING
|
||||||
|
#define _LOGt_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
||||||
|
#define _LOGt(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#define _LOGt_err(errsv, ...) _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
/* still call the logging macros to get compile time checks, but they will be optimized out. */
|
||||||
|
#define _LOGt_ENABLED(...) ( FALSE && (_NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
|
||||||
|
#define _LOGt(...) G_STMT_START { if (FALSE) { _NMLOG (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
||||||
|
#define _LOGt_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/* Some implementation define a second set of logging macros, for a separate
|
||||||
|
* use. As with the _LOGD() macro family above, the exact implementation
|
||||||
|
* depends on the file that uses them.
|
||||||
|
* Still, it encourages a common pattern to have the common set of macros
|
||||||
|
* like _LOG2D(), _LOG2I(), etc. and have _LOG2t() which by default
|
||||||
|
* is disabled at compile time. */
|
||||||
|
|
||||||
|
#define _NMLOG2_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG2_DOMAIN)) )
|
||||||
|
|
||||||
|
#define _LOG2T(...) _NMLOG2 (LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#define _LOG2D(...) _NMLOG2 (LOGL_DEBUG, __VA_ARGS__)
|
||||||
|
#define _LOG2I(...) _NMLOG2 (LOGL_INFO , __VA_ARGS__)
|
||||||
|
#define _LOG2W(...) _NMLOG2 (LOGL_WARN , __VA_ARGS__)
|
||||||
|
#define _LOG2E(...) _NMLOG2 (LOGL_ERR , __VA_ARGS__)
|
||||||
|
|
||||||
|
#define _LOG2T_ENABLED(...) _NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
||||||
|
#define _LOG2D_ENABLED(...) _NMLOG2_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
|
||||||
|
#define _LOG2I_ENABLED(...) _NMLOG2_ENABLED (LOGL_INFO , ##__VA_ARGS__)
|
||||||
|
#define _LOG2W_ENABLED(...) _NMLOG2_ENABLED (LOGL_WARN , ##__VA_ARGS__)
|
||||||
|
#define _LOG2E_ENABLED(...) _NMLOG2_ENABLED (LOGL_ERR , ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#define _LOG2T_err(errsv, ...) _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#define _LOG2D_err(errsv, ...) _NMLOG2_err (errsv, LOGL_DEBUG, __VA_ARGS__)
|
||||||
|
#define _LOG2I_err(errsv, ...) _NMLOG2_err (errsv, LOGL_INFO , __VA_ARGS__)
|
||||||
|
#define _LOG2W_err(errsv, ...) _NMLOG2_err (errsv, LOGL_WARN , __VA_ARGS__)
|
||||||
|
#define _LOG2E_err(errsv, ...) _NMLOG2_err (errsv, LOGL_ERR , __VA_ARGS__)
|
||||||
|
|
||||||
|
#if NM_MORE_LOGGING
|
||||||
|
#define _LOG2t_ENABLED(...) _NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
||||||
|
#define _LOG2t(...) _NMLOG2 (LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#define _LOG2t_err(errsv, ...) _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
/* still call the logging macros to get compile time checks, but they will be optimized out. */
|
||||||
|
#define _LOG2t_ENABLED(...) ( FALSE && (_NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
|
||||||
|
#define _LOG2t(...) G_STMT_START { if (FALSE) { _NMLOG2 (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
||||||
|
#define _LOG2t_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _NMLOG3_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG3_DOMAIN)) )
|
||||||
|
|
||||||
|
#define _LOG3T(...) _NMLOG3 (LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#define _LOG3D(...) _NMLOG3 (LOGL_DEBUG, __VA_ARGS__)
|
||||||
|
#define _LOG3I(...) _NMLOG3 (LOGL_INFO , __VA_ARGS__)
|
||||||
|
#define _LOG3W(...) _NMLOG3 (LOGL_WARN , __VA_ARGS__)
|
||||||
|
#define _LOG3E(...) _NMLOG3 (LOGL_ERR , __VA_ARGS__)
|
||||||
|
|
||||||
|
#define _LOG3T_ENABLED(...) _NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
||||||
|
#define _LOG3D_ENABLED(...) _NMLOG3_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
|
||||||
|
#define _LOG3I_ENABLED(...) _NMLOG3_ENABLED (LOGL_INFO , ##__VA_ARGS__)
|
||||||
|
#define _LOG3W_ENABLED(...) _NMLOG3_ENABLED (LOGL_WARN , ##__VA_ARGS__)
|
||||||
|
#define _LOG3E_ENABLED(...) _NMLOG3_ENABLED (LOGL_ERR , ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#define _LOG3T_err(errsv, ...) _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#define _LOG3D_err(errsv, ...) _NMLOG3_err (errsv, LOGL_DEBUG, __VA_ARGS__)
|
||||||
|
#define _LOG3I_err(errsv, ...) _NMLOG3_err (errsv, LOGL_INFO , __VA_ARGS__)
|
||||||
|
#define _LOG3W_err(errsv, ...) _NMLOG3_err (errsv, LOGL_WARN , __VA_ARGS__)
|
||||||
|
#define _LOG3E_err(errsv, ...) _NMLOG3_err (errsv, LOGL_ERR , __VA_ARGS__)
|
||||||
|
|
||||||
|
#if NM_MORE_LOGGING
|
||||||
|
#define _LOG3t_ENABLED(...) _NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
||||||
|
#define _LOG3t(...) _NMLOG3 (LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#define _LOG3t_err(errsv, ...) _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
/* still call the logging macros to get compile time checks, but they will be optimized out. */
|
||||||
|
#define _LOG3t_ENABLED(...) ( FALSE && (_NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
|
||||||
|
#define _LOG3t(...) G_STMT_START { if (FALSE) { _NMLOG3 (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
||||||
|
#define _LOG3t_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
#endif /* __NM_LOGGING_DEFINES_H__ */
|
#endif /* __NM_LOGGING_DEFINES_H__ */
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
#include <glib-unix.h>
|
||||||
|
|
||||||
#include "nm-errno.h"
|
#include "nm-errno.h"
|
||||||
|
|
||||||
|
|
@ -540,6 +541,102 @@ _nm_utils_ip4_prefix_to_netmask (guint32 prefix)
|
||||||
return prefix < 32 ? ~htonl(0xFFFFFFFF >> prefix) : 0xFFFFFFFF;
|
return prefix < 32 ? ~htonl(0xFFFFFFFF >> prefix) : 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gconstpointer
|
||||||
|
nm_utils_ipx_address_clear_host_address (int family, gpointer dst, gconstpointer src, guint8 plen)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (dst, NULL);
|
||||||
|
|
||||||
|
switch (family) {
|
||||||
|
case AF_INET:
|
||||||
|
g_return_val_if_fail (plen <= 32, NULL);
|
||||||
|
|
||||||
|
if (!src) {
|
||||||
|
/* allow "self-assignment", by specifying %NULL as source. */
|
||||||
|
src = dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
*((guint32 *) dst) = nm_utils_ip4_address_clear_host_address (*((guint32 *) src), plen);
|
||||||
|
break;
|
||||||
|
case AF_INET6:
|
||||||
|
nm_utils_ip6_address_clear_host_address (dst, src, plen);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_return_val_if_reached (NULL);
|
||||||
|
}
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* nm_utils_ip4_address_clear_host_address:
|
||||||
|
* @addr: source ip6 address
|
||||||
|
* @plen: prefix length of network
|
||||||
|
*
|
||||||
|
* returns: the input address, with the host address set to 0.
|
||||||
|
*/
|
||||||
|
in_addr_t
|
||||||
|
nm_utils_ip4_address_clear_host_address (in_addr_t addr, guint8 plen)
|
||||||
|
{
|
||||||
|
return addr & _nm_utils_ip4_prefix_to_netmask (plen);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* nm_utils_ip6_address_clear_host_address:
|
||||||
|
* @dst: destination output buffer, will contain the network part of the @src address
|
||||||
|
* @src: source ip6 address
|
||||||
|
* @plen: prefix length of network
|
||||||
|
*
|
||||||
|
* Note: this function is self assignment safe, to update @src inplace, set both
|
||||||
|
* @dst and @src to the same destination or set @src NULL.
|
||||||
|
*/
|
||||||
|
const struct in6_addr *
|
||||||
|
nm_utils_ip6_address_clear_host_address (struct in6_addr *dst, const struct in6_addr *src, guint8 plen)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (plen <= 128, NULL);
|
||||||
|
g_return_val_if_fail (dst, NULL);
|
||||||
|
|
||||||
|
if (!src)
|
||||||
|
src = dst;
|
||||||
|
|
||||||
|
if (plen < 128) {
|
||||||
|
guint nbytes = plen / 8;
|
||||||
|
guint nbits = plen % 8;
|
||||||
|
|
||||||
|
if (nbytes && dst != src)
|
||||||
|
memcpy (dst, src, nbytes);
|
||||||
|
if (nbits) {
|
||||||
|
dst->s6_addr[nbytes] = (src->s6_addr[nbytes] & (0xFF << (8 - nbits)));
|
||||||
|
nbytes++;
|
||||||
|
}
|
||||||
|
if (nbytes <= 15)
|
||||||
|
memset (&dst->s6_addr[nbytes], 0, 16 - nbytes);
|
||||||
|
} else if (src != dst)
|
||||||
|
*dst = *src;
|
||||||
|
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
nm_utils_ip6_address_same_prefix_cmp (const struct in6_addr *addr_a, const struct in6_addr *addr_b, guint8 plen)
|
||||||
|
{
|
||||||
|
int nbytes;
|
||||||
|
guint8 va, vb, m;
|
||||||
|
|
||||||
|
if (plen >= 128)
|
||||||
|
NM_CMP_DIRECT_MEMCMP (addr_a, addr_b, sizeof (struct in6_addr));
|
||||||
|
else {
|
||||||
|
nbytes = plen / 8;
|
||||||
|
if (nbytes)
|
||||||
|
NM_CMP_DIRECT_MEMCMP (addr_a, addr_b, nbytes);
|
||||||
|
|
||||||
|
plen = plen % 8;
|
||||||
|
if (plen != 0) {
|
||||||
|
m = ~((1 << (8 - plen)) - 1);
|
||||||
|
va = ((((const guint8 *) addr_a))[nbytes]) & m;
|
||||||
|
vb = ((((const guint8 *) addr_b))[nbytes]) & m;
|
||||||
|
NM_CMP_DIRECT (va, vb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _nm_utils_ip4_get_default_prefix:
|
* _nm_utils_ip4_get_default_prefix:
|
||||||
* @ip: an IPv4 address (in network byte order)
|
* @ip: an IPv4 address (in network byte order)
|
||||||
|
|
@ -3388,3 +3485,53 @@ nm_utils_parse_debug_string (const char *string,
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
GSource *
|
||||||
|
nm_g_idle_source_new (int priority,
|
||||||
|
GSourceFunc func,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify destroy_notify)
|
||||||
|
{
|
||||||
|
GSource *source;
|
||||||
|
|
||||||
|
source = g_idle_source_new ();
|
||||||
|
if (priority != G_PRIORITY_DEFAULT)
|
||||||
|
g_source_set_priority (source, priority);
|
||||||
|
g_source_set_callback (source, func, user_data, destroy_notify);
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
GSource *
|
||||||
|
nm_g_timeout_source_new (guint timeout_ms,
|
||||||
|
int priority,
|
||||||
|
GSourceFunc func,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify destroy_notify)
|
||||||
|
{
|
||||||
|
GSource *source;
|
||||||
|
|
||||||
|
source = g_timeout_source_new (timeout_ms);
|
||||||
|
if (priority != G_PRIORITY_DEFAULT)
|
||||||
|
g_source_set_priority (source, priority);
|
||||||
|
g_source_set_callback (source, func, user_data, destroy_notify);
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
GSource *
|
||||||
|
nm_g_unix_signal_source_new (int signum,
|
||||||
|
int priority,
|
||||||
|
GSourceFunc handler,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify notify)
|
||||||
|
{
|
||||||
|
GSource *source;
|
||||||
|
|
||||||
|
source = g_unix_signal_source_new (signum);
|
||||||
|
|
||||||
|
if (priority != G_PRIORITY_DEFAULT)
|
||||||
|
g_source_set_priority (source, priority);
|
||||||
|
g_source_set_callback (source, handler, user_data, notify);
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -522,6 +522,11 @@ nm_utils_escaped_tokens_escape_gstr (const char *str,
|
||||||
guint32 _nm_utils_ip4_prefix_to_netmask (guint32 prefix);
|
guint32 _nm_utils_ip4_prefix_to_netmask (guint32 prefix);
|
||||||
guint32 _nm_utils_ip4_get_default_prefix (guint32 ip);
|
guint32 _nm_utils_ip4_get_default_prefix (guint32 ip);
|
||||||
|
|
||||||
|
gconstpointer nm_utils_ipx_address_clear_host_address (int family, gpointer dst, gconstpointer src, guint8 plen);
|
||||||
|
in_addr_t nm_utils_ip4_address_clear_host_address (in_addr_t addr, guint8 plen);
|
||||||
|
const struct in6_addr *nm_utils_ip6_address_clear_host_address (struct in6_addr *dst, const struct in6_addr *src, guint8 plen);
|
||||||
|
int nm_utils_ip6_address_same_prefix_cmp (const struct in6_addr *addr_a, const struct in6_addr *addr_b, guint8 plen);
|
||||||
|
|
||||||
gboolean nm_utils_ip_is_site_local (int addr_family,
|
gboolean nm_utils_ip_is_site_local (int addr_family,
|
||||||
const void *address);
|
const void *address);
|
||||||
|
|
||||||
|
|
@ -925,12 +930,39 @@ nm_g_source_destroy_and_unref (GSource *source)
|
||||||
g_source_unref (source);
|
g_source_unref (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define nm_clear_g_source_inst(ptr) (nm_clear_pointer ((ptr), nm_g_source_destroy_and_unref))
|
||||||
|
|
||||||
NM_AUTO_DEFINE_FCN0 (GSource *, _nm_auto_destroy_and_unref_gsource, nm_g_source_destroy_and_unref);
|
NM_AUTO_DEFINE_FCN0 (GSource *, _nm_auto_destroy_and_unref_gsource, nm_g_source_destroy_and_unref);
|
||||||
#define nm_auto_destroy_and_unref_gsource nm_auto(_nm_auto_destroy_and_unref_gsource)
|
#define nm_auto_destroy_and_unref_gsource nm_auto(_nm_auto_destroy_and_unref_gsource)
|
||||||
|
|
||||||
NM_AUTO_DEFINE_FCN0 (GMainContext *, _nm_auto_pop_gmaincontext, g_main_context_pop_thread_default)
|
NM_AUTO_DEFINE_FCN0 (GMainContext *, _nm_auto_pop_gmaincontext, g_main_context_pop_thread_default)
|
||||||
#define nm_auto_pop_gmaincontext nm_auto (_nm_auto_pop_gmaincontext)
|
#define nm_auto_pop_gmaincontext nm_auto (_nm_auto_pop_gmaincontext)
|
||||||
|
|
||||||
|
GSource *nm_g_idle_source_new (int priority,
|
||||||
|
GSourceFunc func,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify destroy_notify);
|
||||||
|
|
||||||
|
GSource *nm_g_timeout_source_new (guint timeout_ms,
|
||||||
|
int priority,
|
||||||
|
GSourceFunc func,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify destroy_notify);
|
||||||
|
|
||||||
|
GSource *nm_g_unix_signal_source_new (int signum,
|
||||||
|
int priority,
|
||||||
|
GSourceFunc handler,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify notify);
|
||||||
|
|
||||||
|
static inline GSource *
|
||||||
|
nm_g_source_attach (GSource *source,
|
||||||
|
GMainContext *context)
|
||||||
|
{
|
||||||
|
g_source_attach (source, context);
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
static inline GMainContext *
|
static inline GMainContext *
|
||||||
nm_g_main_context_push_thread_default (GMainContext *context)
|
nm_g_main_context_push_thread_default (GMainContext *context)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#endif
|
#endif
|
||||||
#include <linux/rtnetlink.h>
|
#include <linux/rtnetlink.h>
|
||||||
|
#include <glib-unix.h>
|
||||||
|
|
||||||
#include "c-list/src/c-list.h"
|
#include "c-list/src/c-list.h"
|
||||||
#include "nm-core-internal.h"
|
#include "nm-core-internal.h"
|
||||||
|
|
@ -313,7 +314,6 @@ _con_curl_check_connectivity (CURLM *mhandle, int sockfd, int ev_bitmask)
|
||||||
{
|
{
|
||||||
NMConnectivityCheckHandle *cb_data;
|
NMConnectivityCheckHandle *cb_data;
|
||||||
CURLMsg *msg;
|
CURLMsg *msg;
|
||||||
CURLcode eret;
|
|
||||||
int m_left;
|
int m_left;
|
||||||
long response_code;
|
long response_code;
|
||||||
CURLMcode ret;
|
CURLMcode ret;
|
||||||
|
|
@ -322,12 +322,13 @@ _con_curl_check_connectivity (CURLM *mhandle, int sockfd, int ev_bitmask)
|
||||||
|
|
||||||
ret = curl_multi_socket_action (mhandle, sockfd, ev_bitmask, &running_handles);
|
ret = curl_multi_socket_action (mhandle, sockfd, ev_bitmask, &running_handles);
|
||||||
if (ret != CURLM_OK) {
|
if (ret != CURLM_OK) {
|
||||||
_LOGD ("connectivity check failed: (%d) %s", ret, curl_easy_strerror (ret));
|
_LOGD ("connectivity check failed: (%d) %s", ret, curl_multi_strerror (ret));
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((msg = curl_multi_info_read (mhandle, &m_left))) {
|
while ((msg = curl_multi_info_read (mhandle, &m_left))) {
|
||||||
const char *response;
|
const char *response;
|
||||||
|
CURLcode eret;
|
||||||
|
|
||||||
if (msg->msg != CURLMSG_DONE)
|
if (msg->msg != CURLMSG_DONE)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -408,10 +409,9 @@ _con_curl_timeout_cb (gpointer user_data)
|
||||||
{
|
{
|
||||||
NMConnectivityCheckHandle *cb_data = user_data;
|
NMConnectivityCheckHandle *cb_data = user_data;
|
||||||
|
|
||||||
cb_data->concheck.curl_timer = 0;
|
|
||||||
_con_curl_check_connectivity (cb_data->concheck.curl_mhandle, CURL_SOCKET_TIMEOUT, 0);
|
_con_curl_check_connectivity (cb_data->concheck.curl_mhandle, CURL_SOCKET_TIMEOUT, 0);
|
||||||
_complete_queued (cb_data->self);
|
_complete_queued (cb_data->self);
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -427,7 +427,8 @@ multi_timer_cb (CURLM *multi, long timeout_ms, void *userdata)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMConnectivityCheckHandle *cb_data;
|
NMConnectivityCheckHandle *cb_data;
|
||||||
GIOChannel *ch;
|
|
||||||
|
GSource *source;
|
||||||
|
|
||||||
/* this is a very simplistic weak-pointer. If ConCurlSockData gets
|
/* this is a very simplistic weak-pointer. If ConCurlSockData gets
|
||||||
* destroyed, it will set *destroy_notify to TRUE.
|
* destroyed, it will set *destroy_notify to TRUE.
|
||||||
|
|
@ -436,15 +437,15 @@ typedef struct {
|
||||||
* safely access @fdp after _con_curl_check_connectivity(). */
|
* safely access @fdp after _con_curl_check_connectivity(). */
|
||||||
gboolean *destroy_notify;
|
gboolean *destroy_notify;
|
||||||
|
|
||||||
guint ev;
|
|
||||||
} ConCurlSockData;
|
} ConCurlSockData;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_con_curl_socketevent_cb (GIOChannel *ch, GIOCondition condition, gpointer user_data)
|
_con_curl_socketevent_cb (int fd,
|
||||||
|
GIOCondition condition,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ConCurlSockData *fdp = user_data;
|
ConCurlSockData *fdp = user_data;
|
||||||
NMConnectivityCheckHandle *cb_data = fdp->cb_data;
|
NMConnectivityCheckHandle *cb_data = fdp->cb_data;
|
||||||
int fd = g_io_channel_unix_get_fd (ch);
|
|
||||||
int action = 0;
|
int action = 0;
|
||||||
gboolean fdp_destroyed = FALSE;
|
gboolean fdp_destroyed = FALSE;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
@ -468,12 +469,12 @@ _con_curl_socketevent_cb (GIOChannel *ch, GIOCondition condition, gpointer user_
|
||||||
nm_assert (fdp->destroy_notify == &fdp_destroyed);
|
nm_assert (fdp->destroy_notify == &fdp_destroyed);
|
||||||
fdp->destroy_notify = NULL;
|
fdp->destroy_notify = NULL;
|
||||||
if (!success)
|
if (!success)
|
||||||
fdp->ev = 0;
|
nm_clear_g_source_inst (&fdp->source);
|
||||||
}
|
}
|
||||||
|
|
||||||
_complete_queued (cb_data->self);
|
_complete_queued (cb_data->self);
|
||||||
|
|
||||||
return success ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -481,7 +482,6 @@ multi_socket_cb (CURL *e_handle, curl_socket_t fd, int what, void *userdata, voi
|
||||||
{
|
{
|
||||||
NMConnectivityCheckHandle *cb_data = userdata;
|
NMConnectivityCheckHandle *cb_data = userdata;
|
||||||
ConCurlSockData *fdp = socketp;
|
ConCurlSockData *fdp = socketp;
|
||||||
GIOCondition condition = 0;
|
|
||||||
|
|
||||||
(void) _NM_ENSURE_TYPE (int, fd);
|
(void) _NM_ENSURE_TYPE (int, fd);
|
||||||
|
|
||||||
|
|
@ -489,19 +489,21 @@ multi_socket_cb (CURL *e_handle, curl_socket_t fd, int what, void *userdata, voi
|
||||||
if (fdp) {
|
if (fdp) {
|
||||||
if (fdp->destroy_notify)
|
if (fdp->destroy_notify)
|
||||||
*fdp->destroy_notify = TRUE;
|
*fdp->destroy_notify = TRUE;
|
||||||
|
nm_clear_g_source_inst (&fdp->source);
|
||||||
curl_multi_assign (cb_data->concheck.curl_mhandle, fd, NULL);
|
curl_multi_assign (cb_data->concheck.curl_mhandle, fd, NULL);
|
||||||
nm_clear_g_source (&fdp->ev);
|
|
||||||
g_io_channel_unref (fdp->ch);
|
|
||||||
g_slice_free (ConCurlSockData, fdp);
|
g_slice_free (ConCurlSockData, fdp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
GIOCondition condition;
|
||||||
|
|
||||||
if (!fdp) {
|
if (!fdp) {
|
||||||
fdp = g_slice_new0 (ConCurlSockData);
|
fdp = g_slice_new (ConCurlSockData);
|
||||||
fdp->cb_data = cb_data;
|
*fdp = (ConCurlSockData) {
|
||||||
fdp->ch = g_io_channel_unix_new (fd);
|
.cb_data = cb_data,
|
||||||
|
};
|
||||||
curl_multi_assign (cb_data->concheck.curl_mhandle, fd, fdp);
|
curl_multi_assign (cb_data->concheck.curl_mhandle, fd, fdp);
|
||||||
} else
|
} else
|
||||||
nm_clear_g_source (&fdp->ev);
|
nm_clear_g_source_inst (&fdp->source);
|
||||||
|
|
||||||
if (what == CURL_POLL_IN)
|
if (what == CURL_POLL_IN)
|
||||||
condition = G_IO_IN;
|
condition = G_IO_IN;
|
||||||
|
|
@ -509,9 +511,14 @@ multi_socket_cb (CURL *e_handle, curl_socket_t fd, int what, void *userdata, voi
|
||||||
condition = G_IO_OUT;
|
condition = G_IO_OUT;
|
||||||
else if (what == CURL_POLL_INOUT)
|
else if (what == CURL_POLL_INOUT)
|
||||||
condition = G_IO_IN | G_IO_OUT;
|
condition = G_IO_IN | G_IO_OUT;
|
||||||
|
else
|
||||||
|
condition = 0;
|
||||||
|
|
||||||
if (condition)
|
if (condition) {
|
||||||
fdp->ev = g_io_add_watch (fdp->ch, condition, _con_curl_socketevent_cb, fdp);
|
fdp->source = g_unix_fd_source_new (fd, condition);
|
||||||
|
g_source_set_callback (fdp->source, G_SOURCE_FUNC (_con_curl_socketevent_cb), fdp, NULL);
|
||||||
|
g_source_attach (fdp->source, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CURLM_OK;
|
return CURLM_OK;
|
||||||
|
|
|
||||||
|
|
@ -231,102 +231,6 @@ nm_ethernet_address_is_valid (gconstpointer addr, gssize len)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gconstpointer
|
|
||||||
nm_utils_ipx_address_clear_host_address (int family, gpointer dst, gconstpointer src, guint8 plen)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (dst, NULL);
|
|
||||||
|
|
||||||
switch (family) {
|
|
||||||
case AF_INET:
|
|
||||||
g_return_val_if_fail (plen <= 32, NULL);
|
|
||||||
|
|
||||||
if (!src) {
|
|
||||||
/* allow "self-assignment", by specifying %NULL as source. */
|
|
||||||
src = dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
*((guint32 *) dst) = nm_utils_ip4_address_clear_host_address (*((guint32 *) src), plen);
|
|
||||||
break;
|
|
||||||
case AF_INET6:
|
|
||||||
nm_utils_ip6_address_clear_host_address (dst, src, plen);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_return_val_if_reached (NULL);
|
|
||||||
}
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* nm_utils_ip4_address_clear_host_address:
|
|
||||||
* @addr: source ip6 address
|
|
||||||
* @plen: prefix length of network
|
|
||||||
*
|
|
||||||
* returns: the input address, with the host address set to 0.
|
|
||||||
*/
|
|
||||||
in_addr_t
|
|
||||||
nm_utils_ip4_address_clear_host_address (in_addr_t addr, guint8 plen)
|
|
||||||
{
|
|
||||||
return addr & _nm_utils_ip4_prefix_to_netmask (plen);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* nm_utils_ip6_address_clear_host_address:
|
|
||||||
* @dst: destination output buffer, will contain the network part of the @src address
|
|
||||||
* @src: source ip6 address
|
|
||||||
* @plen: prefix length of network
|
|
||||||
*
|
|
||||||
* Note: this function is self assignment safe, to update @src inplace, set both
|
|
||||||
* @dst and @src to the same destination or set @src NULL.
|
|
||||||
*/
|
|
||||||
const struct in6_addr *
|
|
||||||
nm_utils_ip6_address_clear_host_address (struct in6_addr *dst, const struct in6_addr *src, guint8 plen)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (plen <= 128, NULL);
|
|
||||||
g_return_val_if_fail (dst, NULL);
|
|
||||||
|
|
||||||
if (!src)
|
|
||||||
src = dst;
|
|
||||||
|
|
||||||
if (plen < 128) {
|
|
||||||
guint nbytes = plen / 8;
|
|
||||||
guint nbits = plen % 8;
|
|
||||||
|
|
||||||
if (nbytes && dst != src)
|
|
||||||
memcpy (dst, src, nbytes);
|
|
||||||
if (nbits) {
|
|
||||||
dst->s6_addr[nbytes] = (src->s6_addr[nbytes] & (0xFF << (8 - nbits)));
|
|
||||||
nbytes++;
|
|
||||||
}
|
|
||||||
if (nbytes <= 15)
|
|
||||||
memset (&dst->s6_addr[nbytes], 0, 16 - nbytes);
|
|
||||||
} else if (src != dst)
|
|
||||||
*dst = *src;
|
|
||||||
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
nm_utils_ip6_address_same_prefix_cmp (const struct in6_addr *addr_a, const struct in6_addr *addr_b, guint8 plen)
|
|
||||||
{
|
|
||||||
int nbytes;
|
|
||||||
guint8 va, vb, m;
|
|
||||||
|
|
||||||
if (plen >= 128)
|
|
||||||
NM_CMP_DIRECT_MEMCMP (addr_a, addr_b, sizeof (struct in6_addr));
|
|
||||||
else {
|
|
||||||
nbytes = plen / 8;
|
|
||||||
if (nbytes)
|
|
||||||
NM_CMP_DIRECT_MEMCMP (addr_a, addr_b, nbytes);
|
|
||||||
|
|
||||||
plen = plen % 8;
|
|
||||||
if (plen != 0) {
|
|
||||||
m = ~((1 << (8 - plen)) - 1);
|
|
||||||
va = ((((const guint8 *) addr_a))[nbytes]) & m;
|
|
||||||
vb = ((((const guint8 *) addr_b))[nbytes]) & m;
|
|
||||||
NM_CMP_DIRECT (va, vb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
108
src/nm-logging.h
108
src/nm-logging.h
|
|
@ -177,114 +177,6 @@ gboolean nm_logging_syslog_enabled (void);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/* This is the default definition of _NMLOG_ENABLED(). Special implementations
|
|
||||||
* might want to undef this and redefine it. */
|
|
||||||
#define _NMLOG_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG_DOMAIN)) )
|
|
||||||
|
|
||||||
#define _LOGT(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#define _LOGD(...) _NMLOG (LOGL_DEBUG, __VA_ARGS__)
|
|
||||||
#define _LOGI(...) _NMLOG (LOGL_INFO , __VA_ARGS__)
|
|
||||||
#define _LOGW(...) _NMLOG (LOGL_WARN , __VA_ARGS__)
|
|
||||||
#define _LOGE(...) _NMLOG (LOGL_ERR , __VA_ARGS__)
|
|
||||||
|
|
||||||
#define _LOGT_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
||||||
#define _LOGD_ENABLED(...) _NMLOG_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
|
|
||||||
#define _LOGI_ENABLED(...) _NMLOG_ENABLED (LOGL_INFO , ##__VA_ARGS__)
|
|
||||||
#define _LOGW_ENABLED(...) _NMLOG_ENABLED (LOGL_WARN , ##__VA_ARGS__)
|
|
||||||
#define _LOGE_ENABLED(...) _NMLOG_ENABLED (LOGL_ERR , ##__VA_ARGS__)
|
|
||||||
|
|
||||||
#define _LOGT_err(errsv, ...) _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#define _LOGD_err(errsv, ...) _NMLOG_err (errsv, LOGL_DEBUG, __VA_ARGS__)
|
|
||||||
#define _LOGI_err(errsv, ...) _NMLOG_err (errsv, LOGL_INFO , __VA_ARGS__)
|
|
||||||
#define _LOGW_err(errsv, ...) _NMLOG_err (errsv, LOGL_WARN , __VA_ARGS__)
|
|
||||||
#define _LOGE_err(errsv, ...) _NMLOG_err (errsv, LOGL_ERR , __VA_ARGS__)
|
|
||||||
|
|
||||||
/* _LOGT() and _LOGt() both log with level TRACE, but the latter is disabled by default,
|
|
||||||
* unless building with --with-more-logging. */
|
|
||||||
#if NM_MORE_LOGGING
|
|
||||||
#define _LOGt_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
||||||
#define _LOGt(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#define _LOGt_err(errsv, ...) _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#else
|
|
||||||
/* still call the logging macros to get compile time checks, but they will be optimized out. */
|
|
||||||
#define _LOGt_ENABLED(...) ( FALSE && (_NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
|
|
||||||
#define _LOGt(...) G_STMT_START { if (FALSE) { _NMLOG (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
||||||
#define _LOGt_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/* Some implementation define a second set of logging macros, for a separate
|
|
||||||
* use. As with the _LOGD() macro family above, the exact implementation
|
|
||||||
* depends on the file that uses them.
|
|
||||||
* Still, it encourages a common pattern to have the common set of macros
|
|
||||||
* like _LOG2D(), _LOG2I(), etc. and have _LOG2t() which by default
|
|
||||||
* is disabled at compile time. */
|
|
||||||
|
|
||||||
#define _NMLOG2_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG2_DOMAIN)) )
|
|
||||||
|
|
||||||
#define _LOG2T(...) _NMLOG2 (LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#define _LOG2D(...) _NMLOG2 (LOGL_DEBUG, __VA_ARGS__)
|
|
||||||
#define _LOG2I(...) _NMLOG2 (LOGL_INFO , __VA_ARGS__)
|
|
||||||
#define _LOG2W(...) _NMLOG2 (LOGL_WARN , __VA_ARGS__)
|
|
||||||
#define _LOG2E(...) _NMLOG2 (LOGL_ERR , __VA_ARGS__)
|
|
||||||
|
|
||||||
#define _LOG2T_ENABLED(...) _NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
||||||
#define _LOG2D_ENABLED(...) _NMLOG2_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
|
|
||||||
#define _LOG2I_ENABLED(...) _NMLOG2_ENABLED (LOGL_INFO , ##__VA_ARGS__)
|
|
||||||
#define _LOG2W_ENABLED(...) _NMLOG2_ENABLED (LOGL_WARN , ##__VA_ARGS__)
|
|
||||||
#define _LOG2E_ENABLED(...) _NMLOG2_ENABLED (LOGL_ERR , ##__VA_ARGS__)
|
|
||||||
|
|
||||||
#define _LOG2T_err(errsv, ...) _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#define _LOG2D_err(errsv, ...) _NMLOG2_err (errsv, LOGL_DEBUG, __VA_ARGS__)
|
|
||||||
#define _LOG2I_err(errsv, ...) _NMLOG2_err (errsv, LOGL_INFO , __VA_ARGS__)
|
|
||||||
#define _LOG2W_err(errsv, ...) _NMLOG2_err (errsv, LOGL_WARN , __VA_ARGS__)
|
|
||||||
#define _LOG2E_err(errsv, ...) _NMLOG2_err (errsv, LOGL_ERR , __VA_ARGS__)
|
|
||||||
|
|
||||||
#if NM_MORE_LOGGING
|
|
||||||
#define _LOG2t_ENABLED(...) _NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
||||||
#define _LOG2t(...) _NMLOG2 (LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#define _LOG2t_err(errsv, ...) _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#else
|
|
||||||
/* still call the logging macros to get compile time checks, but they will be optimized out. */
|
|
||||||
#define _LOG2t_ENABLED(...) ( FALSE && (_NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
|
|
||||||
#define _LOG2t(...) G_STMT_START { if (FALSE) { _NMLOG2 (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
||||||
#define _LOG2t_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _NMLOG3_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG3_DOMAIN)) )
|
|
||||||
|
|
||||||
#define _LOG3T(...) _NMLOG3 (LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#define _LOG3D(...) _NMLOG3 (LOGL_DEBUG, __VA_ARGS__)
|
|
||||||
#define _LOG3I(...) _NMLOG3 (LOGL_INFO , __VA_ARGS__)
|
|
||||||
#define _LOG3W(...) _NMLOG3 (LOGL_WARN , __VA_ARGS__)
|
|
||||||
#define _LOG3E(...) _NMLOG3 (LOGL_ERR , __VA_ARGS__)
|
|
||||||
|
|
||||||
#define _LOG3T_ENABLED(...) _NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
||||||
#define _LOG3D_ENABLED(...) _NMLOG3_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
|
|
||||||
#define _LOG3I_ENABLED(...) _NMLOG3_ENABLED (LOGL_INFO , ##__VA_ARGS__)
|
|
||||||
#define _LOG3W_ENABLED(...) _NMLOG3_ENABLED (LOGL_WARN , ##__VA_ARGS__)
|
|
||||||
#define _LOG3E_ENABLED(...) _NMLOG3_ENABLED (LOGL_ERR , ##__VA_ARGS__)
|
|
||||||
|
|
||||||
#define _LOG3T_err(errsv, ...) _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#define _LOG3D_err(errsv, ...) _NMLOG3_err (errsv, LOGL_DEBUG, __VA_ARGS__)
|
|
||||||
#define _LOG3I_err(errsv, ...) _NMLOG3_err (errsv, LOGL_INFO , __VA_ARGS__)
|
|
||||||
#define _LOG3W_err(errsv, ...) _NMLOG3_err (errsv, LOGL_WARN , __VA_ARGS__)
|
|
||||||
#define _LOG3E_err(errsv, ...) _NMLOG3_err (errsv, LOGL_ERR , __VA_ARGS__)
|
|
||||||
|
|
||||||
#if NM_MORE_LOGGING
|
|
||||||
#define _LOG3t_ENABLED(...) _NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
||||||
#define _LOG3t(...) _NMLOG3 (LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#define _LOG3t_err(errsv, ...) _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
||||||
#else
|
|
||||||
/* still call the logging macros to get compile time checks, but they will be optimized out. */
|
|
||||||
#define _LOG3t_ENABLED(...) ( FALSE && (_NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
|
|
||||||
#define _LOG3t(...) G_STMT_START { if (FALSE) { _NMLOG3 (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
||||||
#define _LOG3t_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
#define __NMLOG_DEFAULT(level, domain, prefix, ...) \
|
#define __NMLOG_DEFAULT(level, domain, prefix, ...) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
nm_log ((level), (domain), NULL, NULL, \
|
nm_log ((level), (domain), NULL, NULL, \
|
||||||
|
|
|
||||||
|
|
@ -1,55 +1,57 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
datadir=$1
|
nm_datadir="$1"
|
||||||
bindir=$2
|
nm_bindir="$2"
|
||||||
pkgconfdir=$3
|
nm_pkgconfdir="$3"
|
||||||
pkglibdir=$4
|
nm_pkglibdir="$4"
|
||||||
pkgstatedir=$5
|
nm_pkgstatedir="$5"
|
||||||
|
nm_mandir="$6"
|
||||||
|
nm_sysconfdir="$7"
|
||||||
|
enable_docs="$8"
|
||||||
|
enable_ifcfg_rh="$9"
|
||||||
|
|
||||||
[ -n "$DESTDIR" ] && DESTDIR=${DESTDIR%%/}/
|
[ -n "$DESTDIR" ] && DESTDIR="${DESTDIR%%/}/"
|
||||||
|
|
||||||
if [ -f "${DESTDIR}${datadir}/bash-completion/completions/nmcli-completion" ]; then
|
if [ -f "${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli-completion" ]; then
|
||||||
mv "${DESTDIR}${datadir}/bash-completion/completions/nmcli-completion" \
|
mv "${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli-completion" \
|
||||||
"${DESTDIR}${datadir}/bash-completion/completions/nmcli"
|
"${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x "${DESTDIR}${bindir}/nmtui" ]; then
|
if [ -x "${DESTDIR}${nm_bindir}/nmtui" ]; then
|
||||||
for alias in nmtui-connect nmtui-edit nmtui-hostname; do
|
for alias in nmtui-connect nmtui-edit nmtui-hostname; do
|
||||||
ln -sf nmtui "${DESTDIR}${bindir}/$alias"
|
ln -sf nmtui "${DESTDIR}${nm_bindir}/$alias"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for dir in "${pkgconfdir}/conf.d" \
|
for dir in "${nm_pkgconfdir}/conf.d" \
|
||||||
"${pkgconfdir}/system-connections" \
|
"${nm_pkgconfdir}/system-connections" \
|
||||||
"${pkgconfdir}/dispatcher.d/no-wait.d" \
|
"${nm_pkgconfdir}/dispatcher.d/no-wait.d" \
|
||||||
"${pkgconfdir}/dispatcher.d/pre-down.d" \
|
"${nm_pkgconfdir}/dispatcher.d/pre-down.d" \
|
||||||
"${pkgconfdir}/dispatcher.d/pre-up.d" \
|
"${nm_pkgconfdir}/dispatcher.d/pre-up.d" \
|
||||||
"${pkgconfdir}/dnsmasq.d" \
|
"${nm_pkgconfdir}/dnsmasq.d" \
|
||||||
"${pkgconfdir}/dnsmasq-shared.d" \
|
"${nm_pkgconfdir}/dnsmasq-shared.d" \
|
||||||
"${pkglibdir}/conf.d" \
|
"${nm_pkglibdir}/conf.d" \
|
||||||
"${pkglibdir}/dispatcher.d/no-wait.d" \
|
"${nm_pkglibdir}/dispatcher.d/no-wait.d" \
|
||||||
"${pkglibdir}/dispatcher.d/pre-down.d" \
|
"${nm_pkglibdir}/dispatcher.d/pre-down.d" \
|
||||||
"${pkglibdir}/dispatcher.d/pre-up.d" \
|
"${nm_pkglibdir}/dispatcher.d/pre-up.d" \
|
||||||
"${pkglibdir}/system-connections" \
|
"${nm_pkglibdir}/system-connections" \
|
||||||
"${pkglibdir}/VPN"; do
|
"${nm_pkglibdir}/VPN"; do
|
||||||
mkdir -p "${DESTDIR}${dir}"
|
mkdir -p "${DESTDIR}${dir}"
|
||||||
chmod 0755 "${DESTDIR}${dir}"
|
chmod 0755 "${DESTDIR}${dir}"
|
||||||
done
|
done
|
||||||
|
|
||||||
mkdir -p "${DESTDIR}${pkgstatedir}"
|
mkdir -p "${DESTDIR}${nm_pkgstatedir}"
|
||||||
chmod 0700 "${DESTDIR}${pkgstatedir}"
|
chmod 0700 "${DESTDIR}${nm_pkgstatedir}"
|
||||||
|
|
||||||
if [ "$6" = install_docs ]; then
|
if [ "$enable_docs" = 1 ]; then
|
||||||
mandir=$7
|
|
||||||
|
|
||||||
for alias in nmtui-connect nmtui-edit nmtui-hostname; do
|
for alias in nmtui-connect nmtui-edit nmtui-hostname; do
|
||||||
ln -f "${DESTDIR}${mandir}/man1/nmtui.1" "${DESTDIR}${mandir}/man1/${alias}.1"
|
ln -f "${DESTDIR}${nm_mandir}/man1/nmtui.1" "${DESTDIR}${nm_mandir}/man1/${alias}.1"
|
||||||
done
|
done
|
||||||
|
|
||||||
ln -f "${DESTDIR}${mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${mandir}/man5/nm-system-settings.conf.5"
|
ln -f "${DESTDIR}${nm_mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${nm_mandir}/man5/nm-system-settings.conf.5"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$8" = create_network_scripts ]; then
|
if [ "$enable_ifcfg_rh" = 1 ]; then
|
||||||
sysconfdir=$9
|
mkdir -p "${DESTDIR}${nm_sysconfdir}/sysconfig/network-scripts"
|
||||||
mkdir -p "${DESTDIR}${sysconfdir}/sysconfig/network-scripts"
|
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue