- #6and4: backward compatibility
- local bindv6only='0'
- if [ "$OLSRD_IPVERSION_6AND4" -ne 0 ]; then
- warn "IpVersion 6and4 is deprecated and will be removed in future!"
- warn "You must use /etc/config/olsrd and /etc/init.d/olsrd for IPv4"
- warn " /etc/config/olsrd6 and /etc/init.d/olsrd6 for IPv6"
-
- bindv6only="$(sysctl -n net.ipv6.bindv6only)"
- sysctl -w net.ipv6.bindv6only=1 > /dev/null
- sed -e '/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/d' < "$OLSRD_CONFIG_FILE" > /var/etc/olsrd.conf.ipv6
- sed -e 's/^IpVersion[ ][ ]*6$/IpVersion 4/' -e 's/^\t\t[A-Fa-f0-9.:]*[:][A-Fa-f0-9.:]*[ ][0-9]*$//' < "$OLSRD_CONFIG_FILE" > /var/etc/olsrd.conf.ipv4
- rm $OLSRD_CONFIG_FILE
-
- # some filenames should get the suffix .ipv6
- for file in $latlon_file $hosts_file $services_file $resolv_file $macs_file $wd_file;do
- f=$(echo $file|sed 's/\//\\\//g')
- sed -i "s/$f/$f.ipv6/g" /var/etc/olsrd.conf.ipv6
- done
-
- SERVICE_PID_FILE="$PID6"
- if service_check /usr/sbin/olsrd; then
- error "there is already an IPv6 instance of olsrd running (pid: '$(cat $PID6)'), not starting."
- else
- service_start /usr/sbin/olsrd -f /var/etc/olsrd.conf.ipv6 -nofork
- fi
-
- SERVICE_PID_FILE="$PID"
- if service_check /usr/sbin/olsrd; then
- error "there is already an IPv4 instance of olsrd running (pid: '$(cat $PID)'), not starting."
- else
- service_start /usr/sbin/olsrd -f /var/etc/olsrd.conf.ipv4 -nofork
- fi
-
- sleep 3
- sysctl -w net.ipv6.bindv6only="$bindv6only" > /dev/null