Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Oct 2012 19:40:43 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r305848 - in head/net/openbgpd: . files
Message-ID:  <201210131940.q9DJeh4W093869@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Sat Oct 13 19:40:42 2012
New Revision: 305848
URL: http://svn.freebsd.org/changeset/ports/305848

Log:
  Update to 5.2.20121014.
  
  Feature safe:	yes

Added:
  head/net/openbgpd/files/patch-bgpctl_irr_asset.c   (contents, props changed)
  head/net/openbgpd/files/patch-bgpctl_irr_output.c   (contents, props changed)
  head/net/openbgpd/files/patch-bgpctl_mrtparser.c   (contents, props changed)
  head/net/openbgpd/files/patch-bgpctl_mrtparser.h   (contents, props changed)
  head/net/openbgpd/files/patch-bgpd_log.h   (contents, props changed)
  head/net/openbgpd/files/patch-bgpd_name2id.c   (contents, props changed)
Modified:
  head/net/openbgpd/Makefile
  head/net/openbgpd/files/patch-bgpctl_Makefile
  head/net/openbgpd/files/patch-bgpctl_bgpctl.8   (contents, props changed)
  head/net/openbgpd/files/patch-bgpctl_bgpctl.c
  head/net/openbgpd/files/patch-bgpctl_irr_parser.c
  head/net/openbgpd/files/patch-bgpctl_irr_prefix.c
  head/net/openbgpd/files/patch-bgpctl_irrfilter.c
  head/net/openbgpd/files/patch-bgpctl_irrfilter.h
  head/net/openbgpd/files/patch-bgpctl_parser.c
  head/net/openbgpd/files/patch-bgpctl_parser.h
  head/net/openbgpd/files/patch-bgpctl_whois.c
  head/net/openbgpd/files/patch-bgpd_Makefile   (contents, props changed)
  head/net/openbgpd/files/patch-bgpd_bgpd.8   (contents, props changed)
  head/net/openbgpd/files/patch-bgpd_bgpd.c
  head/net/openbgpd/files/patch-bgpd_bgpd.conf.5   (contents, props changed)
  head/net/openbgpd/files/patch-bgpd_bgpd.h   (contents, props changed)
  head/net/openbgpd/files/patch-bgpd_carp.c
  head/net/openbgpd/files/patch-bgpd_config.c
  head/net/openbgpd/files/patch-bgpd_control.c
  head/net/openbgpd/files/patch-bgpd_kroute.c
  head/net/openbgpd/files/patch-bgpd_log.c
  head/net/openbgpd/files/patch-bgpd_mrt.c
  head/net/openbgpd/files/patch-bgpd_mrt.h
  head/net/openbgpd/files/patch-bgpd_parse.y
  head/net/openbgpd/files/patch-bgpd_pfkey.c
  head/net/openbgpd/files/patch-bgpd_pftable.c
  head/net/openbgpd/files/patch-bgpd_printconf.c
  head/net/openbgpd/files/patch-bgpd_rde.c
  head/net/openbgpd/files/patch-bgpd_rde.h
  head/net/openbgpd/files/patch-bgpd_rde_attr.c
  head/net/openbgpd/files/patch-bgpd_rde_decide.c
  head/net/openbgpd/files/patch-bgpd_rde_filter.c
  head/net/openbgpd/files/patch-bgpd_rde_prefix.c
  head/net/openbgpd/files/patch-bgpd_rde_rib.c
  head/net/openbgpd/files/patch-bgpd_rde_update.c
  head/net/openbgpd/files/patch-bgpd_session.c
  head/net/openbgpd/files/patch-bgpd_session.h
  head/net/openbgpd/files/patch-bgpd_timer.c
  head/net/openbgpd/files/patch-bgpd_util.c
  head/net/openbgpd/files/patch-openbsd-compat_openbsd-compat.h

Modified: head/net/openbgpd/Makefile
==============================================================================
--- head/net/openbgpd/Makefile	Sat Oct 13 18:43:31 2012	(r305847)
+++ head/net/openbgpd/Makefile	Sat Oct 13 19:40:42 2012	(r305848)
@@ -1,13 +1,8 @@
-# New ports collection makefile for:	openbgpd
-# Date created:				May 10 2005
-# Whom:					Florent Thoumie <flz@FreeBSD.org>
-#
+# Created by: Florent Thoumie <flz@FreeBSD.org>
 # $FreeBSD$
-#
 
 PORTNAME=	openbgpd
-PORTVERSION=	4.9.20110612
-PORTREVISION=	1
+PORTVERSION=	5.2.20121014
 CATEGORIES=	net
 MASTER_SITES=	${MASTER_SITE_OPENBSD}
 MASTER_SITE_SUBDIR=	OpenBGPD
@@ -20,8 +15,9 @@ COMMENT=	Free implementation of the Bord
 
 CONFLICTS=	zebra-[0-9]* quagga-[0-9]*
 
-OPTIONS=	IPV6LLPEER \
-		"Support nexthop using IPv6 link-local address"	on
+OPTIONS_DEFINE=	IPV6LLPEER
+OPTIONS_DEFAULT=IPV6LLPEER
+IPV6LLPEER_DESC=Support nexthop using IPv6 link-local address
 
 .include <bsd.port.pre.mk>
 

Modified: head/net/openbgpd/files/patch-bgpctl_Makefile
==============================================================================
--- head/net/openbgpd/files/patch-bgpctl_Makefile	Sat Oct 13 18:43:31 2012	(r305847)
+++ head/net/openbgpd/files/patch-bgpctl_Makefile	Sat Oct 13 19:40:42 2012	(r305848)
@@ -2,10 +2,10 @@ Index: bgpctl/Makefile
 ===================================================================
 RCS file: /home/cvs/private/hrs/openbgpd/bgpctl/Makefile,v
 retrieving revision 1.1.1.1
-retrieving revision 1.3
-diff -u -p -r1.1.1.1 -r1.3
+retrieving revision 1.4
+diff -u -p -r1.1.1.1 -r1.4
 --- bgpctl/Makefile	30 Jun 2009 05:46:15 -0000	1.1.1.1
-+++ bgpctl/Makefile	2 Jul 2011 16:06:35 -0000	1.3
++++ bgpctl/Makefile	13 Oct 2012 18:35:56 -0000	1.4
 @@ -1,17 +1,18 @@
  #	$OpenBSD: Makefile,v 1.10 2007/12/20 17:08:48 henning Exp $
  
