#!/bin/sh

#BRMESHMAC=$(printf "%02x" $(( $(hexdump -n1 -e'/1 "0x%02x"' /dev/urandom) & ~1 | 2)) && hexdump -n5 -e'/1 ":%02x"' /dev/urandom)

uci -q batch <<-EOF >/dev/null
  set network.mesh=interface
  set network.mesh.auto='1'
  set network.mesh.device='br-mesh'
  set network.mesh.proto='autoip'
#  set network.ninux_mesh.macaddr=${BRMESHMAC}
  set network.mesh.stp='1'
  set network.device_mesh=device
  set network.device_mesh.bridge_empty='1'
  set network.device_mesh.ports='mesh mesh0 wmesh0'
  set network.device_mesh.name='br-mesh'
  set network.device_mesh.type='bridge'
  set network.device_mesh.igmp_snooping='0'
  set network.device_mesh.mtu='1500'
  commit network
EOF
