Text   |  XML   |  ReML   |   Visible Warnings:

Ignored Return Value  at packet-tipc.c:1499

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

dissect_tipc_v2_internal_msg

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-tipc.c)expand/collapse
Show more  
 826  dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_info *pinfo, int offset, guint8 user, guint32 msg_size, guint8 orig_hdr_size)
 827  {
 828          guint32 dword;
 829          gchar *addr_str_ptr;
 830          tvbuff_t *data_tvb;
 831          guint8 message_type;
 832          guint8 item_size = 0;
 833          guint16 message_count;
 834          guint msg_no = 0;
 835          guint32 msg_in_bundle_size;
 836          guint8 msg_in_bundle_user;
 837          gint b_inst_strlen, padlen;
 838   
 839          /* for fragmented messages */
 840          gint len, reported_len;
 841          gboolean save_fragmented;
 842          guint32 frag_no, frag_msg_no;
 843          tvbuff_t* new_tvb = NULL;
 844          fragment_data *frag_msg = NULL;
 845   
 846          message_type = (tvb_get_guint8(tipc_tvb, offset) >>5) & 0x7;
 847   
 848          switch (user) {
 849                  case TIPCv2_BCAST_PROTOCOL:
 850                          /* W1 */
 851                          proto_tree_add_item(tipc_tree, hf_tipcv2_bcast_mtype, tipc_tvb, offset, 4, FALSE);
 852                          /* NO bcstsqgap */
 853                          /* NO sequence gap */
 854                          proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, FALSE);
 855                          offset = offset + 4;
 856                          /* W2 */
 857                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, FALSE);
 858                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, FALSE);
 859                          offset = offset + 4;
 860                          /* W3 */
 861                          dword = tvb_get_ntohl(tipc_tvb, offset);
 862                          addr_str_ptr = tipc_addr_to_str(dword);
 863                          proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
 864                          offset = offset + 4;
 865                          if (handle_v2_as & (V2_AS_1_6)) {
 866                                  /* W4-8 */
 867                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 20, "words 4-8 unused for this user");
 868                                  offset = offset + 20;
 869                          } else {
 870                                  /* W4 */
 871                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 4 unused for this user");
 872                                  offset = offset + 4;
 873                                  /* W5 */
 874                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 875                                  addr_str_ptr = tipc_addr_to_str(dword);
 876                                  proto_tree_add_item(tipc_tree, hf_tipcv2_network_id, tipc_tvb, offset, 4, FALSE);
 877                                  offset = offset + 4;
 878                                  /* W6 */
 879                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 880                                  addr_str_ptr = tipc_addr_to_str(dword);
 881                                  proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr);
 882                                  offset = offset + 4;
 883                                  /* W7 */
 884                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 885                                  addr_str_ptr = tipc_addr_to_str(dword);
 886                                  proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
 887                                  offset = offset + 4;
 888                                  /* W8 */
 889                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
 890                                  offset = offset + 4;
 891                          }
 892                          /* W9 */
 893                          proto_tree_add_item(tipc_tree, hf_tipcv2_bcast_tag, tipc_tvb, offset, 4, FALSE);
 894                          /* NO link tolerance */
 895                          offset = offset + 4;
 896                          break;
 897                  case TIPCv2_MSG_BUNDLER:
 898                          if (handle_v2_as & (V2_AS_1_6)) {
 899                                  /* W1+W2 */
 900                                  /* No message types */
 901                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 8, "words 1+2 unused for this user");
 902                                  offset = offset + 8;
 903                          } else {
 904                                  /* W1 */
 905                                  proto_tree_add_item(tipc_tree, hf_tipcv2_bundler_mtype, tipc_tvb, offset, 4, FALSE);
 906                                  proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, FALSE);
 907                                  offset = offset + 4;
 908                                  /* W2 */
 909                                  proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, FALSE);
 910                                  proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, FALSE);
 911                                  offset = offset + 4;
 912                          }
 913                          /* W3 */
 914                          dword = tvb_get_ntohl(tipc_tvb, offset);
 915                          addr_str_ptr = tipc_addr_to_str(dword);
 916                          proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
 917                          offset = offset + 4;
 918                          if (handle_v2_as & (V2_AS_1_6)) {
 919                                  /* W4-8 */
 920                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 20, "words 4-8 unused for this user");
 921                                  offset = offset + 20;
 922                          } else {
 923                                  /* W4+5 */
 924                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 8, "words 4+5 unused for this user");
 925                                  offset = offset + 8;
 926                                  /* W6 */
 927                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 928                                  addr_str_ptr = tipc_addr_to_str(dword);
 929                                  proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr);
 930                                  offset = offset + 4;
 931                                  /* W7 */
 932                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 933                                  addr_str_ptr = tipc_addr_to_str(dword);
 934                                  proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
 935                                  offset = offset + 4;
 936                                  /* W8 */
 937                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
 938                                  offset = offset + 4;
 939                          }
 940                          /* W9 */
 941                          /* Message Count: 16 bits. */
 942                          proto_tree_add_item(tipc_tree, hf_tipcv2_msg_count, tipc_tvb, offset, 4, FALSE);
 943                          message_count = tvb_get_ntohs(tipc_tvb, offset);
 944                          /* According to the spec this should not be set here,
 945                           * while there is data != 0 in this field when capturing
 946                           *
 947                           proto_tree_add_item(tipc_tree, hf_tipcv2_link_tolerance, tipc_tvb, offset, 4, FALSE);
 948                           */
 949                          offset = offset + 4;
 950                          /* This should give equal results like
 951                           * while (message_count-- > 0) */
 952                          while ((guint32)offset < msg_size) {
 953                                  msg_no++;
 954   
 955                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 956                                  msg_in_bundle_size = dword & 0x1ffff;
 957                                  msg_in_bundle_user = (dword >> 25) & 0xf;
 958   
 959                                  proto_tree_add_text(top_tree, tipc_tvb, offset, msg_in_bundle_size, "Message %u of %u in Bundle (%s)",
 960                                                  msg_no, message_count, val_to_str(msg_in_bundle_user, tipcv2_user_short_str_vals, "unknown"));
 961                                  data_tvb = tvb_new_subset(tipc_tvb, offset, msg_in_bundle_size, msg_in_bundle_size);
 962   
 963                                  /* the info column shall not be deleted by the 
 964                                   * encapsulated messages */
 965                                  if (check_col(pinfo->cinfo, COL_INFO)) {
 966                                          col_append_str(pinfo->cinfo, COL_INFO, " | ");
 967                                          col_set_fence(pinfo->cinfo, COL_INFO);
 968                                  }
 969   
 970                                  dissect_tipc(data_tvb, pinfo, top_tree);
 971   
 972                                  /* the modulo is used to align the messages to 4 Bytes */
 973                                  offset += msg_in_bundle_size + ((msg_in_bundle_size%4)?(4-(msg_in_bundle_size%4)):0);
 974                          }
 975                          break;
 976                  case TIPCv2_LINK_PROTOCOL:
 977                          /* W1 */
 978                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_mtype, tipc_tvb, offset, 4, FALSE);
 979                          /*  Broadcast Sequence Gap: 5 bits. */
 980                          proto_tree_add_item(tipc_tree, hf_tipcv2_bcast_seq_gap, tipc_tvb, offset, 4, FALSE);
 981                          /* Sequence Gap:  8 bits. */
 982                          proto_tree_add_item(tipc_tree, hf_tipcv2_sequence_gap, tipc_tvb, offset, 4, FALSE);
 983                          proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, FALSE);
 984                          offset = offset + 4;
 985                          /* W2 */
 986                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, FALSE);
 987                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, FALSE);
 988                          offset = offset + 4;
 989                          /* W3 */
 990                          dword = tvb_get_ntohl(tipc_tvb, offset);
 991                          addr_str_ptr = tipc_addr_to_str(dword);
 992                          proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
 993                          offset = offset + 4;
 994                          /* W4 */
 995                          /* Next Sent Broadcast: 16 bits */
 996                          proto_tree_add_item(tipc_tree, hf_tipcv2_next_sent_broadcast, tipc_tvb, offset, 4, FALSE);
 997                          /* Next Sent Packet:  16 bits. */
 998                          proto_tree_add_item(tipc_tree, hf_tipcv2_next_sent_packet, tipc_tvb, offset, 4, FALSE);
 999                          offset = offset + 4;
 1000                          /* W5 */
 1001                          /* Session Number: 16 bits. */
 1002                          proto_tree_add_item(tipc_tree, hf_tipcv2_session_no, tipc_tvb, offset, 4, FALSE);
 1003                          /* Reserved: 3 bits Must be set to zero. */
 1004                          /* the following two fields appear in this user according to */
 1005                          /* Jon Maloy on the tipc-discussion mailing list */
 1006                          /* Redundant Link: 1 bit */
 1007                          proto_tree_add_item(tipc_tree, hf_tipcv2_redundant_link, tipc_tvb, offset, 4, FALSE);
 1008                          /* Bearer Identity: 3 bits */
 1009                          proto_tree_add_item(tipc_tree, hf_tipcv2_bearer_id, tipc_tvb, offset, 4, FALSE);
 1010                          /* Link Priority: 5 bits. */
 1011                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_prio, tipc_tvb, offset, 4, FALSE);
 1012                          /* Network Plane: 3 bits. */
 1013                          proto_tree_add_item(tipc_tree, hf_tipcv2_network_plane, tipc_tvb, offset, 4, FALSE);
 1014                          /* Probe: 1 bit. */
 1015                          proto_tree_add_item(tipc_tree, hf_tipcv2_probe, tipc_tvb, offset, 4, FALSE);
 1016                          offset = offset + 4;
 1017                          if (handle_v2_as & (V2_AS_1_6)) {
 1018                                  /* W6-8 */
 1019                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 12, "words 6-8 unused for this user");
 1020                                  offset = offset + 12;
 1021                          } else {
 1022                                  /* W6 */
 1023                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1024                                  addr_str_ptr = tipc_addr_to_str(dword);
 1025                                  proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr);
 1026                                  offset = offset + 4;
 1027                                  /* W7 */
 1028                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1029                                  addr_str_ptr = tipc_addr_to_str(dword);
 1030                                  proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
 1031                                  offset = offset + 4;
 1032                                  /* W8 */
 1033                                  proto_tree_add_item(tipc_tree, hf_tipcv2_timestamp, tipc_tvb, offset, 4, FALSE);
 1034                                  offset = offset + 4;
 1035                          }
 1036                          /* W9 */
 1037                          proto_tree_add_item(tipc_tree, hf_tipcv2_max_packet, tipc_tvb, offset, 4, FALSE);
 1038                          /* Link Tolerance:  16 bits */
 1039                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_tolerance, tipc_tvb, offset, 4, FALSE);
 1040                          offset = offset + 4;
 1041   
 1042                          if ((message_type == TIPCv2_RESET_MSG)
 1043                                          || ((message_type == TIPCv2_STATE_MSG) && ((msg_size-(orig_hdr_size*4)) != 0))) /* is allowed */
 1044                                  proto_tree_add_item(tipc_tree, hf_tipcv2_bearer_instance, tipc_tvb, offset, -1, FALSE);
 1045                                  /* the bearer instance string is padded with \0 to the next word boundry */
 1046                                  b_inst_strlen = tvb_strsize(tipc_tvb, offset);
 1047                                  offset += b_inst_strlen;
 1048                                  if ((padlen = (4-b_inst_strlen%4)) > 0) {
 1049                                          proto_tree_add_text(tipc_tree, tipc_tvb, offset, padlen, "Padding: %d byte%c", padlen, (padlen!=1?'s':0));
 1050                                          offset += padlen;
 1051                                  };
 1052                                  if ((offset-msg_size) > 0) {
 1053                                          proto_tree_add_text(tipc_tree, tipc_tvb, offset, -1, "Filler for MTU discovery: %d byte%c", tvb_length_remaining(tipc_tvb, offset), (padlen!=1?'s':0));
 1054                                  };
 1055                          break;
 1056                  case TIPCv2_CONN_MANAGER:
 1057                          /* CONN_MANAGER uses the 36-byte header format of CONN_MSG payload messages */
 1058                          /* W1 */
 1059                          proto_tree_add_item(tipc_tree, hf_tipcv2_connmgr_mtype, tipc_tvb, offset, 4, FALSE);
 1060                          proto_tree_add_item(tipc_tree, hf_tipcv2_errorcode, tipc_tvb, offset, 4, FALSE);
 1061                          proto_tree_add_item(tipc_tree, hf_tipcv2_rer_cnt, tipc_tvb, offset, 4, FALSE);
 1062                          proto_tree_add_item(tipc_tree, hf_tipcv2_lookup_scope, tipc_tvb, offset, 4, FALSE);
 1063   
 1064                          /* Options Position: 3 bits */
 1065                          /* this is not used by this user according to Jon Maloy in tipc-discussion mailing list
 1066                             opt_p = tvb_get_guint8(tipc_tvb, offset+1) & 0x7;
 1067                             proto_tree_add_item(tipc_tree, hf_tipcv2_opt_p , tipc_tvb, offset, 4, FALSE);
 1068                             if (opt_p != 0) {
 1069                             hdr_size = hdr_size - (opt_p << 2);
 1070                             }
 1071                             */
 1072                          proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no , tipc_tvb, offset, 4, FALSE);
 1073                          offset = offset + 4;
 1074   
 1075                          /* W2 */
 1076                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no , tipc_tvb, offset, 4, FALSE);
 1077                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no , tipc_tvb, offset, 4, FALSE);
 1078                          offset = offset + 4;
 1079   
 1080                          /* W3 */
 1081                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1082                          addr_str_ptr = tipc_addr_to_str(dword);
 1083                          proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
 1084                          offset = offset + 4;
 1085   
 1086                          /* W4 */
 1087                          proto_tree_add_item(tipc_tree, hf_tipc_org_port , tipc_tvb, offset, 4, FALSE);
 1088                          offset = offset + 4;
 1089   
 1090                          /* W5 */
 1091                          proto_tree_add_item(tipc_tree, hf_tipc_dst_port , tipc_tvb, offset, 4, FALSE);
 1092                          offset = offset + 4;
 1093   
 1094                          /* W6 */
 1095                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1096                          addr_str_ptr = tipc_addr_to_str(dword);
 1097                          proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr);
 1098                          offset = offset + 4;
 1099   
 1100                          /* W7 */
 1101                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1102                          addr_str_ptr = tipc_addr_to_str(dword);
 1103                          proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
 1104                          offset = offset + 4;
 1105   
 1106                          /* W8 */
 1107                          /* according to Allan Stephens this was never verfied by the receiver 
 1108                             proto_tree_add_item(tipc_tree, hf_tipcv2_transport_seq_no, tipc_tvb, offset, 4, FALSE);
 1109                             */
 1110                          proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user (might be set prior to 1.7.3 but was never verified)");
 1111                          offset = offset + 4;
 1112   
 1113   
 1114                          /* this is not used here according to Jon Maloy in tipc-discussion mailing list
 1115                           * Options 
 1116   
 1117                           if (opt_p != 0) {
 1118                           proto_tree_add_text(tipc_tree, tipc_tvb, offset, (opt_p >> 2), "Options");
 1119                           offset = offset + (opt_p << 2);
 1120                           }
 1121                           */
 1122   
 1123                          if (message_type == TIPCv2_CONMGR_MSG_ACK || (handle_v2_as & (V2_AS_ALL + V2_AS_1_7)))
 1124                          {
 1125                                  /* W9 */
 1126                                  proto_tree_add_item(tipc_tree, hf_tipcv2_conn_mgr_msg_ack, tipc_tvb, offset, 4, FALSE);
 1127                                  offset += 4;
 1128                          }
 1129                          break;
 1130                  case TIPCv2_ROUTE_DISTRIBUTOR:
 1131                          /* W1 */
 1132                          /* determine if it is TIPC v1.6 or v1.7 */
 1133                          dword = tvb_get_ntohl(tipc_tvb, offset+28);
 1134                          item_size = (dword >> 24) & 0xff;
 1135                          if ((handle_v2_as & V2_AS_1_6) || ((handle_v2_as & V2_AS_ALL) == 0)) {
 1136                                  proto_tree_add_item(tipc_tree, hf_tipcv2_route_mtype_1_6, tipc_tvb, offset, 4, FALSE);
 1137                          } else {
 1138                                  proto_tree_add_item(tipc_tree, hf_tipcv2_route_mtype_1_7, tipc_tvb, offset, 4, FALSE);
 1139                          }
 1140                          proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, FALSE);
 1141                          offset = offset + 4;
 1142                          /* W2 */
 1143                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, FALSE);
 1144                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, FALSE);
 1145                          offset = offset + 4;
 1146                          /* W3 */
 1147                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1148                          addr_str_ptr = tipc_addr_to_str(dword);
 1149                          proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
 1150                          offset = offset + 4;
 1151                          /* W4 */
 1152   
 1153                          if (handle_v2_as & V2_AS_1_6) {
 1154                                  /* W4-9 */
 1155                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 24, "words 4-9 unused for this user");
 1156                                  offset = offset + 24;
 1157                          } else {
 1158                                  /* W4 */
 1159                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 4 unused for this user");
 1160                                  offset = offset + 4;
 1161                                  /* W5 */
 1162                                  proto_tree_add_item(tipc_tree, hf_tipc_dst_port, tipc_tvb, offset, 4, FALSE);
 1163                                  offset = offset + 4;
 1164                                  /* W6 */
 1165                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1166                                  addr_str_ptr = tipc_addr_to_str(dword);
 1167                                  proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr);
 1168                                  offset = offset + 4;
 1169                                  /* W7 */
 1170                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1171                                  addr_str_ptr = tipc_addr_to_str(dword);
 1172                                  proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
 1173                                  offset = offset + 4;
 1174                                  /* W8 */
 1175                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
 1176                                  offset = offset + 4;
 1177                                  /* W9 */
 1178                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1179                                  item_size = (dword >> 24) & 0xff;
 1180                                  proto_tree_add_item(tipc_tree, hf_tipcv2_item_size, tipc_tvb, offset, 4, FALSE);
 1181                                  offset = offset + 4;
 1182                          }
 1183   
 1184                          /* item_size == 0 indicates that it's TIPC v1.6 style */
 1185                          if ((handle_v2_as & V2_AS_1_6) || ((handle_v2_as & V2_AS_ALL) && (item_size == 0))) {
 1186                                  /* W10 */
 1187                                  switch (message_type) {
 1188                                          case TIPCv2_EXT_ROUTING_TABLE:          /* 0  */
 1189                                          case TIPCv2_LOCAL_ROUTING_TABLE:        /* 1  */
 1190                                          case TIPCv2_SEC_ROUTING_TABLE:          /* 2  */
 1191                                                  /* Cluster Address */
 1192                                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1193                                                  addr_str_ptr = tipc_addr_to_str(dword);
 1194                                                  proto_tree_add_string(tipc_tree, hf_tipcv2_cluster_address, tipc_tvb, offset, 4, addr_str_ptr);
 1195                                                  offset = offset + 4;
 1196                                                  /* bitmap */
 1197                                                  proto_tree_add_item(tipc_tree, hf_tipcv2_bitmap, tipc_tvb, offset, -1, FALSE);
 1198                                                  break;
 1199                                          case TIPCv2_ROUTE_ADDITION:                     /* 3  */
 1200                                          case TIPCv2_ROUTE_REMOVAL:                      /* 4  */
 1201                                                  /* Node Address */
 1202                                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1203                                                  addr_str_ptr = tipc_addr_to_str(dword);
 1204                                                  proto_tree_add_string(tipc_tree, hf_tipcv2_node_address, tipc_tvb, offset, 4, addr_str_ptr);
 1205                                                  offset = offset + 4;
 1206                                          default:
 1207                                                  break;
 1208                                  }
 1209                          } else {
 1210                                  /* what if item_size is set to a value fitting to TIPC v1.6 ? */
 1211                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1212                                  addr_str_ptr = tipc_addr_to_str(dword);
 1213                                  proto_tree_add_string(tipc_tree, hf_tipcv2_network_region, tipc_tvb, offset, 4, addr_str_ptr);
 1214                                  offset += 4;
 1215                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1216                                  addr_str_ptr = tipc_addr_to_str(dword);
 1217                                  proto_tree_add_string(tipc_tree, hf_tipcv2_local_router, tipc_tvb, offset, 4, addr_str_ptr);
 1218                                  offset += 4;
 1219                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1220                                  addr_str_ptr = tipc_addr_to_str(dword);
 1221                                  proto_tree_add_string(tipc_tree, hf_tipcv2_remote_router, tipc_tvb, offset, 4, addr_str_ptr);
 1222                                  offset += 4;
 1223                                  proto_tree_add_item(tipc_tree, hf_tipcv2_dist_dist, tipc_tvb, offset, 4, FALSE);
 1224                                  proto_tree_add_item(tipc_tree, hf_tipcv2_dist_scope, tipc_tvb, offset, 4, FALSE);
 1225                                  offset = offset + 4;
 1226                          }
 1227                          break;
 1228   
 1229                  case TIPCv2_CHANGEOVER_PROTOCOL:
 1230                          /* W1 */
 1231                          proto_tree_add_item(tipc_tree, hf_tipcv2_changeover_mtype, tipc_tvb, offset, 4, FALSE);
 1232                          proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, FALSE);
 1233                          offset = offset + 4;
 1234                          /* W2 */
 1235                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, FALSE);
 1236                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, FALSE);
 1237                          offset = offset + 4;
 1238                          /* W3 */
 1239                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1240                          addr_str_ptr = tipc_addr_to_str(dword);
 1241                          proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
 1242                          offset = offset + 4;
 1243                          /* W4 */
 1244                          proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 4 unused for this user");
 1245                          offset = offset + 4;
 1246                          /* W5 */
 1247                          /* the following two fields appear in this user according to */
 1248                          /* Jon Maloy on the tipc-discussion mailing list */
 1249                          /* Redundant Link: 1 bit */
 1250                          if (handle_v2_as & (V2_AS_1_6)) {
 1251                                  proto_tree_add_item(tipc_tree, hf_tipcv2_redundant_link, tipc_tvb, offset, 4, FALSE);
 1252                          }
 1253                          /* Bearer Identity: 3 bits */
 1254                          proto_tree_add_item(tipc_tree, hf_tipcv2_bearer_id, tipc_tvb, offset, 4, FALSE);
 1255                          offset = offset + 4;
 1256                          /* W6-W8 */
 1257                          if (handle_v2_as & (V2_AS_1_6)) {
 1258                                  /* W6-8 */
 1259                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 12, "words 6-8 unused for this user");
 1260                                  offset = offset + 12;
 1261                          } else {
 1262                                  /* W6 */
 1263                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1264                                  addr_str_ptr = tipc_addr_to_str(dword);
 1265                                  proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr);
 1266                                  offset = offset + 4;
 1267                                  /* W7 */
 1268                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1269                                  addr_str_ptr = tipc_addr_to_str(dword);
 1270                                  proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
 1271                                  offset = offset + 4;
 1272                                  /* W8 */
 1273                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
 1274                                  offset = offset + 4;
 1275                          }
 1276                          /* W9 */
 1277                          switch (message_type)
 1278                          {
 1279                                  case 0:
 1280                                          /* DUPLICATE_MSG */
 1281                                          proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 9 unused for this message type");
 1282                                          break;
 1283                                  case 1:
 1284                                          /* ORIGINAL_MSG */
 1285                                          /* Message Count: 16 bits. */
 1286                                          proto_tree_add_item(tipc_tree, hf_tipcv2_msg_count, tipc_tvb, offset, 4, FALSE);
 1287                                          break;
 1288                                  default:
 1289                                          break;
 1290                          }
 1291                          offset = offset + 4;
 1292                          break;
 1293                  case TIPCv2_NAME_DISTRIBUTOR:
 1294                          /* W1 */
 1295                          proto_tree_add_item(tipc_tree, hf_tipcv2_naming_mtype, tipc_tvb, offset, 4, FALSE);
 1296                          proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, FALSE);
 1297                          offset = offset + 4;
 1298                          /* W2 */
 1299                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, FALSE);
 1300                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, FALSE);
 1301                          offset = offset + 4;
 1302                          /* W3 */
 1303                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1304                          addr_str_ptr = tipc_addr_to_str(dword);
 1305                          proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
 1306                          offset = offset + 4;
 1307                          /* W4+W5 */
 1308                          proto_tree_add_text(tipc_tree, tipc_tvb, offset, 8, "words 4+5 unused for this user");
 1309                          offset = offset + 8;
 1310                          /* W6 */
 1311                          /* Originating Node: 32 bits. */
 1312                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1313                          addr_str_ptr = tipc_addr_to_str(dword);
 1314                          proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr);
 1315                          offset = offset + 4;
 1316                          /* W7 */
 1317                          /* Destination Node: 32 bits.  */
 1318                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1319                          addr_str_ptr = tipc_addr_to_str(dword);
 1320                          proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
 1321                          offset = offset + 4;
 1322                          if (handle_v2_as & (V2_AS_1_6 + V2_AS_ALL)) {
 1323                                  /* W8 */
 1324                                  /* Transport Level Sequence Number: 32 bits */
 1325                                  proto_tree_add_item(tipc_tree, hf_tipcv2_transport_seq_no, tipc_tvb, offset, 4, FALSE);
 1326                                  offset = offset + 4;
 1327                          } else {
 1328                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
 1329                                  offset = offset + 4;
 1330                          }
 1331                          /* W9 */
 1332                          if (handle_v2_as & V2_AS_1_6) {
 1333                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 9 unused for this user");
 1334                                  offset = offset + 4;
 1335                          } else {
 1336                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1337                                  item_size = (dword >> 24) & 0xff;
 1338                                  proto_tree_add_item(tipc_tree, hf_tipcv2_item_size, tipc_tvb, offset, 4, FALSE);
 1339                                  offset = offset + 4;
 1340                          }
 1341                          /* W10 */
 1342                          /* dissect the (one or more) Publications */
 1343                          data_tvb = tvb_new_subset(tipc_tvb, offset, -1, -1);
 1344                          dissect_tipc_name_dist_data(data_tvb, tipc_tree, item_size);
 1345                          break;
 1346                  case TIPCv2_MSG_FRAGMENTER:
 1347                          /* W1 */
 1348                          proto_tree_add_item(tipc_tree, hf_tipcv2_fragmenter_mtype, tipc_tvb, offset, 4, FALSE);
 1349                          proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, FALSE);
 1350                          offset = offset + 4;
 1351                          /* W2 */
 1352                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, FALSE);
 1353                          proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, FALSE);
 1354                          offset = offset + 4;
 1355                          /* W3 */
 1356                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1357                          addr_str_ptr = tipc_addr_to_str(dword);
 1358                          proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
 1359                          offset = offset + 4;
 1360                          /* W4 */
 1361                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1362                          /* Fragment Number: 16 Bits. */
 1363                          proto_tree_add_item(tipc_tree, hf_tipcv2_fragment_number, tipc_tvb, offset, 4, FALSE);
 1364                          frag_no = (dword >> 16) & 0x0000ffff;
 1365                          /* Fragment msg Number: 16 bits */
 1366                          proto_tree_add_item(tipc_tree, hf_tipcv2_fragment_msg_number, tipc_tvb, offset, 4, FALSE);
 1367                          frag_msg_no = dword & 0x0000ffff;
 1368                          offset = offset + 4;
 1369                          if (handle_v2_as & (V2_AS_1_6)) {
 1370                                  /* W5-W9 */
 1371                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 20, "words 5-9 unused for this user");
 1372                                  offset = offset + 20;
 1373                          } else {
 1374                                  /* W5 */
 1375                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 5 unused for this user");
 1376                                  offset = offset + 4;
 1377                                  /* W6 */
 1378                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1379                                  addr_str_ptr = tipc_addr_to_str(dword);
 1380                                  proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr);
 1381                                  offset = offset + 4;
 1382                                  /* W7 */
 1383                                  dword = tvb_get_ntohl(tipc_tvb, offset);
 1384                                  addr_str_ptr = tipc_addr_to_str(dword);
 1385                                  proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
 1386                                  offset = offset + 4;
 1387                                  /* W8+9 */
 1388                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, 8, "words 8+9 unused for this user");
 1389                                  offset = offset + 8;
 1390                          }
 1391   
 1392                          len = (msg_size - (orig_hdr_size<<2));
 1393                          reported_len = tvb_reported_length_remaining(tipc_tvb, offset);
 1394   
 1395                          if (tipc_defragment) {
 1396                                  /* reassemble fragmented packages */
 1397                                  save_fragmented = pinfo->fragmented;
 1398                                  pinfo->fragmented = TRUE;
 1399   
 1400                                  frag_msg = fragment_add_seq_check(tipc_tvb, offset, pinfo,
 1401                                                  frag_msg_no,                                    /* ID for fragments belonging together */
 1402                                                  /* TODO: make sure that fragments are on the same LINK */
 1403                                                  tipc_msg_fragment_table,                        /* list of message fragments */
 1404                                                  tipc_msg_reassembled_table,                     /* list of reassembled messages */
 1405                                                  /* TIPC starts with "1" but we * need "0" */
 1406                                                  (frag_no-1),                                    /* number of the fragment */
 1407                                                  len,                                            /* fragment length - to the end of the data */
 1408                                                  (message_type != TIPCv2_USER_LAST_FRAGMENT));   /* More fragments? */
 1409   
 1410                                  new_tvb = process_reassembled_data(tipc_tvb, offset, pinfo,
 1411                                                  "Reassembled Message", frag_msg, &tipc_msg_frag_items,
 1412                                                  NULL, tipc_tree);
 1413   
 1414                                  if (frag_msg) { /* Reassembled */
 1415                                          if (check_col(pinfo->cinfo, COL_INFO))
 1416                                                  col_append_str(pinfo->cinfo, COL_INFO,
 1417                                                                  " (Message Reassembled)");
 1418                                  } else { /* Not last packet of reassembled Short Message */
 1419                                          if (check_col(pinfo->cinfo, COL_INFO))
 1420                                                  col_append_fstr(pinfo->cinfo, COL_INFO,
 1421                                                                  " (Message fragment %u)", frag_no);
 1422                                  }
 1423                                  if (new_tvb) { /* take it all */
 1424                                          data_tvb = new_tvb;
 1425   
 1426                                          /* the info column shall not be deleted by the 
 1427                                           * encapsulated messages */
 1428                                          if (check_col(pinfo->cinfo, COL_INFO)) {
 1429                                                  col_append_str(pinfo->cinfo, COL_INFO, " | ");
 1430                                                  col_set_fence(pinfo->cinfo, COL_INFO);
 1431                                          }
 1432                                          dissect_tipc(new_tvb, pinfo, top_tree);
 1433                                  } else { /* make a new subset */
 1434                                          data_tvb = tvb_new_subset(tipc_tvb, offset, len, reported_len);
 1435                                          call_dissector(data_handle, data_tvb, pinfo, top_tree);
 1436                                  }
 1437   
 1438                                  pinfo->fragmented = save_fragmented;
 1439                          } else {
 1440                                  /* don't reassemble is set in the "preferences" */
 1441                                  data_tvb = tvb_new_subset(tipc_tvb, offset, len, reported_len);
 1442                                  call_dissector(data_handle, data_tvb, pinfo, top_tree);
 1443                          }
 1444   
 1445                          break;
 1446                  case TIPCv2_NEIGHBOUR_DISCOVERY:
 1447  /*
 1448  The protocol for neighbour detection 
 1449  uses a special message format, with the following generic structure:
 1450   
 1451  0                   1                   2                   3
 1452  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 1453     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 1454  w0:|vers |msg usr|hdr sz |n|resrv|            packet size          |
 1455     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 1456  w1:|m typ|0| requested links       |       broadcast ack no        |
 1457
1469
Show [ Lines 1457 to 1469 omitted. ]
 1470  w8:|                                                               |
 1471     +-+-+-+-+-+-+-                                    +-+-+-+-+-+-+-+
 1472  w9:|                                                               |
 1473     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 1474     \                                                               \
 1475     /                 vendor specific data  (optional)              /
 1476     \                                                               \
 1477     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 1478  */
 1479                          /* W1 */
 1480                          proto_tree_add_item(tipc_tree, hf_tipcv2_neighbour_mtype, tipc_tvb, offset, 4, FALSE);
 1481                          /* Requested Links (12 bits) */
 1482                          proto_tree_add_item(tipc_tree, hf_tipcv2_req_links, tipc_tvb, offset, 4, FALSE);
 1483                          proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, FALSE);
 1484                          offset = offset + 4;
 1485                          /* W2 */
 1486                          /* Destination Domain */
 1487                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1488                          addr_str_ptr = tipc_addr_to_str(dword);
 1489                          proto_tree_add_string(tipc_tree, hf_tipcv2_destination_domain, tipc_tvb, offset, 4, addr_str_ptr);
 1490                          offset = offset + 4;
 1491                          /* W3 */
 1492                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1493                          addr_str_ptr = tipc_addr_to_str(dword);
 1494                          proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
 1495                          offset = offset + 4;
 1496                          /* W4 */
 1497                          /* Network Identity: */
 1498                          dword = tvb_get_ntohl(tipc_tvb, offset);
 1499                          addr_str_ptr = tipc_addr_to_str(dword);
 1500                          proto_tree_add_item(tipc_tree, hf_tipcv2_network_id, tipc_tvb, offset, 4, FALSE);
 1501                          offset = offset + 4;
 1502                          if (handle_v2_as & (V2_AS_1_6)) {
 1503                                  /* W5 - W9 Bearer Level Originating Address: */
 1504                                  proto_tree_add_item(tipc_tree, hf_tipcv2_bearer_level_orig_addr, tipc_tvb, offset, 20, FALSE);
 1505                                  offset = offset + 20;
 1506                          } else {
 1507                                  /* W5 */
 1508                                  proto_tree_add_item(tipc_tree, hf_tipcv2_media_id, tipc_tvb, offset, 4, FALSE);
 1509                                  offset = offset + 4;
 1510                                  /* W6 - W9 Bearer Level Originating Address: */
 1511                                  proto_tree_add_item(tipc_tree, hf_tipcv2_bearer_level_orig_addr, tipc_tvb, offset, 16, FALSE);
 1512                                  offset = offset + 16;
 1513                          }
 1514                          if (msg_size-(orig_hdr_size*4) != 0) {
 1515                                  proto_tree_add_text(tipc_tree, tipc_tvb, offset, -1, "Vendor specific data");
 1516                          }
 1517                          break;
 1518                  default:
 1519                          break;
 1520          }
 1521   
 1522  }
Show more  




Change Warning 12521.35638 : Ignored Return Value

Priority:
State:
Finding:
Owner:
Note: