Closed vermaden closed 6 years ago
Thanks, I've rewrote the script, can you check if the latest version has the same problem ?
Now its not better but different :)
Here is output without modifications.
% ./graphpath-new.sh.ORG 46.215.0.141 1.1.1.1
This tool is mainly designed for drawing router or firewall routing view
./graphpath-new.sh.ORG: position: parameter not set
There seams to be problem with postition and position parameter name.
% grep -C 3 postition ./graphpath-new.sh.ORG
local ip=$3 # IP address for src & dst host (=direct for a router)
local gateway=$4 # IP address for a router
local gateway_arp=$5 # ARP cache if directly connected to "me" block
local postition=$6
left=""
right=""
# There is a special case: If ip=direct, this mean this block is useless
% grep -C 3 position ./graphpath-new.sh.ORG
# There is a special case: If ip=direct, this mean this block is useless
[ "$ip" == direct ] && return 0
# If in second family mode, need to move or add vertical line
[ "${position}" == "left" ] && left=" | "
[ "${position}" == "right" ] && right=" |"
# If label is "ROUTER TOWARDS DESTINATION", need to move this block to the left
#echo ${label} | grep -q "ROUTER TOWARDS DESTINATION" && left=" | "
# If label is "ROUTER TOWARDS SOURCE", need to add an vertical line to the left"
Here is the script after my 'new' modifications.
% ./graphpath-new.sh 46.215.0.141 1.1.1.1
This tool is mainly designed for drawing router or firewall routing view
+----------------------------+
| SOURCE HOST |
| IP: 46.215.0.141 |
| ARP: empty |
+----------------------------+
|
+----------------------------+
| IF: lo0 |
| MAC: |
| IP: 127.0.0.1 |
| net: 46.215.0.141 |
| mask: 255.255.255.255 |
| |
| THIS HOST |
| |
| net: 0.0.0.0 |
| mask: 0.0.0.0 |
| IP: 46.215.0.141 |
| MAC: |
| IF: tun0 |
+----------------------------+
|
+----------------------------+
| DESTINATION HOST |
| IP: 1.1.1.1 |
| ARP: empty |
+----------------------------+
... and here is the 'new' diff.
% diff -u ./graphpath-new.sh.ORG ./graphpath-new.sh
--- ./graphpath-new.sh.ORG 2018-04-27 12:28:59.563936000 +0200
+++ ./graphpath-new.sh 2018-04-27 12:33:02.593642000 +0200
@@ -132,14 +132,10 @@
local ip=$3 # IP address for src & dst host (=direct for a router)
local gateway=$4 # IP address for a router
local gateway_arp=$5 # ARP cache if directly connected to "me" block
- local postition=$6
left=""
right=""
# There is a special case: If ip=direct, this mean this block is useless
[ "$ip" == direct ] && return 0
- # If in second family mode, need to move or add vertical line
- [ "${position}" == "left" ] && left=" | "
- [ "${position}" == "right" ] && right=" |"
# If label is "ROUTER TOWARDS DESTINATION", need to move this block to the left
#echo ${label} | grep -q "ROUTER TOWARDS DESTINATION" && left=" | "
# If label is "ROUTER TOWARDS SOURCE", need to add an vertical line to the left"
thanks, this typo is fixed, and the new output with this version seems better than the previous.
Still a problem with 'position' variable, as $6 does not exist and its not check for not existence.
% ./graphpath-new-new.sh 46.215.0.141 1.1.1.1
This tool is mainly designed for drawing router or firewall routing view
+----------------------------+
| SOURCE HOST |
| IP: 46.215.0.141 |
| ARP: empty |
+----------------------------+
|
+----------------------------+
| IF: lo0 |
| MAC: |
| IP: 127.0.0.1 |
| net: 46.215.0.141 |
| mask: 255.255.255.255 |
| |
| THIS HOST |
| |
| net: 0.0.0.0 |
| mask: 0.0.0.0 |
| IP: 46.215.0.141 |
| MAC: |
| IF: tun0 |
+----------------------------+
./graphpath-new-new.sh: 6: parameter not set
% grep position ./graphpath-new-new.sh
local position=$6
[ "${position}" == "left" ] && left=" | "
[ "${position}" == "right" ] && right=" |"
I've forgot to update arguments on one function call.
Can I close this ticket ?
If its fixed then sure, go ahead.
Hi,
thanks for great tool.
I tried to use it with 3G/tun0 interface and its not very well suited towards that.
I made some modifications and here is the patch of these mods.
Here is the result from non modified graphpath script.
Here is the fixed one with patch.
Regards.