@@ -16,7 +16,8 @@ diff -u -p -r1.1.1.1 -r1.3
 -SRCS=	bgpctl.c parser.c buffer.c imsg.c util.c timer.c
 +SRCS=	bgpctl.c parser.c util.c timer.c
  SRCS+=	irrfilter.c whois.c irr_asset.c irr_prefix.c irr_output.c
- SRCS+=	irr_parser.c
+-SRCS+=	irr_parser.c
++SRCS+=	irr_parser.c mrtparser.c
 +SRCS+=	fmt_scaled.c imsg.c imsg-buffer.c
  CFLAGS+= -Wall
  CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes

Modified: head/net/openbgpd/files/patch-bgpctl_bgpctl.8
==============================================================================
--- head/net/openbgpd/files/patch-bgpctl_bgpctl.8	Sat Oct 13 18:43:31 2012	(r305847)
+++ head/net/openbgpd/files/patch-bgpctl_bgpctl.8	Sat Oct 13 19:40:42 2012	(r305848)
@@ -2,13 +2,13 @@ Index: bgpctl/bgpctl.8
 ===================================================================
 RCS file: /home/cvs/private/hrs/openbgpd/bgpctl/bgpctl.8,v
 retrieving revision 1.1.1.6
-retrieving revision 1.5
-diff -u -p -r1.1.1.6 -r1.5
+retrieving revision 1.6
+diff -u -p -r1.1.1.6 -r1.6
 --- bgpctl/bgpctl.8	14 Feb 2010 20:20:13 -0000	1.1.1.6
-+++ bgpctl/bgpctl.8	2 Jul 2011 16:06:35 -0000	1.5
++++ bgpctl/bgpctl.8	13 Oct 2012 18:35:56 -0000	1.6
 @@ -1,4 +1,4 @@
 -.\" $OpenBSD: bgpctl.8,v 1.49 2009/06/06 06:11:17 claudio Exp $
-+.\" $OpenBSD: bgpctl.8,v 1.52 2009/11/03 08:09:15 jmc Exp $
++.\" $OpenBSD: bgpctl.8,v 1.59 2012/05/27 20:49:42 jmc Exp $
  .\"
  .\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
  .\"
@@ -17,7 +17,7 @@ diff -u -p -r1.1.1.6 -r1.5
  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  .\"
 -.Dd $Mdocdate: June 6 2009 $
-+.Dd $Mdocdate: May 3 2010 $
++.Dd $Mdocdate: May 27 2012 $
  .Dt BGPCTL 8
  .Os
  .Sh NAME
@@ -71,7 +71,7 @@ diff -u -p -r1.1.1.6 -r1.5
  .It Cm neighbor Ar peer Cm up
  Take the BGP session to the specified neighbor up.
  .Ar peer
-@@ -98,8 +113,10 @@ Note that the neighbor is not obliged to
+@@ -98,12 +113,21 @@ Note that the neighbor is not obliged to
  all, even if it announced the route refresh capability.
  .Ar peer
  may be the neighbor's address or description.
@@ -83,7 +83,18 @@ diff -u -p -r1.1.1.6 -r1.5
  .It Cm network delete Ar prefix
  Remove the specified prefix from the list of announced networks.
  .It Cm network flush
-@@ -122,7 +139,7 @@ view of the Forwarding Information Base.
+ Remove all dynamically added prefixes from the list of announced networks.
++.It Cm network mrt file Ar file filter
++Import networks from an MRT table dump for debugging purposes.
++.Ar filter
++can be specified similarly to the
++.Ar show mrt
++command.
++Only networks matching the filter will be imported.
+ .It Cm network show Ar family
+ Show all announced networks.
+ .Ar family ,
+@@ -122,7 +146,7 @@ view of the Forwarding Information Base.
  can be an IP address, in which case the route to this address is shown,
  or a flag:
  .Pp
@@ -92,7 +103,7 @@ diff -u -p -r1.1.1.6 -r1.5
  .It Cm connected
  Show only connected routes.
  .It Cm static
-@@ -133,6 +150,14 @@ Show only routes originating from
+@@ -133,9 +157,81 @@ Show only routes originating from
  itself.
  .It Cm nexthop
  Show only routes required to reach a BGP nexthop.
@@ -107,7 +118,138 @@ diff -u -p -r1.1.1.6 -r1.5
  .El
  .It Cm show interfaces
  Show the interface states.
-@@ -243,10 +268,12 @@ and message counters.
++.It Xo
++.Cm show mrt
++.Op Ar options
++.Ar filter
++.Xc
++Show routes from an MRT table dump file.
++.Ar filter
++can be an IP address, a CIDR prefix, an AS filter, a combination or nothing:
++.Pp
++.Bl -tag -width "address/len all" -compact
++.It Ar address
++Show best matching route for address.
++.It Ar address Ns Li / Ns Ar len
++Show RIB entry for this CIDR prefix.
++.It Xo
++.Ar address Ns Li / Ns Ar len
++.Cm all
++.Xc
++Show all entries in the specified range.
++.\".It Ar address/len Cm longer-prefixes
++.It Cm as Ar as
++Show all entries with
++.Ar as
++anywhere in the AS path.
++.It Cm empty-as
++Show all entries that are internal routes with no AS's in the AS path.
++.It Cm neighbor Ar ip
++Show only entries from the specified peer.
++.It Cm peer-as Ar as
++Show all entries with
++.Ar as
++as leftmost AS.
++.It Cm source-as Ar as
++Show all entries with
++.Ar as
++as rightmost AS.
++.It Cm transit-as Ar as
++Show all entries with
++.Ar as
++anywhere but rightmost.
++.El
++.Pp
++Additionally, the following
++.Ar options
++are defined:
++.Pp
++.Bl -tag -width "file name" -compact
++.It Cm detail
++Show more detailed output for matching routes.
++.It Ar family
++Limit the output to the given address family.
++.It Cm file Ar name
++Read the MRT dump from file
++.Ar name
++instead of using stdin.
++.El
++.Pp
++Multiple options and filters can be used at the same time.
++.It Cm show summary
++Show a list of all neighbors, including information about the session state
++and message counters.
++.It Cm show summary terse
++Show a list of all neighbors, including information about the session state,
++in a terse format.
+ .It Cm show neighbor Ar peer modifier
+ Show detailed information about the neighbor identified by
+ .Ar peer ,
+@@ -183,33 +279,33 @@ Show all entries in the specified range.
+ Show all entries with
+ .Ar as
+ anywhere in the AS path.
+-.It Cm source-as Ar as
+-Show all entries with
+-.Ar as
+-as rightmost AS.
+-.It Cm transit-as Ar as
+-Show all entries with
+-.Ar as
+-anywhere but rightmost.
+-.It Cm peer-as Ar as
+-Show all entries with
+-.Ar as
+-as leftmost AS.
+-.It Cm empty-as
+-Show all entries that are internal routes with no AS's in the AS path.
+ .It Cm community Ar community
+ Show all entries with community
+ .Ar community .
++.It Cm empty-as
++Show all entries that are internal routes with no AS's in the AS path.
++.It Cm memory
++Show RIB memory statistics.
+ .It Cm neighbor Ar peer
+ Show only entries from the specified peer.
+-.It Cm table Ar rib
+-Show only entries from the specified RIB table.
++.It Cm peer-as Ar as
++Show all entries with
++.Ar as
++as leftmost AS.
++.It Cm source-as Ar as
++Show all entries with
++.Ar as
++as rightmost AS.
+ .It Cm summary
+ This is the same as the
+ .Ic show summary
+ command.
+-.It Cm memory
+-Show RIB memory statistics.
++.It Cm table Ar rib
++Show only entries from the specified RIB table.
++.It Cm transit-as Ar as
++Show all entries with
++.Ar as
++anywhere but rightmost.
+ .El
+ .Pp
+ Additionally, the following
+@@ -217,8 +313,10 @@ Additionally, the following
+ are defined:
+ .Pp
+ .Bl -tag -width "detail" -compact
++.It Cm selected
++Show only selected routes.
+ .It Cm detail
+-Show more detailed output for matched routes.
++Show more detailed output for matching routes.
+ .It Ar family
+ Limit the output to the given address family.
+ .It Cm in
+@@ -243,10 +341,12 @@ and message counters.
  .It Cm show summary terse
  Show a list of all neighbors, including information about the session state,
  in a terse format.
