2 # Sets up olsrd interfaces
10 # Rename interface for $netrenamed
12 config_get interface
"$1" Interface
13 if [ "$interface" == "$netrenamed" ]; then
14 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
15 section_rename olsrd
$1 $netrenamed
20 config_foreach handle_interface Interface
22 # Setup new interface for $netrenamed
24 uci
set olsrd.
$netrenamed=Interface
25 set_defaults
"olsr_interface_" olsrd.
$net
26 uci
set olsrd.
$netrenamed.interface
="$netrenamed"
28 uci_commitverbose
"Setup olsr interface for $netrenamed." olsrd
30 # If dhcp-network is inside the mesh_network then add HNA for it
32 dhcprange
=$
(uci
-q get meshwizard.netconfig.
$net\_dhcprange
)
33 uci
-q delete olsrd.
${netrenamed}clients
35 if [ -n "$dhcprange" ]; then
36 meshnet
="$(uci get profile_$community.profile.mesh_network)"
37 dhcpinmesh
="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)"
39 if [ "$dhcpinmesh" == 1 ] && [ -n "$meshnet" ]; then
40 uci
set olsrd.
${netrenamed}clients
="Hna4"
41 eval $
(sh
$dir/helpers
/ipcalc-cidr.sh
$dhcprange)
42 uci
set olsrd.
${netrenamed}clients.netaddr
="$NETWORK"
43 uci
set olsrd.
${netrenamed}clients.netmask
="$NETMASK"
44 uci_commitverbose
"Setup HNA for network $dhcprange" olsrd
48 # Set Hna entry for ipv6 net for static ipv6 config
49 uci
-q delete olsrd.
${netrenamed}static
50 if [ "$ipv6_enabled" = "1" ] && [ "$ipv6_config" = "static" ]; then
51 local v6range
="$(uci -q get meshwizard.netconfig.$net\_ip6addr)"
52 local v6net
="$(echo $v6range | cut -d '/' -f 1)"
53 local v6mask
="$(echo $v6range | cut -d '/' -f 2)"
54 if [ -n "$v6net" ] && [ -n "$v6mask" ]; then
55 uci
set olsrd.
${netrenamed}static
="Hna6"
56 uci
set olsrd.
${netrenamed}static.netaddr
="$v6net"
57 uci
set olsrd.
${netrenamed}static.prefix
="$v6mask"
58 uci_commitverbose
"Setup HNA for network $v6range" olsrd