From 67d893788fabad18b1472dbcab0484154e89eb79 Mon Sep 17 00:00:00 2001 From: Davide Bertola Date: Wed, 25 Sep 2024 21:51:19 +0200 Subject: [PATCH] Fix kconfig string loading --- aya/src/bpf.rs | 4 ---- test/integration-test/bpf/kconfig.bpf.c | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index 79432d4d6..babcb888f 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -176,10 +176,6 @@ fn compute_kconfig_definition(features: &Features) -> HashMap> { Some('y') => to_bytes(1).to_vec(), Some('m') => to_bytes(2).to_vec(), Some('"') => { - if raw_value.len() > 2 || raw_value.ends_with('"') { - continue; - } - let raw_value = &raw_value[1..raw_value.len() - 1]; raw_value.as_bytes().to_vec() diff --git a/test/integration-test/bpf/kconfig.bpf.c b/test/integration-test/bpf/kconfig.bpf.c index 37ba61cba..2a7859518 100644 --- a/test/integration-test/bpf/kconfig.bpf.c +++ b/test/integration-test/bpf/kconfig.bpf.c @@ -9,6 +9,8 @@ extern unsigned int CONFIG_BPF __kconfig; extern unsigned int CONFIG_PANIC_TIMEOUT __kconfig; // CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 extern unsigned int CONFIG_DEFAULT_HUNG_TASK_TIMEOUT __kconfig; +// CONFIG_DEFAULT_HOSTNAME +extern char CONFIG_DEFAULT_HOSTNAME[] __kconfig; SEC("xdp") int kconfig(struct xdp_md *ctx) { @@ -24,6 +26,12 @@ int kconfig(struct xdp_md *ctx) { return XDP_DROP; } + for (int i = 0; i < 7; i++) { + if ("(none)"[i] != CONFIG_DEFAULT_HOSTNAME[i]) { + return XDP_DROP; + } + } + return XDP_PASS; }