Ethereal-dev: [Ethereal-dev] newbie wants to add some IS-IS stuff ...

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Hannes Gredler <hannes@xxxxxxxxxxx>
Date: Sun, 8 Apr 2001 20:03:49 +0200
hi all,

played a little bit with integrated IS-IS and discoverred some bugs,
& unsupported things.

first of all there is no OSI support over PPP.

[hannes@ghostrider ethereal-0.8.16]$ diff ../old/ethereal-0.8.16/ppptypes.h .
34a35
> #define PPP_OSI               0x23
[hannes@ghostrider ethereal-0.8.16]$ diff ../old/ethereal-0.8.16/packet-osi.c .
45a46
> #include "ppptypes.h"
280a282
[hannes@ghostrider ethereal-0.8.16]$ diff ../old/ethereal-0.8.16/packet-osi.c .
45a46
> #include "ppptypes.h"
280a282
>         dissector_add("ppp.protocol", PPP_OSI, dissect_osi, -1);

these three fixes should do it.

next i discovered a bug in the P2P ISIS processing engine which, increments the offset
before checking if its a P2P hello or a LAN Hello, for LAN hellos the decode is fine,
however for P2P hellos the rest of the packet gets messed up.

[hannes@ghostrider ethereal-0.8.16]$ diff -e ../old/ethereal-0.8.16/packet-isis-hello.c .
497a

                if (tree) {
                        proto_tree_add_uint_format(hello_tree, hf_isis_hello_priority_reserved, NullTVB,
                                    offset, 1, pd[offset],
                                    "Priority                  : %d, reserved(0x%02x == 0)",
                                        pd[offset]&ISIS_HELLO_PRIORITY_MASK,
                                        pd[offset]&ISIS_HELLO_P_RESERVED_MASK );
                }
                offset += 1;

.
482,490d

this should do it.

and finally i added support for the hostname TLV #137

[hannes@ghostrider ethereal-0.8.16]$ diff -e ../old/ethereal-0.8.16/packet-isis-clv.h .     
58a
extern void isis_dissect_hostname_clv(const u_char *pd, int offset, 
                guint length, frame_data *fd, proto_tree *tree );
.
[hannes@ghostrider ethereal-0.8.16]$ diff -e ../old/ethereal-0.8.16/packet-isis-clv.c . 
174a

/*
 * Name: isis_dissect_hostname_clv()
 *
 * Description:
 *      dump the hostname information found in TLV 137
 *      pls note that the hostname is not null terminated
 *
 * Input:
 *      u_char * : packet data
 *      int : offset into packet data where we are.
 *      guint : length of clv we are decoding
 *      frame_data * : frame data (complete frame)
 *      proto_tree * : protocol display tree to fill out.  May be NULL
 *      char * : Password meaning
 *
 * Output:
 *      void, but we will add to proto tree if !NULL.
 */


void
isis_dissect_hostname_clv(const u_char *pd, int offset,
                guint length, frame_data *fd, proto_tree *tree ) {
        char sbuf[256*6];
        char *s = sbuf;
        int hlen = length;
        int old_offset = offset;


        if ( !tree ) return;            /* nothing to do! */

        memcpy ( s, &pd[offset], hlen);
        sbuf[hlen] = 0;                 /* don't forget null termination */

        if ( hlen == 0 ) {
                sprintf ( sbuf, "--none--" );
        }

        proto_tree_add_text ( tree, NullTVB, old_offset, hlen,
                        "Hostname: %s", sbuf );
}





.

[hannes@ghostrider ethereal-0.8.16]$ diff -e ../old/ethereal-0.8.16/packet-isis-lsp.c .   
948a
                &ett_isis_lsp_clv_hostname,
.
361a
 * Name: dissect_lsp_hostname_clv()
 *
 * Description:
 *      Decode for a lsp packets hostname clv.  Calls into the
 *      clv common one.
 *
 * Input:
 *      u_char * : packet data
 *      int : current offset into packet data
 *      guint : length of this clv
 *      int : length of IDs in packet.
 *      frame_data * : frame data
 *      proto_tree * : proto tree to build on (may be null)
 *
 * Output:
 *      void, will modify proto_tree if not null.
 */
static void 
dissect_lsp_hostname_clv(const u_char *pd, int offset, 
                guint length, int id_length, frame_data *fd, proto_tree *tree) {
        isis_dissect_hostname_clv(pd, offset, length, fd, tree );
}
/*
.
200a
        {
                ISIS_CLV_L2_LSP_HOSTNAME,
                "Hostname",
                &ett_isis_lsp_clv_hostname,
                dissect_lsp_hostname_clv
        },
.
137a
        {
                ISIS_CLV_L1_LSP_HOSTNAME,
                "Hostname",
                &ett_isis_lsp_clv_hostname,
                dissect_lsp_hostname_clv
        },
.
99a
static void dissect_lsp_hostname_clv(const u_char *pd, int offset,
                guint length, int id_length, frame_data *fd, proto_tree *tree);
.
66a
static gint ett_isis_lsp_clv_hostname = -1;
.
[hannes@ghostrider ethereal-0.8.16]$ diff -e ../old/ethereal-0.8.16/packet-isis-lsp.h . 
83a
#define ISIS_CLV_L2_LSP_HOSTNAME                137
.
64a
#define ISIS_CLV_L1_LSP_HOSTNAME                137
.

---

pls let me know what you think of it, and commit it to the source
tree.

/hannes