gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: -added binary check to netjail and set s


From: gnunet
Subject: [gnunet] branch master updated: -added binary check to netjail and set stunserver fixed
Date: Mon, 03 May 2021 10:31:07 +0200

This is an automated email from the git hooks/post-receive script.

thejackimonster pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new ae3ce5eaf -added binary check to netjail and set stunserver fixed
ae3ce5eaf is described below

commit ae3ce5eaf5df138e41337c7cf4d964a031b3008d
Author: TheJackiMonster <thejackimonster@gmail.com>
AuthorDate: Mon May 3 10:28:49 2021 +0200

    -added binary check to netjail and set stunserver fixed
    
    Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
---
 contrib/scripts/netjail/netjail_core.sh           | 14 ++++++++++++++
 contrib/scripts/netjail/netjail_setup_internet.sh | 19 ++++++++++++-------
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/contrib/scripts/netjail/netjail_core.sh 
b/contrib/scripts/netjail/netjail_core.sh
index a3271a3e4..cbf25434b 100755
--- a/contrib/scripts/netjail/netjail_core.sh
+++ b/contrib/scripts/netjail/netjail_core.sh
@@ -44,6 +44,20 @@ netjail_check() {
        fi
 }
 
+netjail_check_bin() {
+       PROGRAM=$1
+
+       MATCH=$(ls $(echo $PATH | tr ":" "\n") | grep "^$PROGRAM\$" | tr "\n" " 
" | awk '{ print $1 }')
+
+       # quit if the required binary $PROGRAM can not be
+       # found in the used $PATH.
+
+       if [ "$MATCH" != "$PROGRAM" ]; then
+               echo "Required binary not found: $PROGRAM" >&2
+               exit 1
+       fi
+}
+
 netjail_print_name() {
        printf "%s%02x%02x" $1 $2 ${3:-0}
 }
diff --git a/contrib/scripts/netjail/netjail_setup_internet.sh 
b/contrib/scripts/netjail/netjail_setup_internet.sh
index 94aec007e..7ff25c014 100755
--- a/contrib/scripts/netjail/netjail_setup_internet.sh
+++ b/contrib/scripts/netjail/netjail_setup_internet.sh
@@ -18,6 +18,16 @@ netjail_check $(($LOCAL_M * $GLOBAL_N))
 # Starts optionally 'stunserver' on "92.68.150.$(($GLOBAL_N + 1))":
 STUN=$(netjail_opt '--stun' $@)
 
+if [ $STUN -gt 0 ]; then
+       netjail_check_bin stunserver
+       
+       shift 1
+       
+       STUN_NODE=$(netjail_print_name "S" 254)
+fi
+
+netjail_check_bin $1
+
 LOCAL_GROUP="192.168.15"
 GLOBAL_GROUP="92.68.150"
 
@@ -60,13 +70,8 @@ WAITING=""
 KILLING=""
 
 if [ $STUN -gt 0 ]; then
-       shift 1
-       
-       S=$(($GLOBAL_N + 1))
-       STUN_NODE=$(netjail_print_name "S" $S)
-
        netjail_node $STUN_NODE
-       netjail_node_link_bridge $STUN_NODE $NETWORK_NET "$GLOBAL_GROUP.$S" 24
+       netjail_node_link_bridge $STUN_NODE $NETWORK_NET "$GLOBAL_GROUP.254" 24
 
        netjail_node_exec $STUN_NODE 0 1 stunserver &
        KILLING="$!"
@@ -90,7 +95,7 @@ for PID in $KILLING; do netjail_kill $PID; done
 wait
 
 if [ $STUN -gt 0 ]; then
-       STUN_NODE=$(netjail_print_name "S" $(($GLOBAL_N + 1)))
+       STUN_NODE=$(netjail_print_name "S" 254)
 
        netjail_node_unlink_bridge $STUN_NODE $NETWORK_NET
        netjail_node_clear $STUN_NODE

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]