Text   |  XML   |  ReML   |   Visible Warnings:

Ignored Return Value  at packet-icmpv6.c:1615

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

dissect_icmpv6

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-icmpv6.c)expand/collapse
Show more  
 1445  dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 1446  {
 1447      proto_tree *icmp6_tree, *field_tree;
 1448      proto_item *ti, *hidden_item, *tf = NULL;
 1449      struct icmp6_hdr icmp6_hdr, *dp;
 1450      struct icmp6_nodeinfo *ni = NULL;
 1451      const char *codename, *typename;
 1452      const char *colcodename, *coltypename;
 1453      int len;
 1454      guint length, reported_length;
 1455      vec_t cksum_vec[4];
 1456      guint32 phdr[2];
 1457      guint16 cksum, computed_cksum;
 1458      int offset;
 1459      tvbuff_t *next_tvb;
 1460   
 1461      if (check_col(pinfo->cinfo, COL_PROTOCOL))
 1462          col_set_str(pinfo->cinfo, COL_PROTOCOL, "ICMPv6");
 1463      if (check_col(pinfo->cinfo, COL_INFO))
 1464          col_clear(pinfo->cinfo, COL_INFO);
 1465   
 1466      offset = 0;
 1467      tvb_memcpy(tvb, (guint8 *)&icmp6_hdr, offset, sizeof icmp6_hdr);
 1468      dp = &icmp6_hdr;
 1469      codename = typename = colcodename = coltypename = "Unknown";
 1470      len = sizeof(*dp);
 1471      switch (dp->icmp6_type) {
 1472      case ICMP6_DST_UNREACH:
 1473          typename = coltypename = "Unreachable";
 1474          switch (dp->icmp6_code) {
 1475          case ICMP6_DST_UNREACH_NOROUTE:
 1476              codename = colcodename = "Route unreachable";
 1477              break;
 1478          case ICMP6_DST_UNREACH_ADMIN:
 1479              codename = colcodename = "Administratively prohibited";
 1480              break;
 1481          case ICMP6_DST_UNREACH_NOTNEIGHBOR:
 1482              codename = colcodename = "Not a neighbor";
 1483              break;
 1484          case ICMP6_DST_UNREACH_ADDR:
 1485              codename = colcodename = "Address unreachable";
 1486              break;
 1487          case ICMP6_DST_UNREACH_NOPORT:
 1488              codename = colcodename = "Port unreachable";
 1489              break;
 1490          }
 1491          break;
 1492      case ICMP6_PACKET_TOO_BIG:
 1493          typename = coltypename = "Too big";
 1494          codename = colcodename = NULL;
 1495          break;
 1496      case ICMP6_TIME_EXCEEDED:
 1497          typename = coltypename = "Time exceeded";
 1498          switch (dp->icmp6_code) {
 1499          case ICMP6_TIME_EXCEED_TRANSIT:
 1500              codename = colcodename = "In-transit";
 1501              break;
 1502          case ICMP6_TIME_EXCEED_REASSEMBLY:
 1503              codename = colcodename = "Reassembly";
 1504              break;
 1505          }
 1506          break;
 1507      case ICMP6_PARAM_PROB:
 1508          typename = coltypename = "Parameter problem";
 1509          switch (dp->icmp6_code) {
 1510          case ICMP6_PARAMPROB_HEADER:
 1511              codename = colcodename = "Header";
 1512              break;
 1513          case ICMP6_PARAMPROB_NEXTHEADER:
 1514              codename = colcodename = "Next header";
 1515              break;
 1516          case ICMP6_PARAMPROB_OPTION:
 1517              codename = colcodename = "Option";
 1518              break;
 1519          }
 1520          break;
 1521      case ICMP6_ECHO_REQUEST:
 1522          typename = coltypename = "Echo request";
 1523          codename = colcodename = NULL;
 1524          break;
 1525      case ICMP6_ECHO_REPLY:
 1526          typename = coltypename = "Echo reply";
 1527          codename = colcodename = NULL;
 1528          break;
 1529      case ICMP6_MEMBERSHIP_QUERY:
 1530          typename = coltypename = "Multicast listener query";
 1531          codename = colcodename = NULL;
 1532          break;
 1533      case ICMP6_MEMBERSHIP_REPORT:
 1534          typename = coltypename = "Multicast listener report";
 1535          codename = colcodename = NULL;
 1536          break;
 1537      case ICMP6_MEMBERSHIP_REDUCTION:
 1538          typename = coltypename = "Multicast listener done";
 1539          codename = colcodename = NULL;
 1540          break;
 1541      case ND_ROUTER_SOLICIT:
 1542          typename = coltypename = "Router solicitation";
 1543          codename = colcodename = NULL;
 1544          len = sizeof(struct nd_router_solicit);
 1545          break;
 1546      case ND_ROUTER_ADVERT:
 1547          typename = coltypename = "Router advertisement";
 1548          codename = colcodename = NULL;
 1549          len = sizeof(struct nd_router_advert);
 1550          break;
 1551      case ND_NEIGHBOR_SOLICIT:
 1552          typename = coltypename = "Neighbor solicitation";
 1553          codename = colcodename = NULL;
 1554          len = sizeof(struct nd_neighbor_solicit);
 1555          break;
 1556      case ND_NEIGHBOR_ADVERT:
 1557          typename = coltypename = "Neighbor advertisement";
 1558          codename = colcodename = NULL;
 1559          len = sizeof(struct nd_neighbor_advert);
 1560          break;
 1561      case ND_REDIRECT:
 1562          typename = coltypename = "Redirect";
 1563          codename = colcodename = NULL;
 1564          len = sizeof(struct nd_redirect);
 1565          break;
 1566      case ICMP6_ROUTER_RENUMBERING:
 1567          typename = coltypename = "Router renumbering";
 1568          switch (dp->icmp6_code) {
 1569          case ICMP6_ROUTER_RENUMBERING_COMMAND:
 1570              codename = colcodename = "Command";
 1571              break;
 1572          case ICMP6_ROUTER_RENUMBERING_RESULT:
 1573              codename = colcodename = "Result";
 1574              break;
 1575          case ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET:
 1576              codename = colcodename = "Sequence number reset";
 1577              break;
 1578          }
 1579          len = sizeof(struct icmp6_router_renum);
 1580          break;
 1581      case ICMP6_NI_QUERY:
 1582      case ICMP6_NI_REPLY:
 1583          ni = (struct icmp6_nodeinfo *)dp;
 1584          if (ni->ni_type == ICMP6_NI_QUERY) {
 1585              typename = coltypename = "Node information query";
 1586              switch (ni->ni_code) {
 1587              case ICMP6_NI_SUBJ_IPV6:
 1588                  codename = "Query subject = IPv6 addresses";
 1589                  break;
 1590              case ICMP6_NI_SUBJ_FQDN:
 1591                  if (tvb_bytes_exist(tvb, offset, sizeof(*ni)))
 1592                      codename = "Query subject = DNS name";
 1593                  else 
 1594                      codename = "Query subject = empty";
 1595                  break;
 1596              case ICMP6_NI_SUBJ_IPV4:
 1597                  codename = "Query subject = IPv4 addresses";
 1598                  break;
 1599              }
 1600          } else {
 1601              typename = coltypename = "Node information reply";
 1602              switch (ni->ni_code) {
 1603              case ICMP6_NI_SUCCESS:
 1604                  codename = "Successful";
 1605                  break;
 1606              case ICMP6_NI_REFUSED:
 1607                  codename = "Refused";
 1608                  break;
 1609              case ICMP6_NI_UNKNOWN:
 1610                  codename = "Unknown query type";
 1611                  break;
 1612              }
 1613          }
 1614          colcodename = val_to_str(pntohs(&ni->ni_qtype), names_nodeinfo_qtype,
 1615              "Unknown");
 1616          len = sizeof(struct icmp6_nodeinfo);
 1617          break;
 1618      case ICMP6_MIP6_DHAAD_REQUEST:
 1619          typename = coltypename = "Dynamic Home Agent Address Discovery Request";
 1620          codename = "Should always be zero";
 1621          colcodename = NULL;
 1622          break;
 1623      case ICMP6_MIP6_DHAAD_REPLY:
 1624          typename = coltypename = "Dynamic Home Agent Address Discovery Reply";
 1625          codename = "Should always be zero";
 1626          colcodename = NULL;
 1627          break;
 1628      case ICMP6_MIP6_MPS:
 1629          typename = coltypename = "Mobile Prefix Solicitation";
 1630          codename = "Should always be zero";
 1631          colcodename = NULL;
 1632          break;
 1633      case ICMP6_MIP6_MPA:
 1634          typename = coltypename = "Mobile Prefix Advertisement";
 1635          codename = "Should always be zero";
 1636          colcodename = NULL;
 1637          break;
 1638          case ICMP6_CERT_PATH_SOL:
 1639                  typename = coltypename = "Certification Path Solicitation";
 1640          codename = "Should always be zero";
 1641          colcodename = NULL;
 1642          break;
 1643          case ICMP6_CERT_PATH_AD:
 1644                  typename = coltypename = "Certification Path Advertisement";
 1645          codename = "Should always be zero";
 1646          colcodename = NULL;
 1647          break;
 1648      case ICMP6_MLDV2_REPORT:
 1649          typename = coltypename = "Multicast Listener Report Message v2";
 1650          codename = "Should always be zero";
 1651          colcodename = NULL;
 1652          break;
 1653                  case ICMP6_EXPERIMENTAL_MOBILITY:
 1654                          typename = coltypename ="Experimental Mobility";
 1655                          switch (dp->icmp6_data8[0]) {
 1656                                  case FMIP6_SUBTYPE_RTSOLPR:
 1657                                          typename = coltypename ="RtSolPr (ICMPv6 Experimental Mobility)";
 1658                                          codename = "Should always be zero";
 1659                                          colcodename = NULL;
 1660                                          break;
 1661                                  case FMIP6_SUBTYPE_PRRTADV:
 1662                                          typename = coltypename ="PrRtAdv (ICMPv6 Experimental Mobility)";
 1663                                          codename = val_to_str(dp->icmp6_code, names_fmip6_prrtadv_code, "Unknown");
 1664                                          colcodename = NULL;
 1665                                          break;
 1666                                  case FMIP6_SUBTYPE_HI:
 1667                                          typename = coltypename ="HI (ICMPv6 Experimental Mobility)";
 1668                                          codename = val_to_str(dp->icmp6_code, names_fmip6_hi_code, "Unknown");
 1669                                          colcodename = NULL;
 1670                                          break;
 1671                                  case FMIP6_SUBTYPE_HACK:
 1672                                          typename = coltypename ="HAck (ICMPv6 Experimental Mobility)";
 1673                                          codename = val_to_str(dp->icmp6_code, names_fmip6_hack_code, "Unknown");
 1674                                          colcodename = NULL;
 1675                                          break;
 1676                          }
 1677                          break;
 1678      }
 1679   
 1680      if (check_col(pinfo->cinfo, COL_INFO)) {
 1681          char typebuf[256], codebuf[256];
 1682   
 1683          if (coltypename && strcmp(coltypename, "Unknown") == 0) {
 1684              g_snprintf(typebuf, sizeof(typebuf), "Unknown (0x%02x)",
 1685                  dp->icmp6_type);
 1686              coltypename = typebuf;
 1687          }
 1688          if (colcodename && strcmp(colcodename, "Unknown") == 0) {
 1689              g_snprintf(codebuf, sizeof(codebuf), "Unknown (0x%02x)",
 1690                  dp->icmp6_code);
 1691              colcodename = codebuf;
 1692          }
 1693          if (colcodename) {
 1694              col_add_fstr(pinfo->cinfo, COL_INFO, "%s (%s)", coltypename, colcodename);
 1695          } else {
 1696              col_add_str(pinfo->cinfo, COL_INFO, coltypename);
 1697          }
 1698      }
 1699   
 1700      if (tree) {
 1701          /* !!! specify length */
 1702          ti = proto_tree_add_item(tree, proto_icmpv6, tvb, offset, -1, FALSE);
 1703          icmp6_tree = proto_item_add_subtree(ti, ett_icmpv6);
 1704   
 1705          proto_tree_add_uint_format(icmp6_tree, hf_icmpv6_type, tvb,
 1706              offset + offsetof(struct icmp6_hdr, icmp6_type), 1,
 1707              dp->icmp6_type,
 1708              "Type: %u (%s)", dp->icmp6_type, typename);
 1709          if (codename) {
 1710              proto_tree_add_uint_format(icmp6_tree, hf_icmpv6_code, tvb,
 1711                  offset + offsetof(struct icmp6_hdr, icmp6_code), 1,
 1712                  dp->icmp6_code,
 1713                  "Code: %u (%s)", dp->icmp6_code, codename);
 1714          } else {
 1715              proto_tree_add_uint_format(icmp6_tree, hf_icmpv6_code, tvb,
 1716                  offset + offsetof(struct icmp6_hdr, icmp6_code), 1,
 1717                  dp->icmp6_code,
 1718                  "Code: %u", dp->icmp6_code);
 1719          }
 1720          cksum = (guint16)g_htons(dp->icmp6_cksum);
 1721          length = tvb_length(tvb);
 1722          reported_length = tvb_reported_length(tvb);
 1723          if (!pinfo->fragmented && length >= reported_length) {
 1724              /* The packet isn't part of a fragmented datagram and isn't
 1725                 truncated, so we can checksum it. */
 1726   
 1727              /* Set up the fields of the pseudo-header. */
 1728              cksum_vec[0].ptr = pinfo->src.data;
 1729              cksum_vec[0].len = pinfo->src.len;
 1730              cksum_vec[1].ptr = pinfo->dst.data;
 1731              cksum_vec[1].len = pinfo->dst.len;
 1732              cksum_vec[2].ptr = (const guint8 *)&phdr;
 1733              phdr[0] = g_htonl(tvb_reported_length(tvb));
 1734              phdr[1] = g_htonl(IP_PROTO_ICMPV6);
 1735              cksum_vec[2].len = 8;
 1736              cksum_vec[3].len = tvb_reported_length(tvb);
 1737              cksum_vec[3].ptr = tvb_get_ptr(tvb, offset, cksum_vec[3].len);
 1738              computed_cksum = in_cksum(cksum_vec, 4);
 1739              if (computed_cksum == 0) {
 1740                  proto_tree_add_uint_format(icmp6_tree, hf_icmpv6_checksum,
 1741                          tvb,
 1742                          offset + offsetof(struct icmp6_hdr, icmp6_cksum), 2,
 1743                          cksum,
 1744                          "Checksum: 0x%04x [correct]", cksum);
 1745              } else {
 1746                  hidden_item = proto_tree_add_boolean(icmp6_tree, hf_icmpv6_checksum_bad,
 1747                          tvb,
 1748                          offset + offsetof(struct icmp6_hdr, icmp6_cksum), 2,
 1749                          TRUE);
 1750                  PROTO_ITEM_SET_HIDDEN(hidden_item);
 1751                  proto_tree_add_uint_format(icmp6_tree, hf_icmpv6_checksum,
 1752                          tvb,
 1753                          offset + offsetof(struct icmp6_hdr, icmp6_cksum), 2,
 1754                          cksum,
 1755                          "Checksum: 0x%04x [incorrect, should be 0x%04x]",
 1756                          cksum, in_cksum_shouldbe(cksum, computed_cksum));
 1757              }
 1758          } else {
 1759              proto_tree_add_uint(icmp6_tree, hf_icmpv6_checksum, tvb,
 1760                  offset + offsetof(struct icmp6_hdr, icmp6_cksum), 2,
 1761                  cksum);
 1762          }
 1763   
 1764  #define ICMP6_DATA_OFFSET 4
 1765  #define ICMP6_SEQ_OFFSET 4
 1766          /* decode... */
 1767          switch (dp->icmp6_type) {
 1768          case ICMP6_DST_UNREACH:
 1769          case ICMP6_TIME_EXCEEDED:
 1770              dissect_contained_icmpv6(tvb, offset + sizeof(*dp), pinfo,
 1771                  icmp6_tree);
 1772              break;
 1773          case ICMP6_PACKET_TOO_BIG:
 1774              proto_tree_add_text(icmp6_tree, tvb,
 1775                  offset + ICMP6_DATA_OFFSET, 4,
 1776                  "MTU: %u", pntohl(&dp->icmp6_mtu));
 1777              dissect_contained_icmpv6(tvb, offset + sizeof(*dp), pinfo,
 1778                  icmp6_tree);
 1779              break;
 1780          case ICMP6_PARAM_PROB:
 1781              proto_tree_add_text(icmp6_tree, tvb,
 1782                  offset + ICMP6_DATA_OFFSET, 4,
 1783                  "Problem pointer: 0x%04x", pntohl(&dp->icmp6_pptr));
 1784              dissect_contained_icmpv6(tvb, offset + sizeof(*dp), pinfo,
 1785                  icmp6_tree);
 1786              break;
 1787          case ICMP6_ECHO_REQUEST:
 1788          case ICMP6_ECHO_REPLY:
 1789              proto_tree_add_text(icmp6_tree, tvb,
 1790                  offset + ICMP6_DATA_OFFSET, 2,
 1791                  "ID: 0x%04x", (guint16)g_ntohs(dp->icmp6_id));
 1792              proto_tree_add_text(icmp6_tree, tvb,
 1793                  offset + ICMP6_SEQ_OFFSET, 2,
 1794                  "Sequence: 0x%04x", (guint16)g_ntohs(dp->icmp6_seq));
 1795              next_tvb = tvb_new_subset(tvb, offset + sizeof(*dp), -1, -1);
 1796              call_dissector(data_handle,next_tvb, pinfo, icmp6_tree);
 1797              break;
 1798          case ICMP6_MEMBERSHIP_QUERY:
 1799          case ICMP6_MEMBERSHIP_REPORT:
 1800          case ICMP6_MEMBERSHIP_REDUCTION:
 1801  #define MLDV2_MINLEN 28
 1802  #define MLDV1_MINLEN 24
 1803              if (dp->icmp6_type == ICMP6_MEMBERSHIP_QUERY) {
 1804                  if (length >= MLDV2_MINLEN) {
 1805                      guint32 mrc;
 1806                      guint16 qqi;
 1807                      guint8 flag;
 1808                      guint16 nsrcs;
 1809   
 1810                      mrc = g_ntohs(dp->icmp6_maxdelay);
 1811                      flag = tvb_get_guint8(tvb, offset + sizeof(*dp) + 16);
 1812                      qqi = tvb_get_guint8(tvb, offset + sizeof(*dp) + 16 + 1);
 1813                      nsrcs = tvb_get_ntohs(tvb, offset + sizeof(*dp) + 16 + 2);
 1814   
 1815                      if (mrc >= 32768)
 1816                          mrc = ((mrc & 0x0fff) | 0x1000) <<
 1817                                  (((mrc & 0x7000) >> 12) + 3);
 1818                      proto_tree_add_text(icmp6_tree, tvb,
 1819                          offset + ICMP6_DATA_OFFSET, 2,
 1820                          "Maximum response delay[ms]: %u", mrc);
 1821   
 1822                      proto_tree_add_text(icmp6_tree, tvb, offset + sizeof(*dp),
 1823                          16, "Multicast Address: %s",
 1824                          ip6_to_str((const struct e_in6_addr *)(tvb_get_ptr(tvb,
 1825                              offset + sizeof *dp, sizeof (struct e_in6_addr)))));
 1826   
 1827                      proto_tree_add_text(icmp6_tree, tvb,
 1828                          offset + sizeof(*dp) + 16, 1, "S Flag: %s",
 1829                          flag & 0x08 ? "ON" : "OFF");
 1830                      proto_tree_add_text(icmp6_tree, tvb,
 1831                          offset + sizeof(*dp) + 16, 1, "Robustness: %d",
 1832                          flag & 0x07);
 1833                      if (qqi >= 128)
 1834                          qqi = ((qqi & 0x0f) | 0x10) << (((qqi & 0x70) >> 4) + 3);
 1835                      proto_tree_add_text(icmp6_tree, tvb,
 1836                          offset + sizeof(*dp) + 17, 1, "QQI: %d", qqi);
 1837   
 1838                      dissect_mldqv2(tvb, offset + sizeof(*dp) + 20, nsrcs,
 1839                          icmp6_tree);
 1840                      break;
 1841                  } else if (length > MLDV1_MINLEN) {
 1842                      next_tvb = tvb_new_subset(tvb, offset + sizeof(*dp), -1, -1);
 1843                      call_dissector(data_handle,next_tvb, pinfo, tree);
 1844                      break;
 1845                  }
 1846                  /* MLDv1 Query -> FALLTHOUGH */
 1847              }
 1848  #undef MLDV2_MINLEN 
 1849  #undef MLDV1_MINLEN 
 1850              proto_tree_add_text(icmp6_tree, tvb,
 1851                  offset + ICMP6_DATA_OFFSET, 2,
 1852                  "Maximum response delay: %u",
 1853                  (guint16)g_ntohs(dp->icmp6_maxdelay));
 1854              proto_tree_add_text(icmp6_tree, tvb, offset + sizeof(*dp), 16,
 1855                  "Multicast Address: %s",
 1856                  ip6_to_str((const struct e_in6_addr *)(tvb_get_ptr(tvb, offset + sizeof *dp, sizeof (struct e_in6_addr)))));
 1857              break;
 1858          case ND_ROUTER_SOLICIT:
 1859              dissect_icmpv6ndopt(tvb, offset + sizeof(*dp), pinfo, icmp6_tree);
 1860              break;
 1861          case ICMP6_MLDV2_REPORT: {
 1862            guint16 nbRecords;
 1863   
 1864            nbRecords = tvb_get_ntohs( tvb, offset+4+2 );
 1865            dissect_mldrv2( tvb, offset+4+2+2, nbRecords, icmp6_tree );
 1866            break;
 1867          }
 1868  #define ND_RA_CURHOPLIMIT_OFFSET 4
 1869  #define ND_RA_FLAGS_RESERVED_OFFSET 4
 1870  #define ND_RA_ROUTER_LIFETIME_OFFSET 5
 1871          case ND_ROUTER_ADVERT:
 1872            {
 1873              struct nd_router_advert nd_router_advert, *ra;
 1874              int flagoff;
 1875              guint32 ra_flags;
 1876   
 1877              ra = &nd_router_advert;
 1878              tvb_memcpy(tvb, (guint8 *)ra, offset, sizeof *ra);
 1879   
 1880              /* Current hop limit */
 1881              proto_tree_add_uint(icmp6_tree, hf_icmpv6_ra_cur_hop_limit, tvb,
 1882                  offset + ND_RA_CURHOPLIMIT_OFFSET,
 1883                  1, ra->nd_ra_curhoplimit);
 1884   
 1885              /* Flags */
 1886              flagoff = offset + ND_RA_FLAGS_RESERVED_OFFSET;
 1887              ra_flags = tvb_get_guint8(tvb, flagoff);
 1888              tf = proto_tree_add_text(icmp6_tree, tvb, flagoff, 1, "Flags: 0x%02x", ra_flags);
 1889              field_tree = proto_item_add_subtree(tf, ett_icmpv6flag);
 1890   
 1891              proto_tree_add_text(field_tree, tvb, flagoff, 1, "%s",
 1892                  decode_boolean_bitfield(ra_flags,
 1893                          ND_RA_FLAG_MANAGED, 8, "Managed", "Not managed"));
 1894              proto_tree_add_text(field_tree, tvb, flagoff, 1, "%s",
 1895                  decode_boolean_bitfield(ra_flags,
 1896                          ND_RA_FLAG_OTHER, 8, "Other", "Not other"));
 1897              proto_tree_add_text(field_tree, tvb, flagoff, 1, "%s",
 1898                  decode_boolean_bitfield(ra_flags,
 1899                          ND_RA_FLAG_HOME_AGENT, 8,
 1900                          "Home Agent", "Not Home Agent"));
 1901              proto_tree_add_text(field_tree, tvb, flagoff, 1, "%s",
 1902                  decode_enumerated_bitfield(ra_flags, ND_RA_FLAG_RTPREF_MASK, 8,
 1903                  names_router_pref, "Router preference: %s"));
 1904   
 1905              /* Router lifetime */
 1906              proto_tree_add_uint(icmp6_tree, hf_icmpv6_ra_router_lifetime, tvb,
 1907                  offset + ND_RA_ROUTER_LIFETIME_OFFSET,
 1908                  2, (guint16)g_ntohs(ra->nd_ra_router_lifetime));
 1909   
 1910              /* Reachable time */
 1911              proto_tree_add_uint(icmp6_tree, hf_icmpv6_ra_reachable_time, tvb,
 1912                  offset + offsetof(struct nd_router_advert, nd_ra_reachable), 4,
 1913                  pntohl(&ra->nd_ra_reachable));
 1914   
 1915              /* Retrans timer */
 1916              proto_tree_add_uint(icmp6_tree, hf_icmpv6_ra_retrans_timer, tvb,
 1917                  offset + offsetof(struct nd_router_advert, nd_ra_retransmit), 4,
 1918                  pntohl(&ra->nd_ra_retransmit));
 1919   
 1920              dissect_icmpv6ndopt(tvb, offset + sizeof(struct nd_router_advert), pinfo, icmp6_tree);
 1921              break;
 1922            }
 1923          case ND_NEIGHBOR_SOLICIT:
 1924            {
 1925              struct nd_neighbor_solicit nd_neighbor_solicit, *ns;
 1926   
 1927              ns = &nd_neighbor_solicit;
 1928              tvb_memcpy(tvb, (guint8 *)ns, offset, sizeof *ns);
 1929              proto_tree_add_text(icmp6_tree, tvb,
 1930                          offset + offsetof(struct nd_neighbor_solicit, nd_ns_target), 16,
 1931  #ifdef INET6 
 1932                          "Target: %s (%s)",
 1933                          get_hostname6(&ns->nd_ns_target),
 1934  #else
 1935                          "Target: %s",
 1936  #endif
 1937                          ip6_to_str(&ns->nd_ns_target));
 1938   
 1939              dissect_icmpv6ndopt(tvb, offset + sizeof(*ns), pinfo, icmp6_tree);
 1940              break;
 1941            }
 1942  #define ND_NA_FLAGS_RESERVED_OFFSET 4
 1943          case ND_NEIGHBOR_ADVERT:
 1944            {
 1945              int flagoff, targetoff;
 1946              guint32 na_flags;
 1947              struct e_in6_addr na_target;
 1948   
 1949              flagoff = offset + ND_NA_FLAGS_RESERVED_OFFSET;
 1950              na_flags = tvb_get_ntohl(tvb, flagoff);
 1951   
 1952              tf = proto_tree_add_text(icmp6_tree, tvb, flagoff, 4, "Flags: 0x%08x", na_flags);
 1953              field_tree = proto_item_add_subtree(tf, ett_icmpv6flag);
 1954              proto_tree_add_text(field_tree, tvb, flagoff, 4, "%s",
 1955                  decode_boolean_bitfield(na_flags,
 1956                          ND_NA_FLAG_ROUTER, 32, "Router", "Not router"));
 1957              proto_tree_add_text(field_tree, tvb, flagoff, 4, "%s",
 1958                  decode_boolean_bitfield(na_flags,
 1959                          ND_NA_FLAG_SOLICITED, 32, "Solicited", "Not adverted"));
 1960              proto_tree_add_text(field_tree, tvb, flagoff, 4, "%s",
 1961                  decode_boolean_bitfield(na_flags,
 1962                          ND_NA_FLAG_OVERRIDE, 32, "Override", "Not override"));
 1963   
 1964              targetoff = offset + offsetof(struct nd_neighbor_advert, nd_na_target);
 1965              tvb_memcpy(tvb, (guint8 *)&na_target, targetoff, sizeof na_target);
 1966              proto_tree_add_text(icmp6_tree, tvb, targetoff, 16,
 1967  #ifdef INET6 
 1968                          "Target: %s (%s)",
 1969                          get_hostname6(&na_target),
 1970  #else
 1971                          "Target: %s",
 1972  #endif
 1973                          ip6_to_str(&na_target));
 1974   
 1975              dissect_icmpv6ndopt(tvb, offset + sizeof(struct nd_neighbor_advert), pinfo, icmp6_tree);
 1976              break;
 1977            }
 1978          case ND_REDIRECT:
 1979            {
 1980              struct nd_redirect nd_redirect, *rd;
 1981   
 1982              rd = &nd_redirect;
 1983              tvb_memcpy(tvb, (guint8 *)rd, offset, sizeof *rd);
 1984              proto_tree_add_text(icmp6_tree, tvb,
 1985                          offset + offsetof(struct nd_redirect, nd_rd_target), 16,
 1986  #ifdef INET6 
 1987                          "Target: %s (%s)",
 1988                          get_hostname6(&rd->nd_rd_target),
 1989  #else
 1990                          "Target: %s",
 1991  #endif
 1992                          ip6_to_str(&rd->nd_rd_target));
 1993   
 1994              proto_tree_add_text(icmp6_tree, tvb,
 1995                          offset + offsetof(struct nd_redirect, nd_rd_dst), 16,
 1996  #ifdef INET6 
 1997                          "Destination: %s (%s)",
 1998                          get_hostname6(&rd->nd_rd_dst),
 1999  #else
 2000                          "Destination: %s",
 2001  #endif
 2002                          ip6_to_str(&rd->nd_rd_dst));
 2003   
 2004              dissect_icmpv6ndopt(tvb, offset + sizeof(*rd), pinfo, icmp6_tree);
 2005              break;
 2006            }
 2007          case ICMP6_ROUTER_RENUMBERING:
 2008              dissect_rrenum(tvb, offset, pinfo, icmp6_tree);
 2009              break;
 2010  #define NI_QTYPE_OFFSET 4
 2011          case ICMP6_NI_QUERY:
 2012          case ICMP6_NI_REPLY:
 2013              ni = (struct icmp6_nodeinfo *)dp;
 2014              proto_tree_add_text(icmp6_tree, tvb,
 2015                  offset + NI_QTYPE_OFFSET,
 2016                  sizeof(ni->ni_qtype),
 2017                  "Query type: 0x%04x (%s)", pntohs(&ni->ni_qtype),
 2018                  val_to_str(pntohs(&ni->ni_qtype), names_nodeinfo_qtype,
 2019                  "Unknown"));
 2020              dissect_nodeinfo(tvb, offset, pinfo, icmp6_tree);
 2021              break;
 2022          case ICMP6_MIP6_DHAAD_REQUEST:
 2023              proto_tree_add_text(icmp6_tree, tvb,
 2024                  offset + 4, 2, "Identifier: %d (0x%02x)",
 2025                  tvb_get_ntohs(tvb, offset + 4),
 2026                  tvb_get_ntohs(tvb, offset + 4));
 2027              proto_tree_add_text(icmp6_tree, tvb,
 2028                  offset + 6, 2, "Reserved: %d",
 2029                  tvb_get_ntohs(tvb, offset + 6));
 2030              break;
 2031          case ICMP6_MIP6_DHAAD_REPLY:
 2032              proto_tree_add_text(icmp6_tree, tvb,
 2033                  offset + 4, 2, "Identifier: %d (0x%02x)",
 2034                  tvb_get_ntohs(tvb, offset + 4),
 2035                  tvb_get_ntohs(tvb, offset + 4));
 2036              proto_tree_add_text(icmp6_tree, tvb,
 2037                  offset + 6, 2, "Reserved: %d",
 2038                  tvb_get_ntohs(tvb, offset + 6));
 2039              /* Show all Home Agent Addresses */
 2040              {
 2041                  int i, suboffset;
 2042                  int ha_num = (length - 8)/16;
 2043   
 2044                  for (i = 0; i < ha_num; i++) {
 2045                      suboffset = 16 * i;
 2046                      proto_tree_add_ipv6(icmp6_tree, hf_icmpv6_haad_ha_addrs,
 2047                          tvb, offset + 8 + suboffset, 16,
 2048                          tvb_get_ptr(tvb, offset + 8 + suboffset, 16));
 2049                  }
 2050              }
 2051              break;
 2052          case ICMP6_MIP6_MPS:
 2053              proto_tree_add_text(icmp6_tree, tvb,
 2054                  offset + 4, 2, "Identifier: %d (0x%02x)",
 2055                  tvb_get_ntohs(tvb, offset + 4),
 2056                  tvb_get_ntohs(tvb, offset + 4));
 2057              proto_tree_add_text(icmp6_tree, tvb,
 2058                  offset + 6, 2, "Reserved: %d",
 2059                  tvb_get_ntohs(tvb, offset + 6));
 2060              break;
 2061          case ICMP6_MIP6_MPA:
 2062              proto_tree_add_text(icmp6_tree, tvb,
 2063                  offset + 4, 2, "Identifier: %d (0x%02x)",
 2064                  tvb_get_ntohs(tvb, offset + 4),
 2065                  tvb_get_ntohs(tvb, offset + 4));
 2066              proto_tree_add_text(icmp6_tree, tvb,
 2067                  offset + 6, 1, "%s",
 2068                  decode_boolean_bitfield(tvb_get_guint8(tvb, offset + 6),
 2069                      0x80, 8,
 2070                      "Managed Address Configuration",
 2071                      "No Managed Address Configuration"));
 2072              proto_tree_add_text(icmp6_tree, tvb,
 2073                  offset + 6, 1, "%s",
 2074                  decode_boolean_bitfield(tvb_get_guint8(tvb, offset + 6),
 2075                      0x40, 8,
 2076                      "Other Stateful Configuration",
 2077                      "No Other Stateful Configuration"));
 2078              proto_tree_add_text(icmp6_tree, tvb,
 2079                  offset + 7, 1, "Reserved: %d",
 2080                  tvb_get_guint8(tvb, offset + 7));
 2081              /* Show all options */
 2082              dissect_icmpv6ndopt(tvb, offset + 8, pinfo, icmp6_tree);
 2083              break;
 2084          case ICMP6_EXPERIMENTAL_MOBILITY:
 2085                  switch (dp->icmp6_data8[0]) {
 2086                          case FMIP6_SUBTYPE_RTSOLPR:
 2087                                  {
 2088                                          struct fmip6_rtsolpr *rtsolpr;
 2089                                          rtsolpr = (struct fmip6_rtsolpr*) dp;
 2090                                          proto_tree_add_text(icmp6_tree, tvb,
 2091                                                          offset + 4, 1,
 2092                                                          "Subtype: Router Solicitation for Proxy Advertisement");
 2093                                          proto_tree_add_text(icmp6_tree, tvb,
 2094                                                          offset + 6, 2,
 2095                                                          "Identifier: %d", pntohs(&rtsolpr->fmip6_rtsolpr_id));
 2096                                          dissect_icmpv6fmip6opt(tvb, offset + sizeof(*dp), icmp6_tree);
 2097                                          break;
 2098                                  }
 2099                          case FMIP6_SUBTYPE_PRRTADV:
 2100                                  {
 2101                                          struct fmip6_prrtadv *prrtadv;
 2102                                          prrtadv = (struct fmip6_prrtadv*) dp;
 2103                                          proto_tree_add_text(icmp6_tree, tvb,
 2104                                                          offset + 4, 1,
 2105                                                          "Subtype: Proxy Router Advertisement");
 2106                                          proto_tree_add_text(icmp6_tree, tvb,
 2107                                                          offset + 6, 2,
 2108                                                          "Identifier: %d", pntohs(&prrtadv->fmip6_prrtadv_id));
 2109                                          dissect_icmpv6fmip6opt(tvb, offset + sizeof(*dp), icmp6_tree);
 2110                                          break;
 2111                                  }
 2112                          case FMIP6_SUBTYPE_HI:
 2113                                  {
 2114                                          struct fmip6_hi *hi;
 2115                                          int flagoff;
 2116                                          guint8 hi_flags;
 2117                                          hi = (struct fmip6_hi*) dp;
 2118                                          proto_tree_add_text(icmp6_tree, tvb,
 2119                                                          offset + 4, 1,
 2120                                                          "Subtype: Handover Initiate");
 2121   
 2122                                          flagoff = offset + 5;
 2123                                          hi_flags = tvb_get_guint8(tvb, flagoff);
 2124                                          tf = proto_tree_add_text(icmp6_tree, tvb, flagoff, 1, "Flags: 0x%02x", hi_flags);
 2125                                          field_tree = proto_item_add_subtree(tf, ett_icmpv6flag);
 2126                                          proto_tree_add_text(field_tree, tvb, flagoff, 1, "%s",
 2127                                                          decode_boolean_bitfield(hi_flags,
 2128                                                                  FMIP_HI_FLAG_ASSIGNED, 8, "Assigned", "Not assigned"));
 2129                                          proto_tree_add_text(field_tree, tvb, flagoff, 1, "%s",
 2130                                                          decode_boolean_bitfield(hi_flags,
 2131                                                                  FMIP_HI_FLAG_BUFFER, 8, "Buffered", "Not buffered"));
 2132                                          proto_tree_add_text(icmp6_tree, tvb,
 2133                                                          offset + 6, 2,
 2134                                                          "Identifier: %d", pntohs(&hi->fmip6_hi_id));
 2135                                          dissect_icmpv6fmip6opt(tvb, offset + sizeof(*dp), icmp6_tree);
 2136                                          break;
 2137                                  }
 2138                          case FMIP6_SUBTYPE_HACK:
 2139                                  {
 2140                                          struct fmip6_hack *hack;
 2141                                          hack = (struct fmip6_hack*) dp;
 2142                                          proto_tree_add_text(icmp6_tree, tvb,
 2143                                                          offset + 4, 1,
 2144                                                          "Subtype: Handover Acknowledge");
 2145                                          proto_tree_add_text(icmp6_tree, tvb,
 2146                                                          offset + 6, 2,
 2147                                                          "Identifier: %d", pntohs(&hack->fmip6_hack_id));
 2148                                          dissect_icmpv6fmip6opt(tvb, offset + sizeof(*dp), icmp6_tree);
 2149                                          break;
 2150                                  }
 2151                  }
 2152              break;
 2153          case ICMP6_CERT_PATH_SOL:
 2154                  /*RFC 3971 6.4.1.  Certification Path Solicitation Message Format */
 2155                  offset += 4;
 2156                  proto_tree_add_text(icmp6_tree, tvb, offset, -1,
 2157                                                          "Certification Path Solicitation Message");
 2158                  /* Identifier A 16-bit unsigned integer field */
 2159                  proto_tree_add_item(icmp6_tree, hf_icmpv6_identifier, tvb, offset,
 2160                                                          2, FALSE);
 2161                  offset += 2;
 2162                  /* Component A 16-bit unsigned integer field,
 2163                   * 65,535 if the sender seeks to retrieve all certificates.
 2164                   * Otherwise, set to the identifier that the receiver wants.
 2165                   */
 2166                  proto_tree_add_item(icmp6_tree, hf_icmpv6_comp, tvb, offset, 2,
 2167                                                          FALSE);
 2168                  offset += 2;
 2169                  dissect_icmpv6ndopt(tvb, offset, pinfo, icmp6_tree);
 2170                  break;
 2171          case ICMP6_CERT_PATH_AD:
 2172                  /*RFC 3971 6.4.2.  Certification Path Advertisement Message Format */
 2173                  offset = offset +4;
 2174                  proto_tree_add_text(icmp6_tree, tvb, offset, -1,"Certification Path Advertisement Message");
 2175   
 2176                  /* Identifier A 16-bit unsigned integer field */
 2177                  proto_tree_add_item(icmp6_tree, hf_icmpv6_identifier, tvb, offset, 2, FALSE);
 2178                  offset = offset + 2;
 2179                  /* All Components  A 16-bit unsigned integer field*/
 2180                  proto_tree_add_item(icmp6_tree, hf_icmpv6_all_comp, tvb, offset, 2, FALSE);
 2181                  offset = offset + 2;
 2182   
 2183                  /* Component A 16-bit unsigned integer field, used to inform the receiver 
 2184                   * which certificate is being sent.
 2185                   */
 2186                  proto_tree_add_item(icmp6_tree, hf_icmpv6_comp, tvb, offset, 2, FALSE);
 2187                  offset = offset + 2;
 2188   
 2189                  /* Reserved */
 2190                  proto_tree_add_text(icmp6_tree, tvb, offset, 2,"Reserved");
 2191                  offset = offset + 2;
 2192   
 2193                  dissect_icmpv6ndopt(tvb, offset, pinfo, icmp6_tree);
 2194                  break;
 2195          default:
 2196              next_tvb = tvb_new_subset(tvb, offset + sizeof(*dp), -1, -1);
 2197              call_dissector(data_handle,next_tvb, pinfo, tree);
 2198              break;
 2199          }
 2200      }
 2201  }
Show more  




Change Warning 5488.35698 : Ignored Return Value

Because they are very similar, this warning shares annotations with warnings 5488.35699 and 5488.35700.

Priority:
State:
Finding:
Owner:
Note: