diff --git a/doc/EN/mesh.org b/doc/EN/mesh.org index 8cf2ceea..f910f4d9 100644 --- a/doc/EN/mesh.org +++ b/doc/EN/mesh.org @@ -32,7 +32,7 @@ If an internet connection is available then it can make use of that, but otherwi Systems only need to be within wifi range of each other for the mesh to be created, so it can be an very convenient way to create a local communications network. -Like [[https://libremesh.org][LibreMesh]], this system uses a combination of [[https://en.wikipedia.org/wiki/B.A.T.M.A.N.][batman-adv]] on network layer 2 and [[http://bmx6.net][BMX]] on layer 3. +Like [[https://libremesh.org][LibreMesh]], this system uses a combination of [[https://en.wikipedia.org/wiki/B.A.T.M.A.N.][batman-adv]] on network layer 2 and [[http://bmx6.net][BMX]] on layer 3. Routing protocols [[http://www.olsr.org][OLSR2]] and [[https://www.irif.fr/~jch/software/babel][Babel]] are also selectable. #+BEGIN_CENTER This site can also be accessed via a Tor browser at http://pazyv7nkllp76hqr.onion diff --git a/img/mesh_desktop1.png b/img/mesh_desktop1.png index 8b2b1d68..85ee5649 100644 Binary files a/img/mesh_desktop1.png and b/img/mesh_desktop1.png differ diff --git a/img/mesh_desktop_routing.png b/img/mesh_desktop_routing.png new file mode 100644 index 00000000..98339159 Binary files /dev/null and b/img/mesh_desktop_routing.png differ diff --git a/src/freedombone-image-mesh b/src/freedombone-image-mesh index d51a073a..3b818bb8 100755 --- a/src/freedombone-image-mesh +++ b/src/freedombone-image-mesh @@ -835,7 +835,7 @@ function show_desktop_icons { echo 'Comment[ru]=Выберите протокол маршрутизации сетки' >> /home/$MY_USERNAME/Desktop/routing.desktop echo 'Comment[zh]=选择网状路由协议' >> /home/$MY_USERNAME/Desktop/routing.desktop echo "Exec=mate-terminal -e \"/usr/local/bin/${PROJECT_NAME}-mesh-routing\"" >> /home/$MY_USERNAME/Desktop/routing.desktop - echo 'Icon=/usr/share/$PROJECT_NAME/avatars/icon_routing.png' >> /home/$MY_USERNAME/Desktop/routing.desktop + echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_routing.png" >> /home/$MY_USERNAME/Desktop/routing.desktop echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/routing.desktop echo 'Categories=Application' >> /home/$MY_USERNAME/Desktop/routing.desktop diff --git a/src/freedombone-mesh-routing b/src/freedombone-mesh-routing index e5c04c50..b10326ec 100755 --- a/src/freedombone-mesh-routing +++ b/src/freedombone-mesh-routing @@ -34,6 +34,17 @@ export TEXTDOMAINDIR="/usr/share/locale" source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh +function mesh_stop_daemon { + daemon_name=$1 + + clear + echo '' + echo $"Stopping $1..." + sudo systemctl stop $1 + echo $"Disabling $1..." + sudo systemctl disable $1 +} + clear echo '' echo $'Scanning for BMX6 protocol...' @@ -59,12 +70,29 @@ case $sel in 255) exit 1;; esac -echo '#!/bin/bash' > /tmp/change_routing -echo "echo '$1' > $MESH_DEFAULT_PROTOCOL" >> /tmp/change_routing -echo "echo '$1' > $MESH_CURRENT_PROTOCOL" >> /tmp/change_routing -echo "sed -i 's|.*|_${1}._tcp|g' /etc/avahi/services/routing.service" >> /tmp/change_routing -echo 'systemctl restart avahi-daemon' >> /tmp/change_routing -chmod +x /tmp/change_routing +temp_script=$HOME/.change_routing +echo '#!/bin/bash' > $temp_script +echo "echo \"\$1\" > $MESH_DEFAULT_PROTOCOL" >> $temp_script +echo "echo \"\$1\" > $MESH_CURRENT_PROTOCOL" >> $temp_script +echo "sed -i \"s|.*|_\${1}._tcp|g\" /etc/avahi/services/routing.service" >> $temp_script +echo 'systemctl restart avahi-daemon' >> $temp_script +echo "IFACE=\$(cat /etc/systemd/system/\${1}.service | grep ExecStart | awk -F ' ' '{print \$2}')" >> $temp_script +echo 'network=fd66:66:66' >> $temp_script +echo 'search_ipv6=$(ifconfig $1 | grep $network)' >> $temp_script +echo 'if [ $search_ipv6 ]; then' >> $temp_script +echo " result=\$(ifconfig \$1 | grep \$network | awk -F ' ' '{print \$2}')" >> $temp_script +echo ' ip -6 addr add ${result}/128 dev $1' >> $temp_script +echo 'else' >> $temp_script +echo ' ipv6_array=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )' >> $temp_script +echo ' a=${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}' >> $temp_script +echo ' b=${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}' >> $temp_script +echo ' c=${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}' >> $temp_script +echo ' d=${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}' >> $temp_script +echo ' e=${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}${ipv6_array[$RANDOM%16]}' >> $temp_script +echo ' result=$network:$a:$b:$c:$d:$e' >> $temp_script +echo ' ip -6 addr add ${result}/128 dev $1' >> $temp_script +echo 'fi' >> $temp_script +chmod +x $temp_script clear echo '' @@ -72,42 +100,41 @@ echo $'Authentication to change mesh protocol' echo '' case $data in - 1) sudo /tmp/change_routing 'bmx6' - sudo systemctl stop bmx7 - sudo systemctl disable bmx7 - sudo systemctl stop olsr2 - sudo systemctl disable olsr2 - sudo systemctl stop babel - sudo systemctl disable babel + 1) sudo $temp_script 'bmx6' + mesh_stop_daemon 'bmx7' + mesh_stop_daemon 'olsr2' + mesh_stop_daemon 'babel' + clear + echo '' + echo $'Enabling BMX6...' sudo systemctl enable bmx6 + echo $'Starting BMX6...' sudo systemctl start bmx6 ;; - 2) sudo /tmp/change_routing 'olsr2' - sudo systemctl stop bmx7 - sudo systemctl disable bmx7 - sudo systemctl stop bmx6 - sudo systemctl disable bmx6 - sudo systemctl stop babel - sudo systemctl disable babel - IFACE=$(cat /etc/systemd/system/olsr2.service | grep ExecStart | awk -F ' ' '{print $2}') - mesh_generate_ipv6_address $IFACE + 2) sudo $temp_script 'olsr2' + mesh_stop_daemon 'bmx6' + mesh_stop_daemon 'bmx7' + mesh_stop_daemon 'babel' + clear + echo '' + echo $'Enabling OLSR2...' sudo systemctl enable olsr2 + echo $'Starting OLSR2...' sudo systemctl start olsr2 ;; - 3) sudo /tmp/change_routing 'babel' - sudo systemctl stop bmx7 - sudo systemctl disable bmx7 - sudo systemctl stop bmx6 - sudo systemctl disable bmx6 - sudo systemctl stop olsr2 - sudo systemctl disable olsr2 - IFACE=$(cat /etc/systemd/system/babel.service | grep ExecStart | awk -F ' ' '{print $2}') - mesh_generate_ipv6_address $IFACE + 3) sudo $temp_script 'babel' + mesh_stop_daemon 'bmx6' + mesh_stop_daemon 'bmx7' + mesh_stop_daemon 'olsr2' + clear + echo '' + echo $'Enabling Babel...' sudo systemctl enable babel + echo $'Starting Babel...' sudo systemctl start babel ;; esac -rm /tmp/change_routing +rm $temp_script exit 0 diff --git a/src/meshavahi b/src/meshavahi index ead868fc..b3dabb3c 100755 --- a/src/meshavahi +++ b/src/meshavahi @@ -100,6 +100,7 @@ function ipfs_publish { } function ipfs_bootstrap { + # TODO switch to ipv6 cat $TEMPFILE_BASE | grep "ipfs_id\|hostname =\|address =\|port =\|txt =" > $TEMPFILE state=0 @@ -114,7 +115,7 @@ function ipfs_bootstrap { ipfs_txt=$(echo "$line" | awk -F '[' '{print $2}' | awk -F ']' '{print $1}' | awk -F '"' '{print $2}') ipfs_peer_id=$(echo "$ipfs_txt" | awk -F ':' '{print $1}') ipfs_tox_id=$(echo "$ipfs_txt" | awk -F ':' '{print $2}') - su -c "$IPFS_COMMAND bootstrap add /ip4/${address}/tcp/${IPFS_PORT}/ipfs/${ipfs_peer_id}" - $MY_USERNAME + su -c "$IPFS_COMMAND bootstrap add /ip6/${address}/tcp/${IPFS_PORT}/ipfs/${ipfs_peer_id}" - $MY_USERNAME if [ -d /home/$MY_USERNAME/Desktop ]; then if [[ $ipfs_tox_id != 'none' ]]; then echo "$ipfs_tox_id:$ipfs_peer_id" >> ${IPFS_USERS_FILE}.new diff --git a/website/EN/mesh.html b/website/EN/mesh.html index fe846feb..58f38425 100644 --- a/website/EN/mesh.html +++ b/website/EN/mesh.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + @@ -279,7 +279,7 @@ Systems only need to be within wifi range of each other for the mesh to be creat

-Like LibreMesh, this system uses a combination of batman-adv on network layer 2 and BMX on layer 3. +Like LibreMesh, this system uses a combination of batman-adv on network layer 2 and BMX on layer 3. Routing protocols OLSR2 and Babel are also selectable.