Just use "val_to_str()" to generate names for communities whose values
are in the reserved region (which also fixes a bug where we weren't printing the value for the NO_ADVERTISE community correctly). svn path=/trunk/; revision=4638
This commit is contained in:
parent
595513d5cc
commit
8dc27bb184
37
packet-bgp.c
37
packet-bgp.c
|
@ -2,7 +2,7 @@
|
||||||
* Routines for BGP packet dissection.
|
* Routines for BGP packet dissection.
|
||||||
* Copyright 1999, Jun-ichiro itojun Hagino <itojun@itojun.org>
|
* Copyright 1999, Jun-ichiro itojun Hagino <itojun@itojun.org>
|
||||||
*
|
*
|
||||||
* $Id: packet-bgp.c,v 1.53 2002/01/21 07:36:32 guy Exp $
|
* $Id: packet-bgp.c,v 1.54 2002/01/30 23:04:02 guy Exp $
|
||||||
*
|
*
|
||||||
* Supports:
|
* Supports:
|
||||||
* RFC1771 A Border Gateway Protocol 4 (BGP-4)
|
* RFC1771 A Border Gateway Protocol 4 (BGP-4)
|
||||||
|
@ -492,6 +492,13 @@ decode_prefix_MP(guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, char *buf
|
||||||
/*
|
/*
|
||||||
* Dissect a BGP OPEN message.
|
* Dissect a BGP OPEN message.
|
||||||
*/
|
*/
|
||||||
|
static const value_string community_vals[] = {
|
||||||
|
{ BGP_COMM_NO_EXPORT, "NO_EXPORT" },
|
||||||
|
{ BGP_COMM_NO_ADVERTISE, "NO_ADVERTISE" },
|
||||||
|
{ BGP_COMM_NO_EXPORT_SUBCONFED, "NO_EXPORT_SUBCONFED" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dissect_bgp_open(tvbuff_t *tvb, int offset, proto_tree *tree)
|
dissect_bgp_open(tvbuff_t *tvb, int offset, proto_tree *tree)
|
||||||
{
|
{
|
||||||
|
@ -1309,28 +1316,16 @@ dissect_bgp_update(tvbuff_t *tvb, int offset, proto_tree *tree)
|
||||||
/* snarf each community */
|
/* snarf each community */
|
||||||
while (q < end) {
|
while (q < end) {
|
||||||
/* check for reserved values */
|
/* check for reserved values */
|
||||||
if (tvb_get_ntohs(tvb, q) == FOURHEX0 || tvb_get_ntohs(tvb, q) == FOURHEXF) {
|
guint32 community = tvb_get_ntohl(tvb, q);
|
||||||
/* check for well-known communities */
|
if ((community & 0xFFFF0000) == FOURHEX0 ||
|
||||||
if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_EXPORT)
|
(community & 0xFFFF0000) == FOURHEXF) {
|
||||||
proto_tree_add_text(communities_tree, tvb,
|
proto_tree_add_text(communities_tree, tvb,
|
||||||
q - 3 + aoff, 4,
|
q - 3 + aoff, 4,
|
||||||
"Community: NO_EXPORT (0x%x)", tvb_get_ntohl(tvb, q));
|
"Community: %s (0x%08x)",
|
||||||
else if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_ADVERTISE)
|
val_to_str(community, community_vals, "(reserved)"),
|
||||||
proto_tree_add_text(communities_tree, tvb,
|
community);
|
||||||
q - 3 + aoff, 4,
|
|
||||||
"Community: NO_ADVERTISE (0x%x)", pntohl(q));
|
|
||||||
else if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_EXPORT_SUBCONFED)
|
|
||||||
proto_tree_add_text(communities_tree, tvb,
|
|
||||||
q - 3 + aoff, 4,
|
|
||||||
"Community: NO_EXPORT_SUBCONFED (0x%x)",
|
|
||||||
tvb_get_ntohl(tvb, q));
|
|
||||||
else
|
|
||||||
proto_tree_add_text(communities_tree, tvb,
|
|
||||||
q - 3 + aoff, 4,
|
|
||||||
"Community (reserved): 0x%x", tvb_get_ntohl(tvb, q));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
ti = proto_tree_add_text(communities_tree, tvb,
|
ti = proto_tree_add_text(communities_tree, tvb,
|
||||||
q - 3 + aoff, 4, "Community: %u:%u",
|
q - 3 + aoff, 4, "Community: %u:%u",
|
||||||
tvb_get_ntohs(tvb, q), tvb_get_ntohs(tvb, q + 2));
|
tvb_get_ntohs(tvb, q), tvb_get_ntohs(tvb, q + 2));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet-bgp.c
|
/* packet-bgp.c
|
||||||
* Definitions for BGP packet disassembly structures and routine
|
* Definitions for BGP packet disassembly structures and routine
|
||||||
*
|
*
|
||||||
* $Id: packet-bgp.h,v 1.16 2001/11/03 21:25:12 guy Exp $
|
* $Id: packet-bgp.h,v 1.17 2002/01/30 23:04:02 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -117,8 +117,8 @@ struct bgp_attr {
|
||||||
#define BGP_COMM_NO_EXPORT 0xFFFFFF01
|
#define BGP_COMM_NO_EXPORT 0xFFFFFF01
|
||||||
#define BGP_COMM_NO_ADVERTISE 0xFFFFFF02
|
#define BGP_COMM_NO_ADVERTISE 0xFFFFFF02
|
||||||
#define BGP_COMM_NO_EXPORT_SUBCONFED 0xFFFFFF03
|
#define BGP_COMM_NO_EXPORT_SUBCONFED 0xFFFFFF03
|
||||||
#define FOURHEX0 0x0000
|
#define FOURHEX0 0x00000000
|
||||||
#define FOURHEXF 0xFFFF
|
#define FOURHEXF 0xFFFF0000
|
||||||
|
|
||||||
/* attribute types */
|
/* attribute types */
|
||||||
#define BGPTYPE_ORIGIN 1 /* RFC1771 */
|
#define BGPTYPE_ORIGIN 1 /* RFC1771 */
|
||||||
|
|
Loading…
Reference in New Issue