diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-17 08:00:06 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-17 08:00:06 +0200 |
commit | 4d6ad22f8d1db2ee42951b40139e498153de0124 (patch) | |
tree | b1bce02a0ce07d2422b65b88fb743dca55b82e48 | |
parent | network/sysctl-monitor: do not allocate sysctl_shadow when eBPF is not supported (diff) | |
download | systemd-4d6ad22f8d1db2ee42951b40139e498153de0124.tar.xz systemd-4d6ad22f8d1db2ee42951b40139e498153de0124.zip |
network: drop unnecessary BPF related objects from Manager when disabled
-rw-r--r-- | src/network/networkd-manager.c | 2 | ||||
-rw-r--r-- | src/network/networkd-manager.h | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index f172e0d865..2813fa1f28 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -604,7 +604,9 @@ int manager_new(Manager **ret, bool test_mode) { .duid_product_uuid.type = DUID_TYPE_UUID, .dhcp_server_persist_leases = true, .ip_forwarding = { -1, -1, }, +#if HAVE_VMLINUX_H .cgroup_fd = -EBADF, +#endif }; *ret = TAKE_PTR(m); diff --git a/src/network/networkd-manager.h b/src/network/networkd-manager.h index 9a310c2eab..05a86b6b58 100644 --- a/src/network/networkd-manager.h +++ b/src/network/networkd-manager.h @@ -122,12 +122,14 @@ struct Manager { /* sysctl */ int ip_forwarding[2]; +#if HAVE_VMLINUX_H Hashmap *sysctl_shadow; sd_event_source *sysctl_event_source; struct ring_buffer *sysctl_buffer; struct sysctl_monitor_bpf *sysctl_skel; struct bpf_link *sysctl_link; int cgroup_fd; +#endif }; int manager_new(Manager **ret, bool test_mode); |