From Hannes Gredler: dissect the graceful restart capability in BGP OPEN

messages.

svn path=/trunk/; revision=6430
This commit is contained in:
Guy Harris 2002-10-15 17:19:06 +00:00
parent 01bd6435e4
commit a03e90ad09
2 changed files with 66 additions and 9 deletions

View File

@ -2,7 +2,7 @@
* Routines for BGP packet dissection.
* Copyright 1999, Jun-ichiro itojun Hagino <itojun@itojun.org>
*
* $Id: packet-bgp.c,v 1.70 2002/10/15 03:47:47 gerald Exp $
* $Id: packet-bgp.c,v 1.71 2002/10/15 17:19:06 guy Exp $
*
* Supports:
* RFC1771 A Border Gateway Protocol 4 (BGP-4)
@ -202,7 +202,7 @@ static const value_string bgpattr_nlri_safi[] = {
{ 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 @@ dissect_bgp_open(tvbuff_t *tvb, int offset, proto_tree *tree)
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 */
@ -814,6 +814,62 @@ dissect_bgp_open(tvbuff_t *tvb, int offset, proto_tree *tree)
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:
ti = proto_tree_add_text(subtree1, tvb, p - 2,

View File

@ -1,7 +1,7 @@
/* packet-bgp.c
* Definitions for BGP packet disassembly structures and routine
*
* $Id: packet-bgp.h,v 1.21 2002/10/15 03:47:47 gerald Exp $
* $Id: packet-bgp.h,v 1.22 2002/10/15 17:19:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -99,11 +99,12 @@ struct bgp_attr {
#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 */