diff options
-rw-r--r-- | epan/address.h | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-tipc.c | 42 | ||||
-rw-r--r-- | epan/to_str.c | 28 | ||||
-rw-r--r-- | epan/to_str.h | 1 |
4 files changed, 68 insertions, 9 deletions
diff --git a/epan/address.h b/epan/address.h index 4c28d132a1..db204a1445 100644 --- a/epan/address.h +++ b/epan/address.h @@ -45,7 +45,8 @@ typedef enum { AT_SS7PC, /* SS7 Point Code */ AT_STRINGZ, /* null-terminated string */ AT_EUI64, /* IEEE EUI-64 */ - AT_URI /* URI/URL/URN */ + AT_URI, /* URI/URL/URN */ + AT_TIPC /* TIPC Address Zone,Subnetwork,Processor */ } address_type; typedef struct _address { @@ -116,7 +117,8 @@ typedef enum { PT_EXCHG, /* Fibre Channel exchange */ PT_DDP, /* DDP AppleTalk connection */ PT_SBCCS, /* FICON */ - PT_IDP /* XNS IDP sockets */ + PT_IDP, /* XNS IDP sockets */ + PT_TIPC /* TIPC PORT */ } port_type; /* Types of circuit IDs Ethereal knows about. */ diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c index 04bc3fdede..372b25c5ef 100644 --- a/epan/dissectors/packet-tipc.c +++ b/epan/dissectors/packet-tipc.c @@ -148,8 +148,8 @@ const value_string tipc_link_prot_msg_type_values[] = { { 0, NULL}, }; const value_string tipc_sm_msg_type_values[] = { - { 0, "FIRST_SEGMENT"}, - { 1, "SEGMENT"}, + { 1, "FIRST_SEGMENT"}, + { 2, "SEGMENT"}, { 0, NULL}, }; @@ -177,7 +177,7 @@ tipc_addr_to_str(guint tipc_address) } static void -dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tree,int offset,guint8 user) +dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tree,int offset,guint8 user, guint32 msg_size) { guint8 msg_type; /* Internal Protocol Header */ @@ -240,7 +240,7 @@ dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tr /* Unused */ proto_tree_add_item(tipc_tree, hf_tipc_unused3, tvb, offset, 4, FALSE); offset = offset + 4; - proto_tree_add_text(tipc_tree, tvb, offset, -1,"Data"); + proto_tree_add_text(tipc_tree, tvb, offset, -1,"%u bytes Data",(msg_size - 28)); } static void @@ -251,9 +251,11 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *tipc_tree; int offset = 0; guint32 dword; + guint32 msg_size; guint8 hdr_size; guint8 user; gchar *addr_str_ptr; + const guchar *src_addr, *dst_addr; /* Make entry in Protocol column on summary display */ if (check_col(pinfo->cinfo, COL_PROTOCOL)) @@ -262,6 +264,21 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dword = tvb_get_ntohl(tvb,offset); hdr_size = (dword >>21) & 0xf; user = (dword>>25) & 0xf; + msg_size = dword & 0x1ffff; + + if ( hdr_size > 5 && user <3){ + src_addr = tvb_get_ptr(tvb, offset + 24, 4); + SET_ADDRESS(&pinfo->src, AT_TIPC, 4, src_addr); + + dst_addr = tvb_get_ptr(tvb, offset + 28, 4); + SET_ADDRESS(&pinfo->dst, AT_TIPC, 4, dst_addr); + } + + if ((user >2 )|| (hdr_size <= 5)){ + src_addr = tvb_get_ptr(tvb, offset + 8, 4); + SET_ADDRESS(&pinfo->src, AT_TIPC, 4, src_addr); + } + if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "User: %s", val_to_str(user, tipc_user_values, "unknown")); @@ -280,10 +297,12 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(tipc_tree, hf_tipc_unused, tvb, offset, 4, FALSE); proto_tree_add_item(tipc_tree, hf_tipc_msg_size, tvb, offset, 4, FALSE); offset = offset + 4; + /* Word 1 */ proto_tree_add_item(tipc_tree, hf_tipc_ack_link_lev_seq, tvb, offset, 4, FALSE); proto_tree_add_item(tipc_tree, hf_tipc_link_lev_seq, tvb, offset, 4, FALSE); offset = offset + 4; + /* Word 2 */ dword = tvb_get_ntohl(tvb,offset); addr_str_ptr = tipc_addr_to_str(dword); @@ -291,11 +310,18 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = offset + 4; if (user >2){ - dissect_tipc_int_prot_msg(tvb, pinfo, tipc_tree, offset, user); + dissect_tipc_int_prot_msg(tvb, pinfo, tipc_tree, offset, user, msg_size); return; } + + dword = tvb_get_ntohl(tvb,offset); + pinfo->ptype = PT_TIPC; + pinfo->srcport = dword; proto_tree_add_item(tipc_tree, hf_tipc_org_port, tvb, offset, 4, FALSE); offset = offset + 4; + + dword = tvb_get_ntohl(tvb,offset); + pinfo->destport = dword; proto_tree_add_item(tipc_tree, hf_tipc_dst_port, tvb, offset, 4, FALSE); offset = offset + 4; /* 20 - 24 Bytes @@ -313,7 +339,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) should be by far the most frequent one this small optimization pays off. */ if ( hdr_size <= 5 ){ - proto_tree_add_text(tipc_tree, tvb, offset, -1,"Data"); + proto_tree_add_text(tipc_tree, tvb, offset, -1,"%u bytes Data",(msg_size - hdr_size *4)); }else{ proto_tree_add_item(tipc_tree, hf_tipc_data_msg_type, tvb, offset, 4, FALSE); proto_tree_add_item(tipc_tree, hf_tipc_err_code, tvb, offset, 4, FALSE); @@ -323,11 +349,13 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dword = tvb_get_ntohl(tvb,offset); addr_str_ptr = tipc_addr_to_str(dword); + proto_tree_add_string(tipc_tree, hf_tipc_org_proc, tvb, offset, 4, addr_str_ptr); offset = offset + 4; dword = tvb_get_ntohl(tvb,offset); addr_str_ptr = tipc_addr_to_str(dword); + proto_tree_add_string(tipc_tree, hf_tipc_dst_proc, tvb, offset, 4, addr_str_ptr); offset = offset + 4; if ( hdr_size > 8 ){ @@ -341,7 +369,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = offset + 4; } } - proto_tree_add_text(tipc_tree, tvb, offset, -1,"Data"); + proto_tree_add_text(tipc_tree, tvb, offset, -1,"%u bytes Data",(msg_size - hdr_size *4)); }/* if tree */ } diff --git a/epan/to_str.c b/epan/to_str.c index bde3ac5c10..138d831e99 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -822,6 +822,9 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len) buf[copy_len] = '\0'; } break; + case AT_TIPC: + tipc_addr_to_str_buf(addr->data, buf, buf_len); + break; default: g_assert_not_reached(); } @@ -879,3 +882,28 @@ gchar* guid_to_str_buf(const guint8 *guid, gchar *buf, int buf_len) { guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]); return buf; } + +void +tipc_addr_to_str_buf( const guint8 *data, gchar *buf, int buf_len){ + guint8 zone; + guint16 subnetwork; + guint16 processor; + guint32 tipc_address; + + tipc_address = data[0]; + tipc_address = (tipc_address << 8) ^ data[1]; + tipc_address = (tipc_address << 8) ^ data[2]; + tipc_address = (tipc_address << 8) ^ data[3]; + + processor = tipc_address & 0x0fff; + + tipc_address = tipc_address >> 12; + subnetwork = tipc_address & 0x0fff; + + tipc_address = tipc_address >> 12; + zone = tipc_address & 0xff; + + g_snprintf(buf,buf_len,"%u.%u.%u",zone,subnetwork,processor); + + +}
\ No newline at end of file diff --git a/epan/to_str.h b/epan/to_str.h index e9997d62f3..3b741a4ecb 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -79,6 +79,7 @@ extern gchar* oid_to_str_buf(const guint8*, gint, gchar*, int); extern gchar* guid_to_str(const guint8*); extern gchar* guid_to_str_buf(const guint8*, gchar*, int); +void tipc_addr_to_str_buf( const guint8 *data, gchar *buf, int buf_len); extern char *other_decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width); |