forked from osmocom/wireshark
more updates to bgp dissector.
- separate tree for each message - added some comments - merged my code for OPEN message, mainly just terminology updates - searched all RFCs and defined known attributes from: Greg Hankins <gregh@cc.gatech.edu> svn path=/trunk/; revision=979
This commit is contained in:
parent
907090770c
commit
004607a3fe
8
AUTHORS
8
AUTHORS
|
@ -76,6 +76,8 @@ Didier Jorand <Didier.Jorand@alcatel.fr> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Jun-ichiro itojun Hagino <itojun@itojun.org> {
|
Jun-ichiro itojun Hagino <itojun@itojun.org> {
|
||||||
|
http://www.itojun.org/
|
||||||
|
|
||||||
IPv6 support
|
IPv6 support
|
||||||
RIPng support
|
RIPng support
|
||||||
IPsec support
|
IPsec support
|
||||||
|
@ -166,6 +168,12 @@ Warren Young <tangent@mail.com> {
|
||||||
"Print" button support in "Tools:Follow TCP Stream" window
|
"Print" button support in "Tools:Follow TCP Stream" window
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Greg Hankins <gregh@cc.gatech.edu> {
|
||||||
|
http://www.cc.gatech.edu/staff/h/Greg.Hankins/
|
||||||
|
|
||||||
|
updates to BGP (Border Gateway Protocol) support
|
||||||
|
}
|
||||||
|
|
||||||
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to
|
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to
|
||||||
give his permission to use his version of snprintf.c.
|
give his permission to use his version of snprintf.c.
|
||||||
|
|
||||||
|
|
78
packet-bgp.c
78
packet-bgp.c
|
@ -1,8 +1,19 @@
|
||||||
/* packet-bgp.c
|
/* packet-bgp.c
|
||||||
* 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.7 1999/11/02 00:11:58 itojun Exp $
|
* $Id: packet-bgp.c,v 1.8 1999/11/06 01:28:49 itojun Exp $
|
||||||
|
*
|
||||||
|
* Supports:
|
||||||
|
* RFC1771 A Border Gateway Protocol 4 (BGP-4)
|
||||||
|
* RFC2283 Multiprotocol Extensions for BGP-4
|
||||||
|
*
|
||||||
|
* TODO:
|
||||||
|
* RFC1863 A BGP/IDRP Route Server alternative to a full mesh routing
|
||||||
|
* RFC1965 Autonomous System Confederations for BGP
|
||||||
|
* RFC1997 BGP Communities Attribute
|
||||||
|
* RFC1998 An Application of the BGP Community Attribute in Multi-home Routing
|
||||||
|
* Destination Preference Attribute for BGP (work in progress)
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@unicom.net>
|
* By Gerald Combs <gerald@unicom.net>
|
||||||
|
@ -203,12 +214,16 @@ decode_prefix6(const u_char *pd, char *buf, int buflen)
|
||||||
return 1 + (plen + 7) / 8;
|
return 1 + (plen + 7) / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dissect a BGP OPEN message.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
dissect_bgp_open(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
dissect_bgp_open(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
||||||
{
|
{
|
||||||
struct bgp_open bgpo;
|
struct bgp_open bgpo; /* BGP OPEN message */
|
||||||
int hlen;
|
int hlen; /* message length */
|
||||||
|
|
||||||
|
/* snarf OPEN message */
|
||||||
memcpy(&bgpo, &pd[offset], sizeof(bgpo));
|
memcpy(&bgpo, &pd[offset], sizeof(bgpo));
|
||||||
hlen = ntohs(bgpo.bgpo_len);
|
hlen = ntohs(bgpo.bgpo_len);
|
||||||
|
|
||||||
|
@ -220,17 +235,19 @@ dissect_bgp_open(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
||||||
"My AS: %u", ntohs(bgpo.bgpo_myas));
|
"My AS: %u", ntohs(bgpo.bgpo_myas));
|
||||||
proto_tree_add_text(tree,
|
proto_tree_add_text(tree,
|
||||||
offset + offsetof(struct bgp_open, bgpo_holdtime), 2,
|
offset + offsetof(struct bgp_open, bgpo_holdtime), 2,
|
||||||
"Holdtime: %u", ntohs(bgpo.bgpo_holdtime));
|
"Hold Time: %u", ntohs(bgpo.bgpo_holdtime));
|
||||||
proto_tree_add_text(tree,
|
proto_tree_add_text(tree,
|
||||||
offset + offsetof(struct bgp_open, bgpo_id), 4,
|
offset + offsetof(struct bgp_open, bgpo_id), 4,
|
||||||
"ID: %s", ip_to_str((guint8 *)&bgpo.bgpo_id));
|
"BGP Identifier: %s", ip_to_str((guint8 *)&bgpo.bgpo_id));
|
||||||
proto_tree_add_text(tree,
|
proto_tree_add_text(tree,
|
||||||
offset + offsetof(struct bgp_open, bgpo_optlen), 1,
|
offset + offsetof(struct bgp_open, bgpo_optlen), 1,
|
||||||
"Option length: %u", bgpo.bgpo_optlen);
|
"Optional Parameters Length: %u %s", bgpo.bgpo_optlen,
|
||||||
|
(bgpo.bgpo_optlen == 1) ? "byte" : "bytes");
|
||||||
|
|
||||||
if (hlen > sizeof(struct bgp_open)) {
|
if (hlen > sizeof(struct bgp_open)) {
|
||||||
proto_tree_add_text(tree,
|
proto_tree_add_text(tree,
|
||||||
offset + sizeof(struct bgp_open), hlen - sizeof(struct bgp_open),
|
offset + sizeof(struct bgp_open), hlen - sizeof(struct bgp_open),
|
||||||
"Option data%s");
|
"Optional Parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,9 +671,9 @@ static void
|
||||||
dissect_bgp_notification(const u_char *pd, int offset, frame_data *fd,
|
dissect_bgp_notification(const u_char *pd, int offset, frame_data *fd,
|
||||||
proto_tree *tree)
|
proto_tree *tree)
|
||||||
{
|
{
|
||||||
struct bgp_notification bgpn;
|
struct bgp_notification bgpn; /* BGP NOTIFICATION message */
|
||||||
int hlen;
|
int hlen; /* message length */
|
||||||
char *p;
|
char *p; /* string pointer */
|
||||||
|
|
||||||
/* snarf message */
|
/* snarf message */
|
||||||
memcpy(&bgpn, &pd[offset], sizeof(bgpn));
|
memcpy(&bgpn, &pd[offset], sizeof(bgpn));
|
||||||
|
@ -695,19 +712,19 @@ dissect_bgp_notification(const u_char *pd, int offset, frame_data *fd,
|
||||||
void
|
void
|
||||||
dissect_bgp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
dissect_bgp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
||||||
{
|
{
|
||||||
proto_item *ti;
|
proto_item *ti; /* tree item */
|
||||||
proto_tree *bgp_tree;
|
proto_tree *bgp_tree; /* BGP packet tree */
|
||||||
proto_tree *bgp1_tree;
|
proto_tree *bgp1_tree; /* BGP message tree */
|
||||||
const u_char *p;
|
const u_char *p; /* packet offset pointer */
|
||||||
int l, i;
|
int l, i; /* tmp */
|
||||||
int found;
|
int found; /* number of BGP messages in packet */
|
||||||
static u_char marker[] = {
|
static u_char marker[] = { /* BGP message marker */
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
};
|
};
|
||||||
struct bgp bgp;
|
struct bgp bgp; /* BGP header */
|
||||||
int hlen;
|
int hlen; /* BGP header length */
|
||||||
char *typ;
|
char *typ; /* BGP message type */
|
||||||
|
|
||||||
if (check_col(fd, COL_PROTOCOL))
|
if (check_col(fd, COL_PROTOCOL))
|
||||||
col_add_str(fd, COL_PROTOCOL, "BGP");
|
col_add_str(fd, COL_PROTOCOL, "BGP");
|
||||||
|
@ -778,7 +795,24 @@ dissect_bgp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
||||||
ti = proto_tree_add_text(bgp_tree, offset + i, hlen,
|
ti = proto_tree_add_text(bgp_tree, offset + i, hlen,
|
||||||
"%s", typ);
|
"%s", typ);
|
||||||
}
|
}
|
||||||
bgp1_tree = proto_item_add_subtree(ti, ETT_BGP);
|
/* add a different tree for each message type */
|
||||||
|
switch (bgp.bgp_type) {
|
||||||
|
case BGP_OPEN:
|
||||||
|
bgp1_tree = proto_item_add_subtree(ti, ETT_BGP_OPEN);
|
||||||
|
break;
|
||||||
|
case BGP_UPDATE:
|
||||||
|
bgp1_tree = proto_item_add_subtree(ti, ETT_BGP_UPDATE);
|
||||||
|
break;
|
||||||
|
case BGP_NOTIFICATION:
|
||||||
|
bgp1_tree = proto_item_add_subtree(ti, ETT_BGP_NOTIFICATION);
|
||||||
|
break;
|
||||||
|
case BGP_KEEPALIVE:
|
||||||
|
bgp1_tree = proto_item_add_subtree(ti, ETT_BGP);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bgp1_tree = proto_item_add_subtree(ti, ETT_BGP);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
proto_tree_add_text(bgp1_tree, offset + i, BGP_MARKER_SIZE,
|
proto_tree_add_text(bgp1_tree, offset + i, BGP_MARKER_SIZE,
|
||||||
"Marker", NULL);
|
"Marker", NULL);
|
||||||
|
|
26
packet-bgp.h
26
packet-bgp.h
|
@ -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.2 1999/11/02 00:11:58 itojun Exp $
|
* $Id: packet-bgp.h,v 1.3 1999/11/06 01:28:50 itojun Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@unicom.net>
|
* By Gerald Combs <gerald@unicom.net>
|
||||||
|
@ -75,15 +75,21 @@ struct bgp_attr {
|
||||||
guint8 bgpa_type;
|
guint8 bgpa_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BGPTYPE_ORIGIN 1
|
#define BGPTYPE_ORIGIN 1 /* RFC1771 */
|
||||||
#define BGPTYPE_AS_PATH 2
|
#define BGPTYPE_AS_PATH 2 /* RFC1771 */
|
||||||
#define BGPTYPE_NEXT_HOP 3
|
#define BGPTYPE_NEXT_HOP 3 /* RFC1771 */
|
||||||
#define BGPTYPE_MULTI_EXIT_DISC 4
|
#define BGPTYPE_MULTI_EXIT_DISC 4 /* RFC1771 */
|
||||||
#define BGPTYPE_LOCAL_PREF 5
|
#define BGPTYPE_LOCAL_PREF 5 /* RFC1771 */
|
||||||
#define BGPTYPE_ATOMIC_AGGREGATE 6
|
#define BGPTYPE_ATOMIC_AGGREGATE 6 /* RFC1771 */
|
||||||
#define BGPTYPE_AGGREGATOR 7
|
#define BGPTYPE_AGGREGATOR 7 /* RFC1771 */
|
||||||
#define BGPTYPE_MP_REACH_NLRI 14 /* RFC2283 */
|
#define BGPTYPE_COMMUNITIES 8 /* RFC1997 */
|
||||||
#define BGPTYPE_MP_UNREACH_NLRI 15 /* RFC2283 */
|
#define BGPTYPE_ORIGINATOR_ID 9 /* RFC1998 */
|
||||||
|
#define BGPTYPE_CLUSTER_LIST 10 /* RFC1998 */
|
||||||
|
#define BGPTYPE_DPA 11 /* work in progress */
|
||||||
|
#define BGPTYPE_ADVERTISERS 12 /* RFC1863 */
|
||||||
|
#define BGPTYPE_RCID_PATH 13 /* RFC1863 */
|
||||||
|
#define BGPTYPE_MP_REACH_NLRI 14 /* RFC2283 */
|
||||||
|
#define BGPTYPE_MP_UNREACH_NLRI 15 /* RFC2283 */
|
||||||
|
|
||||||
/* RFC1700 address family numbers */
|
/* RFC1700 address family numbers */
|
||||||
#define AFNUM_INET 1
|
#define AFNUM_INET 1
|
||||||
|
|
8
packet.h
8
packet.h
|
@ -1,7 +1,7 @@
|
||||||
/* packet.h
|
/* packet.h
|
||||||
* Definitions for packet disassembly structures and routines
|
* Definitions for packet disassembly structures and routines
|
||||||
*
|
*
|
||||||
* $Id: packet.h,v 1.125 1999/11/05 07:16:22 guy Exp $
|
* $Id: packet.h,v 1.126 1999/11/06 01:28:50 itojun Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -277,6 +277,12 @@ enum {
|
||||||
ETT_BOOTP_OPTION,
|
ETT_BOOTP_OPTION,
|
||||||
ETT_IPv6,
|
ETT_IPv6,
|
||||||
ETT_BGP,
|
ETT_BGP,
|
||||||
|
ETT_BGP_OPEN,
|
||||||
|
ETT_BGP_UPDATE,
|
||||||
|
ETT_BGP_NOTIFICATION,
|
||||||
|
ETT_BGP_ATTRS,
|
||||||
|
ETT_BGP_ATTR,
|
||||||
|
ETT_BGP_NLRI,
|
||||||
ETT_CLNP,
|
ETT_CLNP,
|
||||||
ETT_COTP,
|
ETT_COTP,
|
||||||
ETT_VINES_FRP,
|
ETT_VINES_FRP,
|
||||||
|
|
Loading…
Reference in New Issue