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>
*/
static void config_fixup_bridge_ports(struct uci_section *s)
{
*/
static void config_fixup_bridge_ports(struct uci_section *s)
{
+ struct uci_ptr ptr = {
+ .p = s->package,
+ .s = s,
+ .option = "ifname",
+ };
if (uci_lookup_option(uci_ctx, s, "ports"))
return;
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);