Fix kconfig string loading

pull/1017/merge^2
Davide Bertola 4 months ago
parent a723cfa22d
commit 12b3727e05

@ -176,10 +176,6 @@ fn compute_kconfig_definition(features: &Features) -> HashMap<String, Vec<u8>> {
Some('y') => to_bytes(1).to_vec(), Some('y') => to_bytes(1).to_vec(),
Some('m') => to_bytes(2).to_vec(), Some('m') => to_bytes(2).to_vec(),
Some('"') => { Some('"') => {
if raw_value.len() > 2 || raw_value.ends_with('"') {
continue;
}
let raw_value = &raw_value[1..raw_value.len() - 1]; let raw_value = &raw_value[1..raw_value.len() - 1];
raw_value.as_bytes().to_vec() raw_value.as_bytes().to_vec()

@ -9,6 +9,8 @@ extern unsigned int CONFIG_BPF __kconfig;
extern unsigned int CONFIG_PANIC_TIMEOUT __kconfig; extern unsigned int CONFIG_PANIC_TIMEOUT __kconfig;
// CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 // CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120
extern unsigned int CONFIG_DEFAULT_HUNG_TASK_TIMEOUT __kconfig; extern unsigned int CONFIG_DEFAULT_HUNG_TASK_TIMEOUT __kconfig;
// CONFIG_DEFAULT_HOSTNAME
extern char CONFIG_DEFAULT_HOSTNAME[] __kconfig;
SEC("xdp") SEC("xdp")
int kconfig(struct xdp_md *ctx) { int kconfig(struct xdp_md *ctx) {
@ -24,6 +26,12 @@ int kconfig(struct xdp_md *ctx) {
return XDP_DROP; return XDP_DROP;
} }
for (int i = 0; i < 7; i++) {
if ("(none)"[i] != CONFIG_DEFAULT_HOSTNAME[i]) {
return XDP_DROP;
}
}
return XDP_PASS; return XDP_PASS;
} }

Loading…
Cancel
Save