diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-04-14 15:43:03 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-04-14 22:43:25 +0000 |
commit | 16b26b8e5fa066bfde0939ca2a66af00af44285e (patch) | |
tree | 44a81524cfc7da675d01172af06b979870bbcc0d | |
parent | d3ad27390c47089d1bab973b9760eb80ae9de92f (diff) |
Put the system ID in the top-level items for neighbors.
Add a tvb_print_system_id() routine, and use that in various ISIS
dissectors, while we're at it.
Change-Id: I31b6b9ea8faf2b4849f974ec7ed27fbdd14b91ef
Reviewed-on: https://code.wireshark.org/review/1145
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | epan/dissectors/packet-isis-hello.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-isis-lsp.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-isis-snp.c | 8 | ||||
-rw-r--r-- | epan/osi-utils.c | 7 | ||||
-rw-r--r-- | epan/osi-utils.h | 1 |
5 files changed, 16 insertions, 6 deletions
diff --git a/epan/dissectors/packet-isis-hello.c b/epan/dissectors/packet-isis-hello.c index 4e62f2cd6b..e93e6817eb 100644 --- a/epan/dissectors/packet-isis-hello.c +++ b/epan/dissectors/packet-isis-hello.c @@ -963,7 +963,7 @@ dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offs offset += 1; proto_tree_add_item(hello_tree, hf_isis_hello_source_id, tvb, offset, id_length, ENC_NA); - col_append_fstr(pinfo->cinfo, COL_INFO, ", System-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length )); + col_append_fstr(pinfo->cinfo, COL_INFO, ", System-ID: %s", tvb_print_system_id( tvb, offset, id_length )); offset += id_length; diff --git a/epan/dissectors/packet-isis-lsp.c b/epan/dissectors/packet-isis-lsp.c index b26c775c5c..c16186efae 100644 --- a/epan/dissectors/packet-isis-lsp.c +++ b/epan/dissectors/packet-isis-lsp.c @@ -1691,6 +1691,7 @@ dissect_lsp_eis_neighbors_clv_inner(tvbuff_t *tvb, packet_info *pinfo, proto_tre proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_error_metric_ie, tvb, offset+3, 1, ENC_NA); proto_tree_add_item(ntree, is_eis ? hf_isis_lsp_eis_neighbors_es_neighbor_id : hf_isis_lsp_eis_neighbors_is_neighbor_id, tvb, offset+4, id_length, ENC_NA); + proto_item_append_text(ti, ": %s", tvb_print_system_id(tvb, offset+4, id_length)); } offset += tlen; length -= tlen; @@ -1981,6 +1982,7 @@ dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tre ntree = proto_item_add_subtree (ti, ett_isis_lsp_part_of_clv_ext_is_reachability ); proto_tree_add_item(ntree, hf_isis_lsp_ext_is_reachability_is_neighbor_id, tvb, offset, 7, ENC_NA); + proto_item_append_text(ti, ": %s", tvb_print_system_id(tvb, offset, 7)); proto_tree_add_item(ntree, hf_isis_lsp_ext_is_reachability_metric, tvb, offset+7, 3, ENC_BIG_ENDIAN); @@ -2601,7 +2603,7 @@ dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset offset_checksum = offset; proto_tree_add_item(lsp_tree, hf_isis_lsp_lsp_id, tvb, offset, id_length + 2, ENC_NA); - system_id = print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2); + system_id = tvb_print_system_id( tvb, offset, id_length+2 ); col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP-ID: %s", system_id); offset += (id_length + 2); diff --git a/epan/dissectors/packet-isis-snp.c b/epan/dissectors/packet-isis-snp.c index 0664f95926..a71807e759 100644 --- a/epan/dissectors/packet-isis-snp.c +++ b/epan/dissectors/packet-isis-snp.c @@ -322,17 +322,17 @@ dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse offset += 2; proto_tree_add_item(csnp_tree, hf_isis_csnp_source_id, tvb, offset, id_length, ENC_NA); - col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length )); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", tvb_print_system_id( tvb, offset, id_length )); offset += id_length + 1; proto_tree_add_item(csnp_tree, hf_isis_csnp_start_lsp_id, tvb, offset, id_length + 2, ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP-ID: %s", - print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 )); + tvb_print_system_id( tvb, offset, id_length+2 )); offset += id_length + 2; proto_tree_add_item(csnp_tree, hf_isis_csnp_end_lsp_id, tvb, offset, id_length + 2, ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP-ID: %s", - print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 )); + tvb_print_system_id( tvb, offset, id_length+2 )); offset += id_length + 2; len = pdu_length - header_length; @@ -385,7 +385,7 @@ dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse offset += 2; proto_tree_add_item(psnp_tree, hf_isis_psnp_source_id, tvb, offset, id_length, ENC_NA); - col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length )); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", tvb_print_system_id( tvb, offset, id_length )); offset += id_length + 1; diff --git a/epan/osi-utils.c b/epan/osi-utils.c index 4734b14633..5d2671fe37 100644 --- a/epan/osi-utils.c +++ b/epan/osi-utils.c @@ -30,6 +30,7 @@ #include <string.h> #include <glib.h> +#include "tvbuff.h" #include "osi-utils.h" #include "emem.h" @@ -87,6 +88,12 @@ print_system_id( const guint8 *ad, int length ) return( cur ); } +gchar * +tvb_print_system_id( tvbuff_t *tvb, const gint offset, int length ) +{ + return( print_system_id(tvb_get_ptr(tvb, offset, length), length) ); +} + void print_system_id_buf( const guint8 *ad, int length, gchar *buf, int buf_len) { diff --git a/epan/osi-utils.h b/epan/osi-utils.h index fcb1948e80..7ce8e569f4 100644 --- a/epan/osi-utils.h +++ b/epan/osi-utils.h @@ -50,6 +50,7 @@ void print_nsap_net_buf( const guint8 *, int, gchar *, int); gchar* print_area ( const guint8 *, int ); void print_area_buf ( const guint8 *, int, gchar *, int); gchar* print_system_id( const guint8 *, int ); +gchar* tvb_print_system_id( tvbuff_t *, const gint, int ); void print_system_id_buf( const guint8 *, int, gchar *, int); #endif /* __OSI_UTILS_H__ */ |