From e2cdd5c4dc2dae6b4fae19744f7b94f5de601dc5 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 2 Feb 2026 11:22:32 +0100 Subject: [PATCH] build: don't require libndp >= 1.9 if CLAT is disabled libndp >= 1.9 is only required to parse the PREF64 option needed for CLAT. When building NM in an enviroment with an older libndp, still allow building without CLAT support. --- meson.build | 4 +++- src/core/ndisc/nm-lndp-ndisc.c | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 507462b205..733f545885 100644 --- a/meson.build +++ b/meson.build @@ -288,7 +288,7 @@ uuid_dep = dependency('uuid') libelogind_dep = dependency('libelogind', version: '>= 219', required: false) libudev_dep = dependency('libudev', version: '>= 175') dbus_dep = dependency('dbus-1', version: '>= 1.1') -libndp_dep = dependency('libndp', version: '>= 1.9') +libndp_dep = dependency('libndp') jansson_dep = dependency('jansson', version: '>= 2.7', required: false) config_h.set10('WITH_JANSSON', jansson_dep.found()) @@ -519,6 +519,8 @@ enable_clat = get_option('clat') if enable_clat libbpf = dependency('libbpf', version: '>= 0.1.0', required: false) assert(libbpf.found(), 'You must have libbpf installed to build. Use -Dclat=false to disable use of it') + libndp_dep = dependency('libndp', version: '>= 1.9', required: false) + assert(libndp_dep.found(), 'You must have libndp >= 1.9 installed to build with CLAT support. Use -Dclat=false to disable it') endif config_h.set10('HAVE_CLAT', enable_clat) diff --git a/src/core/ndisc/nm-lndp-ndisc.c b/src/core/ndisc/nm-lndp-ndisc.c index c004e80136..66ee477b29 100644 --- a/src/core/ndisc/nm-lndp-ndisc.c +++ b/src/core/ndisc/nm-lndp-ndisc.c @@ -401,14 +401,15 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) } } +#if HAVE_CLAT /* PREF64 */ ndp_msg_opt_for_each_offset (offset, msg, NDP_MSG_OPT_PREF64) { NMNDiscPref64 pref64; pref64 = (NMNDiscPref64) { - .prefix = *ndp_msg_opt_pref64_prefix(msg, offset), - .plen = ndp_msg_opt_pref64_prefix_length(msg, offset), - .gateway = gateway.address, + .prefix = *ndp_msg_opt_pref64_prefix(msg, offset), + .plen = ndp_msg_opt_pref64_prefix_length(msg, offset), + .gateway = gateway.address, .gateway_preference = gateway.preference, .expiry_msec = _nm_ndisc_lifetime_to_expiry(now_msec, ndp_msg_opt_pref64_lifetime(msg, offset)), @@ -422,6 +423,7 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) changed |= NM_NDISC_CONFIG_PREF64; } } +#endif nm_ndisc_ra_received(ndisc, now_msec, changed); return 0;