diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-16 08:10:46 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-17 07:53:29 +0200 |
commit | 099ee34ca187a5c7f3cc94f1f278df50f1ee9455 (patch) | |
tree | 1061e3d02b835d04643cfe6981bf9c676ecbb677 /src/network/networkd-manager.h | |
parent | network/sysctl-monitor: fix use-after-free (diff) | |
download | systemd-099ee34ca187a5c7f3cc94f1f278df50f1ee9455.tar.xz systemd-099ee34ca187a5c7f3cc94f1f278df50f1ee9455.zip |
network/sysctl-monitor: do not allocate sysctl_shadow when eBPF is not supported
When eBPF is disabled, the hashmap will be never used. Let's not
allocate it.
Diffstat (limited to 'src/network/networkd-manager.h')
-rw-r--r-- | src/network/networkd-manager.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/network/networkd-manager.h b/src/network/networkd-manager.h index 5a0decced2..9a310c2eab 100644 --- a/src/network/networkd-manager.h +++ b/src/network/networkd-manager.h @@ -150,4 +150,12 @@ int manager_set_timezone(Manager *m, const char *timezone); int manager_reload(Manager *m, sd_bus_message *message); +static inline Hashmap** manager_get_sysctl_shadow(Manager *manager) { +#if HAVE_VMLINUX_H + return &ASSERT_PTR(manager)->sysctl_shadow; +#else + return NULL; +#endif +} + DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free); |