Skip to content

Commit a9f3545

Browse files
committed
gluon-mesh-batman-adv: move wireless hop_penalty handling from gluon-core
The batadv_hop_penalty option for wireless mesh interfaces was read in gluon-core's 200-wireless, mixing the batman-adv-specific option name into the generic wireless configurator. Move the read into a new gluon-mesh-batman-adv upgrade script (305) that runs after 200-wireless has created the mesh_<radio> network interfaces. Behavior is preserved: when gluon.band_X.batadv_hop_penalty is set, hop_penalty is applied to network.mesh_<radio>; when unset, it is left absent and gluon_bat0.sh defaults it to 0 at runtime (same as the previous 'or 0' fallback in 200-wireless). Also document the wireless band-scoped hop_penalty in gluon-mesh-batman-adv.rst alongside the existing wired/VPN variants.
1 parent 034730c commit a9f3545

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

docs/package/gluon-mesh-batman-adv.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ Examples of this are shown below:
197197
uci set gluon.iface_lan.batadv_hop_penalty=10
198198
# optional for mesh on wan
199199
uci set gluon.iface_wan.batadv_hop_penalty=10
200+
# optional penalty for wireless mesh per band
201+
uci set gluon.band_5g.batadv_hop_penalty=10
200202
# don't forget to commit changes
201203
uci commit gluon
202204

package/gluon-core/luasrc/lib/gluon/upgrade/200-wireless

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,8 @@ local function configure_mesh(radio, index, mesh_config)
134134
return
135135
end
136136

137-
local batadv_hop_penalty = uci:get('gluon', 'band_' .. radio.band, 'batadv_hop_penalty') or 0
138-
139137
uci:section('network', 'interface', name, {
140138
proto = 'gluon_mesh',
141-
hop_penalty = batadv_hop_penalty,
142139
})
143140

144141
uci:section('wireless', 'wifi-iface', name, {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/lua
2+
3+
local wireless = require 'gluon.wireless'
4+
5+
local uci = require('simple-uci').cursor()
6+
7+
8+
wireless.foreach_radio(uci, function(radio)
9+
local name = 'mesh_' .. radio['.name']
10+
11+
if not uci:get('network', name) then
12+
return
13+
end
14+
15+
local hop_penalty = uci:get('gluon', 'band_' .. radio.band, 'batadv_hop_penalty')
16+
if hop_penalty ~= nil then
17+
uci:set('network', name, 'hop_penalty', hop_penalty)
18+
end
19+
end)
20+
21+
uci:save('network')

0 commit comments

Comments
 (0)