Translated all files to ENG (#5)
Reviewed-on: #5 Co-authored-by: Finn <fwaggoner@nmfpgt.de> Co-committed-by: Finn <fwaggoner@nmfpgt.de>
This commit was merged in pull request #5.
This commit is contained in:
+57
-56
@@ -373,7 +373,7 @@ void wlan_clear(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Recopilar secciones a eliminar (no modificar durante iteración) */
|
||||
/* Collect sections to remove (do not modify during iteration) */
|
||||
char *to_del[64];
|
||||
int ndel = 0;
|
||||
struct uci_element *e;
|
||||
@@ -403,14 +403,14 @@ void wlan_clear(void)
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════
|
||||
wlan_apply_radio — aplicar config de radio (canal, HT, potencia)
|
||||
wlan_apply_radio — apply radio config (channel, HT, power)
|
||||
═══════════════════════════════════════════════════════════════════
|
||||
|
||||
Lectura de parámetros del JSON del controlador:
|
||||
Reading parameters from the controller's JSON:
|
||||
channel → wireless.<device>.channel
|
||||
ht → wireless.<device>.htmode ("HT20" / "HT40" / "HT80" / "HE80")
|
||||
tx_power → wireless.<device>.txpower
|
||||
min_rssi → no se mapea a UCI (requiere daemon externo)
|
||||
min_rssi → not mapped to UCI (requires an external daemon)
|
||||
*/
|
||||
void wlan_apply_radio(struct json_object *radio_json,
|
||||
const char *device_name)
|
||||
@@ -452,7 +452,7 @@ void wlan_apply_radio(struct json_object *radio_json,
|
||||
|
||||
RP("ht", "htmode");
|
||||
|
||||
/* Canal: 0 = auto en UniFi */
|
||||
/* Channel: 0 = auto in UniFi */
|
||||
if (json_object_object_get_ex(radio_json, "channel", &v)) {
|
||||
int ch = json_object_get_int(v);
|
||||
if (ch == 0) {
|
||||
@@ -474,7 +474,7 @@ void wlan_apply_radio(struct json_object *radio_json,
|
||||
uci_set(ctx, &ptr);
|
||||
}
|
||||
|
||||
/* Habilitar el radio */
|
||||
/* Enable the radio */
|
||||
snprintf(path, sizeof(path), "wireless.%s.disabled=0", device_name);
|
||||
struct uci_ptr ptr;
|
||||
if (uci_lookup_ptr(ctx, &ptr, path, true) == UCI_OK)
|
||||
@@ -488,22 +488,22 @@ void wlan_apply_radio(struct json_object *radio_json,
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════
|
||||
Crear una VAP (wifi-iface UCI) desde un JSON VAP del controlador
|
||||
Create a VAP (wifi-iface UCI) from a controller VAP JSON
|
||||
═══════════════════════════════════════════════════════════════════
|
||||
|
||||
Parámetros del controlador que leemos y cómo los mapeamos:
|
||||
Controller parameters we read and how we map them:
|
||||
|
||||
essid → wireless.openuf_X.ssid
|
||||
x_passphrase → wireless.openuf_X.key
|
||||
security → wireless.openuf_X.encryption (via sec_to_uci)
|
||||
hide_ssid → wireless.openuf_X.hidden
|
||||
guest_policy → wireless.openuf_X.isolate (aislamiento de clientes)
|
||||
fast_roaming_enabled → ieee80211r, ft_over_ds, mobility_domain, ft_psk_generate_local
|
||||
band_steering → ieee80211k, ieee80211v, rrm_neighbor_report, bss_transition
|
||||
pmf_mode → ieee80211w (0/1/2)
|
||||
wpa3_support → añadir "sae-mixed" si WPA2+WPA3
|
||||
uapsd → uapsd (U-APSD power saving)
|
||||
vlan_id → wireless.openuf_X.vlan_id (si ≠ 0)
|
||||
x_passphrase → wireless.openuf_X.key
|
||||
security → wireless.openuf_X.encryption (via sec_to_uci)
|
||||
hide_ssid → wireless.openuf_X.hidden
|
||||
guest_policy → wireless.openuf_X.isolate (client isolation)
|
||||
fast_roaming_enabled → ieee80211r, ft_over_ds, mobility_domain, ft_psk_generate_local
|
||||
band_steering → ieee80211k, ieee80211v, rrm_neighbor_report, bss_transition
|
||||
pmf_mode → ieee80211w (0/1/2)
|
||||
wpa3_support → add "sae-mixed" if WPA2+WPA3
|
||||
uapsd → uapsd (U-APSD power saving)
|
||||
vlan_id → wireless.openuf_X.vlan_id (if ≠ 0)
|
||||
*/
|
||||
static int apply_vap(struct uci_context *ctx,
|
||||
struct uci_package *pkg,
|
||||
@@ -535,7 +535,7 @@ static int apply_vap(struct uci_context *ctx,
|
||||
snprintf(target_network, sizeof(target_network), "vlan%d", vid);
|
||||
}
|
||||
|
||||
/* Nombre de sección: openuf_<idx>_<ssid_safe> */
|
||||
/* Section name: openuf_<idx>_<ssid_safe> */
|
||||
char safe[16] = {0};
|
||||
safe_section_name(essid, safe, sizeof(safe));
|
||||
char sec_name[48];
|
||||
@@ -556,7 +556,7 @@ static int apply_vap(struct uci_context *ctx,
|
||||
* Preserve the controller's WLAN configuration ID. Inform telemetry must
|
||||
* refer to this ObjectId; a label such as "user" is not a valid VAP ID.
|
||||
* Controller versions use different keys, so accept the known variants.
|
||||
*/
|
||||
*/
|
||||
const char *vap_id = NULL;
|
||||
const char *id_keys[] = { "_id", "id", "wlanconf_id" };
|
||||
for (size_t i = 0; i < sizeof(id_keys) / sizeof(id_keys[0]); i++) {
|
||||
@@ -571,23 +571,23 @@ static int apply_vap(struct uci_context *ctx,
|
||||
if (vap_id)
|
||||
UCI_SET(ctx, "wireless", sec_name, "openuf_vap_id", vap_id);
|
||||
|
||||
/* Contraseña */
|
||||
/* Password */
|
||||
if (pass && pass[0] && strcmp(security,"open") != 0)
|
||||
UCI_SET(ctx, "wireless", sec_name, "key", pass);
|
||||
|
||||
/* SSID oculto */
|
||||
/* hidden SSID */
|
||||
int hidden = 0;
|
||||
if (json_object_object_get_ex(vap_json, "hide_ssid", &v))
|
||||
hidden = json_object_get_boolean(v) ? 1 : 0;
|
||||
UCI_SET_INT(ctx, "wireless", sec_name, "hidden", hidden);
|
||||
|
||||
/* Aislamiento de clientes (guest network) */
|
||||
/* Client isolation (guest network) */
|
||||
int isolate = 0;
|
||||
if (json_object_object_get_ex(vap_json, "guest_policy", &v))
|
||||
isolate = json_object_get_boolean(v) ? 1 : 0;
|
||||
UCI_SET_INT(ctx, "wireless", sec_name, "isolate", isolate);
|
||||
|
||||
/* U-APSD (ahorro de energía para clientes móviles) */
|
||||
/* U-APSD (power saving for mobile clients) */
|
||||
int uapsd = 1;
|
||||
if (json_object_object_get_ex(vap_json, "uapsd", &v))
|
||||
uapsd = json_object_get_boolean(v) ? 1 : 0;
|
||||
@@ -595,22 +595,22 @@ static int apply_vap(struct uci_context *ctx,
|
||||
|
||||
/* ── PMF (Protected Management Frames / 802.11w) ──────────────
|
||||
* "disabled" → 0, "optional" → 1, "required" → 2
|
||||
* WPA3 (sae/sae-mixed) siempre requiere ieee80211w=2 */
|
||||
* WPA3 (sae/sae-mixed) always requires "optional" or " required" ieee80211w=2 */
|
||||
int pmf = 0;
|
||||
if (json_object_object_get_ex(vap_json, "pmf_mode", &v)) {
|
||||
const char *pm = json_object_get_string(v);
|
||||
if (!strcmp(pm, "optional")) pmf = 1;
|
||||
if (!strcmp(pm, "required")) pmf = 2;
|
||||
}
|
||||
/* WPA3 obliga PMF=2 */
|
||||
/* WPA3 forces PMF=2 */
|
||||
if (!strcmp(security,"wpa3") || !strcmp(security,"wpa3transition") ||
|
||||
!strcmp(security,"wpa3enterprise"))
|
||||
pmf = 2;
|
||||
UCI_SET_INT(ctx, "wireless", sec_name, "ieee80211w", pmf);
|
||||
|
||||
/* ── Fast Roaming (802.11r FT) ────────────────────────────────
|
||||
* Permite que los clientes se muevan entre APs sin re-autenticación
|
||||
* completa. El handshake FT sólo tarda ~50ms vs ~200-300ms normal. */
|
||||
* Allows clients to move between APs without re-authentication
|
||||
* complete. The FT handshake only takes ~50ms vs ~200-300ms for a normal one. */
|
||||
const char *ft_keys[] = {
|
||||
"fast_roaming_enabled", "fast_roaming", "ft_enabled", "ieee80211r"
|
||||
};
|
||||
@@ -629,10 +629,10 @@ static int apply_vap(struct uci_context *ctx,
|
||||
}
|
||||
|
||||
/* ── Band Steering (802.11k/v) ────────────────────────────────
|
||||
* 802.11k: Neighbor Reports → el AP informa al cliente qué otros
|
||||
* APs existen para facilitar el roaming.
|
||||
* 802.11v: BSS Transition Management → el AP puede "sugerir" al
|
||||
* cliente que se mueva a otro AP con mejor señal. */
|
||||
* 802.11k: Neighbor Reports → the AP tells the client what other
|
||||
* APs exist to facilitate roaming.
|
||||
* 802.11v: BSS Transition Management → the AP can "suggest" to the
|
||||
* client to move to another AP with better signal.*/
|
||||
int band_steer = 0;
|
||||
if (json_object_object_get_ex(vap_json, "band_steering", &v))
|
||||
band_steer = json_object_get_boolean(v) ? 1 : 0;
|
||||
@@ -669,18 +669,18 @@ static int apply_vap(struct uci_context *ctx,
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════
|
||||
wlan_apply_config — aplicar configuración completa del controlador
|
||||
wlan_apply_config — apply the controller's full configuration
|
||||
═══════════════════════════════════════════════════════════════════
|
||||
|
||||
Llamado desde inform.c → handle_response() cuando _type=="setstate".
|
||||
config_json es el JSON completo del controlador.
|
||||
Called from inform.c → handle_response() when _type=="setstate".
|
||||
config_json is the controller's complete JSON.
|
||||
|
||||
Proceso:
|
||||
1. Eliminar VAPs antiguas (prefijo openuf_)
|
||||
2. Aplicar radio_table (canal, potencia, htmode) por radio
|
||||
3. Crear una VAP por cada entrada en vap_table
|
||||
4. Hacer commit UCI
|
||||
5. Ejecutar "wifi reload" para aplicar sin reiniciar el AP
|
||||
Process:
|
||||
1. Remove old VAPs (openuf_ prefix)
|
||||
2. Apply radio_table (channel, power, htmode) per radio
|
||||
3. Create one VAP for each entry in vap_table
|
||||
4. Commit UCI
|
||||
5. Run "wifi reload" to apply without rebooting the AP
|
||||
*/
|
||||
int wlan_apply_config(struct json_object *config_json,
|
||||
const uf_model_t *model)
|
||||
@@ -689,7 +689,7 @@ int wlan_apply_config(struct json_object *config_json,
|
||||
json_object_object_get_ex(config_json, "radio_table", &rt_arr);
|
||||
json_object_object_get_ex(config_json, "vap_table", &vt_arr);
|
||||
|
||||
/* Obtener MAC del AP para mobility_domain */
|
||||
/* Get the AP's MAC for mobility_domain */
|
||||
char mac_str[32] = "00:00:00:00:00:00";
|
||||
{
|
||||
char path[128];
|
||||
@@ -706,13 +706,13 @@ int wlan_apply_config(struct json_object *config_json,
|
||||
/* Remove every existing VAP so UniFi becomes the sole Wi-Fi owner. */
|
||||
wlan_clear();
|
||||
|
||||
/* 2. Aplicar radio_table */
|
||||
/* 2. Apply radio_table */
|
||||
if (rt_arr && json_object_is_type(rt_arr, json_type_array)) {
|
||||
int nr = json_object_array_length(rt_arr);
|
||||
for (int i = 0; i < nr; i++) {
|
||||
struct json_object *r = json_object_array_get_idx(rt_arr, i);
|
||||
if (!r) continue;
|
||||
/* Buscar el device UCI correspondiente a esta banda */
|
||||
/* Find the UCI device corresponding to this band */
|
||||
const char *radio_band = "";
|
||||
if (json_object_object_get_ex(r, "radio", &v))
|
||||
radio_band = json_object_get_string(v);
|
||||
@@ -766,7 +766,7 @@ int wlan_apply_config(struct json_object *config_json,
|
||||
printf("[openuf] Disabled %d default OpenWrt VAPs\n",
|
||||
disabled_defaults);
|
||||
|
||||
/* 3. Crear VAPs */
|
||||
/* 3. Create VAPs */
|
||||
if (vt_arr && json_object_is_type(vt_arr, json_type_array)) {
|
||||
int nv = json_object_array_length(vt_arr);
|
||||
for (int i = 0; i < nv; i++) {
|
||||
@@ -974,24 +974,25 @@ int wlan_apply_system_cfg(const char *system_cfg,
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════
|
||||
wlan_get_vap_table — leer VAPs activas desde UCI
|
||||
wlan_get_vap_table — read active VAPs from UCI
|
||||
═══════════════════════════════════════════════════════════════════
|
||||
|
||||
Itera todas las wifi-iface con prefijo "openuf_" en /etc/config/wireless
|
||||
y construye el JSON vap_table para incluir en el payload inform.
|
||||
Iterates over all wifi-iface entries with the "openuf_" prefix in
|
||||
/etc/config/wireless and builds the vap_table JSON to include in
|
||||
the inform payload.
|
||||
|
||||
Campos que leemos de UCI → campos en el JSON:
|
||||
Fields we read from UCI → fields in the JSON:
|
||||
ssid → essid
|
||||
device → (usado para buscar radio y BSSID)
|
||||
device → (used to look up radio and BSSID)
|
||||
encryption → security (via sec_to_unifi)
|
||||
hidden → hide_ssid
|
||||
ieee80211r → fast_roaming_enabled
|
||||
ieee80211k → band_steering
|
||||
ieee80211w → pmf_mode ("disabled"/"optional"/"required")
|
||||
disabled → up (inverso)
|
||||
disabled → up (inverse)
|
||||
|
||||
También intentamos leer el BSSID real de la interfaz wlan
|
||||
desde /sys/class/net/<iface>/address.
|
||||
We also try to read the actual BSSID of the wlan interface
|
||||
from /sys/class/net/<iface>/address.
|
||||
*/
|
||||
/* Resolve a configured VAP to the live interface reported by nl80211. */
|
||||
static int find_runtime_vap(int phy_index, const char *ssid,
|
||||
@@ -1044,7 +1045,7 @@ struct json_object *wlan_get_vap_table(const uf_model_t *model)
|
||||
uci_foreach_element(&pkg->sections, e) {
|
||||
struct uci_section *sec = uci_to_section(e);
|
||||
if (strcmp(sec->type, "wifi-iface") != 0) continue;
|
||||
/* Solo reportar VAPs gestionadas por openuf */
|
||||
/* Only report VAPs managed by openuf */
|
||||
if (strncmp(sec->e.name, "openuf_", 7) != 0) continue;
|
||||
|
||||
#define UCI_GET(opt) uci_lookup_option_string(ctx, sec, opt)
|
||||
@@ -1063,7 +1064,7 @@ struct json_object *wlan_get_vap_table(const uf_model_t *model)
|
||||
if (!ssid) ssid = "";
|
||||
if (!device) device = "radio0";
|
||||
|
||||
/* Banda de este radio */
|
||||
/* Band of this radio */
|
||||
const char *radio_band = "ng";
|
||||
for (int j = 0; j < model->radio_map_len; j++) {
|
||||
if (!strcmp(model->radio_map[j].device, device)) {
|
||||
@@ -1079,7 +1080,7 @@ struct json_object *wlan_get_vap_table(const uf_model_t *model)
|
||||
if (find_runtime_vap(ridx, ssid, wlan_iface, sizeof(wlan_iface)) != 0)
|
||||
snprintf(wlan_iface, sizeof(wlan_iface), "phy%d-ap0", ridx);
|
||||
|
||||
/* Leer BSSID real desde sysfs */
|
||||
/* Read the actual BSSID from sysfs */
|
||||
char bssid[32] = "00:00:00:00:00:00";
|
||||
{
|
||||
char path[128];
|
||||
|
||||
Reference in New Issue
Block a user