mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-24 12:30:40 +01: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 =
|
||||
dbusservice_DATA =
|
||||
dbusactivation_DATA =
|
||||
systemdsystemunit_DATA =
|
||||
|
||||
INTROSPECTION_GIRS =
|
||||
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
|
||||
|
||||
dist_polkit_policy_in_in_files = \
|
||||
|
|
@ -4633,28 +4667,13 @@ EXTRA_DIST += \
|
|||
# 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
|
||||
|
||||
systemdsystemunit_DATA = \
|
||||
systemdsystemunit_DATA += \
|
||||
data/NetworkManager.service \
|
||||
data/NetworkManager-wait-online.service \
|
||||
data/NetworkManager-dispatcher.service
|
||||
data/NetworkManager-dispatcher.service \
|
||||
$(NULL)
|
||||
|
||||
data/NetworkManager.service: $(srcdir)/data/NetworkManager.service.in
|
||||
$(AM_V_GEN) $(data_edit) $< >$@
|
||||
|
|
@ -4687,21 +4706,23 @@ data/server.conf: $(srcdir)/data/server.conf.in
|
|||
$(AM_V_GEN) $(data_edit) $< >$@
|
||||
|
||||
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/85-nm-unmanaged.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/meson.build
|
||||
$(NULL)
|
||||
|
||||
CLEANFILES += \
|
||||
data/NetworkManager.service \
|
||||
data/NetworkManager-wait-online.service \
|
||||
data/NetworkManager-dispatcher.service \
|
||||
data/server.conf
|
||||
data/NetworkManager-wait-online.service \
|
||||
data/NetworkManager.service \
|
||||
data/server.conf \
|
||||
$(NULL)
|
||||
|
||||
###############################################################################
|
||||
# man
|
||||
|
|
@ -4952,15 +4973,6 @@ dist-hook: $(dist_hook)
|
|||
install-exec-hook: $(install_exec_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)
|
||||
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ configurations using "/etc/sysconfig/network-scripts/rule-NAME" files
|
|||
(eg, to do policy-based routing).
|
||||
|
||||
|
||||
%if 0%{with_nmtui}
|
||||
%if %{with nmtui}
|
||||
%package tui
|
||||
Summary: NetworkManager curses-based UI
|
||||
Group: System Environment/Base
|
||||
|
|
@ -533,6 +533,11 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
|
|||
-Diwd=true \
|
||||
%else
|
||||
-Diwd=false \
|
||||
%endif
|
||||
%if %{with nmtui}
|
||||
-Dnmtui=true \
|
||||
%else
|
||||
-Dnmtui=false \
|
||||
%endif
|
||||
-Dvapi=true \
|
||||
-Dintrospection=true \
|
||||
|
|
@ -649,6 +654,11 @@ intltoolize --automake --copy --force
|
|||
--with-iwd=yes \
|
||||
%else
|
||||
--with-iwd=no \
|
||||
%endif
|
||||
%if %{with nmtui}
|
||||
--with-nmtui=yes \
|
||||
%else
|
||||
--with-nmtui=no \
|
||||
%endif
|
||||
--enable-vala=yes \
|
||||
--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(
|
||||
input: 'server.conf.in',
|
||||
output: '@BASENAME@',
|
||||
|
|
|
|||
|
|
@ -2,17 +2,11 @@ dispatcher_inc = include_directories('.')
|
|||
|
||||
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(
|
||||
input: 'org.freedesktop.nm_dispatcher.service.in',
|
||||
output: '@BASENAME@',
|
||||
install_dir: dbus_system_bus_services_dir,
|
||||
configuration: service_conf,
|
||||
configuration: data_conf,
|
||||
)
|
||||
|
||||
install_data(
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ endif
|
|||
content_files += configure_file(
|
||||
input: 'version.xml.in',
|
||||
output: '@BASENAME@',
|
||||
configuration: version_conf,
|
||||
configuration: data_conf,
|
||||
)
|
||||
|
||||
filecopier = find_program('cp')
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ scan_args = [
|
|||
version_xml = configure_file(
|
||||
input: 'version.xml.in',
|
||||
output: '@BASENAME@',
|
||||
configuration: version_conf,
|
||||
configuration: data_conf,
|
||||
)
|
||||
|
||||
gnome.gtkdoc(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
version_conf = configuration_data()
|
||||
version_conf.set('VERSION', nm_version)
|
||||
|
||||
subdir('libnm')
|
||||
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(
|
||||
input: 'common.ent.in',
|
||||
output: '@BASENAME@',
|
||||
configuration: common_conf,
|
||||
configuration: data_conf,
|
||||
)
|
||||
|
||||
xsltproc_options = [
|
||||
|
|
|
|||
25
meson.build
25
meson.build
|
|
@ -774,6 +774,27 @@ if python.found()
|
|||
config_h.set_quoted('TEST_NM_PYTHON', python.path())
|
||||
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
|
||||
'''
|
||||
build_docs=no
|
||||
|
|
@ -885,10 +906,10 @@ meson.add_install_script(
|
|||
nm_pkgconfdir,
|
||||
nm_pkglibdir,
|
||||
nm_pkgstatedir,
|
||||
enable_docs ? 'install_docs' : '',
|
||||
nm_mandir,
|
||||
enable_ifcfg_rh ? 'create_network_scripts' : '',
|
||||
nm_sysconfdir,
|
||||
enable_docs ? '1' : '0',
|
||||
enable_ifcfg_rh ? '1' : '0',
|
||||
)
|
||||
|
||||
output = '\nSystem paths:\n'
|
||||
|
|
|
|||
|
|
@ -99,15 +99,10 @@ libn_dhcp4_dep = declare_dependency(
|
|||
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(
|
||||
input: 'nm-version-macros.h.in',
|
||||
output: '@BASENAME@',
|
||||
configuration: nm_version_macro_conf,
|
||||
configuration: data_conf,
|
||||
)
|
||||
|
||||
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__ */
|
||||
|
|
|
|||
|
|
@ -135,4 +135,114 @@ extern void _nm_utils_monotonic_timestamp_initialized (const struct timespec *tp
|
|||
gint64 offset_sec,
|
||||
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__ */
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <poll.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <glib-unix.h>
|
||||
|
||||
#include "nm-errno.h"
|
||||
|
||||
|
|
@ -540,6 +541,102 @@ _nm_utils_ip4_prefix_to_netmask (guint32 prefix)
|
|||
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:
|
||||
* @ip: an IPv4 address (in network byte order)
|
||||
|
|
@ -3388,3 +3485,53 @@ nm_utils_parse_debug_string (const char *string,
|
|||
|
||||
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_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,
|
||||
const void *address);
|
||||
|
||||
|
|
@ -925,12 +930,39 @@ nm_g_source_destroy_and_unref (GSource *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);
|
||||
#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)
|
||||
#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 *
|
||||
nm_g_main_context_push_thread_default (GMainContext *context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <curl/curl.h>
|
||||
#endif
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <glib-unix.h>
|
||||
|
||||
#include "c-list/src/c-list.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
|
@ -313,7 +314,6 @@ _con_curl_check_connectivity (CURLM *mhandle, int sockfd, int ev_bitmask)
|
|||
{
|
||||
NMConnectivityCheckHandle *cb_data;
|
||||
CURLMsg *msg;
|
||||
CURLcode eret;
|
||||
int m_left;
|
||||
long response_code;
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
while ((msg = curl_multi_info_read (mhandle, &m_left))) {
|
||||
const char *response;
|
||||
CURLcode eret;
|
||||
|
||||
if (msg->msg != CURLMSG_DONE)
|
||||
continue;
|
||||
|
|
@ -408,10 +409,9 @@ _con_curl_timeout_cb (gpointer 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);
|
||||
_complete_queued (cb_data->self);
|
||||
return G_SOURCE_REMOVE;
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -427,7 +427,8 @@ multi_timer_cb (CURLM *multi, long timeout_ms, void *userdata)
|
|||
|
||||
typedef struct {
|
||||
NMConnectivityCheckHandle *cb_data;
|
||||
GIOChannel *ch;
|
||||
|
||||
GSource *source;
|
||||
|
||||
/* this is a very simplistic weak-pointer. If ConCurlSockData gets
|
||||
* destroyed, it will set *destroy_notify to TRUE.
|
||||
|
|
@ -436,15 +437,15 @@ typedef struct {
|
|||
* safely access @fdp after _con_curl_check_connectivity(). */
|
||||
gboolean *destroy_notify;
|
||||
|
||||
guint ev;
|
||||
} ConCurlSockData;
|
||||
|
||||
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;
|
||||
NMConnectivityCheckHandle *cb_data = fdp->cb_data;
|
||||
int fd = g_io_channel_unix_get_fd (ch);
|
||||
int action = 0;
|
||||
gboolean fdp_destroyed = FALSE;
|
||||
gboolean success;
|
||||
|
|
@ -468,12 +469,12 @@ _con_curl_socketevent_cb (GIOChannel *ch, GIOCondition condition, gpointer user_
|
|||
nm_assert (fdp->destroy_notify == &fdp_destroyed);
|
||||
fdp->destroy_notify = NULL;
|
||||
if (!success)
|
||||
fdp->ev = 0;
|
||||
nm_clear_g_source_inst (&fdp->source);
|
||||
}
|
||||
|
||||
_complete_queued (cb_data->self);
|
||||
|
||||
return success ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE;
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
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;
|
||||
ConCurlSockData *fdp = socketp;
|
||||
GIOCondition condition = 0;
|
||||
|
||||
(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->destroy_notify)
|
||||
*fdp->destroy_notify = TRUE;
|
||||
nm_clear_g_source_inst (&fdp->source);
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
GIOCondition condition;
|
||||
|
||||
if (!fdp) {
|
||||
fdp = g_slice_new0 (ConCurlSockData);
|
||||
fdp->cb_data = cb_data;
|
||||
fdp->ch = g_io_channel_unix_new (fd);
|
||||
fdp = g_slice_new (ConCurlSockData);
|
||||
*fdp = (ConCurlSockData) {
|
||||
.cb_data = cb_data,
|
||||
};
|
||||
curl_multi_assign (cb_data->concheck.curl_mhandle, fd, fdp);
|
||||
} else
|
||||
nm_clear_g_source (&fdp->ev);
|
||||
nm_clear_g_source_inst (&fdp->source);
|
||||
|
||||
if (what == CURL_POLL_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;
|
||||
else if (what == CURL_POLL_INOUT)
|
||||
condition = G_IO_IN | G_IO_OUT;
|
||||
else
|
||||
condition = 0;
|
||||
|
||||
if (condition)
|
||||
fdp->ev = g_io_add_watch (fdp->ch, condition, _con_curl_socketevent_cb, fdp);
|
||||
if (condition) {
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -231,102 +231,6 @@ nm_ethernet_address_is_valid (gconstpointer addr, gssize len)
|
|||
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
|
||||
|
|
|
|||
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, ...) \
|
||||
G_STMT_START { \
|
||||
nm_log ((level), (domain), NULL, NULL, \
|
||||
|
|
|
|||
|
|
@ -1,55 +1,57 @@
|
|||
#!/bin/sh
|
||||
|
||||
datadir=$1
|
||||
bindir=$2
|
||||
pkgconfdir=$3
|
||||
pkglibdir=$4
|
||||
pkgstatedir=$5
|
||||
nm_datadir="$1"
|
||||
nm_bindir="$2"
|
||||
nm_pkgconfdir="$3"
|
||||
nm_pkglibdir="$4"
|
||||
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
|
||||
mv "${DESTDIR}${datadir}/bash-completion/completions/nmcli-completion" \
|
||||
"${DESTDIR}${datadir}/bash-completion/completions/nmcli"
|
||||
if [ -f "${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli-completion" ]; then
|
||||
mv "${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli-completion" \
|
||||
"${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli"
|
||||
fi
|
||||
|
||||
if [ -x "${DESTDIR}${bindir}/nmtui" ]; then
|
||||
if [ -x "${DESTDIR}${nm_bindir}/nmtui" ]; then
|
||||
for alias in nmtui-connect nmtui-edit nmtui-hostname; do
|
||||
ln -sf nmtui "${DESTDIR}${bindir}/$alias"
|
||||
ln -sf nmtui "${DESTDIR}${nm_bindir}/$alias"
|
||||
done
|
||||
fi
|
||||
|
||||
for dir in "${pkgconfdir}/conf.d" \
|
||||
"${pkgconfdir}/system-connections" \
|
||||
"${pkgconfdir}/dispatcher.d/no-wait.d" \
|
||||
"${pkgconfdir}/dispatcher.d/pre-down.d" \
|
||||
"${pkgconfdir}/dispatcher.d/pre-up.d" \
|
||||
"${pkgconfdir}/dnsmasq.d" \
|
||||
"${pkgconfdir}/dnsmasq-shared.d" \
|
||||
"${pkglibdir}/conf.d" \
|
||||
"${pkglibdir}/dispatcher.d/no-wait.d" \
|
||||
"${pkglibdir}/dispatcher.d/pre-down.d" \
|
||||
"${pkglibdir}/dispatcher.d/pre-up.d" \
|
||||
"${pkglibdir}/system-connections" \
|
||||
"${pkglibdir}/VPN"; do
|
||||
for dir in "${nm_pkgconfdir}/conf.d" \
|
||||
"${nm_pkgconfdir}/system-connections" \
|
||||
"${nm_pkgconfdir}/dispatcher.d/no-wait.d" \
|
||||
"${nm_pkgconfdir}/dispatcher.d/pre-down.d" \
|
||||
"${nm_pkgconfdir}/dispatcher.d/pre-up.d" \
|
||||
"${nm_pkgconfdir}/dnsmasq.d" \
|
||||
"${nm_pkgconfdir}/dnsmasq-shared.d" \
|
||||
"${nm_pkglibdir}/conf.d" \
|
||||
"${nm_pkglibdir}/dispatcher.d/no-wait.d" \
|
||||
"${nm_pkglibdir}/dispatcher.d/pre-down.d" \
|
||||
"${nm_pkglibdir}/dispatcher.d/pre-up.d" \
|
||||
"${nm_pkglibdir}/system-connections" \
|
||||
"${nm_pkglibdir}/VPN"; do
|
||||
mkdir -p "${DESTDIR}${dir}"
|
||||
chmod 0755 "${DESTDIR}${dir}"
|
||||
done
|
||||
|
||||
mkdir -p "${DESTDIR}${pkgstatedir}"
|
||||
chmod 0700 "${DESTDIR}${pkgstatedir}"
|
||||
mkdir -p "${DESTDIR}${nm_pkgstatedir}"
|
||||
chmod 0700 "${DESTDIR}${nm_pkgstatedir}"
|
||||
|
||||
if [ "$6" = install_docs ]; then
|
||||
mandir=$7
|
||||
if [ "$enable_docs" = 1 ]; then
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
if [ "$8" = create_network_scripts ]; then
|
||||
sysconfdir=$9
|
||||
mkdir -p "${DESTDIR}${sysconfdir}/sysconfig/network-scripts"
|
||||
if [ "$enable_ifcfg_rh" = 1 ]; then
|
||||
mkdir -p "${DESTDIR}${nm_sysconfdir}/sysconfig/network-scripts"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue