diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-07-07 22:52:57 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-07-07 22:52:57 +0000 |
commit | 07f42b5b31f9523deeb147226521f77a2c8dd797 (patch) | |
tree | c720d2a42f11c9d14ac1a161eb785b438c2c4b14 /packet-ospf.c | |
parent | fba49cfe85d4b23ebbffa97fae126a379e913ecd (diff) | |
download | wireshark-07f42b5b31f9523deeb147226521f77a2c8dd797.tar.gz wireshark-07f42b5b31f9523deeb147226521f77a2c8dd797.tar.bz2 wireshark-07f42b5b31f9523deeb147226521f77a2c8dd797.zip |
Created a new protocol tree implementation and a new display filter
mechanism that is built into ethereal. Wiretap is now used to read all
file formats. Libpcap is used only for capturing.
svn path=/trunk/; revision=342
Diffstat (limited to 'packet-ospf.c')
-rw-r--r-- | packet-ospf.c | 163 |
1 files changed, 78 insertions, 85 deletions
diff --git a/packet-ospf.c b/packet-ospf.c index 77e0095918..f4fd8b2584 100644 --- a/packet-ospf.c +++ b/packet-ospf.c @@ -2,7 +2,7 @@ * Routines for OSPF packet disassembly * (c) Copyright Hannes R. Boehm <hannes@boehm.org> * - * $Id: packet-ospf.c,v 1.10 1999/03/23 03:14:42 gram Exp $ + * $Id: packet-ospf.c,v 1.11 1999/07/07 22:51:50 gram Exp $ * * At this time, this module is able to analyze OSPF * packets as specified in RFC2328. MOSPF (RFC1584) and other @@ -80,49 +80,47 @@ dissect_ospf(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { } if (tree) { - ti = proto_tree_add_item(tree, offset, ntohs(ospfh.length), "Open Shortest Path First"); - ospf_tree = proto_tree_new(); - proto_item_add_subtree(ti, ospf_tree, ETT_OSPF); + ti = proto_tree_add_text(tree, offset, ntohs(ospfh.length), "Open Shortest Path First"); + ospf_tree = proto_item_add_subtree(ti, ETT_OSPF); - ti = proto_tree_add_item(ospf_tree, offset, OSPF_HEADER_LENGTH, "OSPF Header"); - ospf_header_tree = proto_tree_new(); - proto_item_add_subtree(ti, ospf_header_tree, ETT_OSPF_HDR); + ti = proto_tree_add_text(ospf_tree, offset, OSPF_HEADER_LENGTH, "OSPF Header"); + ospf_header_tree = proto_item_add_subtree(ti, ETT_OSPF_HDR); - proto_tree_add_item(ospf_header_tree, offset, 1, "OSPF Version: %d", ospfh.version); - proto_tree_add_item(ospf_header_tree, offset + 1 , 1, "OSPF Packet Type: %d (%s)", + proto_tree_add_text(ospf_header_tree, offset, 1, "OSPF Version: %d", ospfh.version); + proto_tree_add_text(ospf_header_tree, offset + 1 , 1, "OSPF Packet Type: %d (%s)", ospfh.packet_type, (packet_type != NULL ? packet_type : "Unknown")); - proto_tree_add_item(ospf_header_tree, offset + 2 , 2, "Packet Length: %d", + proto_tree_add_text(ospf_header_tree, offset + 2 , 2, "Packet Length: %d", ntohs(ospfh.length)); - proto_tree_add_item(ospf_header_tree, offset + 4 , 4, "Source OSPF Router ID: %s", + proto_tree_add_text(ospf_header_tree, offset + 4 , 4, "Source OSPF Router ID: %s", ip_to_str((guint8 *) &(ospfh.routerid))); if (!(ospfh.area)) { - proto_tree_add_item(ospf_header_tree, offset + 8 , 4, "Area ID: Backbone"); + proto_tree_add_text(ospf_header_tree, offset + 8 , 4, "Area ID: Backbone"); } else { - proto_tree_add_item(ospf_header_tree, offset + 8 , 4, "Area ID: %s", ip_to_str((guint8 *) &(ospfh.area))); + proto_tree_add_text(ospf_header_tree, offset + 8 , 4, "Area ID: %s", ip_to_str((guint8 *) &(ospfh.area))); } - proto_tree_add_item(ospf_header_tree, offset + 12 , 2, "Packet Checksum: 0x%x", + proto_tree_add_text(ospf_header_tree, offset + 12 , 2, "Packet Checksum: 0x%x", ntohs(ospfh.checksum)); switch( ntohs(ospfh.auth_type) ) { case OSPF_AUTH_NONE: - proto_tree_add_item(ospf_header_tree, offset + 14 , 2, "Auth Type: none"); - proto_tree_add_item(ospf_header_tree, offset + 16 , 8, "Auth Data (none)"); + proto_tree_add_text(ospf_header_tree, offset + 14 , 2, "Auth Type: none"); + proto_tree_add_text(ospf_header_tree, offset + 16 , 8, "Auth Data (none)"); break; case OSPF_AUTH_SIMPLE: - proto_tree_add_item(ospf_header_tree, offset + 14 , 2, "Auth Type: simple"); + proto_tree_add_text(ospf_header_tree, offset + 14 , 2, "Auth Type: simple"); strncpy(auth_data, (char *) &ospfh.auth_data, 8); - proto_tree_add_item(ospf_header_tree, offset + 16 , 8, "Auth Data: %s", auth_data); + proto_tree_add_text(ospf_header_tree, offset + 16 , 8, "Auth Data: %s", auth_data); break; case OSPF_AUTH_CRYPT: - proto_tree_add_item(ospf_header_tree, offset + 14 , 2, "Auth Type: crypt"); - proto_tree_add_item(ospf_header_tree, offset + 16 , 8, "Auth Data (crypt)"); + proto_tree_add_text(ospf_header_tree, offset + 14 , 2, "Auth Type: crypt"); + proto_tree_add_text(ospf_header_tree, offset + 16 , 8, "Auth Data (crypt)"); break; default: - proto_tree_add_item(ospf_header_tree, offset + 14 , 2, "Auth Type (unknown)"); - proto_tree_add_item(ospf_header_tree, offset + 16 , 8, "Auth Data (unknown)"); + proto_tree_add_text(ospf_header_tree, offset + 14 , 2, "Auth Type (unknown)"); + proto_tree_add_text(ospf_header_tree, offset + 16 , 8, "Auth Data (unknown)"); } } @@ -163,13 +161,12 @@ dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, proto_tree *tre memcpy(&ospfhello, &pd[offset], sizeof(e_ospf_hello)); if (tree) { - ti = proto_tree_add_item(tree, offset, (fd->cap_len - offset) , "OSPF Hello Packet"); - ospf_hello_tree = proto_tree_new(); - proto_item_add_subtree(ti, ospf_hello_tree, ETT_OSPF_HELLO); + ti = proto_tree_add_text(tree, offset, (fd->cap_len - offset) , "OSPF Hello Packet"); + ospf_hello_tree = proto_item_add_subtree(ti, ETT_OSPF_HELLO); - proto_tree_add_item(ospf_hello_tree, offset , 4, "Network Mask: %s", ip_to_str((guint8 *) &ospfhello.network_mask)); - proto_tree_add_item(ospf_hello_tree, offset + 4, 2, "Hello Interval: %d seconds", ntohs(ospfhello.hellointervall)); + proto_tree_add_text(ospf_hello_tree, offset , 4, "Network Mask: %s", ip_to_str((guint8 *) &ospfhello.network_mask)); + proto_tree_add_text(ospf_hello_tree, offset + 4, 2, "Hello Interval: %d seconds", ntohs(ospfhello.hellointervall)); /* ATTENTION !!! no check for length of options string */ options_offset=0; @@ -194,18 +191,18 @@ dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, proto_tree *tre options_offset+=3; } - proto_tree_add_item(ospf_hello_tree, offset + 6, 1, "Options: %d (%s)", ospfhello.options, options); - proto_tree_add_item(ospf_hello_tree, offset + 7, 1, "Router Priority: %d", ospfhello.priority); - proto_tree_add_item(ospf_hello_tree, offset + 8, 4, "Router Dead Interval: %ld seconds", (long)ntohl(ospfhello.dead_interval)); - proto_tree_add_item(ospf_hello_tree, offset + 12, 4, "Designated Router: %s", ip_to_str((guint8 *) &ospfhello.drouter)); - proto_tree_add_item(ospf_hello_tree, offset + 16, 4, "Backup Designated Router: %s", ip_to_str((guint8 *) &ospfhello.bdrouter)); + proto_tree_add_text(ospf_hello_tree, offset + 6, 1, "Options: %d (%s)", ospfhello.options, options); + proto_tree_add_text(ospf_hello_tree, offset + 7, 1, "Router Priority: %d", ospfhello.priority); + proto_tree_add_text(ospf_hello_tree, offset + 8, 4, "Router Dead Interval: %ld seconds", (long)ntohl(ospfhello.dead_interval)); + proto_tree_add_text(ospf_hello_tree, offset + 12, 4, "Designated Router: %s", ip_to_str((guint8 *) &ospfhello.drouter)); + proto_tree_add_text(ospf_hello_tree, offset + 16, 4, "Backup Designated Router: %s", ip_to_str((guint8 *) &ospfhello.bdrouter)); offset+=20; while(((int)(fd->cap_len - offset)) >= 4){ printf("%d", fd->cap_len - offset); ospfneighbor=(guint32 *) &pd[offset]; - proto_tree_add_item(ospf_hello_tree, offset, 4, "Active Neighbor: %s", ip_to_str((guint8 *) ospfneighbor)); + proto_tree_add_text(ospf_hello_tree, offset, 4, "Active Neighbor: %s", ip_to_str((guint8 *) ospfneighbor)); offset+=4; } } @@ -225,11 +222,10 @@ dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, proto_tree *t memcpy(&ospf_dbd, &pd[offset], sizeof(e_ospf_dbd)); if (tree) { - ti = proto_tree_add_item(tree, offset, (fd->cap_len - offset) , "OSPF DB Description"); - ospf_db_desc_tree = proto_tree_new(); - proto_item_add_subtree(ti, ospf_db_desc_tree, ETT_OSPF_DESC); + ti = proto_tree_add_text(tree, offset, (fd->cap_len - offset) , "OSPF DB Description"); + ospf_db_desc_tree = proto_item_add_subtree(ti, ETT_OSPF_DESC); - proto_tree_add_item(ospf_db_desc_tree, offset, 2, "Interface MTU: %d", ntohs(ospf_dbd.interface_mtu) ); + proto_tree_add_text(ospf_db_desc_tree, offset, 2, "Interface MTU: %d", ntohs(ospf_dbd.interface_mtu) ); options_offset=0; @@ -254,7 +250,7 @@ dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, proto_tree *t options_offset+=3; } - proto_tree_add_item(ospf_db_desc_tree, offset + 2 , 1, "Options: %d (%s)", ospf_dbd.options, options ); + proto_tree_add_text(ospf_db_desc_tree, offset + 2 , 1, "Options: %d (%s)", ospf_dbd.options, options ); flags_offset=0; @@ -271,8 +267,8 @@ dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, proto_tree *t flags_offset+=3; } - proto_tree_add_item(ospf_db_desc_tree, offset + 3 , 1, "Flags: %d (%s)", ospf_dbd.flags, flags ); - proto_tree_add_item(ospf_db_desc_tree, offset + 4 , 4, "DD Sequence: %ld", (long)ntohl(ospf_dbd.dd_sequence) ); + proto_tree_add_text(ospf_db_desc_tree, offset + 3 , 1, "Flags: %d (%s)", ospf_dbd.flags, flags ); + proto_tree_add_text(ospf_db_desc_tree, offset + 4 , 4, "DD Sequence: %ld", (long)ntohl(ospf_dbd.dd_sequence) ); } /* LS Headers will be processed here */ /* skip to the end of DB-Desc header */ @@ -296,39 +292,38 @@ dissect_ospf_ls_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { while( ((int) ( fd->cap_len - offset)) >= OSPF_LS_REQ_LENGTH ){ memcpy(&ospf_lsr, &pd[offset], sizeof(e_ospf_ls_req)); - ti = proto_tree_add_item(tree, offset, OSPF_LS_REQ_LENGTH, "Link State Request"); - ospf_lsr_tree = proto_tree_new(); - proto_item_add_subtree(ti, ospf_lsr_tree, ETT_OSPF_LSR); + ti = proto_tree_add_text(tree, offset, OSPF_LS_REQ_LENGTH, "Link State Request"); + ospf_lsr_tree = proto_item_add_subtree(ti, ETT_OSPF_LSR); switch( ntohl( ospf_lsr.ls_type ) ){ case OSPF_LSTYPE_ROUTER: - proto_tree_add_item(ospf_lsr_tree, offset, 4, "LS Type: Router-LSA (%ld)", + proto_tree_add_text(ospf_lsr_tree, offset, 4, "LS Type: Router-LSA (%ld)", (long)ntohl( ospf_lsr.ls_type ) ); break; case OSPF_LSTYPE_NETWORK: - proto_tree_add_item(ospf_lsr_tree, offset, 4, "LS Type: Network-LSA (%ld)", + proto_tree_add_text(ospf_lsr_tree, offset, 4, "LS Type: Network-LSA (%ld)", (long)ntohl( ospf_lsr.ls_type ) ); break; case OSPF_LSTYPE_SUMMERY: - proto_tree_add_item(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (IP network) (%ld)", + proto_tree_add_text(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (IP network) (%ld)", (long)ntohl( ospf_lsr.ls_type ) ); break; case OSPF_LSTYPE_ASBR: - proto_tree_add_item(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (ASBR) (%ld)", + proto_tree_add_text(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (ASBR) (%ld)", (long)ntohl( ospf_lsr.ls_type ) ); break; case OSPF_LSTYPE_ASEXT: - proto_tree_add_item(ospf_lsr_tree, offset, 4, "LS Type: AS-External-LSA (ASBR) (%ld)", + proto_tree_add_text(ospf_lsr_tree, offset, 4, "LS Type: AS-External-LSA (ASBR) (%ld)", (long)ntohl( ospf_lsr.ls_type ) ); break; default: - proto_tree_add_item(ospf_lsr_tree, offset, 4, "LS Type: %ld (unknown)", + proto_tree_add_text(ospf_lsr_tree, offset, 4, "LS Type: %ld (unknown)", (long)ntohl( ospf_lsr.ls_type ) ); } - proto_tree_add_item(ospf_lsr_tree, offset + 4, 4, "Link State ID : %s", + proto_tree_add_text(ospf_lsr_tree, offset + 4, 4, "Link State ID : %s", ip_to_str((guint8 *) &(ospf_lsr.ls_id))); - proto_tree_add_item(ospf_lsr_tree, offset + 8, 4, "Advertising Router : %s", + proto_tree_add_text(ospf_lsr_tree, offset + 8, 4, "Advertising Router : %s", ip_to_str((guint8 *) &(ospf_lsr.adv_router))); offset+=12; @@ -346,11 +341,10 @@ dissect_ospf_ls_upd(const u_char *pd, int offset, frame_data *fd, proto_tree *tr memcpy(&upd_hdr, &pd[offset], sizeof(e_ospf_lsa_upd_hdr)); if (tree) { - ti = proto_tree_add_item(tree, offset, (fd->cap_len - offset) , "LS Update Packet"); - ospf_lsa_upd_tree = proto_tree_new(); - proto_item_add_subtree(ti, ospf_lsa_upd_tree, ETT_OSPF_LSA_UPD); + ti = proto_tree_add_text(tree, offset, (fd->cap_len - offset) , "LS Update Packet"); + ospf_lsa_upd_tree = proto_item_add_subtree(ti, ETT_OSPF_LSA_UPD); - proto_tree_add_item(ospf_lsa_upd_tree, offset, 4, "Nr oF LSAs: %ld", (long)ntohl(upd_hdr.lsa_nr) ); + proto_tree_add_text(ospf_lsa_upd_tree, offset, 4, "Nr oF LSAs: %ld", (long)ntohl(upd_hdr.lsa_nr) ); } /* skip to the beginning of the first LSA */ offset+=4; /* the LS Upd PAcket contains only a 32 bit #LSAs field */ @@ -427,29 +421,28 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { if(disassemble_body){ - ti = proto_tree_add_item(tree, offset, ntohs(lsa_hdr.length), + ti = proto_tree_add_text(tree, offset, ntohs(lsa_hdr.length), "%s (Type: %d)", lsa_type, lsa_hdr.ls_type); } else { - ti = proto_tree_add_item(tree, offset, OSPF_LSA_HEADER_LENGTH, "LSA Header"); + ti = proto_tree_add_text(tree, offset, OSPF_LSA_HEADER_LENGTH, "LSA Header"); } - ospf_lsa_tree = proto_tree_new(); - proto_item_add_subtree(ti, ospf_lsa_tree, ETT_OSPF_LSA); + ospf_lsa_tree = proto_item_add_subtree(ti, ETT_OSPF_LSA); - proto_tree_add_item(ospf_lsa_tree, offset, 2, "LS Age: %d seconds", ntohs(lsa_hdr.ls_age)); - proto_tree_add_item(ospf_lsa_tree, offset + 2, 1, "Options: %d ", lsa_hdr.options); - proto_tree_add_item(ospf_lsa_tree, offset + 3, 1, "LSA Type: %d (%s)", lsa_hdr.ls_type, lsa_type); + proto_tree_add_text(ospf_lsa_tree, offset, 2, "LS Age: %d seconds", ntohs(lsa_hdr.ls_age)); + proto_tree_add_text(ospf_lsa_tree, offset + 2, 1, "Options: %d ", lsa_hdr.options); + proto_tree_add_text(ospf_lsa_tree, offset + 3, 1, "LSA Type: %d (%s)", lsa_hdr.ls_type, lsa_type); - proto_tree_add_item(ospf_lsa_tree, offset + 4, 4, "Linke State ID: %s ", + proto_tree_add_text(ospf_lsa_tree, offset + 4, 4, "Linke State ID: %s ", ip_to_str((guint8 *) &(lsa_hdr.ls_id))); - proto_tree_add_item(ospf_lsa_tree, offset + 8, 4, "Advertising Router: %s ", + proto_tree_add_text(ospf_lsa_tree, offset + 8, 4, "Advertising Router: %s ", ip_to_str((guint8 *) &(lsa_hdr.adv_router))); - proto_tree_add_item(ospf_lsa_tree, offset + 12, 4, "LS Sequence Number: 0x%04lx ", + proto_tree_add_text(ospf_lsa_tree, offset + 12, 4, "LS Sequence Number: 0x%04lx ", (unsigned long)ntohl(lsa_hdr.ls_seq)); - proto_tree_add_item(ospf_lsa_tree, offset + 16, 2, "LS Checksum: %d ", ntohs(lsa_hdr.ls_checksum)); + proto_tree_add_text(ospf_lsa_tree, offset + 16, 2, "LS Checksum: %d ", ntohs(lsa_hdr.ls_checksum)); - proto_tree_add_item(ospf_lsa_tree, offset + 18, 2, "Length: %d ", ntohs(lsa_hdr.length)); + proto_tree_add_text(ospf_lsa_tree, offset + 18, 2, "Length: %d ", ntohs(lsa_hdr.length)); if(!disassemble_body){ return OSPF_LSA_HEADER_LENGTH; @@ -463,8 +456,8 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, memcpy(&router_lsa, &pd[offset], sizeof(e_ospf_router_lsa)); /* again: flags should be secified in detail */ - proto_tree_add_item(ospf_lsa_tree, offset, 1, "Flags: 0x%02x ", router_lsa.flags); - proto_tree_add_item(ospf_lsa_tree, offset + 2, 2, "Nr. of Links: %d ", + proto_tree_add_text(ospf_lsa_tree, offset, 1, "Flags: 0x%02x ", router_lsa.flags); + proto_tree_add_text(ospf_lsa_tree, offset + 2, 2, "Nr. of Links: %d ", ntohs(router_lsa.nr_links)); offset += 4; /* router_lsa.nr_links links follow @@ -496,17 +489,17 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, link_id="unknown link id"; } - proto_tree_add_item(ospf_lsa_tree, offset, 4, "%s: %s", link_id, + proto_tree_add_text(ospf_lsa_tree, offset, 4, "%s: %s", link_id, ip_to_str((guint8 *) &(router_data.link_id))); /* link_data should be specified in detail (e.g. network mask) (depends on link type)*/ - proto_tree_add_item(ospf_lsa_tree, offset + 4, 4, "Link Data: %s", + proto_tree_add_text(ospf_lsa_tree, offset + 4, 4, "Link Data: %s", ip_to_str((guint8 *) &(router_data.link_data))); - proto_tree_add_item(ospf_lsa_tree, offset + 8, 1, "Link Type: %d - %s", + proto_tree_add_text(ospf_lsa_tree, offset + 8, 1, "Link Type: %d - %s", router_data.link_type, link_type); - proto_tree_add_item(ospf_lsa_tree, offset + 9, 1, "Nr. of TOS metrics: %d", router_data.nr_tos); - proto_tree_add_item(ospf_lsa_tree, offset + 10, 2, "TOS 0 metric: %d", ntohs( router_data.tos0_metric )); + proto_tree_add_text(ospf_lsa_tree, offset + 9, 1, "Nr. of TOS metrics: %d", router_data.nr_tos); + proto_tree_add_text(ospf_lsa_tree, offset + 10, 2, "TOS 0 metric: %d", ntohs( router_data.tos0_metric )); offset += 12; @@ -517,7 +510,7 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, for(tos_counter = 1 ; link_counter <= ntohs(router_data.nr_tos); tos_counter++){ memcpy(&tos_data, &pd[offset], sizeof(e_ospf_router_metric)); - proto_tree_add_item(ospf_lsa_tree, offset, 1, "TOS: %d, Metric: %d", + proto_tree_add_text(ospf_lsa_tree, offset, 1, "TOS: %d, Metric: %d", tos_data.tos, ntohs(tos_data.metric)); offset += 4; } @@ -525,13 +518,13 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, break; case(OSPF_LSTYPE_NETWORK): memcpy(&network_lsa, &pd[offset], sizeof(e_ospf_network_lsa)); - proto_tree_add_item(ospf_lsa_tree, offset, 4, "Netmask: %s", + proto_tree_add_text(ospf_lsa_tree, offset, 4, "Netmask: %s", ip_to_str((guint8 *) &(network_lsa.network_mask))); offset += 4; while( ((int) (fd->cap_len - offset)) >= 4){ attached_router = (guint32 *) &pd[offset]; - proto_tree_add_item(ospf_lsa_tree, offset, 4, "Attached Router: %s", + proto_tree_add_text(ospf_lsa_tree, offset, 4, "Attached Router: %s", ip_to_str((guint8 *) attached_router)); offset += 4; } @@ -540,22 +533,22 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, /* Type 3 and 4 LSAs have the same format */ case(OSPF_LSTYPE_ASBR): memcpy(&summary_lsa, &pd[offset], sizeof(e_ospf_summary_lsa)); - proto_tree_add_item(ospf_lsa_tree, offset, 4, "Netmask: %s", + proto_tree_add_text(ospf_lsa_tree, offset, 4, "Netmask: %s", ip_to_str((guint8 *) &(summary_lsa.network_mask))); /* returns only the TOS 0 metric (even if there are more TOS metrics) */ break; case(OSPF_LSTYPE_ASEXT): memcpy(&summary_lsa, &pd[offset], sizeof(e_ospf_summary_lsa)); - proto_tree_add_item(ospf_lsa_tree, offset, 4, "Netmask: %s", + proto_tree_add_text(ospf_lsa_tree, offset, 4, "Netmask: %s", ip_to_str((guint8 *) &(summary_lsa.network_mask))); /* asext_lsa = (e_ospf_asexternal_lsa *) &pd[offset + 4]; */ memcpy(&asext_lsa, &pd[offset + 4], sizeof(asext_lsa)); if( (asext_lsa.options & 128) == 128 ) { /* check wether or not E bit is set */ - proto_tree_add_item(ospf_lsa_tree, offset, 1, + proto_tree_add_text(ospf_lsa_tree, offset, 1, "External Type: Type 2 (metric is larger than any other link state path)"); } else { - proto_tree_add_item(ospf_lsa_tree, offset + 4, 1, + proto_tree_add_text(ospf_lsa_tree, offset + 4, 1, "External Type: Type 1 (metric is specified in the same units as interface cost)"); } /* the metric field of a AS-external LAS is specified in 3 bytes -> not well aligned */ @@ -565,15 +558,15 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, /* erase the leading 8 bits (the dont belong to the metric */ asext_metric = ntohl(asext_metric) & 0x00ffffff ; - proto_tree_add_item(ospf_lsa_tree, offset + 5, 3,"Metric: %d", asext_metric); - proto_tree_add_item(ospf_lsa_tree, offset + 8, 4,"Forwarding Address: %s", + proto_tree_add_text(ospf_lsa_tree, offset + 5, 3,"Metric: %d", asext_metric); + proto_tree_add_text(ospf_lsa_tree, offset + 8, 4,"Forwarding Address: %s", ip_to_str((guint8 *) &(asext_lsa.gateway))); - proto_tree_add_item(ospf_lsa_tree, offset + 12, 4,"External Route Tag: %ld", (long)ntohl(asext_lsa.external_tag)); + proto_tree_add_text(ospf_lsa_tree, offset + 12, 4,"External Route Tag: %ld", (long)ntohl(asext_lsa.external_tag)); break; default: /* unknown LSA type */ - proto_tree_add_item(ospf_lsa_tree, offset, (fd->cap_len - offset), "Unknown LSA Type"); + proto_tree_add_text(ospf_lsa_tree, offset, (fd->cap_len - offset), "Unknown LSA Type"); } } /* return the length of this LSA */ |