Ethereal-dev: [Ethereal-dev] Graceful Restart for BGP Dissector support
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Hannes Gredler <hannes@xxxxxxxxxxx>
Date: Fri, 11 Oct 2002 15:17:57 +0200
hi ethereeal developers, pls find attached a patch that dissects the graceful restart capability in BGP OPEN Messages; /hannes
Index: packet-bgp.h =================================================================== RCS file: /cvsroot/ethereal/packet-bgp.h,v retrieving revision 1.20 diff -u -r1.20 packet-bgp.h --- packet-bgp.h 2002/08/28 21:00:08 1.20 +++ packet-bgp.h 2002/10/11 13:14:33 @@ -106,11 +106,12 @@ #define BGP_OPTION_CAPABILITY 2 /* RFC2842 */ /* BGP capability code */ -#define BGP_CAPABILITY_RESERVED 0 /* RFC2434 */ -#define BGP_CAPABILITY_MULTIPROTOCOL 1 /* RFC2858 */ -#define BGP_CAPABILITY_ROUTE_REFRESH 2 /* RFC2918 */ -#define BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING 3 /* draft-ietf-idr-route-filter-04.txt */ -#define BGP_CAPABILITY_ORF_CISCO 0x82 /* Cisco */ +#define BGP_CAPABILITY_RESERVED 0 /* RFC2434 */ +#define BGP_CAPABILITY_MULTIPROTOCOL 1 /* RFC2858 */ +#define BGP_CAPABILITY_ROUTE_REFRESH 2 /* RFC2918 */ +#define BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING 3 /* draft-ietf-idr-route-filter-04.txt */ +#define BGP_CAPABILITY_GRACEFUL_RESTART 0x40 /* draft-ietf-idr-restart-05 */ +#define BGP_CAPABILITY_ORF_CISCO 0x82 /* Cisco */ #define BGP_CAPABILITY_ROUTE_REFRESH_CISCO 0x80 /* Cisco */ #define BGP_ORF_PREFIX_CISCO 0x80 /* Cisco */ Index: packet-bgp.c =================================================================== RCS file: /cvsroot/ethereal/packet-bgp.c,v retrieving revision 1.68 diff -u -r1.68 packet-bgp.c --- packet-bgp.c 2002/10/10 01:36:53 1.68 +++ packet-bgp.c 2002/10/11 13:14:47 @@ -202,7 +202,7 @@ { SAFNUM_UNICAST, "Unicast" }, { SAFNUM_MULCAST, "Multicast" }, { SAFNUM_UNIMULC, "Unicast+Multicast" }, - { SAFNUM_MPLS_LABEL, "MPLS Labeled Prefix"}, + { SAFNUM_MPLS_LABEL, "Labeled Unicast"}, { SAFNUM_LAB_VPNUNICAST, "Labeled VPN Unicast" }, /* draft-rosen-rfc2547bis-03 */ { SAFNUM_LAB_VPNMULCAST, "Labeled VPN Multicast" }, { SAFNUM_LAB_VPNUNIMULC, "Labeled VPN Unicast+Multicast" }, @@ -674,7 +674,7 @@ int ptype; /* parameter type */ int plen; /* parameter length */ int ctype; /* capability type */ - int clen; /* capability length */ + int clen,tclen;/* capability length */ int cend; /* capabilities end */ int ostart; /* options start */ int oend; /* options end */ @@ -813,6 +813,62 @@ i >= 128 ? "Vendor specific" : "Unknown"), i); p++; } + break; + case BGP_CAPABILITY_GRACEFUL_RESTART: + ti = proto_tree_add_text(subtree1, tvb, p - 2, + 2 + clen, "Graceful Restart capability (%u %s)", 2 + clen, + (clen == 1) ? "byte" : "bytes"); + subtree2 = proto_item_add_subtree(ti, ett_bgp_option); + proto_tree_add_text(subtree2, tvb, p - 2, + 1, "Capability code: Graceful Restart (%d)", ctype); + if (clen < 6) { + proto_tree_add_text(subtree2, tvb, p, + clen, "Capability value: Invalid"); + } + else { + proto_tree_add_text(subtree2, tvb, p - 1, + 1, "Capability length: %u %s", clen, + (clen == 1) ? "byte" : "bytes"); + ti = proto_tree_add_text(subtree2, tvb, p, + clen, "Capability value"); + subtree3 = proto_item_add_subtree(ti, + ett_bgp_option); + /* Timers */ + i = tvb_get_ntohs(tvb, p); + proto_tree_add_text(subtree3, tvb, p, + 2, "Restart Flags: [%s], Restart Time %us", + (i&0x8000) ? "R" : "none", + i&0xfff); + p += 2; + tclen=clen-2; + /* + * what follows is alist of AFI/SAFI/flag triplets + * read it until the TLV ends + */ + while(tclen >=4) { + /* AFI */ + i = tvb_get_ntohs(tvb, p); + proto_tree_add_text(subtree3, tvb, p, + 2, "Address family identifier: %s (%u)", + val_to_str(i, afn_vals, "Unknown"), i); + p += 2; + /* SAFI */ + i = tvb_get_guint8(tvb, p); + proto_tree_add_text(subtree3, tvb, p, + 1, "Subsequent address family identifier: %s (%u)", + val_to_str(i, bgpattr_nlri_safi, + i >= 128 ? "Vendor specific" : "Unknown"), i); + p++; + /* flags */ + i = tvb_get_guint8(tvb, p); + proto_tree_add_text(subtree3, tvb, p, + 1, "Preserve forwarding state: %s", + (i&0x80) ? "yes" : "no"); + p++; + tclen-=4; + } + } + p += clen; break; case BGP_CAPABILITY_ROUTE_REFRESH_CISCO: case BGP_CAPABILITY_ROUTE_REFRESH:
- Follow-Ups:
- Re: [Ethereal-dev] Graceful Restart for BGP Dissector support
- From: Guy Harris
- Re: [Ethereal-dev] Graceful Restart for BGP Dissector support
- Prev by Date: [Ethereal-dev] Changing tap code not to call "epan_dissect_run()" one more time?
- Next by Date: Re: [Ethereal-dev] Novell NDS decodes
- Previous by thread: Re: [Ethereal-dev] Changing tap code not to call "epan_dissect_run()" one more time?
- Next by thread: Re: [Ethereal-dev] Graceful Restart for BGP Dissector support
- Index(es):