@@ -121,3 +263,25 @@ diff -u -p -r1.1.1.6 -r1.5
  default
  .Xr bgpd 8
  configuration file
+@@ -260,10 +360,19 @@ control socket
+ .Xr bgpd 8 ,
+ .Xr bgplg 8 ,
+ .Xr bgplgsh 8
++.Sh STANDARDS
+ .Rs
+-.%R RFC 2622
+-.%T "Routing Policy Specification Language (RPSL)"
++.%A C. Alaettinoglu
++.%A C. Villamizar
++.%A E. Gerich
++.%A D. Kessens
++.%A D. Meyer
++.%A T. Bates
++.%A D. Karrenberg
++.%A M. Terpstra
+ .%D June 1999
++.%R RFC 2622
++.%T Routing Policy Specification Language (RPSL)
+ .Re
+ .Sh HISTORY
+ The

Modified: head/net/openbgpd/files/patch-bgpctl_bgpctl.c
==============================================================================
--- head/net/openbgpd/files/patch-bgpctl_bgpctl.c	Sat Oct 13 18:43:31 2012	(r305847)
+++ head/net/openbgpd/files/patch-bgpctl_bgpctl.c	Sat Oct 13 19:40:42 2012	(r305848)
@@ -2,13 +2,12 @@ Index: bgpctl/bgpctl.c
 ===================================================================
 RCS file: /home/cvs/private/hrs/openbgpd/bgpctl/bgpctl.c,v
 retrieving revision 1.1.1.7
-retrieving revision 1.8
-diff -u -p -r1.1.1.7 -r1.8
+diff -u -p -r1.1.1.7 bgpctl.c
 --- bgpctl/bgpctl.c	14 Feb 2010 20:20:14 -0000	1.1.1.7
-+++ bgpctl/bgpctl.c	2 Jul 2011 16:06:35 -0000	1.8
++++ bgpctl/bgpctl.c	13 Oct 2012 18:49:31 -0000
 @@ -1,4 +1,4 @@
 -/*	$OpenBSD: bgpctl.c,v 1.142 2009/06/06 06:33:15 eric Exp $ */
-+/*	$OpenBSD: bgpctl.c,v 1.157 2010/03/08 17:02:19 claudio Exp $ */
++/*	$OpenBSD: bgpctl.c,v 1.165 2012/09/12 05:57:10 claudio Exp $ */
  
  /*
   * Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -44,23 +43,25 @@ diff -u -p -r1.1.1.7 -r1.8
  
  #include "bgpd.h"
  #include "session.h"
-@@ -38,6 +50,10 @@
+@@ -37,6 +49,11 @@
+ #include "log.h"
  #include "parser.h"
  #include "irrfilter.h"
- 
++#include "mrtparser.h"
++
 +#if defined(__FreeBSD__) /* FreeBSD has no LINK_STATE_IS_UP macro. */
 +#define LINK_STATE_IS_UP(_s)  ((_s) >= LINK_STATE_UP)
 +#endif /* defined(__FreeBSD__) */ 
