8 if [ "$ipv6_enabled" = 1 ] && [ "$has_ipv6" == "1" ]; then
13 # Clean the config, remove interface wlan
15 config_get interface "$1" interface
16 if [ "$interface" = "wlan" ]; then
20 config_foreach handle_interface Interface
24 #Rename olsrd basic settings
26 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
27 section_rename $cfg $1 olsrd
30 config_foreach handle_olsrd olsrd
33 rename_interface_defaults() {
34 # Rename interface defaults
35 handle_interfacedefaults() {
36 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
37 section_rename $cfg $1 InterfaceDefaults
40 config_foreach handle_interfacedefaults InterfaceDefaults
44 # Rename nameservice, dyngw and httpinfo plugins
46 config_get library "$1" library
47 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
48 new="$(echo $library | cut -d '.' -f 1)"
49 section_rename $cfg "$1" "$new"
52 config_foreach handle_plugin LoadPlugin
53 uci -q delete $cfg.olsrd_httpinfo
54 uci -q delete $cfg.olsrd_dyn_gw
58 # Setup nameservice plugin
59 if [ -n "$profile_suffix" ]; then
60 suffix=".$profile_suffix"
64 local llfile="/var/run/latlon.js"
65 local hosts="/var/etc/hosts.olsr"
66 local services="/var/run/services_olsr"
68 if [ "$proto" = "6" ]; then
69 local llfile="/var/run/latlon.js.ipv6"
70 local hosts="/var/etc/hosts.olsr.ipv6"
71 local services="/var/run/services_olsr.ipv6"
75 set $cfg.olsrd_nameservice=LoadPlugin
76 set $cfg.olsrd_nameservice.library="olsrd_nameservice.so.0.3"
77 set $cfg.olsrd_nameservice.latlon_file="$llfile"
78 set $cfg.olsrd_nameservice.hosts_file="$hosts"
79 set $cfg.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid"
80 set $cfg.olsrd_nameservice.services_file="$services"
81 set $cfg.olsrd_nameservice.suffix="$suffix"
84 uci_commitverbose "Setup olsr nameservice plugin" $cfg
89 # If Sharing of Internet is enabled then enable dyngw_plain plugin
91 if [ "$general_sharenet" == 1 ]; then
92 uci set $cfg.dyngw_plain=LoadPlugin
93 uci set $cfg.dyngw_plain.ignore=0
94 uci set $cfg.dyngw_plain.library="olsrd_dyn_gw_plain.so.0.4"
95 uci_commitverbose "Setup olsrd_dyngw_plain plugin" $cfg
102 local watchdogfile="/var/run/olsrd.watchdog"
103 if [ "$proto" = "6" ]; then
104 watchdogfile="/var/run/olsrd.watchdog.ipv6"
108 set $cfg.olsrd_watchdog=LoadPlugin
109 set $cfg.olsrd_watchdog.library="olsrd_watchdog.so.0.1"
110 set $cfg.olsrd_watchdog.file="$watchdogfile"
111 set $cfg.olsrd_watchdog.interval=30
113 uci_commitverbose "Setup olsr watchdog plugin" $cfg
120 set $cfg.olsrd_jsoninfo=LoadPlugin
121 set $cfg.olsrd_jsoninfo.library="olsrd_jsoninfo.so.0.0"
123 if [ "$proto" = "6" ]; then
124 uci set $cfg.olsrd_jsoninfo.ipv6only='1'
126 uci_commitverbose "Setup olsr jsoninfo plugin" $cfg
132 set $cfg.olsrd_txtinfo=LoadPlugin
133 set $cfg.olsrd_txtinfo.library="olsrd_txtinfo.so.0.1"
135 if [ "$proto" = "6" ]; then
136 uci set $cfg.olsrd_txtinfo.ipv6only='1'
138 uci_commitverbose "Setup olsr txtinfo plugin" $cfg
142 for proto in $protocols; do
144 [ "$proto" == "6" ] && cfg="olsrd6"
150 uci set $cfg.olsrd.IpVersion="$proto"
151 uci set $cfg.InterfaceDefaults=InterfaceDefaults
152 set_defaults "olsr_interfacedefaults_" $cfg.InterfaceDefaults
153 uci_commitverbose "Cleanup olsrd config" $cfg
158 setup_jsoninfo $proto