Coder Social home page Coder Social logo

Patch Proposal - graphpath about bsdrp HOT 7 CLOSED

ocochard avatar ocochard commented on August 28, 2024
Patch Proposal - graphpath

from bsdrp.

Comments (7)

ocochard avatar ocochard commented on August 28, 2024

Thanks,
I've rewrote the script, can you check if the latest version has the same problem ?

from bsdrp.

vermaden avatar vermaden commented on August 28, 2024

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"

from bsdrp.

ocochard avatar ocochard commented on August 28, 2024

thanks, this typo is fixed, and the new output with this version seems better than the previous.

from bsdrp.

vermaden avatar vermaden commented on August 28, 2024

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="                  |"


from bsdrp.

ocochard avatar ocochard commented on August 28, 2024

I've forgot to update arguments on one function call.

from bsdrp.

ocochard avatar ocochard commented on August 28, 2024

Can I close this ticket ?

from bsdrp.

vermaden avatar vermaden commented on August 28, 2024

If its fixed then sure, go ahead.

from bsdrp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.