#!/usr/bin/lua local site = require 'gluon.site_config' local uci = require('luci.model.uci').cursor() local function configure_mtu(radio, config, mtu) if config.ibss then local network = 'ibss_' .. radio if config.ibss.vlan then uci:set('network', network, 'mtu', mtu + 4) uci:set('network', network .. '_vlan', 'mtu', mtu) else uci:set('network', network, 'mtu', mtu) end end if config.mesh then uci:set('network', 'mesh_' .. radio, 'mtu', mtu) end end local radios = {} uci:foreach('wireless', 'wifi-device', function(s) table.insert(radios, s['.name']) end ) local mtu = 1528 for _, radio in ipairs(radios) do local hwmode = uci:get('wireless', radio, 'hwmode') if hwmode == '11g' or hwmode == '11ng' then configure_mtu(radio, site.wifi24, mtu) elseif hwmode == '11a' or hwmode == '11na' then configure_mtu(radio, site.wifi5, mtu) end end uci:save('network')