diff --git a/src/config.c b/src/config.c index 652d3e7ca9d0b903102e96fa717b2b24bc2fc97e..a8982ea57ce6ed4ae2ee365baa72d2c11a26f0ea 100644 --- a/src/config.c +++ b/src/config.c @@ -3026,86 +3026,6 @@ int config_calc_ifname(struct agent_config *cfg, return 0; } -int wifi_reorder_interfaces_by_device(struct agent_config *ac, - struct uci_context *ctx, struct uci_package *pkg, char *device) -{ - int i, j = 0; - uint8_t devnum = 0; - char ifname[IFNAMSIZ] = {0}; - enum { - W_IFNAME, - NUM_POLICIES - }; - const struct uci_parse_option opts[] = { - { .name = "ifname", .type = UCI_TYPE_STRING } - }; - struct uci_option *tb[NUM_POLICIES]; - struct uci_element *e; - - dbg("|%s:%d| reordering interfaces for device %s\n", __func__, - __LINE__, device); - - devnum = get_device_num_from_name(device); - - for (i = 0; i < 16; i++) { - - config_calc_ifname(ac, devnum, i, ifname); - - uci_foreach_element(&pkg->sections, e) { - struct uci_section *s = uci_to_section(e); - - if (strncmp(s->type, UCI_WLAN_IFACE, - strlen(UCI_WLAN_IFACE))) - continue; - - uci_parse_section(s, opts, NUM_POLICIES, tb); - - if (!tb[W_IFNAME]) - continue; - - if (strncmp(tb[W_IFNAME]->v.string, ifname, sizeof(ifname))) - continue; - dbg("|%s:%d| found interface %s, reordering to %d\n", - __func__, __LINE__, ifname, j); - uci_reorder_section(ctx, s, j); - j++; - break; - } - } - - return 0; -} - -int wifi_reorder_interfaces(struct agent_config *ac) -{ - - struct uci_context *ctx; - struct uci_package *pkg; - struct uci_element *e; - - ctx = uci_alloc_context(); - if (!ctx) - return -1; - - if (uci_load(ctx, UCI_WIRELESS, &pkg)) { - uci_free_context(ctx); - return -1; - } - - uci_foreach_element(&pkg->sections, e) { - struct uci_section *s = uci_to_section(e); - - if (strncmp(s->type, UCI_WL_DEVICE, strlen(UCI_WL_DEVICE))) - continue; - - wifi_reorder_interfaces_by_device(ac, ctx, pkg, s->e.name); - } - - uci_commit(ctx, &pkg, false); - uci_free_context(ctx); - return 0; -} - int del_value_list(struct uci_context *ctx, struct uci_package *pkg, struct uci_section *s, const char *option, enum uci_option_type type) diff --git a/src/config.h b/src/config.h index e4010f1b43db2054d9ee5b036b9d3b69bf44bb99..007cfd25a36930c1ea2fd23eac067561715f923c 100644 --- a/src/config.h +++ b/src/config.h @@ -286,9 +286,6 @@ int uci_apply_m2(struct agent_config *cfg, char *interface_name, char *device, int uci_apply_wps_credentials(struct agent_config *cfg, enum wifi_band band); int config_calc_ifname(struct agent_config *cfg, uint8_t dev_num, uint8_t index, char *ifname); -int wifi_reorder_interfaces_by_device(struct agent_config *ac, - struct uci_context *ctx, struct uci_package *pkg, char *device); -int wifi_reorder_interfaces(struct agent_config *ac); int uci_set_bridge(char *config, char *bridge, char *proto, char *ipaddress); int uci_add_dhcp(char *interface); int uci_add_fw(struct agent_config *cfg, char *interface);