Ethernet.VLANTermination: set LowerLayers has no effect on the IP.Interface section related to it

if we have an IP.Interface.{i}. links to -> Ethernet.VLANTermination.{i}. which link to -> Ethernet.Link.1. and we need to update Ethernet.VLANTermination.{i}.LowerLayers to Ethernet.Link.2.

the issue is IP.Interface.{i}. was not updated when setting Ethernet.VLANTermination.{i}.LowerLayers to Ethernet.Link.2.

So this commit fixes this issue
This commit is contained in:
Amin Ben Ramdhane 2020-11-20 21:36:26 +01:00
parent 192a2f48b0
commit fe6c5ec71a

View file

@ -1247,10 +1247,12 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
dmuci_set_value_by_section(dmmap_s, "device", new_name);
dmuci_set_value_by_section(dmmap_s, "section_name", sec_name);
} else {
/* type != macvlan */
char *vid;
struct uci_section *s = NULL;
char *vid, *old_name;
dmuci_get_value_by_section_string((struct uci_section *)data, "name", &old_name);
dmuci_get_value_by_section_string((struct uci_section *)data, "vid", &vid);
if (*vid != '\0')
snprintf(new_name, sizeof(new_name), "%s.%s", linker, vid);
@ -1259,6 +1261,13 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
if (is_name_exist_in_devices(new_name))
return -1;
// if device is lowerlayer to an ip interface, then
// the ifname of the ip interface also needs to be updated
uci_foreach_option_eq("network", "interface", "ifname", old_name, s) {
dmuci_set_value_by_section(s, "ifname", new_name);
}
}
// Set ifname and name options of device section