-+
+ 
  enum neighbor_views {
  	NV_DEFAULT,
- 	NV_TIMERS
-@@ -50,12 +66,13 @@ int		 show_summary_msg(struct imsg *, in
+@@ -50,12 +67,14 @@ int		 show_summary_msg(struct imsg *, in
  int		 show_summary_terse_msg(struct imsg *, int);
  int		 show_neighbor_terse(struct imsg *);
  int		 show_neighbor_msg(struct imsg *, enum neighbor_views);
 -void		 print_neighbor_capa_mp_safi(u_int8_t);
 +void		 print_neighbor_capa_mp(struct peer *);
++void		 print_neighbor_capa_restart(struct peer *);
  void		 print_neighbor_msgstats(struct peer *);
  void		 print_timer(const char *, time_t);
  static char	*fmt_timeframe(time_t t);
@@ -70,7 +71,7 @@ diff -u -p -r1.1.1.7 -r1.8
  void		 show_network_head(void);
  void		 show_fib_flags(u_int16_t);
  int		 show_fib_msg(struct imsg *);
-@@ -65,7 +82,7 @@ void		 show_interface_head(void);
+@@ -65,7 +84,7 @@ void		 show_interface_head(void);
  int		 ift2ifm(int);
  const char *	 get_media_descr(int);
  const char *	 get_linkstate(int, int);
@@ -79,15 +80,34 @@ diff -u -p -r1.1.1.7 -r1.8
  int		 show_interface_msg(struct imsg *);
  void		 show_rib_summary_head(void);
  void		 print_prefix(struct bgpd_addr *, u_int8_t, u_int8_t);
-@@ -74,7 +91,6 @@ void		 print_flags(u_int8_t, int);
+@@ -73,16 +92,25 @@ const char *	 print_origin(u_int8_t, int
+ void		 print_flags(u_int8_t, int);
  int		 show_rib_summary_msg(struct imsg *);
  int		 show_rib_detail_msg(struct imsg *, int);
++void		 show_rib_brief(struct ctl_show_rib *, u_char *);
++void		 show_rib_detail(struct ctl_show_rib *, u_char *, int);
++void		 show_attr(void *, u_int16_t);
  void		 show_community(u_char *, u_int16_t);
 -const char	*get_ext_subtype(u_int8_t);
  void		 show_ext_community(u_char *, u_int16_t);
  char		*fmt_mem(int64_t);
  int		 show_rib_memory_msg(struct imsg *);
-@@ -98,7 +114,7 @@ int
+ void		 send_filterset(struct imsgbuf *, struct filter_set_head *);
+ static const char	*get_errstr(u_int8_t, u_int8_t);
+ int		 show_result(struct imsg *);
++void		 show_mrt_dump(struct mrt_rib *, struct mrt_peer *, void *);
++void		 network_mrt_dump(struct mrt_rib *, struct mrt_peer *, void *);
++void		 show_mrt_state(struct mrt_bgp_state *, void *);
++void		 show_mrt_msg(struct mrt_bgp_msg *, void *);
++void		 mrt_to_bgpd_addr(union mrt_addr *, struct bgpd_addr *);
+ 
+ struct imsgbuf	*ibuf;
++struct mrt_parser show_mrt = { show_mrt_dump, show_mrt_state, show_mrt_msg };
++struct mrt_parser net_mrt = { network_mrt_dump, NULL, NULL };
+ 
+ __dead void
+ usage(void)
+@@ -98,7 +126,7 @@ int
  main(int argc, char *argv[])
  {
  	struct sockaddr_un	 sun;
@@ -96,7 +116,7 @@ diff -u -p -r1.1.1.7 -r1.8
  	struct imsg		 imsg;
  	struct network_config	 net;
  	struct parse_result	*res;
-@@ -128,8 +144,11 @@ main(int argc, char *argv[])
+@@ -128,8 +156,11 @@ main(int argc, char *argv[])
  	if ((res = parse(argc, argv)) == NULL)
  		exit(1);
  
@@ -109,7 +129,16 @@ diff -u -p -r1.1.1.7 -r1.8
  
  	memcpy(&neighbor.addr, &res->peeraddr, sizeof(neighbor.addr));
  	strlcpy(neighbor.descr, res->peerdesc, sizeof(neighbor.descr));
-@@ -164,24 +183,32 @@ main(int argc, char *argv[])
+@@ -154,7 +185,7 @@ main(int argc, char *argv[])
+ 	case NONE:
+ 	case IRRFILTER:
+ 		usage();
+-		/* not reached */
++		/* NOTREACHED */
+ 	case SHOW:
+ 	case SHOW_SUMMARY:
+ 		imsg_compose(ibuf, IMSG_CTL_SHOW_NEIGHBOR, 0, 0, -1, NULL, 0);
+@@ -164,24 +195,32 @@ main(int argc, char *argv[])
  		imsg_compose(ibuf, IMSG_CTL_SHOW_TERSE, 0, 0, -1, NULL, 0);
  		break;
  	case SHOW_FIB:
@@ -151,7 +180,7 @@ diff -u -p -r1.1.1.7 -r1.8
  		show_nexthop_head();
  		break;
  	case SHOW_INTERFACE:
-@@ -192,7 +219,7 @@ main(int argc, char *argv[])
+@@ -192,7 +231,7 @@ main(int argc, char *argv[])
  	case SHOW_NEIGHBOR_TIMERS:
  	case SHOW_NEIGHBOR_TERSE:
  		neighbor.show_timers = (res->action == SHOW_NEIGHBOR_TIMERS);
@@ -160,7 +189,7 @@ diff -u -p -r1.1.1.7 -r1.8
  			imsg_compose(ibuf, IMSG_CTL_SHOW_NEIGHBOR, 0, 0, -1,
  			    &neighbor, sizeof(neighbor));
  		else
-@@ -206,7 +233,7 @@ main(int argc, char *argv[])
+@@ -206,7 +245,7 @@ main(int argc, char *argv[])
  			memcpy(&ribreq.as, &res->as, sizeof(res->as));
  			type = IMSG_CTL_SHOW_RIB_AS;
  		}
@@ -169,16 +198,46 @@ diff -u -p -r1.1.1.7 -r1.8
  			memcpy(&ribreq.prefix, &res->addr, sizeof(res->addr));
  			ribreq.prefixlen = res->prefixlen;
  			type = IMSG_CTL_SHOW_RIB_PREFIX;
-@@ -220,7 +247,7 @@ main(int argc, char *argv[])
- 		memcpy(&ribreq.neighbor, &neighbor,
- 		    sizeof(ribreq.neighbor));
+@@ -217,15 +256,35 @@ main(int argc, char *argv[])
+ 			    sizeof(res->community));
+ 			type = IMSG_CTL_SHOW_RIB_COMMUNITY;
+ 		}
+-		memcpy(&ribreq.neighbor, &neighbor,
+-		    sizeof(ribreq.neighbor));
++		memcpy(&ribreq.neighbor, &neighbor, sizeof(ribreq.neighbor));
  		strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib));
 -		ribreq.af = res->af;
 +		ribreq.aid = res->aid;
  		ribreq.flags = res->flags;
  		imsg_compose(ibuf, type, 0, 0, -1, &ribreq, sizeof(ribreq));
  		if (!(res->flags & F_CTL_DETAIL))
-@@ -237,12 +264,14 @@ main(int argc, char *argv[])
+ 			show_rib_summary_head();
+ 		break;
++	case SHOW_MRT:
++		close(fd);
++		bzero(&ribreq, sizeof(ribreq));
++		if (res->as.type != AS_NONE)
++			memcpy(&ribreq.as, &res->as, sizeof(res->as));
++		if (res->addr.aid) {
++			memcpy(&ribreq.prefix, &res->addr, sizeof(res->addr));
++			ribreq.prefixlen = res->prefixlen;
++		}
++		if (res->community.as != COMMUNITY_UNSET &&
++		    res->community.type != COMMUNITY_UNSET)
++			memcpy(&ribreq.community, &res->community,
++			    sizeof(res->community));
++		memcpy(&ribreq.neighbor, &neighbor, sizeof(ribreq.neighbor));
++		ribreq.aid = res->aid;
++		ribreq.flags = res->flags;
++		show_mrt.arg = &ribreq;
++		if (!(res->flags & F_CTL_DETAIL))
++			show_rib_summary_head();
++		mrt_parse(res->mrtfd, &show_mrt, 1);
++		exit(0);
+ 	case SHOW_RIB_MEM:
+ 		imsg_compose(ibuf, IMSG_CTL_SHOW_RIB_MEM, 0, 0, -1, NULL, 0);
+ 		break;
+@@ -237,12 +296,14 @@ main(int argc, char *argv[])
  		errx(1, "action==FIB");
  		break;
  	case FIB_COUPLE:
