~ubuntu-branches/ubuntu/gutsy/wireshark/gutsy-security

« back to all changes in this revision

Viewing changes to epan/dissectors/packet-isis-lsp.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2007-04-01 08:58:40 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070401085840-or3qhrpv8alt1bwg
Tags: 0.99.5-1
* New upstream release.
* debian/patches/09_idl2wrs.dpatch: updated to patch idl2wrs.sh.in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* packet-isis-lsp.c
2
2
 * Routines for decoding isis lsp packets and their CLVs
3
3
 *
4
 
 * $Id: packet-isis-lsp.c 18196 2006-05-21 04:49:01Z sahlberg $
 
4
 * $Id: packet-isis-lsp.c 20214 2006-12-26 09:13:05Z jake $
5
5
 * Stuart Stanley <stuarts@mxmail.net>
6
6
 *
7
7
 * Wireshark - Network traffic analyzer
40
40
#include "packet-isis-lsp.h"
41
41
#include <epan/addr_resolv.h>
42
42
#include <epan/addr_and_mask.h>
 
43
#include <epan/expert.h>
43
44
 
44
45
/* lsp packets */
45
46
static int hf_isis_lsp_pdu_length = -1;
47
48
static int hf_isis_lsp_sequence_number = -1;
48
49
static int hf_isis_lsp_checksum = -1;
49
50
static int hf_isis_lsp_checksum_bad = -1;
 
51
static int hf_isis_lsp_checksum_good = -1;
50
52
static int hf_isis_lsp_clv_ipv4_int_addr = -1;
51
53
static int hf_isis_lsp_clv_ipv6_int_addr = -1;
52
54
static int hf_isis_lsp_clv_te_router_id = -1;
59
61
static gint ett_isis_lsp = -1;
60
62
static gint ett_isis_lsp_info = -1;
61
63
static gint ett_isis_lsp_att = -1;
 
64
static gint ett_isis_lsp_cksum = -1;
62
65
static gint ett_isis_lsp_clv_area_addr = -1;
63
66
static gint ett_isis_lsp_clv_is_neighbors = -1;
64
67
static gint ett_isis_lsp_clv_ext_is_reachability = -1; /* CLV 22 */
1727
1730
        }
1728
1731
}
1729
1732
 
 
1733
static void isis_lsp_checkum_additional_info(tvbuff_t * tvb, packet_info * pinfo, 
 
1734
    proto_item * it_cksum, int offset, gboolean is_cksum_correct)
 
1735
{
 
1736
        proto_tree * checksum_tree;
 
1737
        proto_item * item;
 
1738
 
 
1739
        checksum_tree = proto_item_add_subtree(it_cksum, ett_isis_lsp_cksum);
 
1740
        item = proto_tree_add_boolean(checksum_tree, hf_isis_lsp_checksum_good, tvb,
 
1741
           offset, 2, is_cksum_correct);
 
1742
        PROTO_ITEM_SET_GENERATED(item);
 
1743
        item = proto_tree_add_boolean(checksum_tree, hf_isis_lsp_checksum_bad, tvb,
 
1744
           offset, 2, !is_cksum_correct);
 
1745
        PROTO_ITEM_SET_GENERATED(item);
 
1746
        if (!is_cksum_correct) {
 
1747
          expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum");
 
1748
          if (check_col(pinfo->cinfo, COL_INFO))
 
1749
            col_append_fstr(pinfo->cinfo, COL_INFO, " [ISIS CHECKSUM INCORRECT]");
 
1750
        }
 
1751
}
 
1752
 
 
1753
 
