diff options
-rw-r--r-- | packet-isis-clv.c | 50 | ||||
-rw-r--r-- | packet-isis-clv.h | 80 | ||||
-rw-r--r-- | packet-isis-hello.c | 287 | ||||
-rw-r--r-- | packet-isis-hello.h | 57 | ||||
-rw-r--r-- | packet-isis-lsp.c | 134 | ||||
-rw-r--r-- | packet-isis-lsp.h | 59 | ||||
-rw-r--r-- | packet-isis-snp.c | 285 | ||||
-rw-r--r-- | packet-isis-snp.h | 35 |
8 files changed, 543 insertions, 444 deletions
diff --git a/packet-isis-clv.c b/packet-isis-clv.c index a20f15677b..e893439613 100644 --- a/packet-isis-clv.c +++ b/packet-isis-clv.c @@ -1,7 +1,7 @@ /* packet-isis-clv.c * Common CLV decode routines. * - * $Id: packet-isis-clv.c,v 1.28 2003/06/04 08:46:35 guy Exp $ + * $Id: packet-isis-clv.c,v 1.29 2003/12/08 20:40:32 guy Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -128,26 +128,23 @@ isis_dissect_area_address_clv(tvbuff_t *tvb, proto_tree *tree, int offset, * * Description: * Take apart the CLV that hold authentication information. This - * is currently 1 octet auth type (which must be 1) and then - * the clear text password. - * - * An ISIS password has different meaning depending where it - * is found. Thus we support a passed in prefix string to - * use to name this. + * is currently 1 octet auth type. + * the two defined authentication types + * are 1 for a clear text password and + * 54 for a HMAC-MD5 digest * * Input: * tvbuff_t * : tvbuffer for packet data * proto_tree * : protocol display tree to fill out. May be NULL * int : offset into packet data where we are. * int : length of clv we are decoding - * char * : Password meaning * * Output: * void, but we will add to proto tree if !NULL. */ void isis_dissect_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, - int length, char *meaning) + int length) { guchar pw_type; int auth_unsupported; @@ -204,8 +201,7 @@ isis_dissect_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, break; } - proto_tree_add_text ( tree, tvb, offset - 1, length + 1, - "%s %s", meaning, gstr->str ); + proto_tree_add_text ( tree, tvb, offset - 1, length + 1, "%s", gstr->str ); /* * We're done with the GString, so delete it and get rid of @@ -220,6 +216,38 @@ isis_dissect_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, } /* + * Name: isis_ip_authentication_clv() + * + * Description: + * dump the IP authentication information found in TLV 133 + * the CLV is standardized in rf1195, however all major + * implementations use TLV #10 + * Input: + * tvbuff_t * : tvbuffer for packet data + * proto_tree * : protocol display tree to fill out. May be NULL + * int : offset into packet data where we are. + * int : length of clv we are decoding + * + * Output: + * void, but we will add to proto tree if !NULL. + */ + + +void +isis_dissect_ip_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, + int length) +{ + if ( !tree ) return; /* nothing to do! */ + + if ( length != 0 ) { + proto_tree_add_text ( tree, tvb, offset, length, + "IP Authentication: %.*s", length, + tvb_get_ptr(tvb, offset, length) ); + } +} + + +/* * Name: isis_dissect_hostname_clv() * * Description: diff --git a/packet-isis-clv.h b/packet-isis-clv.h index 10d4c27011..ab8c31bedd 100644 --- a/packet-isis-clv.h +++ b/packet-isis-clv.h @@ -1,7 +1,7 @@ /* packet-isis-clv.h * Declares for common clv decoding functions. * - * $Id: packet-isis-clv.h,v 1.9 2002/08/28 21:00:18 jmayer Exp $ + * $Id: packet-isis-clv.h,v 1.10 2003/12/08 20:40:32 guy Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -27,14 +27,58 @@ #define _PACKET_ISIS_CLV_H /* + * A CLV is a tuple of a type, length and a value and is normally used for + * encoding information in all sorts of places. + * IS-IS uses a uniform CLV code space that is shared across + * all PDU Types. + * + * list taken from rfc3359 plus some memory from veterans ;-) + */ + +#define ISIS_CLV_AREA_ADDRESS 1 /* iso10589 */ +#define ISIS_CLV_IS_REACH 2 /* iso10589 */ +#define ISIS_CLV_ES_NEIGHBORS 3 /* iso10589 */ +#define ISIS_CLV_PARTITION_DIS 4 /* iso10589 */ +#define ISIS_CLV_PREFIX_NEIGHBORS 5 /* iso10589 */ +#define ISIS_CLV_IS_NEIGHBORS 6 /* iso10589 */ +#define ISIS_CLV_IS_NEIGHBORS_VARLEN 7 /* iso10589 */ +#define ISIS_CLV_PADDING 8 /* iso10589 */ +#define ISIS_CLV_LSP_ENTRIES 9 /* iso10589 */ +#define ISIS_CLV_AUTHENTICATION 10 /* iso10589, rfc3567 */ +#define ISIS_CLV_CHECKSUM 12 /* rfc3358 */ +#define ISIS_CLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */ +#define ISIS_CLV_EXTD_IS_REACH 22 /* draft-ietf-isis-traffic-05 */ +#define ISIS_CLV_IS_ALIAS_ID 24 /* draft-ietf-isis-ext-lsp-frags-02 */ +#define ISIS_CLV_INT_IP_REACH 128 /* rfc1195, rfc2966 */ +#define ISIS_CLV_PROTOCOLS_SUPPORTED 129 /* rfc1195 */ +#define ISIS_CLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */ +#define ISIS_CLV_IDRP_INFO 131 /* rfc1195 */ +#define ISIS_CLV_IP_ADDR 132 /* rfc1195 */ +#define ISIS_CLV_IP_AUTHENTICATION 133 /* rfc1195, depreciated */ +#define ISIS_CLV_TE_ROUTER_ID 134 /* draft-ietf-isis-traffic-05 */ +#define ISIS_CLV_EXTD_IP_REACH 135 /* draft-ietf-isis-traffic-05 */ +#define ISIS_CLV_HOSTNAME 137 /* rfc2763 */ +#define ISIS_CLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */ +#define ISIS_CLV_RESTART 211 /* draft-ietf-isis-restart-01 */ +#define ISIS_CLV_MT_IS_REACH 222 /* draft-ietf-isis-wg-multi-topology-05 */ +#define ISIS_CLV_MT_SUPPORTED 229 /* draft-ietf-isis-wg-multi-topology-05 */ +#define ISIS_CLV_IP6_ADDR 232 /* draft-ietf-isis-ipv6-02 */ +#define ISIS_CLV_MT_IP_REACH 235 /* draft-ietf-isis-wg-multi-topology-05 */ +#define ISIS_CLV_IP6_REACH 236 /* draft-ietf-isis-ipv6-02 */ +#define ISIS_CLV_MT_IP6_REACH 237 /* draft-ietf-isis-wg-multi-topology-05 */ +#define ISIS_CLV_PTP_ADJ_STATE 240 /* rfc3373 */ +#define ISIS_CLV_IIH_SEQNR 241 /* draft-shen-isis-iih-sequence-00 */ +#define ISIS_CLV_VENDOR_PRIVATE 250 /* draft-ietf-isis-proprietary-tlv-00 */ + +/* * Our sub-packet dismantle structure for CLV's */ typedef struct { - int optcode; /* code for option */ - char *tree_text; /* text for fold out */ - gint *tree_id; /* id for add_item */ - void (*dissect)(tvbuff_t *tvb, proto_tree *tree, - int offset, int id_length, int length); + int optcode; /* code for option */ + char *tree_text; /* text for fold out */ + gint *tree_id; /* id for add_item */ + void (*dissect)(tvbuff_t *tvb, proto_tree *tree, + int offset, int id_length, int length); } isis_clv_handle_t; /* @@ -42,27 +86,29 @@ typedef struct { * are only valid from with isis decodes. */ extern void isis_dissect_clvs(tvbuff_t *tvb, proto_tree *tree, int offset, - const isis_clv_handle_t *opts, int len, int id_length, - int unknown_tree_id); + const isis_clv_handle_t *opts, int len, int id_length, + int unknown_tree_id); extern void isis_dissect_nlpid_clv(tvbuff_t *tvb, proto_tree *tree, - int offset, int length); + int offset, int length); extern void isis_dissect_te_router_id_clv(tvbuff_t *tvb, proto_tree *tree, - int offset, int length, int tree_id); + int offset, int length, int tree_id); extern void isis_dissect_ipv6_int_clv(tvbuff_t *tvb, proto_tree *tree, - int offset, int length, int tree_id); + int offset, int length, int tree_id); extern void isis_dissect_ip_int_clv(tvbuff_t *tvb, proto_tree *tree, - int offset, int length, int tree_id); + int offset, int length, int tree_id); extern void isis_dissect_mt_clv(tvbuff_t *tvb, proto_tree *tree, - int offset, int length, int tree_id); + int offset, int length, int tree_id); extern void isis_dissect_hostname_clv(tvbuff_t *tvb, proto_tree *tree, - int offset, int length); + int offset, int length); extern void isis_dissect_authentication_clv(tvbuff_t *tvb, proto_tree *tree, - int offset, int length, char *meaning); + int offset, int length); +extern void isis_dissect_ip_authentication_clv(tvbuff_t *tvb, proto_tree *tree, + int offset, int length); extern void isis_dissect_area_address_clv(tvbuff_t *tvb, proto_tree *tree, - int offset, int length); + int offset, int length); extern void isis_dissect_metric(tvbuff_t *tvb, proto_tree *tree, int offset, - guint8 value, char *pstr, int force_supported); + guint8 value, char *pstr, int force_supported); #endif /* _PACKET_ISIS_CLV_H */ diff --git a/packet-isis-hello.c b/packet-isis-hello.c index 17866f2439..4fc44057bf 100644 --- a/packet-isis-hello.c +++ b/packet-isis-hello.c @@ -1,7 +1,7 @@ /* packet-isis-hello.c * Routines for decoding isis hello packets and their CLVs * - * $Id: packet-isis-hello.c,v 1.33 2002/08/29 18:52:51 guy Exp $ + * $Id: packet-isis-hello.c,v 1.34 2003/12/08 20:40:32 guy Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -38,30 +38,32 @@ #include "epan/resolv.h" /* hello packets */ -static int hf_isis_hello_circuit_reserved = -1; -static int hf_isis_hello_source_id = -1; -static int hf_isis_hello_holding_timer = -1; -static int hf_isis_hello_pdu_length = -1; -static int hf_isis_hello_priority_reserved = -1; -static int hf_isis_hello_lan_id = -1; -static int hf_isis_hello_local_circuit_id = -1; -static int hf_isis_hello_clv_ipv4_int_addr = -1; -static int hf_isis_hello_clv_ipv6_int_addr = -1; -static int hf_isis_hello_clv_ptp_adj = -1; -static int hf_isis_hello_clv_mt = -1; - -static gint ett_isis_hello = -1; -static gint ett_isis_hello_clv_area_addr = -1; -static gint ett_isis_hello_clv_is_neighbors = -1; -static gint ett_isis_hello_clv_padding = -1; -static gint ett_isis_hello_clv_unknown = -1; -static gint ett_isis_hello_clv_nlpid = -1; -static gint ett_isis_hello_clv_auth = -1; +static int hf_isis_hello_circuit_reserved = -1; +static int hf_isis_hello_source_id = -1; +static int hf_isis_hello_holding_timer = -1; +static int hf_isis_hello_pdu_length = -1; +static int hf_isis_hello_priority_reserved = -1; +static int hf_isis_hello_lan_id = -1; +static int hf_isis_hello_local_circuit_id = -1; +static int hf_isis_hello_clv_ipv4_int_addr = -1; +static int hf_isis_hello_clv_ipv6_int_addr = -1; +static int hf_isis_hello_clv_ptp_adj = -1; +static int hf_isis_hello_clv_mt = -1; + +static gint ett_isis_hello = -1; +static gint ett_isis_hello_clv_area_addr = -1; +static gint ett_isis_hello_clv_is_neighbors = -1; +static gint ett_isis_hello_clv_padding = -1; +static gint ett_isis_hello_clv_unknown = -1; +static gint ett_isis_hello_clv_nlpid = -1; +static gint ett_isis_hello_clv_authentication = -1; +static gint ett_isis_hello_clv_ip_authentication = -1; static gint ett_isis_hello_clv_ipv4_int_addr = -1; static gint ett_isis_hello_clv_ipv6_int_addr = -1; -static gint ett_isis_hello_clv_ptp_adj = -1; -static gint ett_isis_hello_clv_mt = -1; -static gint ett_isis_hello_clv_restart = -1; +static gint ett_isis_hello_clv_ptp_adj = -1; +static gint ett_isis_hello_clv_mt = -1; +static gint ett_isis_hello_clv_restart = -1; +static gint ett_isis_hello_clv_checksum = -1; static const value_string isis_hello_circuit_type_vals[] = { { ISIS_HELLO_TYPE_RESERVED, "Reserved 0 (discard PDU)"}, @@ -81,7 +83,11 @@ static void dissect_hello_ptp_adj_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); static void dissect_hello_area_address_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); -static void dissect_hello_auth_clv(tvbuff_t *tvb, +static void dissect_hello_authentication_clv(tvbuff_t *tvb, + proto_tree *tree, int offset, int id_length, int length); +static void dissect_hello_ip_authentication_clv(tvbuff_t *tvb, + proto_tree *tree, int offset, int id_length, int length); +static void dissect_hello_checksum_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); static void dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); @@ -97,66 +103,72 @@ static void dissect_hello_restart_clv(tvbuff_t *tvb, static const isis_clv_handle_t clv_l1_hello_opts[] = { { - ISIS_CLV_L1H_AREA_ADDRESS, + ISIS_CLV_AREA_ADDRESS, "Area address(es)", &ett_isis_hello_clv_area_addr, dissect_hello_area_address_clv }, { - ISIS_CLV_L1H_IS_NEIGHBORS, + ISIS_CLV_IS_NEIGHBORS, "IS Neighbor(s)", &ett_isis_hello_clv_is_neighbors, dissect_hello_is_neighbors_clv }, { - ISIS_CLV_L1H_PADDING, + ISIS_CLV_PADDING, "Padding", &ett_isis_hello_clv_padding, dissect_hello_padding_clv }, { - ISIS_CLV_L1H_NLPID, + ISIS_CLV_PROTOCOLS_SUPPORTED, "Protocols Supported", &ett_isis_hello_clv_nlpid, dissect_hello_nlpid_clv }, { - ISIS_CLV_L1H_IP_INTERFACE_ADDR, + ISIS_CLV_IP_ADDR, "IP Interface address(es)", &ett_isis_hello_clv_ipv4_int_addr, dissect_hello_ip_int_addr_clv }, { - ISIS_CLV_L1H_IPv6_INTERFACE_ADDR, + ISIS_CLV_IP6_ADDR, "IPv6 Interface address(es)", &ett_isis_hello_clv_ipv6_int_addr, dissect_hello_ipv6_int_addr_clv }, { - ISIS_CLV_L1H_RESTART, + ISIS_CLV_RESTART, "Restart Signaling", &ett_isis_hello_clv_restart, dissect_hello_restart_clv }, { - ISIS_CLV_L1H_AUTHENTICATION_NS, - "Authentication(non spec)", - &ett_isis_hello_clv_auth, - dissect_hello_auth_clv + ISIS_CLV_AUTHENTICATION, + "Authentication", + &ett_isis_hello_clv_authentication, + dissect_hello_authentication_clv }, { - ISIS_CLV_L1H_AUTHENTICATION, - "Authentication", - &ett_isis_hello_clv_auth, - dissect_hello_auth_clv + ISIS_CLV_IP_AUTHENTICATION, + "IP Authentication", + &ett_isis_hello_clv_ip_authentication, + dissect_hello_ip_authentication_clv }, { - ISIS_CLV_L1H_MT, + ISIS_CLV_MT_SUPPORTED, "Multi Topology", &ett_isis_hello_clv_mt, dissect_hello_mt_clv }, { + ISIS_CLV_CHECKSUM, + "Checksum", + &ett_isis_hello_clv_checksum, + dissect_hello_checksum_clv + }, + { 0, "", NULL, @@ -166,66 +178,72 @@ static const isis_clv_handle_t clv_l1_hello_opts[] = { static const isis_clv_handle_t clv_l2_hello_opts[] = { { - ISIS_CLV_L2H_AREA_ADDRESS, + ISIS_CLV_AREA_ADDRESS, "Area address(es)", &ett_isis_hello_clv_area_addr, dissect_hello_area_address_clv }, { - ISIS_CLV_L2H_IS_NEIGHBORS, + ISIS_CLV_IS_NEIGHBORS, "IS Neighbor(s)", &ett_isis_hello_clv_is_neighbors, dissect_hello_is_neighbors_clv }, { - ISIS_CLV_L2H_PADDING, + ISIS_CLV_PADDING, "Padding", &ett_isis_hello_clv_padding, dissect_hello_padding_clv }, { - ISIS_CLV_L2H_NLPID, + ISIS_CLV_PROTOCOLS_SUPPORTED, "Protocols Supported", &ett_isis_hello_clv_nlpid, dissect_hello_nlpid_clv }, { - ISIS_CLV_L2H_IP_INTERFACE_ADDR, + ISIS_CLV_IP_ADDR, "IP Interface address(es)", &ett_isis_hello_clv_ipv4_int_addr, dissect_hello_ip_int_addr_clv }, { - ISIS_CLV_L2H_IPv6_INTERFACE_ADDR, + ISIS_CLV_IP6_ADDR, "IPv6 Interface address(es)", &ett_isis_hello_clv_ipv6_int_addr, dissect_hello_ipv6_int_addr_clv }, { - ISIS_CLV_L2H_AUTHENTICATION_NS, - "Authentication(non spec)", - &ett_isis_hello_clv_auth, - dissect_hello_auth_clv + ISIS_CLV_AUTHENTICATION, + "Authentication", + &ett_isis_hello_clv_authentication, + dissect_hello_authentication_clv }, { - ISIS_CLV_L2H_RESTART, + ISIS_CLV_IP_AUTHENTICATION, + "IP Authentication", + &ett_isis_hello_clv_ip_authentication, + dissect_hello_ip_authentication_clv + }, + { + ISIS_CLV_RESTART, "Restart Signaling", &ett_isis_hello_clv_restart, dissect_hello_restart_clv }, { - ISIS_CLV_L2H_AUTHENTICATION, - "Authentication", - &ett_isis_hello_clv_auth, - dissect_hello_auth_clv - }, - { - ISIS_CLV_L2H_MT, + ISIS_CLV_MT_SUPPORTED, "Multi Topology", &ett_isis_hello_clv_mt, dissect_hello_mt_clv }, { + ISIS_CLV_CHECKSUM, + "Checksum", + &ett_isis_hello_clv_checksum, + dissect_hello_checksum_clv + }, + { 0, "", NULL, @@ -235,66 +253,72 @@ static const isis_clv_handle_t clv_l2_hello_opts[] = { static const isis_clv_handle_t clv_ptp_hello_opts[] = { { - ISIS_CLV_PTP_AREA_ADDRESS, + ISIS_CLV_AREA_ADDRESS, "Area address(es)", &ett_isis_hello_clv_area_addr, dissect_hello_area_address_clv }, { - ISIS_CLV_PTP_PADDING, + ISIS_CLV_PADDING, "Padding", &ett_isis_hello_clv_padding, dissect_hello_padding_clv }, { - ISIS_CLV_PTP_NLPID, + ISIS_CLV_PROTOCOLS_SUPPORTED, "Protocols Supported", &ett_isis_hello_clv_nlpid, dissect_hello_nlpid_clv }, { - ISIS_CLV_PTP_IP_INTERFACE_ADDR, + ISIS_CLV_IP_ADDR, "IP Interface address(es)", &ett_isis_hello_clv_ipv4_int_addr, dissect_hello_ip_int_addr_clv }, { - ISIS_CLV_PTP_IPv6_INTERFACE_ADDR, + ISIS_CLV_IP6_ADDR, "IPv6 Interface address(es)", &ett_isis_hello_clv_ipv6_int_addr, dissect_hello_ipv6_int_addr_clv }, { - ISIS_CLV_PTP_AUTHENTICATION_NS, - "Authentication(non spec)", - &ett_isis_hello_clv_auth, - dissect_hello_auth_clv + ISIS_CLV_AUTHENTICATION, + "Authentication", + &ett_isis_hello_clv_authentication, + dissect_hello_authentication_clv }, { - ISIS_CLV_PTP_AUTHENTICATION, - "Authentication", - &ett_isis_hello_clv_auth, - dissect_hello_auth_clv + ISIS_CLV_IP_AUTHENTICATION, + "IP Authentication", + &ett_isis_hello_clv_ip_authentication, + dissect_hello_ip_authentication_clv }, { - ISIS_CLV_PTP_RESTART, + ISIS_CLV_RESTART, "Restart Option", &ett_isis_hello_clv_restart, dissect_hello_restart_clv }, { - ISIS_CLV_PTP_ADJ, + ISIS_CLV_PTP_ADJ_STATE, "Point-to-point Adjacency State", &ett_isis_hello_clv_ptp_adj, dissect_hello_ptp_adj_clv }, { - ISIS_CLV_PTP_MT, + ISIS_CLV_MT_SUPPORTED, "Multi Topology", &ett_isis_hello_clv_mt, dissect_hello_mt_clv }, { + ISIS_CLV_CHECKSUM, + "Checksum", + &ett_isis_hello_clv_checksum, + dissect_hello_checksum_clv + }, + { 0, "", NULL, @@ -438,12 +462,11 @@ dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb, } /* - * Name: dissect_hello_auth_clv() + * Name: dissect_hello_authentication_clv() * * Description: - * Decode for a hello packets authenticaion clv. Calls into the - * clv common one. An auth inside a hello packet is a perlink - * password. + * Decode for a hello packets authenticaion clv. + * Calls into the CLV common one. * * Input: * tvbuff_t * : tvbuffer for packet data @@ -456,19 +479,111 @@ dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb, * void, will modify proto_tree if not null. */ static void -dissect_hello_auth_clv(tvbuff_t *tvb, +dissect_hello_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length _U_, int length) { - isis_dissect_authentication_clv(tvb, tree, offset, - length, "authentication" ); + isis_dissect_authentication_clv(tvb, tree, offset, length); } /* + * Name: dissect_hello_ip_authentication_clv() + * + * Description: + * Decode for a hello packets IP authenticaion clv. + * Calls into the CLV common one. + * + * Input: + * tvbuff_t * : tvbuffer for packet data + * proto_tree * : proto tree to build on (may be null) + * int : current offset into packet data + * int : length of IDs in packet. + * int : length of this clv + * + * Output: + * void, will modify proto_tree if not null. + */ +static void +dissect_hello_ip_authentication_clv(tvbuff_t *tvb, + proto_tree *tree, int offset, int id_length _U_, int length) +{ + isis_dissect_ip_authentication_clv(tvb, tree, offset, length); +} + +/* + * Name: dissect_hello_checksum_clv() + * + * Description: + * dump and verify the optional checksum in TLV 12 + * + * Input: + * tvbuff_t * : tvbuffer for packet data + * proto_tree * : protocol display tree to fill out. May be NULL + * int : offset into packet data where we are. + * int : length of clv we are decoding + * + * Output: + * void, but we will add to proto tree if !NULL. + */ + +static void +dissect_hello_checksum_clv(tvbuff_t *tvb, + proto_tree *tree, int offset, int id_length _U_, int length) { + + guint16 pdu_length,checksum, cacl_checksum=0; + + if (tree) { + if ( length != 2 ) { + proto_tree_add_text ( tree, tvb, offset, length, + "incorrect checksum length (%u), should be (2)", length ); + return; + } + + checksum = tvb_get_ntohs(tvb, offset); + + /* the check_and_get_checksum() function needs to know how big + * the packet is. we can either pass through the pdu-len through several layers + * of dissectors and wrappers or extract the PDU length field from the PDU specific header + * which is offseted 17 bytes in IIHs (relative to the beginning of the IS-IS packet) */ + + pdu_length = tvb_get_ntohs(tvb, 17); + + /* unlike the LSP checksum verification which starts at an offset of 12 we start at offset 0*/ + switch (check_and_get_checksum(tvb, 0, pdu_length, checksum, offset, &cacl_checksum)) + { + + case NO_CKSUM : + proto_tree_add_text ( tree, tvb, offset, length, + "Checksum: 0x%04x (unused)", checksum); + break; + case DATA_MISSING : + isis_dissect_unknown(tvb, tree, offset, + "packet length %d went beyond packet", + tvb_length_remaining(tvb, 0)); + break; + case CKSUM_NOT_OK : + proto_tree_add_text ( tree, tvb, offset, length, + "Checksum: 0x%04x (incorrect, should be 0x%04x)", + checksum, + cacl_checksum); + break; + case CKSUM_OK : + proto_tree_add_text ( tree, tvb, offset, length, + "Checksum: 0x%04x (correct)", checksum); + break; + default : + g_message("'check_and_get_checksum' returned an invalid value"); + } + } +} + + + +/* * Name: dissect_hello_area_address_clv() * * Description: - * Decode for a hello packets area address clv. Calls into the - * clv common one. + * Decode for a hello packets area address clv. + * Calls into the CLV common one. * * Input: * tvbuff_t * : tvbuffer for packet data @@ -798,12 +913,14 @@ isis_register_hello(int proto_isis) { &ett_isis_hello_clv_padding, &ett_isis_hello_clv_unknown, &ett_isis_hello_clv_nlpid, - &ett_isis_hello_clv_auth, + &ett_isis_hello_clv_authentication, + &ett_isis_hello_clv_ip_authentication, &ett_isis_hello_clv_ipv4_int_addr, &ett_isis_hello_clv_ipv6_int_addr, &ett_isis_hello_clv_ptp_adj, &ett_isis_hello_clv_mt, - &ett_isis_hello_clv_restart + &ett_isis_hello_clv_restart, + &ett_isis_hello_clv_checksum }; proto_register_field_array(proto_isis, hf, array_length(hf)); diff --git a/packet-isis-hello.h b/packet-isis-hello.h index b726882f8d..32247966b8 100644 --- a/packet-isis-hello.h +++ b/packet-isis-hello.h @@ -1,7 +1,7 @@ /* packet-isis-hello.h * Declares for hello handling inside isis. * - * $Id: packet-isis-hello.h,v 1.10 2002/08/29 18:52:51 guy Exp $ + * $Id: packet-isis-hello.h,v 1.11 2003/12/08 20:40:33 guy Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -40,61 +40,6 @@ #define ISIS_HELLO_TYPE_LEVEL_12 3 /* - * detail clv information on l1 hello packets - */ -#define ISIS_CLV_L1H_AREA_ADDRESS 1 -#define ISIS_CLV_L1H_IS_NEIGHBORS 6 -#define ISIS_CLV_L1H_PADDING 8 -#define ISIS_CLV_L1H_NLPID 129 -#define ISIS_CLV_L1H_IP_INTERFACE_ADDR 132 -#define ISIS_CLV_L1H_RESTART 211 -#define ISIS_CLV_L1H_MT 229 -#define ISIS_CLV_L1H_IPv6_INTERFACE_ADDR 232 - -/* - * Note, the spec say 133, but everyone seems to use 10. Any clue on why - * this is would be appreciated! - */ -#define ISIS_CLV_L1H_AUTHENTICATION_NS 10 /*non spec */ -#define ISIS_CLV_L1H_AUTHENTICATION 133 - -/* - * detail clv information on l2 hello packets - */ -#define ISIS_CLV_L2H_AREA_ADDRESS 1 -#define ISIS_CLV_L2H_IS_NEIGHBORS 6 -#define ISIS_CLV_L2H_PADDING 8 -#define ISIS_CLV_L2H_NLPID 129 -#define ISIS_CLV_L2H_IP_INTERFACE_ADDR 132 -#define ISIS_CLV_L2H_RESTART 211 -#define ISIS_CLV_L2H_MT 229 -#define ISIS_CLV_L2H_IPv6_INTERFACE_ADDR 232 -/* - * Note, the spec say 133, but everyone seems to use 10. Any clue on why - * this is would be appreciated! - */ -#define ISIS_CLV_L2H_AUTHENTICATION_NS 10 /*non spec */ -#define ISIS_CLV_L2H_AUTHENTICATION 133 - -/* - * detail clv information on PTP hello packets - */ -#define ISIS_CLV_PTP_AREA_ADDRESS 1 -#define ISIS_CLV_PTP_PADDING 8 -#define ISIS_CLV_PTP_NLPID 129 -#define ISIS_CLV_PTP_IP_INTERFACE_ADDR 132 -#define ISIS_CLV_PTP_RESTART 211 -#define ISIS_CLV_PTP_MT 229 -#define ISIS_CLV_PTP_IPv6_INTERFACE_ADDR 232 -#define ISIS_CLV_PTP_ADJ 240 -/* - * Note, the spec say 133, but everyone seems to use 10. Any clue on why - * this is would be appreciated! - */ -#define ISIS_CLV_PTP_AUTHENTICATION_NS 10 /*non spec */ -#define ISIS_CLV_PTP_AUTHENTICATION 133 - -/* * misc. bittest macros */ diff --git a/packet-isis-lsp.c b/packet-isis-lsp.c index 2654a7b43a..b239d8438f 100644 --- a/packet-isis-lsp.c +++ b/packet-isis-lsp.c @@ -1,7 +1,7 @@ /* packet-isis-lsp.c * Routines for decoding isis lsp packets and their CLVs * - * $Id: packet-isis-lsp.c,v 1.45 2003/11/19 09:58:37 guy Exp $ + * $Id: packet-isis-lsp.c,v 1.46 2003/12/08 20:40:33 guy Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -70,7 +70,8 @@ static gint ett_isis_lsp_clv_prefix_neighbors = -1; static gint ett_isis_lsp_clv_nlpid = -1; static gint ett_isis_lsp_clv_hostname = -1; static gint ett_isis_lsp_clv_te_router_id = -1; -static gint ett_isis_lsp_clv_auth = -1; +static gint ett_isis_lsp_clv_authentication = -1; +static gint ett_isis_lsp_clv_ip_authentication = -1; static gint ett_isis_lsp_clv_ipv4_int_addr = -1; static gint ett_isis_lsp_clv_ipv6_int_addr = -1; /* CLV 232 */ static gint ett_isis_lsp_clv_ip_reachability = -1; @@ -122,9 +123,9 @@ static void dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); static void dissect_lsp_area_address_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); -static void dissect_lsp_l2_auth_clv(tvbuff_t *tvb, +static void dissect_lsp_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); -static void dissect_lsp_l1_auth_clv(tvbuff_t *tvb, +static void dissect_lsp_ip_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); static void dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); @@ -154,115 +155,115 @@ static void dissect_lsp_mt_reachable_IPv6_prefx_clv(tvbuff_t *tvb, static const isis_clv_handle_t clv_l1_lsp_opts[] = { { - ISIS_CLV_L1_LSP_AREA_ADDRESS, + ISIS_CLV_AREA_ADDRESS, "Area address(es)", &ett_isis_lsp_clv_area_addr, dissect_lsp_area_address_clv }, { - ISIS_CLV_L1_LSP_IS_NEIGHBORS, + ISIS_CLV_IS_REACH, "IS Reachability", &ett_isis_lsp_clv_is_neighbors, dissect_lsp_l1_is_neighbors_clv }, { - ISIS_CLV_L1_LSP_ES_NEIGHBORS, + ISIS_CLV_ES_NEIGHBORS, "ES Neighbor(s)", &ett_isis_lsp_clv_is_neighbors, dissect_lsp_l1_es_neighbors_clv }, { - ISIS_CLV_L1_LSP_EXT_IS_REACHABLE, + ISIS_CLV_EXTD_IS_REACH, "Extended IS reachability", &ett_isis_lsp_clv_ext_is_reachability, dissect_lsp_ext_is_reachability_clv }, { - ISIS_CLV_L1_LSP_IP_INT_REACHABLE, + ISIS_CLV_INT_IP_REACH, "IP Internal reachability", &ett_isis_lsp_clv_ip_reachability, dissect_lsp_ip_reachability_clv }, { - ISIS_CLV_L1_LSP_IP_EXT_REACHABLE, + ISIS_CLV_EXT_IP_REACH, "IP External reachability", &ett_isis_lsp_clv_ip_reachability, dissect_lsp_ip_reachability_clv }, { - ISIS_CLV_L1_LSP_EXT_IP_REACHABLE, + ISIS_CLV_EXTD_IP_REACH, "Extended IP Reachability", &ett_isis_lsp_clv_ext_ip_reachability, dissect_lsp_ext_ip_reachability_clv }, { - ISIS_CLV_L1_LSP_IPv6_REACHABLE, + ISIS_CLV_IP6_REACH, "IPv6 reachability", &ett_isis_lsp_clv_ipv6_reachability, dissect_lsp_ipv6_reachability_clv }, { - ISIS_CLV_L1_LSP_NLPID, + ISIS_CLV_PROTOCOLS_SUPPORTED, "Protocols supported", &ett_isis_lsp_clv_nlpid, dissect_lsp_nlpid_clv }, { - ISIS_CLV_L1_LSP_HOSTNAME, + ISIS_CLV_HOSTNAME, "Hostname", &ett_isis_lsp_clv_hostname, dissect_lsp_hostname_clv }, { - ISIS_CLV_L1_LSP_TE_ROUTER_ID, + ISIS_CLV_TE_ROUTER_ID, "Traffic Engineering Router ID", &ett_isis_lsp_clv_te_router_id, dissect_lsp_te_router_id_clv }, { - ISIS_CLV_L1_LSP_IP_INTERFACE_ADDR, + ISIS_CLV_IP_ADDR, "IP Interface address(es)", &ett_isis_lsp_clv_ipv4_int_addr, dissect_lsp_ip_int_addr_clv }, { - ISIS_CLV_L1_LSP_IPv6_INTERFACE_ADDR, + ISIS_CLV_IP6_ADDR, "IPv6 Interface address(es)", &ett_isis_lsp_clv_ipv6_int_addr, dissect_lsp_ipv6_int_addr_clv }, { - ISIS_CLV_L1_LSP_AUTHENTICATION_NS, - "Authentication(non-spec)", - &ett_isis_lsp_clv_auth, - dissect_lsp_l1_auth_clv + ISIS_CLV_AUTHENTICATION, + "Authentication", + &ett_isis_lsp_clv_authentication, + dissect_lsp_authentication_clv }, { - ISIS_CLV_L1_LSP_AUTHENTICATION, - "Authentication", - &ett_isis_lsp_clv_auth, - dissect_lsp_l1_auth_clv + ISIS_CLV_IP_AUTHENTICATION, + "IP Authentication", + &ett_isis_lsp_clv_ip_authentication, + dissect_lsp_ip_authentication_clv }, { - ISIS_CLV_L1_LSP_MT, - "Multi Topology", + ISIS_CLV_MT_SUPPORTED, + "Multi Topology supported", &ett_isis_lsp_clv_mt, dissect_lsp_mt_clv }, { - ISIS_CLV_L1_LSP_MT_IS_REACHABLE, + ISIS_CLV_MT_IS_REACH, "Multi Topology IS Reachability", &ett_isis_lsp_clv_mt_is, dissect_lsp_mt_is_reachability_clv }, { - ISIS_CLV_L1_LSP_MT_REACHABLE_IPv4_PREFX, + ISIS_CLV_MT_IP_REACH, "Multi Topology Reachable IPv4 Prefixes", &ett_isis_lsp_clv_mt_reachable_IPv4_prefx, dissect_lsp_mt_reachable_IPv4_prefx_clv }, { - ISIS_CLV_L1_LSP_MT_REACHABLE_IPv6_PREFX, + ISIS_CLV_MT_IP6_REACH, "Multi Topology Reachable IPv6 Prefixes", &ett_isis_lsp_clv_mt_reachable_IPv6_prefx, dissect_lsp_mt_reachable_IPv6_prefx_clv @@ -277,121 +278,121 @@ static const isis_clv_handle_t clv_l1_lsp_opts[] = { static const isis_clv_handle_t clv_l2_lsp_opts[] = { { - ISIS_CLV_L1_LSP_AREA_ADDRESS, + ISIS_CLV_AREA_ADDRESS, "Area address(es)", &ett_isis_lsp_clv_area_addr, dissect_lsp_area_address_clv }, { - ISIS_CLV_L2_LSP_IS_NEIGHBORS, + ISIS_CLV_IS_REACH, "IS Reachability", &ett_isis_lsp_clv_is_neighbors, dissect_lsp_l2_is_neighbors_clv }, { - ISIS_CLV_L2_LSP_EXT_IS_REACHABLE, + ISIS_CLV_EXTD_IS_REACH, "Extended IS reachability", &ett_isis_lsp_clv_ext_is_reachability, dissect_lsp_ext_is_reachability_clv }, { - ISIS_CLV_L2_LSP_PARTITION_DIS, + ISIS_CLV_PARTITION_DIS, "Parition Designated Level 2 IS", &ett_isis_lsp_clv_partition_dis, dissect_lsp_partition_dis_clv }, { - ISIS_CLV_L2_LSP_PREFIX_NEIGHBORS, + ISIS_CLV_PREFIX_NEIGHBORS, "Prefix neighbors", &ett_isis_lsp_clv_prefix_neighbors, dissect_lsp_prefix_neighbors_clv }, { - ISIS_CLV_L2_LSP_IP_INT_REACHABLE, + ISIS_CLV_INT_IP_REACH, "IP Internal reachability", &ett_isis_lsp_clv_ip_reachability, dissect_lsp_ip_reachability_clv }, { - ISIS_CLV_L2_LSP_IP_EXT_REACHABLE, + ISIS_CLV_EXT_IP_REACH, "IP External reachability", &ett_isis_lsp_clv_ip_reachability, dissect_lsp_ip_reachability_clv }, { - ISIS_CLV_L2_LSP_NLPID, + ISIS_CLV_PROTOCOLS_SUPPORTED, "Protocols supported", &ett_isis_lsp_clv_nlpid, dissect_lsp_nlpid_clv }, { - ISIS_CLV_L2_LSP_HOSTNAME, + ISIS_CLV_HOSTNAME, "Hostname", &ett_isis_lsp_clv_hostname, dissect_lsp_hostname_clv }, { - ISIS_CLV_L2_LSP_TE_ROUTER_ID, + ISIS_CLV_TE_ROUTER_ID, "Traffic Engineering Router ID", &ett_isis_lsp_clv_te_router_id, dissect_lsp_te_router_id_clv }, { - ISIS_CLV_L2_LSP_EXT_IP_REACHABLE, + ISIS_CLV_EXTD_IP_REACH, "Extended IP Reachability", &ett_isis_lsp_clv_ext_ip_reachability, dissect_lsp_ext_ip_reachability_clv }, { - ISIS_CLV_L2_LSP_IPv6_REACHABLE, + ISIS_CLV_IP6_REACH, "IPv6 reachability", &ett_isis_lsp_clv_ipv6_reachability, dissect_lsp_ipv6_reachability_clv }, { - ISIS_CLV_L2_LSP_IP_INTERFACE_ADDR, + ISIS_CLV_IP_ADDR, "IP Interface address(es)", &ett_isis_lsp_clv_ipv4_int_addr, dissect_lsp_ip_int_addr_clv }, { - ISIS_CLV_L2_LSP_IPv6_INTERFACE_ADDR, + ISIS_CLV_IP6_ADDR, "IPv6 Interface address(es)", &ett_isis_lsp_clv_ipv6_int_addr, dissect_lsp_ipv6_int_addr_clv }, { - ISIS_CLV_L2_LSP_AUTHENTICATION_NS, - "Authentication(non spec)", - &ett_isis_lsp_clv_auth, - dissect_lsp_l2_auth_clv + ISIS_CLV_AUTHENTICATION, + "Authentication", + &ett_isis_lsp_clv_authentication, + dissect_lsp_authentication_clv }, { - ISIS_CLV_L2_LSP_AUTHENTICATION, - "Authentication", - &ett_isis_lsp_clv_auth, - dissect_lsp_l2_auth_clv + ISIS_CLV_IP_AUTHENTICATION, + "IP Authentication", + &ett_isis_lsp_clv_ip_authentication, + dissect_lsp_ip_authentication_clv }, { - ISIS_CLV_L2_LSP_MT, + ISIS_CLV_MT_SUPPORTED, "Multi Topology", &ett_isis_lsp_clv_mt, dissect_lsp_mt_clv }, { - ISIS_CLV_L2_LSP_MT_IS_REACHABLE, + ISIS_CLV_MT_IS_REACH, "Multi Topology IS Reachability", &ett_isis_lsp_clv_mt_is, dissect_lsp_mt_is_reachability_clv }, { - ISIS_CLV_L2_LSP_MT_REACHABLE_IPv4_PREFX, + ISIS_CLV_MT_IP_REACH, "Multi Topology Reachable IPv4 Prefixes", &ett_isis_lsp_clv_mt_reachable_IPv4_prefx, dissect_lsp_mt_reachable_IPv4_prefx_clv }, { - ISIS_CLV_L2_LSP_MT_REACHABLE_IPv6_PREFX, + ISIS_CLV_MT_IP6_REACH, "Multi Topology Reachable IPv6 Prefixes", &ett_isis_lsp_clv_mt_reachable_IPv6_prefx, dissect_lsp_mt_reachable_IPv6_prefx_clv @@ -1033,11 +1034,11 @@ dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb, proto_tree *tree, int offset, } /* - * Name: dissect_lsp_L1_auth_clv() + * Name: dissect_lsp_authentication_clv() * * Description: * Decode for a lsp packets authenticaion clv. Calls into the - * clv common one. An auth inside a L1 LSP is a per area password + * clv common one. * * Input: * tvbuff_t * : tvbuffer for packet data @@ -1050,19 +1051,18 @@ dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb, proto_tree *tree, int offset, * void, will modify proto_tree if not null. */ static void -dissect_lsp_l1_auth_clv(tvbuff_t *tvb, proto_tree *tree, int offset, +dissect_lsp_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length _U_, int length) { - isis_dissect_authentication_clv(tvb, tree, offset, length, - "Per area authentication" ); + isis_dissect_authentication_clv(tvb, tree, offset, length); } /* - * Name: dissect_lsp_L2_auth_clv() + * Name: dissect_lsp_ip_authentication_clv() * * Description: * Decode for a lsp packets authenticaion clv. Calls into the - * clv common one. An auth inside a L2 LSP is a per domain password + * clv common one. * * Input: * tvbuff_t * : tvbuffer for packet data @@ -1075,11 +1075,10 @@ dissect_lsp_l1_auth_clv(tvbuff_t *tvb, proto_tree *tree, int offset, * void, will modify proto_tree if not null. */ static void -dissect_lsp_l2_auth_clv(tvbuff_t *tvb, proto_tree *tree, int offset, +dissect_lsp_ip_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length _U_, int length) { - isis_dissect_authentication_clv(tvb, tree, offset, length, - "Per domain authentication" ); + isis_dissect_ip_authentication_clv(tvb, tree, offset, length); } /* @@ -1984,7 +1983,8 @@ isis_register_lsp(int proto_isis) { &ett_isis_lsp_clv_unknown, &ett_isis_lsp_clv_partition_dis, &ett_isis_lsp_clv_prefix_neighbors, - &ett_isis_lsp_clv_auth, + &ett_isis_lsp_clv_authentication, + &ett_isis_lsp_clv_ip_authentication, &ett_isis_lsp_clv_nlpid, &ett_isis_lsp_clv_hostname, &ett_isis_lsp_clv_ipv4_int_addr, diff --git a/packet-isis-lsp.h b/packet-isis-lsp.h index ab65962f50..93851f3156 100644 --- a/packet-isis-lsp.h +++ b/packet-isis-lsp.h @@ -1,7 +1,7 @@ /* packet-isis-lsp.h * Defines and such for LSP and their CLV decodes * - * $Id: packet-isis-lsp.h,v 1.18 2003/11/19 09:58:37 guy Exp $ + * $Id: packet-isis-lsp.h,v 1.19 2003/12/08 20:40:33 guy Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -78,63 +78,6 @@ #define ISIS_LSP_CLV_METRIC_VALUE(x) ((x)&0x3f) /* - * detail clv information on L1 lsp packets - */ -#define ISIS_CLV_L1_LSP_AREA_ADDRESS 1 -#define ISIS_CLV_L1_LSP_IS_NEIGHBORS 2 -#define ISIS_CLV_L1_LSP_ES_NEIGHBORS 3 -#define ISIS_CLV_L1_LSP_EXT_IS_REACHABLE 22 -#define ISIS_CLV_L1_LSP_IP_INT_REACHABLE 128 -#define ISIS_CLV_L1_LSP_NLPID 129 -#define ISIS_CLV_L1_LSP_IP_EXT_REACHABLE 130 -#define ISIS_CLV_L1_LSP_IP_INTERFACE_ADDR 132 -#define ISIS_CLV_L1_LSP_TE_ROUTER_ID 134 -#define ISIS_CLV_L1_LSP_EXT_IP_REACHABLE 135 -#define ISIS_CLV_L1_LSP_HOSTNAME 137 -#define ISIS_CLV_L1_LSP_MT_IS_REACHABLE 222 -#define ISIS_CLV_L1_LSP_MT 229 -#define ISIS_CLV_L1_LSP_IPv6_INTERFACE_ADDR 232 -#define ISIS_CLV_L1_LSP_MT_REACHABLE_IPv4_PREFX 235 -#define ISIS_CLV_L1_LSP_IPv6_REACHABLE 236 -#define ISIS_CLV_L1_LSP_MT_REACHABLE_IPv6_PREFX 237 -/* - * Note, the spec say 133, but everyone seems to use 10. Any clue on why - * this is would be appreciated! - */ -#define ISIS_CLV_L1_LSP_AUTHENTICATION_NS 10 /* non spec */ -#define ISIS_CLV_L1_LSP_AUTHENTICATION 133 - -/* - * detail clv information on L2 lsp packets - */ -#define ISIS_CLV_L2_LSP_AREA_ADDRESS 1 -#define ISIS_CLV_L2_LSP_IS_NEIGHBORS 2 -#define ISIS_CLV_L2_LSP_PARTITION_DIS 4 -#define ISIS_CLV_L2_LSP_PREFIX_NEIGHBORS 5 -#define ISIS_CLV_L2_LSP_EXT_IS_REACHABLE 22 -#define ISIS_CLV_L2_LSP_IP_INT_REACHABLE 128 -#define ISIS_CLV_L2_LSP_NLPID 129 -#define ISIS_CLV_L2_LSP_IP_EXT_REACHABLE 130 -#define ISIS_CLV_L2_LSP_IDRP_INFO 131 -#define ISIS_CLV_L2_LSP_IP_INTERFACE_ADDR 132 -#define ISIS_CLV_L2_LSP_TE_ROUTER_ID 134 -#define ISIS_CLV_L2_LSP_EXT_IP_REACHABLE 135 -#define ISIS_CLV_L2_LSP_HOSTNAME 137 -#define ISIS_CLV_L2_LSP_MT_IS_REACHABLE 222 -#define ISIS_CLV_L2_LSP_MT 229 -#define ISIS_CLV_L2_LSP_IPv6_INTERFACE_ADDR 232 -#define ISIS_CLV_L2_LSP_MT_REACHABLE_IPv4_PREFX 235 -#define ISIS_CLV_L2_LSP_IPv6_REACHABLE 236 -#define ISIS_CLV_L2_LSP_MT_REACHABLE_IPv6_PREFX 237 - -/* - * Note, the spec say 133, but everyone seems to use 10. Any clue on why - * this is would be appreciated! - */ -#define ISIS_CLV_L2_LSP_AUTHENTICATION_NS 10 /*non spec */ -#define ISIS_CLV_L2_LSP_AUTHENTICATION 133 - -/* * Published API functions. NOTE, this are "local" API functions and * are only valid from with isis decodes. */ diff --git a/packet-isis-snp.c b/packet-isis-snp.c index 8940742eb7..3d460c1852 100644 --- a/packet-isis-snp.c +++ b/packet-isis-snp.c @@ -1,7 +1,7 @@ /* packet-isis-snp.c * Routines for decoding isis complete & partial SNP and their payload * - * $Id: packet-isis-snp.c,v 1.22 2003/07/09 04:25:16 guy Exp $ + * $Id: packet-isis-snp.c,v 1.23 2003/12/08 20:40:33 guy Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -40,46 +40,56 @@ /* csnp packets */ static int hf_isis_csnp_pdu_length = -1; static gint ett_isis_csnp = -1; -static gint ett_isis_csnp_lsp_entries = -1; +static gint ett_isis_csnp_clv_lsp_entries = -1; static gint ett_isis_csnp_lsp_entry = -1; -static gint ett_isis_csnp_authentication = -1; +static gint ett_isis_csnp_clv_authentication = -1; +static gint ett_isis_csnp_clv_ip_authentication = -1; +static gint ett_isis_csnp_clv_checksum = -1; static gint ett_isis_csnp_clv_unknown = -1; /* psnp packets */ static int hf_isis_psnp_pdu_length = -1; static gint ett_isis_psnp = -1; -static gint ett_isis_psnp_lsp_entries = -1; +static gint ett_isis_psnp_clv_lsp_entries = -1; static gint ett_isis_psnp_lsp_entry = -1; -static gint ett_isis_psnp_authentication = -1; +static gint ett_isis_psnp_clv_authentication = -1; +static gint ett_isis_psnp_clv_ip_authentication = -1; +static gint ett_isis_psnp_clv_checksum = -1; static gint ett_isis_psnp_clv_unknown = -1; -static void dissect_l1_snp_authentication_clv(tvbuff_t *tvb, +static void dissect_snp_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); -static void dissect_l2_snp_authentication_clv(tvbuff_t *tvb, +static void dissect_snp_ip_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); -static void dissect_csnp_lsp_entries(tvbuff_t *tvb, +static void dissect_snp_checksum_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); -static void dissect_psnp_lsp_entries(tvbuff_t *tvb, +static void dissect_snp_lsp_entries_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length); static const isis_clv_handle_t clv_l1_csnp_opts[] = { { - ISIS_CLV_L1_CSNP_LSP_ENTRIES, + ISIS_CLV_LSP_ENTRIES, "LSP entries", - &ett_isis_csnp_lsp_entries, - dissect_csnp_lsp_entries + &ett_isis_csnp_clv_lsp_entries, + dissect_snp_lsp_entries_clv }, { - ISIS_CLV_L1_CSNP_AUTHENTICATION_NS, - "Authentication(non spec)", - &ett_isis_csnp_authentication, - dissect_l1_snp_authentication_clv + ISIS_CLV_AUTHENTICATION, + "Authentication", + &ett_isis_csnp_clv_authentication, + dissect_snp_authentication_clv }, { - ISIS_CLV_L1_CSNP_AUTHENTICATION, - "Authentication", - &ett_isis_csnp_authentication, - dissect_l1_snp_authentication_clv + ISIS_CLV_IP_AUTHENTICATION, + "IP Authentication", + &ett_isis_csnp_clv_ip_authentication, + dissect_snp_ip_authentication_clv + }, + { + ISIS_CLV_CHECKSUM, + "Checksum", + &ett_isis_csnp_clv_checksum, + dissect_snp_checksum_clv }, { 0, "", NULL, NULL @@ -88,22 +98,28 @@ static const isis_clv_handle_t clv_l1_csnp_opts[] = { static const isis_clv_handle_t clv_l2_csnp_opts[] = { { - ISIS_CLV_L2_CSNP_LSP_ENTRIES, + ISIS_CLV_LSP_ENTRIES, "LSP entries", - &ett_isis_csnp_lsp_entries, - dissect_csnp_lsp_entries + &ett_isis_csnp_clv_lsp_entries, + dissect_snp_lsp_entries_clv + }, + { + ISIS_CLV_AUTHENTICATION, + "Authentication", + &ett_isis_csnp_clv_authentication, + dissect_snp_authentication_clv }, { - ISIS_CLV_L2_CSNP_AUTHENTICATION_NS, - "Authentication(non spec)", - &ett_isis_csnp_authentication, - dissect_l2_snp_authentication_clv + ISIS_CLV_IP_AUTHENTICATION, + "IP Authentication", + &ett_isis_csnp_clv_ip_authentication, + dissect_snp_ip_authentication_clv }, { - ISIS_CLV_L2_CSNP_AUTHENTICATION, - "Authentication", - &ett_isis_csnp_authentication, - dissect_l2_snp_authentication_clv + ISIS_CLV_CHECKSUM, + "Checksum", + &ett_isis_csnp_clv_checksum, + dissect_snp_checksum_clv }, { 0, "", NULL, NULL @@ -112,22 +128,28 @@ static const isis_clv_handle_t clv_l2_csnp_opts[] = { static const isis_clv_handle_t clv_l1_psnp_opts[] = { { - ISIS_CLV_L1_PSNP_LSP_ENTRIES, + ISIS_CLV_LSP_ENTRIES, "LSP entries", - &ett_isis_psnp_lsp_entries, - dissect_psnp_lsp_entries + &ett_isis_psnp_clv_lsp_entries, + dissect_snp_lsp_entries_clv }, { - ISIS_CLV_L1_PSNP_AUTHENTICATION_NS, - "Authentication(non spec)", - &ett_isis_psnp_authentication, - dissect_l1_snp_authentication_clv + ISIS_CLV_AUTHENTICATION, + "Authentication", + &ett_isis_psnp_clv_authentication, + dissect_snp_authentication_clv }, { - ISIS_CLV_L1_PSNP_AUTHENTICATION, - "Authentication", - &ett_isis_psnp_authentication, - dissect_l1_snp_authentication_clv + ISIS_CLV_IP_AUTHENTICATION, + "IP Authentication", + &ett_isis_psnp_clv_ip_authentication, + dissect_snp_ip_authentication_clv + }, + { + ISIS_CLV_CHECKSUM, + "Checksum", + &ett_isis_psnp_clv_checksum, + dissect_snp_checksum_clv }, { 0, "", NULL, NULL @@ -136,22 +158,28 @@ static const isis_clv_handle_t clv_l1_psnp_opts[] = { static const isis_clv_handle_t clv_l2_psnp_opts[] = { { - ISIS_CLV_L2_PSNP_LSP_ENTRIES, + ISIS_CLV_LSP_ENTRIES, "LSP entries", - &ett_isis_psnp_lsp_entries, - dissect_psnp_lsp_entries + &ett_isis_psnp_clv_lsp_entries, + dissect_snp_lsp_entries_clv }, { - ISIS_CLV_L2_PSNP_AUTHENTICATION_NS, - "Authentication(non spec)", - &ett_isis_psnp_authentication, - dissect_l2_snp_authentication_clv + ISIS_CLV_AUTHENTICATION, + "Authentication", + &ett_isis_psnp_clv_authentication, + dissect_snp_authentication_clv }, { - ISIS_CLV_L2_PSNP_AUTHENTICATION, - "Authentication", - &ett_isis_psnp_authentication, - dissect_l2_snp_authentication_clv + ISIS_CLV_IP_AUTHENTICATION, + "IP Authentication", + &ett_isis_psnp_clv_ip_authentication, + dissect_snp_ip_authentication_clv + }, + { + ISIS_CLV_CHECKSUM, + "Checksum", + &ett_isis_psnp_clv_checksum, + dissect_snp_checksum_clv }, { 0, "", NULL, NULL @@ -159,7 +187,7 @@ static const isis_clv_handle_t clv_l2_psnp_opts[] = { }; /* - * Name: dissect_snp_lsp_entries() + * Name: dissect_snp_lsp_entries_clv() * * Description: * All the snp packets use a common payload format. We have up @@ -180,7 +208,7 @@ static const isis_clv_handle_t clv_l2_psnp_opts[] = { * void, but we will add to proto tree if !NULL. */ static void -dissect_csnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset, +dissect_snp_lsp_entries_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length, int length) { proto_tree *subtree,*ti; @@ -188,7 +216,7 @@ dissect_csnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset, while ( length > 0 ) { if ( length < 2+id_length+2+4+2 ) { isis_dissect_unknown(tvb, tree, offset, - "Short CSNP header entry (%d vs %d)", length, + "Short SNP header entry (%d vs %d)", length, 2+id_length+2+4+2 ); return; } @@ -224,50 +252,6 @@ dissect_csnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset, } -static void -dissect_psnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset, - int id_length, int length) -{ - proto_tree *subtree,*ti; - - while ( length > 0 ) { - if ( length < 2+id_length+2+4+2 ) { - isis_dissect_unknown(tvb, tree, offset, - "Short PSNP header entry (%d vs %d)", length, - 2+id_length+2+4+2 ); - return; - } - - ti = proto_tree_add_text(tree, tvb, offset, 2+id_length+2+4+2, - "LSP-ID: %s, Sequence: 0x%08x, Lifetime: %5us, Checksum: 0x%04x", - print_system_id( tvb_get_ptr(tvb, offset+2, id_length+2), id_length+2 ), - tvb_get_ntohl(tvb, offset+2+id_length+2), - tvb_get_ntohs(tvb, offset), - tvb_get_ntohs(tvb, offset+2+id_length+2+4)); - - subtree = proto_item_add_subtree(ti,ett_isis_psnp_lsp_entry); - - proto_tree_add_text(subtree, tvb, offset+2, 8, - "LSP-ID: : %s", - print_system_id( tvb_get_ptr(tvb, offset+2, id_length+2), id_length+2 )); - - proto_tree_add_text(subtree, tvb, offset+2+id_length+2, 4, - "LSP Sequence Number : 0x%08x", - tvb_get_ntohl(tvb, offset+2+id_length+2)); - - proto_tree_add_text(subtree, tvb, offset, 2, - "Remaining Lifetime : %us", - tvb_get_ntohs(tvb, offset)); - - proto_tree_add_text(subtree, tvb, offset+2+id_length+2+4, 2, - "LSP checksum : 0x%04x", - tvb_get_ntohs(tvb, offset+2+id_length+2+4)); - - length -= 2+id_length+2+4+2; - offset += 2+id_length+2+4+2; - } - -} /* * Name: isis_dissect_isis_csnp() @@ -429,11 +413,11 @@ isis_dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int } /* - * Name: dissect_L1_snp_authentication_clv() + * Name: dissect_snp_authentication_clv() * * Description: - * Decode for a lsp packets authenticaion clv. Calls into the - * clv common one. An auth inside a L1 SNP is a per area password + * Decode for a snp packets authenticaion clv. + * Calls into the CLV common one. * * Input: * tvbuff_t * : tvbuffer for packet data @@ -446,19 +430,18 @@ isis_dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int * void, will modify proto_tree if not null. */ static void -dissect_l1_snp_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, +dissect_snp_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length _U_, int length) { - isis_dissect_authentication_clv(tvb, tree, offset, length, - "Per area authentication" ); + isis_dissect_authentication_clv(tvb, tree, offset, length); } /* - * Name: dissect_l2_authentication_clv() + * Name: dissect_snp_ip_authentication_clv() * * Description: - * Decode for a lsp packets authenticaion clv. Calls into the - * clv common one. An auth inside a L2 LSP is a per domain password + * Decode for a snp packets authenticaion clv. + * Calls into the CLV common one. * * Input: * tvbuff_t * : tvbuffer for packet data @@ -471,11 +454,77 @@ dissect_l1_snp_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, * void, will modify proto_tree if not null. */ static void -dissect_l2_snp_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, +dissect_snp_ip_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int id_length _U_, int length) { - isis_dissect_authentication_clv(tvb, tree, offset, length, - "Per domain authentication" ); + isis_dissect_ip_authentication_clv(tvb, tree, offset, length); +} + +/* + * Name: dissect_snp_checksum_clv() + * + * Description: + * dump and verify the optional checksum in TLV 12 + * + * Input: + * tvbuff_t * : tvbuffer for packet data + * proto_tree * : protocol display tree to fill out. May be NULL + * int : offset into packet data where we are. + * int : length of clv we are decoding + * + * Output: + * void, but we will add to proto tree if !NULL. + */ + +static void +dissect_snp_checksum_clv(tvbuff_t *tvb, + proto_tree *tree, int offset, int id_length _U_, int length) { + + guint16 pdu_length,checksum, cacl_checksum=0; + + if (tree) { + if ( length != 2 ) { + proto_tree_add_text ( tree, tvb, offset, length, + "incorrect checksum length (%u), should be (2)", length ); + return; + } + + checksum = tvb_get_ntohs(tvb, offset); + + /* the check_and_get_checksum() function needs to know how big + * the packet is. we can either pass through the pdu-len through several layers + * of dissectors and wrappers or extract the PDU length field from the PDU specific header + * which is offseted 8 bytes (relative to the beginning of the IS-IS packet) in SNPs */ + + pdu_length = tvb_get_ntohs(tvb, 8); + + /* unlike the LSP checksum verification which starts at an offset of 12 we start at offset 0*/ + switch (check_and_get_checksum(tvb, 0, pdu_length, checksum, offset, &cacl_checksum)) + { + + case NO_CKSUM : + proto_tree_add_text ( tree, tvb, offset, length, + "Checksum: 0x%04x (unused)", checksum); + break; + case DATA_MISSING : + isis_dissect_unknown(tvb, tree, offset, + "packet length %d went beyond packet", + tvb_length_remaining(tvb, 0)); + break; + case CKSUM_NOT_OK : + proto_tree_add_text ( tree, tvb, offset, length, + "Checksum: 0x%04x (incorrect, should be 0x%04x)", + checksum, + cacl_checksum); + break; + case CKSUM_OK : + proto_tree_add_text ( tree, tvb, offset, length, + "Checksum: 0x%04x (correct)", checksum); + break; + default : + g_message("'check_and_get_checksum' returned an invalid value"); + } + } } /* @@ -499,9 +548,11 @@ isis_register_csnp(int proto_isis) { }; static gint *ett[] = { &ett_isis_csnp, - &ett_isis_csnp_lsp_entries, + &ett_isis_csnp_clv_lsp_entries, &ett_isis_csnp_lsp_entry, - &ett_isis_csnp_authentication, + &ett_isis_csnp_clv_authentication, + &ett_isis_csnp_clv_ip_authentication, + &ett_isis_csnp_clv_checksum, &ett_isis_csnp_clv_unknown, }; @@ -531,9 +582,11 @@ isis_register_psnp(int proto_isis) { }; static gint *ett[] = { &ett_isis_psnp, - &ett_isis_psnp_lsp_entries, + &ett_isis_psnp_clv_lsp_entries, &ett_isis_psnp_lsp_entry, - &ett_isis_psnp_authentication, + &ett_isis_psnp_clv_authentication, + &ett_isis_psnp_clv_ip_authentication, + &ett_isis_psnp_clv_checksum, &ett_isis_psnp_clv_unknown, }; diff --git a/packet-isis-snp.h b/packet-isis-snp.h index 97b433d458..c16113b9cd 100644 --- a/packet-isis-snp.h +++ b/packet-isis-snp.h @@ -1,7 +1,7 @@ /* packet-isis-snp.h * Defines and such for CSNP, PSNP, and their payloads * - * $Id: packet-isis-snp.h,v 1.7 2002/08/29 18:52:51 guy Exp $ + * $Id: packet-isis-snp.h,v 1.8 2003/12/08 20:40:33 guy Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -27,39 +27,6 @@ #define _PACKET_ISIS_SNP_H /* - * Note, the spec say 133 for authentication, but everyone seems to use 10. - * Any clue on why this is would be appreciated! - */ - -/* - * detail cvls information for L1 CSNP packets - */ -#define ISIS_CLV_L1_CSNP_LSP_ENTRIES 9 -#define ISIS_CLV_L1_CSNP_AUTHENTICATION_NS 10 -#define ISIS_CLV_L1_CSNP_AUTHENTICATION 133 - -/* - * detail cvls information for L2 CSNP packets - */ -#define ISIS_CLV_L2_CSNP_LSP_ENTRIES 9 -#define ISIS_CLV_L2_CSNP_AUTHENTICATION_NS 10 -#define ISIS_CLV_L2_CSNP_AUTHENTICATION 133 - -/* - * detail cvls information for L1 PSNP packets - */ -#define ISIS_CLV_L1_PSNP_LSP_ENTRIES 9 -#define ISIS_CLV_L1_PSNP_AUTHENTICATION_NS 10 -#define ISIS_CLV_L1_PSNP_AUTHENTICATION 133 - -/* - * detail cvls information for L2 PSNP packets - */ -#define ISIS_CLV_L2_PSNP_LSP_ENTRIES 9 -#define ISIS_CLV_L2_PSNP_AUTHENTICATION_NS 10 -#define ISIS_CLV_L2_PSNP_AUTHENTICATION 133 - -/* * Published API functions. NOTE, this are "local" API functions and * are only valid from with isis decodes. */ |