2 # Sets up olsrd interfaces
11 if [ "$ipv6_enabled" = 1 ] && [ "$has_ipv6" == "1" ]; then
15 for proto
in $protocols; do
18 [ "$proto" == "6" ] && cfg
="olsrd6"
20 # Rename interface for $netrenamed
22 config_get interface
"$1" Interface
23 if [ "$interface" == "$netrenamed" ]; then
24 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
25 section_rename
$cfg $1 $netrenamed
30 config_foreach handle_interface Interface
32 # Setup new interface for $netrenamed
34 uci
set $cfg.
$netrenamed=Interface
35 set_defaults
"olsr_interface_" $cfg.
$net
36 uci
set $cfg.
$netrenamed.interface
="$netrenamed"
38 uci_commitverbose
"Setup olsr interface for $netrenamed." $cfg
40 if [ "$proto" = "4" ]; then
41 # If dhcp-network is inside the mesh_network then add HNA for it
43 dhcprange
=$
(uci
-q get meshwizard.netconfig.
$net\_dhcprange
)
44 uci
-q delete
$cfg.
${netrenamed}clients
46 if [ -n "$dhcprange" ]; then
47 meshnet
="$(uci get profile_$community.profile.mesh_network)"
48 dhcpinmesh
="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)"
50 if [ "$dhcpinmesh" == 1 ] && [ -n "$meshnet" ]; then
51 uci
set $cfg.
${netrenamed}clients
="Hna4"
52 eval $
(sh
$dir/helpers
/ipcalc-cidr.sh
$dhcprange)
53 uci
set $cfg.
${netrenamed}clients.netaddr
="$NETWORK"
54 uci
set $cfg.
${netrenamed}clients.netmask
="$NETMASK"
55 uci_commitverbose
"Setup HNA for network $dhcprange" $cfg
60 if [ "$proto" = "6" ]; then
61 # Set Hna entry for ipv6 net for static ipv6 config
62 uci
-q delete
$cfg.
${netrenamed}static
63 if [ "$ipv6_config" = "static" ]; then
64 v6range
="$(uci -q get meshwizard.netconfig.$net\_ip6addr)"
65 v6net
="$(echo $v6range | cut -d '/' -f 1)"
66 v6mask
="$(echo $v6range | cut -d '/' -f 2)"
67 if [ -n "$v6net" ] && [ -n "$v6mask" ]; then
68 uci
set $cfg.
${netrenamed}static
="Hna6"
69 uci
set $cfg.
${netrenamed}static.netaddr
="$v6net"
70 uci
set $cfg.
${netrenamed}static.prefix
="$v6mask"
71 uci_commitverbose
"Setup HNA for network $v6range" $cfg