gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 05/07: TNG: Changed the format of the interface names to make m


From: gnunet
Subject: [gnunet] 05/07: TNG: Changed the format of the interface names to make miniupnpd happy.
Date: Wed, 18 Jan 2023 10:50:57 +0100

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

t3sserakt pushed a commit to branch master
in repository gnunet.

commit 4aec035eadd8f9d642c24c88ec97a2b9dcee4995
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Wed Jan 18 10:02:50 2023 +0100

    TNG: Changed the format of the interface names to make miniupnpd happy.
---
 contrib/netjail/netjail_core.sh                       | 19 ++++++++++---------
 .../testing_api_cmd_netjail_start_cmds_helper.c       |  3 ++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/contrib/netjail/netjail_core.sh b/contrib/netjail/netjail_core.sh
index 8c1744853..302ae922f 100755
--- a/contrib/netjail/netjail_core.sh
+++ b/contrib/netjail/netjail_core.sh
@@ -1,7 +1,8 @@
 #!/bin/bash
 #
 
-
+INTERFACE_FORMAT_STRING="%s%06x-%06x"
+PREPREFIX=if
 PREFIX=${PPID:?must run from a parent process}
 
 # running with `sudo` is required to be
@@ -93,7 +94,7 @@ netjail_check_bin() {
 netjail_bridge() {
        netjail_next_interface
        local NUM=$RESULT
-       local BRIDGE=$(printf "%06x-%08x" $PREFIX $NUM)
+       local BRIDGE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM)
 
        ip link add $BRIDGE type bridge
        ip link set dev $BRIDGE up
@@ -104,7 +105,7 @@ netjail_bridge() {
 netjail_bridge_name() {
        netjail_next_interface
        local NUM=$RESULT
-       local BRIDGE=$(printf "%06x-%08x" $PREFIX $NUM)
+       local BRIDGE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM)
        
        RESULT=$BRIDGE
 }
@@ -118,7 +119,7 @@ netjail_bridge_clear() {
 netjail_node() {
        netjail_next_namespace
        local NUM=$RESULT
-       local NODE=$(printf "%06x-%08x" $PREFIX $NUM)
+       local NODE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM)
 
        ip netns add $NODE
        
@@ -128,7 +129,7 @@ netjail_node() {
 netjail_node_name() {
        netjail_next_namespace
        local NUM=$RESULT
-       local NODE=$(printf "%06x-%08x" $PREFIX $NUM)
+       local NODE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM)
        
        RESULT=$NODE
 }
@@ -150,8 +151,8 @@ netjail_node_link_bridge() {
        netjail_next_interface
        local NUM_BR=$RESULT
        
-       local LINK_IF=$(printf "%06x-%08x" $PREFIX $NUM_IF)
-       local LINK_BR=$(printf "%06x-%08x" $PREFIX $NUM_BR)
+       local LINK_IF=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX 
$NUM_IF)
+       local LINK_BR=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX 
$NUM_BR)
 
        ip link add $LINK_IF type veth peer name $LINK_BR
        ip link set $LINK_IF netns $NODE
@@ -172,7 +173,7 @@ netjail_node_link_bridge_name() {
        netjail_next_interface
        local NUM_BR=$RESULT
        
-       local LINK_BR=$(printf "%06x-%08x" $PREFIX $NUM_BR)
+       local LINK_BR=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX 
$NUM_BR)
        
        RESULT=$LINK_BR
 }
@@ -192,7 +193,7 @@ netjail_node_add_nat() {
   ip netns exec $NODE nft add table nat
   ip netns exec $NODE nft add chain nat postrouting { type nat hook 
postrouting priority 0 \; }
   ip netns exec $NODE nft add rule ip nat postrouting ip saddr 
"$ADDRESS/$MASK" counter masquerade
-       # ip netns exec $NODE iptables -t nat -A POSTROUTING -s 
"$ADDRESS/$MASK" -j MASQUERADE
+  # ip netns exec $NODE iptables -t nat -A POSTROUTING -s "$ADDRESS/$MASK" -j 
MASQUERADE
 }
 
 netjail_node_add_default() {
diff --git a/src/testing/testing_api_cmd_netjail_start_cmds_helper.c 
b/src/testing/testing_api_cmd_netjail_start_cmds_helper.c
index c0f238530..545b89b33 100644
--- a/src/testing/testing_api_cmd_netjail_start_cmds_helper.c
+++ b/src/testing/testing_api_cmd_netjail_start_cmds_helper.c
@@ -612,7 +612,8 @@ start_helper (struct NetJailState *ns,
   GNUNET_asprintf (&local_m_char, "%u", ns->local_m);
   GNUNET_asprintf (&global_n_char, "%u",ns->global_n);
   GNUNET_asprintf (&known_char, "%u",ns->known);
-  GNUNET_asprintf (&node_id, "%06x-%08x\n",
+  GNUNET_asprintf (&node_id, "%s%06x-%06x\n",
+                   "if",
                    pid,
                    script_num);
   // GNUNET_asprintf (&topology_data, "'%s'", ns->topology_data);

-- 
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]