mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 12:50:09 +01:00
core: merge branch 'th/fix-nm-sudo-symbols-for-ovs'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/973
This commit is contained in:
commit
09ce76d85a
6 changed files with 28 additions and 25 deletions
10
Makefile.am
10
Makefile.am
|
|
@ -2662,14 +2662,6 @@ $(src_core_libNetworkManagerTest_la_OBJECTS): $(src_libnm_core_public_mkenums_h)
|
|||
|
||||
###############################################################################
|
||||
|
||||
# NetworkManager binary also must contain symbols that are not used by the binary
|
||||
# itself, but by the plugins (that are dlopened). We need to explicitly include
|
||||
# them during linking.
|
||||
networkmanager_undefined_symbols = \
|
||||
nm_sudo_call_get_fd \
|
||||
nm_sudo_utils_open_fd \
|
||||
$(NULL)
|
||||
|
||||
noinst_PROGRAMS += src/core/NetworkManager-all-sym
|
||||
|
||||
src_core_NetworkManager_all_sym_CPPFLAGS = $(src_core_cppflags)
|
||||
|
|
@ -2684,7 +2676,6 @@ src_core_NetworkManager_all_sym_LDADD = \
|
|||
|
||||
src_core_NetworkManager_all_sym_LDFLAGS = \
|
||||
-rdynamic \
|
||||
$(networkmanager_undefined_symbols:%=-u %) \
|
||||
$(SANITIZER_EXEC_LDFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
|
|
@ -2711,7 +2702,6 @@ src_core_NetworkManager_LDADD = \
|
|||
src_core_NetworkManager_LDFLAGS = \
|
||||
-rdynamic \
|
||||
-Wl,--version-script="src/core/NetworkManager.ver" \
|
||||
$(networkmanager_undefined_symbols:%=-u %) \
|
||||
$(SANITIZER_EXEC_LDFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
|||
|
|
@ -224,6 +224,9 @@
|
|||
/* Define if you have oFono support (experimental) */
|
||||
#mesondefine WITH_OFONO
|
||||
|
||||
/* Whether we build with OVS plugin */
|
||||
#mesondefine WITH_OPENVSWITCH
|
||||
|
||||
/* Define if you have PPP support */
|
||||
#mesondefine WITH_PPP
|
||||
|
||||
|
|
@ -261,3 +264,4 @@
|
|||
|
||||
/* Define to 1 if you have history support from -lreadline. */
|
||||
#mesondefine HAVE_READLINE_HISTORY
|
||||
|
||||
|
|
|
|||
|
|
@ -851,6 +851,11 @@ if test "${enable_ovs}" != "no"; then
|
|||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(WITH_OPENVSWITCH, test "${enable_ovs}" = "yes")
|
||||
if test "${enable_ovs}" = "yes" ; then
|
||||
AC_DEFINE(WITH_OPENVSWITCH, 1, [Whether we build with OVS plugin])
|
||||
else
|
||||
AC_DEFINE(WITH_OPENVSWITCH, 0, [Whether we build with OVS plugin])
|
||||
fi
|
||||
|
||||
# DHCP client support
|
||||
AC_ARG_WITH([dhclient],
|
||||
|
|
|
|||
|
|
@ -644,6 +644,7 @@ enable_ovs = get_option('ovs')
|
|||
if enable_ovs
|
||||
assert(jansson_dep.found(), 'jansson is needed for Open vSwitch integration. Use -Dovs=false to disable it')
|
||||
endif
|
||||
config_h.set10('WITH_OPENVSWITCH', enable_ovs)
|
||||
|
||||
# DNS resolv.conf managers
|
||||
config_dns_rc_manager_default = get_option('config_dns_rc_manager_default')
|
||||
|
|
|
|||
|
|
@ -271,17 +271,6 @@ endif
|
|||
subdir('devices')
|
||||
subdir('settings/plugins')
|
||||
|
||||
# NetworkManager binary also must contain symbols that are not used by the binary
|
||||
# itself, but by the plugins (that are dlopened). We need to explicitly include
|
||||
# them during linking.
|
||||
networkmanager_undefined_symbols_args = []
|
||||
foreach s: [
|
||||
'nm_sudo_call_get_fd',
|
||||
'nm_sudo_utils_open_fd',
|
||||
]
|
||||
networkmanager_undefined_symbols_args += ['-u', s]
|
||||
endforeach
|
||||
|
||||
# NetworkManager binary
|
||||
|
||||
# libNetworkManager.a, as built by meson doesn't contain all symbols
|
||||
|
|
@ -296,9 +285,7 @@ NetworkManager_all_sym = executable(
|
|||
nm_deps,
|
||||
libudev_dep,
|
||||
],
|
||||
link_args: [
|
||||
'-Wl,--no-gc-sections',
|
||||
] + networkmanager_undefined_symbols_args,
|
||||
link_args: '-Wl,--no-gc-sections',
|
||||
link_whole: [
|
||||
libNetworkManager,
|
||||
libNetworkManagerBase,
|
||||
|
|
@ -359,7 +346,7 @@ NetworkManager = executable(
|
|||
link_args: [
|
||||
'-rdynamic',
|
||||
'-Wl,--version-script,@0@'.format(ver_script.full_path()),
|
||||
] + networkmanager_undefined_symbols_args,
|
||||
],
|
||||
link_depends: ver_script,
|
||||
install: true,
|
||||
install_dir: nm_sbindir,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "nm-rfkill-manager.h"
|
||||
#include "nm-session-monitor.h"
|
||||
#include "nm-sleep-monitor.h"
|
||||
#include "nm-sudo-call.h"
|
||||
#include "settings/nm-settings-connection.h"
|
||||
#include "settings/nm-settings.h"
|
||||
#include "vpn/nm-vpn-manager.h"
|
||||
|
|
@ -212,6 +213,13 @@ struct _NMManager {
|
|||
|
||||
typedef struct {
|
||||
NMDBusObjectClass parent;
|
||||
|
||||
#if WITH_OPENVSWITCH
|
||||
/* these fields only serve the purpose to use the symbols.*/
|
||||
void (*_use_symbol_nm_sudo_call_get_fd)(void);
|
||||
void (*_use_symbol_nm_sudo_utils_open_fd)(void);
|
||||
#endif
|
||||
|
||||
} NMManagerClass;
|
||||
|
||||
G_DEFINE_TYPE(NMManager, nm_manager, NM_TYPE_DBUS_OBJECT)
|
||||
|
|
@ -8528,6 +8536,14 @@ nm_manager_class_init(NMManagerClass *manager_class)
|
|||
GObjectClass * object_class = G_OBJECT_CLASS(manager_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS(manager_class);
|
||||
|
||||
#if WITH_OPENVSWITCH
|
||||
/* Use the symbols. These symbols are in NetworkManager binary but will be
|
||||
* used by the OVS device plugin. If we don't use the symbol here, it will
|
||||
* be wrongly dropped. */
|
||||
manager_class->_use_symbol_nm_sudo_call_get_fd = (void (*)(void)) nm_sudo_call_get_fd;
|
||||
manager_class->_use_symbol_nm_sudo_utils_open_fd = (void (*)(void)) nm_sudo_utils_open_fd;
|
||||
#endif
|
||||
|
||||
dbus_object_class->export_path = NM_DBUS_EXPORT_PATH_STATIC(NM_DBUS_PATH);
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS(&interface_info_manager);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue