From 5a6fff2ba6971f1b386e87044d9ac21b95e9aa37 Mon Sep 17 00:00:00 2001 From: Christian Deacon Date: Mon, 10 Mar 2025 19:30:00 -0400 Subject: [PATCH] Revert interface setting rename so it doesn't break existing configurations. --- README.md | 4 ++-- src/loader/utils/config.c | 4 ++-- xdpfw.conf.example | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3011a6b..00d0cb8 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ Here are more details on the layout of the runtime configuration. | ---- | ---- | ------- | ----------- | | verbose | int | `2` | The verbose level for logging (0 - 5 supported so far). | | log_file | string | `/var/log/xdpfw.log` | The log file location. If the string is empty (`""`), the log file is disabled. | -| interfaces | string \| list of strings | `NULL` | The network interface(s) to attach the XDP program to (usually retrieved with `ip a` or `ifconfig`). | +| interface | string \| list of strings | `NULL` | The network interface(s) to attach the XDP program to (usually retrieved with `ip a` or `ifconfig`). | | pin_maps | bool | `true` | Pins main BPF maps to `/sys/fs/bpf/xdpfw/[map_name]` on the file system. | | update_time | int | `0` | How often to update the config and filtering rules from the file system in seconds (0 disables). | | no_stats | bool | `false` | Whether to enable or disable packet counters. Disabling packet counters will improve performance, but result in less visibility on what the XDP Firewall is doing. | @@ -234,7 +234,7 @@ Here's a runtime config example. ```squidconf verbose = 5; log_file = ""; -interfaces = "ens18"; +interface = "ens18"; pin_maps = true; update_time = 15; no_stats = false; diff --git a/src/loader/utils/config.c b/src/loader/utils/config.c index 75ed1b5..6a5aecc 100644 --- a/src/loader/utils/config.c +++ b/src/loader/utils/config.c @@ -210,7 +210,7 @@ int parse_cfg(config__t *cfg, const char* data, config_overrides_t* overrides) } // Get interface(s). - config_setting_t* interfaces = config_lookup(&conf, "interfaces"); + config_setting_t* interfaces = config_lookup(&conf, "interface"); if (interfaces) { @@ -252,7 +252,7 @@ int parse_cfg(config__t *cfg, const char* data, config_overrides_t* overrides) { const char* interface; - if (config_lookup_string(&conf, "interfaces", &interface) == CONFIG_TRUE) + if (config_lookup_string(&conf, "interface", &interface) == CONFIG_TRUE) { if (cfg->interfaces[0]) { diff --git a/xdpfw.conf.example b/xdpfw.conf.example index f02f957..3fb43d5 100644 --- a/xdpfw.conf.example +++ b/xdpfw.conf.example @@ -1,6 +1,6 @@ verbose = 2; log_file = "/var/log/xdpfw.log"; -interfaces = "ens18"; +interface = "ens18"; update_time = 15; no_stats = false; stats_per_second = false;