From 2e13ddbd0eaed8aa17b7a704e7d79c8fc2dbbae3 Mon Sep 17 00:00:00 2001 From: Amin Ben Romdhane Date: Fri, 28 Apr 2023 12:09:38 +0200 Subject: [PATCH] VLANTermination: Remove unnecessary option --- libbbfdm/dmtree/tr181/ethernet.c | 15 ++++++--------- libbbfdm/dmtree/tr181/interfacestack.c | 10 +++------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/libbbfdm/dmtree/tr181/ethernet.c b/libbbfdm/dmtree/tr181/ethernet.c index e127f9c8..79ed25fe 100644 --- a/libbbfdm/dmtree/tr181/ethernet.c +++ b/libbbfdm/dmtree/tr181/ethernet.c @@ -209,7 +209,7 @@ static int browseEthernetLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void /*#Device.Ethernet.VLANTermination.{i}.!UCI:network/device/dmmap_network*/ static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *type, *name, *is_vlan, *inst = NULL; + char *type, *name, *inst = NULL; struct dmmap_dup *p = NULL; LIST_HEAD(dup_list); @@ -218,11 +218,10 @@ static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent dmuci_get_value_by_section_string(p->config_section, "type", &type); dmuci_get_value_by_section_string(p->config_section, "name", &name); - dmuci_get_value_by_section_string(p->dmmap_section, "is_vlan_ter", &is_vlan); if (DM_LSTRCMP(type, "bridge") == 0 || DM_LSTRCMP(type, "macvlan") == 0 || - (*name == 0 && DM_LSTRCMP(is_vlan, "1") != 0) || - (*name != 0 && !ethernet___check_vlan_termination_section(name))) + (*name != 0 && !ethernet___check_vlan_termination_section(name)) || + (*name == 0 && strncmp(section_name(p->config_section), "br_", 3) == 0)) continue; inst = handle_instance(dmctx, parent_node, p->dmmap_section, "vlan_term_instance", "vlan_term_alias"); @@ -366,7 +365,6 @@ static int addObjEthernetVLANTermination(char *refparam, struct dmctx *ctx, void // Add device section in dmmap_network file dmuci_add_section_bbfdm("dmmap_network", "device", &dmmap_network); dmuci_set_value_by_section(dmmap_network, "section_name", device_name); - dmuci_set_value_by_section(dmmap_network, "is_vlan_ter", "1"); dmuci_set_value_by_section(dmmap_network, "vlan_term_instance", *instance); return 0; } @@ -374,7 +372,7 @@ static int addObjEthernetVLANTermination(char *refparam, struct dmctx *ctx, void static int delObjEthernetVLANTermination(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) { struct uci_section *s_dev = NULL, *sdevtmp = NULL; - char *name, *type, *is_vlan; + char *name, *type; switch (del_action) { case DEL_INST: @@ -389,13 +387,12 @@ static int delObjEthernetVLANTermination(char *refparam, struct dmctx *ctx, void struct uci_section *dmmap_section = NULL; get_dmmap_section_of_config_section("dmmap_network", "device", section_name(s_dev), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "is_vlan_ter", &is_vlan); dmuci_get_value_by_section_string(s_dev, "type", &type); dmuci_get_value_by_section_string(s_dev, "name", &name); if (DM_LSTRCMP(type, "bridge") == 0 || - (*name == 0 && DM_LSTRCMP(is_vlan, "1") != 0) || - (*name != 0 && !ethernet___check_vlan_termination_section(name))) + (*name != 0 && !ethernet___check_vlan_termination_section(name)) || + (*name == 0 && strncmp(section_name(s_dev), "br_", 3) == 0)) continue; // Remove device section in dmmap_network file diff --git a/libbbfdm/dmtree/tr181/interfacestack.c b/libbbfdm/dmtree/tr181/interfacestack.c index a5e4aa03..79b8cc05 100644 --- a/libbbfdm/dmtree/tr181/interfacestack.c +++ b/libbbfdm/dmtree/tr181/interfacestack.c @@ -298,19 +298,15 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre /* Higher layers are Device.Ethernet.VLANTermination.{i}. */ uci_foreach_sections("network", "device", s) { - struct uci_section *dmmap_section = NULL; - char *type = NULL, *name = NULL, *ifname = NULL, *is_vlan = NULL, *value = NULL; - - get_dmmap_section_of_config_section("dmmap_network", "device", section_name(s), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "is_vlan_ter", &is_vlan); + char *type = NULL, *name = NULL, *ifname = NULL, *value = NULL; dmuci_get_value_by_section_string(s, "type", &type); dmuci_get_value_by_section_string(s, "name", &name); dmuci_get_value_by_section_string(s, "ifname", &ifname); if (DM_LSTRCMP(type, "bridge") == 0 || DM_LSTRCMP(type, "macvlan") == 0 || - (*name == 0 && DM_LSTRCMP(is_vlan, "1") != 0) || - (*name != 0 && !ethernet___check_vlan_termination_section(name))) + (*name != 0 && !ethernet___check_vlan_termination_section(name)) || + (*name == 0 && strncmp(section_name(s), "br_", 3) == 0)) continue; // The higher layer is Device.Ethernet.VLANTermination.{i}.