@@ -195,7 +254,7 @@ diff -u -p -r1.1.1.7 -r1.8
  		printf("decouple request sent.\n");
  		done = 1;
  		break;
-@@ -290,12 +319,21 @@ main(int argc, char *argv[])
+@@ -290,12 +351,40 @@ main(int argc, char *argv[])
  		break;
  	case NETWORK_SHOW:
  		bzero(&ribreq, sizeof(ribreq));
@@ -206,6 +265,25 @@ diff -u -p -r1.1.1.7 -r1.8
  		    &ribreq, sizeof(ribreq));
  		show_network_head();
  		break;
++	case NETWORK_MRT:
++		bzero(&ribreq, sizeof(ribreq));
++		if (res->as.type != AS_NONE)
++			memcpy(&ribreq.as, &res->as, sizeof(res->as));
++		if (res->addr.aid) {
++			memcpy(&ribreq.prefix, &res->addr, sizeof(res->addr));
++			ribreq.prefixlen = res->prefixlen;
++		}
++		if (res->community.as != COMMUNITY_UNSET &&
++		    res->community.type != COMMUNITY_UNSET)
++			memcpy(&ribreq.community, &res->community,
++			    sizeof(res->community));
++		memcpy(&ribreq.neighbor, &neighbor, sizeof(ribreq.neighbor));
++		ribreq.aid = res->aid;
++		ribreq.flags = res->flags;
++		net_mrt.arg = &ribreq;
++		mrt_parse(res->mrtfd, &net_mrt, 1);
++		done = 1;
++		break;
 +	case LOG_VERBOSE:
 +		verbose = 1;
 +		/* FALLTHROUGH */
@@ -218,7 +296,7 @@ diff -u -p -r1.1.1.7 -r1.8
  	}
  
  	while (ibuf->w.queued)
-@@ -304,13 +342,13 @@ main(int argc, char *argv[])
+@@ -304,13 +393,13 @@ main(int argc, char *argv[])
  
  	while (!done) {
  		if ((n = imsg_read(ibuf)) == -1)
@@ -234,7 +312,7 @@ diff -u -p -r1.1.1.7 -r1.8
  			if (n == 0)
  				break;
  
-@@ -329,6 +367,8 @@ main(int argc, char *argv[])
+@@ -329,6 +418,8 @@ main(int argc, char *argv[])
  				done = show_summary_terse_msg(&imsg, nodescr);
  				break;
  			case SHOW_FIB:
@@ -243,7 +321,7 @@ diff -u -p -r1.1.1.7 -r1.8
  				done = show_fib_msg(&imsg);
  				break;
  			case SHOW_NEXTHOP:
-@@ -356,9 +396,6 @@ main(int argc, char *argv[])
+@@ -356,9 +447,6 @@ main(int argc, char *argv[])
  			case SHOW_RIB_MEM:
  				done = show_rib_memory_msg(&imsg);
  				break;
@@ -253,16 +331,18 @@ diff -u -p -r1.1.1.7 -r1.8
  			case NEIGHBOR:
  			case NEIGHBOR_UP:
  			case NEIGHBOR_DOWN:
-@@ -373,6 +410,8 @@ main(int argc, char *argv[])
+@@ -373,6 +461,10 @@ main(int argc, char *argv[])
  			case NETWORK_REMOVE:
  			case NETWORK_FLUSH:
  			case IRRFILTER:
 +			case LOG_VERBOSE:
 +			case LOG_BRIEF:
++			case SHOW_MRT:
++			case NETWORK_MRT:
  				break;
  			}
  			imsg_free(&imsg);
