summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-05-20 10:57:52 +0200
committerFelix Fietkau <nbd@nbd.name>2021-05-20 10:57:53 +0200
commit42c19303bff5853866292671df30e9cae0fd60d1 (patch)
tree3b1a1d76bc48497841018945497bd2c55de01d43
parent7277764bf8173d6961acbacfe31757c9195329e1 (diff)
downloadnetifd-42c19303bff5853866292671df30e9cae0fd60d1.tar.gz
config: fix ifname->ports compat rename
Instead of looking it up as a string, use uci_rename. That way it works both on list and string options Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--config.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/config.c b/config.c
index 1f4560f..d83ea9c 100644
--- a/config.c
+++ b/config.c
@@ -103,14 +103,21 @@ config_fixup_bridge_var(struct uci_section *s, const char *name, const char *val
*/
static void config_fixup_bridge_ports(struct uci_section *s)
{
- const char *ifname;
+ struct uci_ptr ptr = {
+ .p = s->package,
+ .s = s,
+ .option = "ifname",
+ };
if (uci_lookup_option(uci_ctx, s, "ports"))
return;
- ifname = uci_lookup_option_string(uci_ctx, s, "ifname");
- if (ifname)
- config_fixup_bridge_var(s, "ports", ifname);
+ uci_lookup_ptr(uci_ctx, &ptr, NULL, false);
+ if (!ptr.o)
+ return;
+
+ ptr.value = "ports";
+ uci_rename(uci_ctx, &ptr);
}
static void