1730
1754
/*
1731
1755
 * Name: isis_dissect_isis_lsp()
1732
1756
 *
1754
1778
        guint16         pdu_length, checksum, cacl_checksum=0;
1755
1779
        guint8          lsp_info, lsp_att;
1756
1780
        int             len, offset_checksum;
 
1781
        proto_item      *it_cksum;
1757
1782
 
1758
1783
        if (tree) {
1759
1784
                ti = proto_tree_add_text(tree, tvb, offset, -1,
1769
1794
        offset += 2;
1770
1795
 
1771
1796
        if (tree) {
1772
 
                proto_tree_add_text(lsp_tree, tvb, offset, 2,
1773
 
                                    "Remaining Lifetime: %us",
1774
 
                                    tvb_get_ntohs(tvb, offset));
 
1797
                proto_tree_add_item(lsp_tree, hf_isis_lsp_remaining_life, 
 
1798
                        tvb, offset, 2, FALSE);
1775
1799
        }
1776
1800
        offset += 2;
1777
1801
        offset_checksum = offset;
1789
1813
        offset += id_length + 2;
1790
1814
 
1791
1815
        if (tree) {
1792
 
                proto_tree_add_uint(lsp_tree, hf_isis_lsp_sequence_number, tvb,
1793
 
                        offset, 4,
1794
 
                        tvb_get_ntohl(tvb, offset));
 
1816
                proto_tree_add_item(lsp_tree, hf_isis_lsp_sequence_number, 
 
1817
                        tvb, offset, 4, FALSE);
1795
1818
        }
1796
1819
        if (check_col(pinfo->cinfo, COL_INFO)) {
1797
1820
                col_append_fstr(pinfo->cinfo, COL_INFO, ", Sequence: 0x%08x, Lifetime: %5us",
1815
1838
                                        tvb_length_remaining(tvb, offset_checksum));
1816
1839
                        break;
1817
1840
                        case CKSUM_NOT_OK :
1818
 
                                        proto_tree_add_uint_format(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum,
 
1841
                                        it_cksum = proto_tree_add_uint_format(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum,
1819
1842
                                                "Checksum: 0x%04x [incorrect, should be 0x%04x]",
1820
1843
                                                checksum, cacl_checksum);
1821
 
                                        proto_tree_add_boolean_hidden(lsp_tree, hf_isis_lsp_checksum_bad,
1822
 
                                                tvb, offset, 2, TRUE);
 
1844
                                        isis_lsp_checkum_additional_info(tvb, pinfo, it_cksum, offset, FALSE);
1823
1845
                        break;
1824
1846
                        case CKSUM_OK :
1825
 
                                        proto_tree_add_uint_format(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum,
 
1847
                                        it_cksum = proto_tree_add_uint_format(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum,
1826
1848
                                                "Checksum: 0x%04x [correct]", checksum);
1827
 
                                        proto_tree_add_boolean_hidden(lsp_tree, hf_isis_lsp_checksum_bad,
1828
 
                                                tvb, offset, 2, FALSE);
 
1849
                                        isis_lsp_checkum_additional_info(tvb, pinfo, it_cksum, offset, TRUE);
1829
1850
                        break;
1830
1851
                        default :
1831
1852
                                g_message("'check_and_get_checksum' returned an invalid value");
1917
1938
                { "Checksum",           "isis.lsp.checksum",FT_UINT16,
1918
1939
                  BASE_HEX, NULL, 0x0, "", HFILL }},
1919
1940
                  
 
1941
                { &hf_isis_lsp_checksum_good,
 
1942
                { "Good Checksum", "isis.lsp.checksum_good", FT_BOOLEAN, BASE_NONE,
 
1943
                        NULL, 0, "Good IS-IS LSP Checksum", HFILL }},
 
1944
 
1920
1945
                { &hf_isis_lsp_checksum_bad,
1921
1946
                { "Bad Checksum", "isis.lsp.checksum_bad", FT_BOOLEAN, BASE_NONE,
1922
1947
                        NULL, 0, "Bad IS-IS LSP Checksum", HFILL }},
1955
1980
                { &hf_isis_lsp_is_type,
1956
1981
                { "Type of Intermediate System",        "isis.lsp.is_type", FT_UINT8, BASE_DEC,
1957
1982
                        VALS(isis_lsp_istype_vals), ISIS_LSP_IS_TYPE_MASK,
1958
 
                        "", HFILL }},
 
1983
                        "", HFILL }}
1959
1984
        };
1960
1985
        static gint *ett[] = {
1961
1986
                &ett_isis_lsp,
1962
1987
                &ett_isis_lsp_info,
1963
1988
                &ett_isis_lsp_att,
 
1989
                &ett_isis_lsp_cksum,
1964
1990
                &ett_isis_lsp_clv_area_addr,
1965
1991
                &ett_isis_lsp_clv_is_neighbors,
1966
1992
                &ett_isis_lsp_clv_ext_is_reachability, /* CLV 22 */
1987
2013
                &ett_isis_lsp_clv_mt_is,
1988
2014
                &ett_isis_lsp_part_of_clv_mt_is,
1989
2015
    &ett_isis_lsp_clv_mt_reachable_IPv4_prefx,
1990
 
    &ett_isis_lsp_clv_mt_reachable_IPv6_prefx,
 
2016
    &ett_isis_lsp_clv_mt_reachable_IPv6_prefx
1991
2017
        };
1992
2018
 
1993
2019
        proto_register_field_array(proto_isis, hf, array_length(hf));