-@@ -398,8 +437,8 @@ fmt_peer(const char *descr, const struct
+@@ -398,8 +490,8 @@ fmt_peer(const char *descr, const struct
  	}
  
  	ip = log_addr(remote_addr);
@@ -273,7 +353,27 @@ diff -u -p -r1.1.1.7 -r1.8
  		if (asprintf(&p, "%s/%u", ip, masklen) == -1)
  			err(1, NULL);
  	} else {
-@@ -521,13 +560,15 @@ show_neighbor_msg(struct imsg *imsg, enu
+@@ -430,7 +522,7 @@ show_summary_msg(struct imsg *imsg, int 
+ 		    p->conf.remote_masklen, nodescr);
+ 		if (strlen(s) >= 20)
+ 			s[20] = 0;
+-		printf("%-20s %8s %10llu %10llu %5u %-8s ",
++		printf("%-20s %8s %10" PRIu64 " %10" PRIu64 " %5u %-8s ",
+ 		    s, log_as(p->conf.remote_as),
+ 		    p->stats.msg_rcvd_open + p->stats.msg_rcvd_notification +
+ 		    p->stats.msg_rcvd_update + p->stats.msg_rcvd_keepalive +
+@@ -492,8 +584,8 @@ show_neighbor_terse(struct imsg *imsg)
+ 	switch (imsg->hdr.type) {
+ 	case IMSG_CTL_SHOW_NEIGHBOR:
+ 		p = imsg->data;
+-		printf("%llu %llu %llu %llu %llu %llu %llu "
+-		    "%llu %llu %llu %u %u %llu %llu %llu %llu\n",
++		printf("%" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " "
++		    "%" PRIu64 " %" PRIu64 " %" PRIu64 " %u %u %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 "\n",
+ 		    p->stats.msg_sent_open, p->stats.msg_rcvd_open,
+ 		    p->stats.msg_sent_notification,
+ 		    p->stats.msg_rcvd_notification,
+@@ -521,13 +613,15 @@ show_neighbor_msg(struct imsg *imsg, enu
  	struct ctl_timer	*t;
  	struct in_addr		 ina;
  	char			 buf[NI_MAXHOST], pbuf[NI_MAXSERV], *s;
@@ -291,7 +391,7 @@ diff -u -p -r1.1.1.7 -r1.8
  		    p->conf.remote_masklen != 128)) {
  			if (asprintf(&s, "%s/%u",
  			    log_addr(&p->conf.remote_addr),
-@@ -549,6 +590,10 @@ show_neighbor_msg(struct imsg *imsg, enu
+@@ -549,6 +643,10 @@ show_neighbor_msg(struct imsg *imsg, enu
  			printf(", Template");
  		if (p->conf.cloned)
  			printf(", Cloned");
@@ -302,7 +402,7 @@ diff -u -p -r1.1.1.7 -r1.8
  		printf("\n");
  		if (p->conf.descr[0])
  			printf(" Description: %s\n", p->conf.descr);
-@@ -563,17 +608,16 @@ show_neighbor_msg(struct imsg *imsg, enu
+@@ -563,22 +661,24 @@ show_neighbor_msg(struct imsg *imsg, enu
  		printf("  Last read %s, holdtime %us, keepalive interval %us\n",
  		    fmt_timeframe(p->stats.last_read),
  		    p->holdtime, p->holdtime/3);
@@ -313,7 +413,7 @@ diff -u -p -r1.1.1.7 -r1.8
 +			if (p->capa.peer.mp[i])
 +				hascapamp = 1;
 +		if (hascapamp || p->capa.peer.refresh ||
-+		    p->capa.peer.restart || p->capa.peer.as4byte) {
++		    p->capa.peer.grestart.restart || p->capa.peer.as4byte) {
  			printf("  Neighbor capabilities:\n");
 -			if (p->capa.peer.mp_v4) {
 -				printf("    Multiprotocol extensions: IPv4");
@@ -329,7 +429,17 @@ diff -u -p -r1.1.1.7 -r1.8
  			}
  			if (p->capa.peer.refresh)
  				printf("    Route Refresh\n");
-@@ -633,20 +677,16 @@ show_neighbor_msg(struct imsg *imsg, enu
+-			if (p->capa.peer.restart)
+-				printf("    Graceful Restart\n");
++			if (p->capa.peer.grestart.restart) {
++				printf("    Graceful Restart");
++				print_neighbor_capa_restart(p);
++				printf("\n");
++			}
+ 			if (p->capa.peer.as4byte)
+ 				printf("    4-byte AS numbers\n");
+ 		}
+@@ -633,20 +733,38 @@ show_neighbor_msg(struct imsg *imsg, enu
  }
  
  void
@@ -356,10 +466,67 @@ diff -u -p -r1.1.1.7 -r1.8
 +			printf("%s%s", comma ? ", " : "", aid2str(i));
 +			comma = 1;
 +		}
++}
++
++void
++print_neighbor_capa_restart(struct peer *p)
++{
++	int		comma;
++	u_int8_t	i;
++
++	if (p->capa.peer.grestart.timeout)
++		printf(": Timeout: %d, ", p->capa.peer.grestart.timeout);
++	for (i = 0, comma = 0; i < AID_MAX; i++)
++		if (p->capa.peer.grestart.flags[i] & CAPA_GR_PRESENT) {
++			if (!comma &&
++			    p->capa.peer.grestart.flags[i] & CAPA_GR_RESTART)
++				printf("restarted, ");
++			if (comma)
++				printf(", ");
++			printf("%s", aid2str(i));
++			if (p->capa.peer.grestart.flags[i] & CAPA_GR_FORWARD)
++				printf(" (preserved)");
++			comma = 1;
++		}
  }
  
  void
-@@ -680,7 +720,7 @@ print_neighbor_msgstats(struct peer *p)
+@@ -654,17 +772,17 @@ print_neighbor_msgstats(struct peer *p)
+ {
+ 	printf("  Message statistics:\n");
+ 	printf("  %-15s %-10s %-10s\n", "", "Sent", "Received");
+-	printf("  %-15s %10llu %10llu\n", "Opens",
++	printf("  %-15s %10" PRIu64 " %10" PRIu64 "\n", "Opens",
+ 	    p->stats.msg_sent_open, p->stats.msg_rcvd_open);
+-	printf("  %-15s %10llu %10llu\n", "Notifications",
++	printf("  %-15s %10" PRIu64 " %10" PRIu64 "\n", "Notifications",
+ 	    p->stats.msg_sent_notification, p->stats.msg_rcvd_notification);
+-	printf("  %-15s %10llu %10llu\n", "Updates",
++	printf("  %-15s %10" PRIu64 " %10" PRIu64 "\n", "Updates",
+ 	    p->stats.msg_sent_update, p->stats.msg_rcvd_update);
+-	printf("  %-15s %10llu %10llu\n", "Keepalives",
++	printf("  %-15s %10" PRIu64 " %10" PRIu64 "\n", "Keepalives",
+ 	    p->stats.msg_sent_keepalive, p->stats.msg_rcvd_keepalive);
+-	printf("  %-15s %10llu %10llu\n", "Route Refresh",
++	printf("  %-15s %10" PRIu64 " %10" PRIu64 "\n", "Route Refresh",
+ 	    p->stats.msg_sent_rrefresh, p->stats.msg_rcvd_rrefresh);
+-	printf("  %-15s %10llu %10llu\n\n", "Total",
++	printf("  %-15s %10" PRIu64 " %10" PRIu64 "\n\n", "Total",
+ 	    p->stats.msg_sent_open + p->stats.msg_sent_notification +
+ 	    p->stats.msg_sent_update + p->stats.msg_sent_keepalive +
+ 	    p->stats.msg_sent_rrefresh,
+@@ -673,14 +791,16 @@ print_neighbor_msgstats(struct peer *p)
+ 	    p->stats.msg_rcvd_rrefresh);
+ 	printf("  Update statistics:\n");
+ 	printf("  %-15s %-10s %-10s\n", "", "Sent", "Received");
+-	printf("  %-15s %10llu %10llu\n", "Updates",
++	printf("  %-15s %10" PRIu64 " %10" PRIu64 "\n", "Updates",
+ 	    p->stats.prefix_sent_update, p->stats.prefix_rcvd_update);
+-	printf("  %-15s %10llu %10llu\n", "Withdraws",
++	printf("  %-15s %10" PRIu64 " %10" PRIu64 "\n", "Withdraws",
+ 	    p->stats.prefix_sent_withdraw, p->stats.prefix_rcvd_withdraw);
++	printf("  %-15s %10" PRIu64 " %10" PRIu64 "\n", "End-of-Rib",
++	    p->stats.prefix_sent_eor, p->stats.prefix_rcvd_eor);
  }
  
  void
@@ -368,7 +535,7 @@ diff -u -p -r1.1.1.7 -r1.8
  {
  	printf("  %-20s ", name);
  
-@@ -745,6 +785,12 @@ show_fib_head(void)
+@@ -745,6 +865,12 @@ show_fib_head(void)
  }
  
  void
@@ -381,7 +548,7 @@ diff -u -p -r1.1.1.7 -r1.8
  show_network_head(void)
  {
  	printf("flags: S = Static\n");
-@@ -788,56 +834,44 @@ show_fib_flags(u_int16_t flags)
+@@ -788,56 +914,44 @@ show_fib_flags(u_int16_t flags)
  int
  show_fib_msg(struct imsg *imsg)
  {
@@ -456,7 +623,7 @@ diff -u -p -r1.1.1.7 -r1.8
  	default:
  		break;
  	}
-@@ -848,35 +882,70 @@ show_fib_msg(struct imsg *imsg)
+@@ -848,35 +962,70 @@ show_fib_msg(struct imsg *imsg)
  void
  show_nexthop_head(void)
  {
@@ -545,7 +712,7 @@ diff -u -p -r1.1.1.7 -r1.8
  		}
  		printf("\n");
  		break;
-@@ -898,9 +967,8 @@ show_interface_head(void)
+@@ -898,9 +1047,8 @@ show_interface_head(void)
  	    "Link state");
  }
  
@@ -557,7 +724,7 @@ diff -u -p -r1.1.1.7 -r1.8
  const struct ifmedia_description
  		ifm_type_descriptions[] = IFM_TYPE_DESCRIPTIONS;
  
-@@ -936,36 +1004,36 @@ get_media_descr(int media_type)
+@@ -936,36 +1084,36 @@ get_media_descr(int media_type)
  const char *
  get_linkstate(int media_type, int link_state)
  {
@@ -566,9 +733,7 @@ diff -u -p -r1.1.1.7 -r1.8
 -
 -	if (link_state == LINK_STATE_UNKNOWN)
 -		return ("unknown");
-+	const struct if_status_description *p;
-+	static char buf[8];
- 
+-
 -	for (i = 0; ifm_status_valid_list[i] != 0; i++)
 -		for (p = ifm_status_descriptions; p->ifms_valid != 0; p++) {
 -			if (p->ifms_type != media_type ||
@@ -578,7 +743,9 @@ diff -u -p -r1.1.1.7 -r1.8
 -				return (p->ifms_string[1]);
 -			return (p->ifms_string[0]);
 -		}
--
++	const struct if_status_description *p;
++	static char buf[8];
+ 
 -	return ("unknown link state");
 +	for (p = if_status_descriptions; p->ifs_string != NULL; p++) {
 +		if (LINK_STATE_DESC_MATCH(p, media_type, link_state))
@@ -597,26 +764,26 @@ diff -u -p -r1.1.1.7 -r1.8
 +
  	if (baudrate > IF_Gbps(1))
 -		printf("%llu GBit/s", baudrate / IF_Gbps(1));
-+		snprintf(bbuf, sizeof(bbuf), "%llu G%s",
++		snprintf(bbuf, sizeof(bbuf), "%" PRIu64 " G%s",
 +		    baudrate / IF_Gbps(1), unit);
  	else if (baudrate > IF_Mbps(1))
 -		printf("%llu MBit/s", baudrate / IF_Mbps(1));
-+		snprintf(bbuf, sizeof(bbuf), "%llu M%s",
++		snprintf(bbuf, sizeof(bbuf), "%" PRIu64 " M%s",
 +		    baudrate / IF_Mbps(1), unit);
  	else if (baudrate > IF_Kbps(1))
 -		printf("%llu KBit/s", baudrate / IF_Kbps(1));
-+		snprintf(bbuf, sizeof(bbuf), "%llu K%s",
++		snprintf(bbuf, sizeof(bbuf), "%" PRIu64 " K%s",
 +		    baudrate / IF_Kbps(1), unit);
  	else
 -		printf("%llu Bit/s", baudrate);
-+		snprintf(bbuf, sizeof(bbuf), "%llu %s",
++		snprintf(bbuf, sizeof(bbuf), "%" PRIu64 " %s",
 +		    baudrate, unit);
 +
 +	return (bbuf);
  }
  
  int
-@@ -982,17 +1050,12 @@ show_interface_msg(struct imsg *imsg)
+@@ -982,17 +1130,12 @@ show_interface_msg(struct imsg *imsg)
  		printf("%-15s", k->flags & IFF_UP ? "UP" : "");
  
  		if ((ifms_type = ift2ifm(k->media_type)) != 0)
@@ -639,16 +806,21 @@ diff -u -p -r1.1.1.7 -r1.8
  		printf("\n");
  		break;
  	case IMSG_CTL_END:
-@@ -1011,7 +1074,7 @@ show_rib_summary_head(void)
- 	printf(
- 	    "flags: * = Valid, > = Selected, I = via IBGP, A = Announced\n");
+@@ -1008,10 +1151,10 @@ show_interface_msg(struct imsg *imsg)
+ void
+ show_rib_summary_head(void)
+ {
+-	printf(
+-	    "flags: * = Valid, > = Selected, I = via IBGP, A = Announced\n");
++	printf("flags: * = Valid, > = Selected, I = via IBGP, A = Announced, "
++	    "S = Stale\n");
  	printf("origin: i = IGP, e = EGP, ? = Incomplete\n\n");
 -	printf("%-5s %-20s%-15s  %5s %5s %s\n", "flags", "destination",
 +	printf("%-5s %-20s %-15s  %5s %5s %s\n", "flags", "destination",
  	    "gateway", "lpref", "med", "aspath origin");
  }
  
-@@ -1049,26 +1112,26 @@ print_flags(u_int8_t flags, int sum)
+@@ -1049,26 +1192,30 @@ print_flags(u_int8_t flags, int sum)
  	char	*p = flagstr;
  
  	if (sum) {
@@ -659,6 +831,8 @@ diff -u -p -r1.1.1.7 -r1.8
 +		if (flags & F_PREF_INTERNAL)
  			*p++ = 'I';
 -		if (flags & F_RIB_ELIGIBLE)
++		if (flags & F_PREF_STALE)
++			*p++ = 'S';
 +		if (flags & F_PREF_ELIGIBLE)
  			*p++ = '*';
 -		if (flags & F_RIB_ACTIVE)
@@ -673,6 +847,8 @@ diff -u -p -r1.1.1.7 -r1.8
  		else
  			printf("external");
 -		if (flags & F_RIB_ELIGIBLE)
++		if (flags & F_PREF_STALE)
++			printf(", stale");
 +		if (flags & F_PREF_ELIGIBLE)
  			printf(", valid");
 -		if (flags & F_RIB_ACTIVE)
@@ -683,43 +859,192 @@ diff -u -p -r1.1.1.7 -r1.8
  			printf(", announced");
  	}
  }
-@@ -1085,7 +1148,7 @@ show_rib_summary_msg(struct imsg *imsg)
- 		memcpy(&rib, imsg->data, sizeof(rib));
+@@ -1077,27 +1224,14 @@ int
+ show_rib_summary_msg(struct imsg *imsg)
+ {
+ 	struct ctl_show_rib	 rib;
+-	char			*aspath;
+ 	u_char			*asdata;
  
- 		print_prefix(&rib.prefix, rib.prefixlen, rib.flags);
+ 	switch (imsg->hdr.type) {
+ 	case IMSG_CTL_SHOW_RIB:
+ 		memcpy(&rib, imsg->data, sizeof(rib));
+-
+-		print_prefix(&rib.prefix, rib.prefixlen, rib.flags);
 -		printf("%-15s ", log_addr(&rib.exit_nexthop));
-+		printf(" %-15s ", log_addr(&rib.exit_nexthop));
- 
- 		printf(" %5u %5u ", rib.local_pref, rib.med);
+-
+-		printf(" %5u %5u ", rib.local_pref, rib.med);
+-
+ 		asdata = imsg->data;
+ 		asdata += sizeof(struct ctl_show_rib);
+-		if (aspath_asprint(&aspath, asdata, rib.aspath_len) == -1)
+-			err(1, NULL);
+-		if (strlen(aspath) > 0)
+-			printf("%s ", aspath);
+-		free(aspath);
+-
+-		printf("%s\n", print_origin(rib.origin, 1));
++		show_rib_brief(&rib, asdata);
+ 		break;
+ 	case IMSG_CTL_END:
+ 		return (1);
+@@ -1112,108 +1246,21 @@ int
+ show_rib_detail_msg(struct imsg *imsg, int nodescr)
+ {
+ 	struct ctl_show_rib	 rib;
+-	struct in_addr		 id;
+-	char			*aspath, *s;
+-	u_char			*data;
+-	u_int32_t		 as;
+-	u_int16_t		 ilen, alen, ioff;
+-	u_int8_t		 flags, type;
+-	time_t			 now;
++	u_char			*asdata;
++	u_int16_t		 ilen;
  
-@@ -1189,8 +1252,8 @@ show_rib_detail_msg(struct imsg *imsg, i
- 		case ATTR_AGGREGATOR:
- 			memcpy(&as, data, sizeof(as));
- 			memcpy(&id, data + sizeof(as), sizeof(id));
+ 	switch (imsg->hdr.type) {
+ 	case IMSG_CTL_SHOW_RIB:
+ 		memcpy(&rib, imsg->data, sizeof(rib));
+-
+-		printf("\nBGP routing table entry for %s/%u\n",
+-		    log_addr(&rib.prefix), rib.prefixlen);
+-
+-		data = imsg->data;
+-		data += sizeof(struct ctl_show_rib);
+-		if (aspath_asprint(&aspath, data, rib.aspath_len) == -1)
+-			err(1, NULL);
+-		if (strlen(aspath) > 0)
+-			printf("    %s\n", aspath);
+-		free(aspath);
+-
+-		s = fmt_peer(rib.descr, &rib.remote_addr, -1, nodescr);
+-		printf("    Nexthop %s ", log_addr(&rib.exit_nexthop));
+-		printf("(via %s) from %s (", log_addr(&rib.true_nexthop), s);
+-		free(s);
+-		id.s_addr = htonl(rib.remote_id);
+-		printf("%s)\n", inet_ntoa(id));
+-
+-		printf("    Origin %s, metric %u, localpref %u, ",
+-		    print_origin(rib.origin, 0), rib.med, rib.local_pref);
+-		print_flags(rib.flags, 0);
+-
+-		now = time(NULL);
+-		if (now > rib.lastchange)
+-			now -= rib.lastchange;
+-		else
+-			now = 0;
+-
+-		printf("\n    Last update: %s ago\n",
+-		    fmt_timeframe_core(now));
++		asdata = imsg->data;
++		asdata += sizeof(struct ctl_show_rib);
++		show_rib_detail(&rib, asdata, nodescr);
+ 		break;
+ 	case IMSG_CTL_SHOW_RIB_ATTR:
+ 		ilen = imsg->hdr.len - IMSG_HEADER_SIZE;
+ 		if (ilen < 3)
+ 			errx(1, "bad IMSG_CTL_SHOW_RIB_ATTR received");
+-		data = imsg->data;
+-		flags = data[0];
+-		type = data[1];
+-
+-		/* get the attribute length */
+-		if (flags & ATTR_EXTLEN) {
+-			if (ilen < 4)
+-				errx(1, "bad IMSG_CTL_SHOW_RIB_ATTR received");
+-			memcpy(&alen, data+2, sizeof(u_int16_t));
+-			alen = ntohs(alen);
+-			data += 4;
+-			ilen -= 4;
+-		} else {
+-			alen = data[2];
+-			data += 3;
+-			ilen -= 3;
+-		}
+-		/* bad imsg len how can that happen!? */
+-		if (alen != ilen)
+-			errx(1, "bad IMSG_CTL_SHOW_RIB_ATTR received");
+-
+-		switch (type) {
+-		case ATTR_COMMUNITIES:
+-			printf("    Communities: ");
+-			show_community(data, alen);
+-			printf("\n");
+-			break;
+-		case ATTR_AGGREGATOR:
+-			memcpy(&as, data, sizeof(as));
+-			memcpy(&id, data + sizeof(as), sizeof(id));
 -			printf("    Aggregator: %s [%s]\n", 
 -			    log_as(htonl(as)), inet_ntoa(id));
-+			printf("    Aggregator: %s [%s]\n",
-+			    log_as(ntohl(as)), inet_ntoa(id));
- 			break;
- 		case ATTR_ORIGINATOR_ID:
- 			memcpy(&id, data, sizeof(id));
-@@ -1236,22 +1299,27 @@ fmt_mem(int64_t num)
- 	return (buf);
+-			break;
+-		case ATTR_ORIGINATOR_ID:
+-			memcpy(&id, data, sizeof(id));
+-			printf("    Originator Id: %s\n", inet_ntoa(id));
+-			break;
+-		case ATTR_CLUSTER_LIST:
+-			printf("    Cluster ID List:");
+-			for (ioff = 0; ioff + sizeof(id) <= ilen;
+-			    ioff += sizeof(id)) {
+-				memcpy(&id, data + ioff, sizeof(id));
+-				printf(" %s", inet_ntoa(id));

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210131940.q9DJeh4W093869>