svn commit: r503421 - in head/net/openbgpd: . files

Kurt Jaeger pi at FreeBSD.org
Mon Jun 3 20:08:39 UTC 2019


Author: pi
Date: Mon Jun  3 20:08:36 2019
New Revision: 503421
URL: https://svnweb.freebsd.org/changeset/ports/503421

Log:
  net/openbgpd: revert upgrade from 6.5p0 to 5.2.20121209
  
  - openbgpd version 6.5p0 was the "portable" version, which specifically
    does *not* support kernel routing updates.
  - Therefore this is only suitable for route servers/collectors, not
    for production use in routers. This significantly violates POLA :)
  
  PR:		213445
  Submitted by:	Oliver H <oliver at watershed.co.uk>

Added:
  head/net/openbgpd/files/patch-Makefile
     - copied unchanged from r503177, head/net/openbgpd/files/patch-Makefile
  head/net/openbgpd/files/patch-Makefile.inc
     - copied unchanged from r503177, head/net/openbgpd/files/patch-Makefile.inc
  head/net/openbgpd/files/patch-bgpctl_Makefile
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_Makefile
  head/net/openbgpd/files/patch-bgpctl_bgpctl.8
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_bgpctl.8
  head/net/openbgpd/files/patch-bgpctl_bgpctl.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_bgpctl.c
  head/net/openbgpd/files/patch-bgpctl_irr_asset.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_irr_asset.c
  head/net/openbgpd/files/patch-bgpctl_irr_output.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_irr_output.c
  head/net/openbgpd/files/patch-bgpctl_irr_parser.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_irr_parser.c
  head/net/openbgpd/files/patch-bgpctl_irr_prefix.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_irr_prefix.c
  head/net/openbgpd/files/patch-bgpctl_irrfilter.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_irrfilter.c
  head/net/openbgpd/files/patch-bgpctl_irrfilter.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_irrfilter.h
  head/net/openbgpd/files/patch-bgpctl_mrtparser.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_mrtparser.c
  head/net/openbgpd/files/patch-bgpctl_mrtparser.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_mrtparser.h
  head/net/openbgpd/files/patch-bgpctl_parser.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_parser.c
  head/net/openbgpd/files/patch-bgpctl_parser.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_parser.h
  head/net/openbgpd/files/patch-bgpctl_whois.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpctl_whois.c
  head/net/openbgpd/files/patch-bgpd_Makefile
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_Makefile
  head/net/openbgpd/files/patch-bgpd_bgpd.8
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_bgpd.8
  head/net/openbgpd/files/patch-bgpd_bgpd.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_bgpd.c
  head/net/openbgpd/files/patch-bgpd_bgpd.conf.5
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_bgpd.conf.5
  head/net/openbgpd/files/patch-bgpd_bgpd.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_bgpd.h
  head/net/openbgpd/files/patch-bgpd_buffer.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_buffer.c
  head/net/openbgpd/files/patch-bgpd_carp.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_carp.c
  head/net/openbgpd/files/patch-bgpd_config.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_config.c
  head/net/openbgpd/files/patch-bgpd_control.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_control.c
  head/net/openbgpd/files/patch-bgpd_imsg.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_imsg.c
  head/net/openbgpd/files/patch-bgpd_imsg.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_imsg.h
  head/net/openbgpd/files/patch-bgpd_kroute.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_kroute.c
  head/net/openbgpd/files/patch-bgpd_log.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_log.c
  head/net/openbgpd/files/patch-bgpd_log.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_log.h
  head/net/openbgpd/files/patch-bgpd_mrt.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_mrt.c
  head/net/openbgpd/files/patch-bgpd_mrt.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_mrt.h
  head/net/openbgpd/files/patch-bgpd_name2id.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_name2id.c
  head/net/openbgpd/files/patch-bgpd_parse.y
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_parse.y
  head/net/openbgpd/files/patch-bgpd_pfkey.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_pfkey.c
  head/net/openbgpd/files/patch-bgpd_pftable.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_pftable.c
  head/net/openbgpd/files/patch-bgpd_printconf.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_printconf.c
  head/net/openbgpd/files/patch-bgpd_rde.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_rde.c
  head/net/openbgpd/files/patch-bgpd_rde.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_rde.h
  head/net/openbgpd/files/patch-bgpd_rde_attr.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_rde_attr.c
  head/net/openbgpd/files/patch-bgpd_rde_decide.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_rde_decide.c
  head/net/openbgpd/files/patch-bgpd_rde_filter.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_rde_filter.c
  head/net/openbgpd/files/patch-bgpd_rde_prefix.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_rde_prefix.c
  head/net/openbgpd/files/patch-bgpd_rde_rib.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_rde_rib.c
  head/net/openbgpd/files/patch-bgpd_rde_update.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_rde_update.c
  head/net/openbgpd/files/patch-bgpd_session.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_session.c
  head/net/openbgpd/files/patch-bgpd_session.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_session.h
  head/net/openbgpd/files/patch-bgpd_timer.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_timer.c
  head/net/openbgpd/files/patch-bgpd_util.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-bgpd_util.c
  head/net/openbgpd/files/patch-openbsd-compat_fmt_scaled.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-openbsd-compat_fmt_scaled.c
  head/net/openbgpd/files/patch-openbsd-compat_hash.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-openbsd-compat_hash.h
  head/net/openbgpd/files/patch-openbsd-compat_if_media.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-openbsd-compat_if_media.h
  head/net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c
  head/net/openbgpd/files/patch-openbsd-compat_imsg.c
     - copied unchanged from r503177, head/net/openbgpd/files/patch-openbsd-compat_imsg.c
  head/net/openbgpd/files/patch-openbsd-compat_imsg.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-openbsd-compat_imsg.h
  head/net/openbgpd/files/patch-openbsd-compat_openbsd-compat.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-openbsd-compat_openbsd-compat.h
  head/net/openbgpd/files/patch-openbsd-compat_util.h
     - copied unchanged from r503177, head/net/openbgpd/files/patch-openbsd-compat_util.h
Deleted:
  head/net/openbgpd/files/patch-Makefile.am
  head/net/openbgpd/pkg-plist
Modified:
  head/net/openbgpd/Makefile
  head/net/openbgpd/distinfo

Modified: head/net/openbgpd/Makefile
==============================================================================
--- head/net/openbgpd/Makefile	Mon Jun  3 20:03:12 2019	(r503420)
+++ head/net/openbgpd/Makefile	Mon Jun  3 20:08:36 2019	(r503421)
@@ -1,9 +1,13 @@
 # $FreeBSD$
 
 PORTNAME=	openbgpd
-PORTVERSION=	6.5p0
+PORTVERSION=	5.2.20121209
+PORTREVISION=	3
+PORTEPOCH=	1
 CATEGORIES=	net
 MASTER_SITES=	OPENBSD/OpenBGPD
+DISTNAME=	${PORTNAME}-4.6
+DIST_SUBDIR=	${PORTNAME}
 
 MAINTAINER=	hrs at FreeBSD.org
 COMMENT=	Free implementation of the Border Gateway Protocol, Version 4
@@ -11,21 +15,27 @@ COMMENT=	Free implementation of the Border Gateway Pro
 LICENSE=	ISCL
 LICENSE_FILE=	${FILESDIR}/COPYING
 
-USES=		autoreconf libtool uidfix
+CONFLICTS=	zebra-[0-9]* quagga-[0-9]*
+
+USES=		tar:tgz uidfix
 USE_RC_SUBR=	${PORTNAME}
 
-GNU_CONFIGURE=	yes
-
+NO_WRKSUBDIR=	yes
+PLIST_FILES=	sbin/bgpctl sbin/bgpd man/man5/bgpd.conf.5.gz \
+		man/man8/bgpctl.8.gz man/man8/bgpd.8.gz
 SUB_FILES=	pkg-message
-
 USERS=		_bgpd
 GROUPS=		_bgpd
 
-CONFLICTS=	zebra-[0-9]* quagga-[0-9]*
-
-OPTIONS_DEFINE=		IPV6LLPEER
-OPTIONS_DEFAULT=	IPV6LLPEER
-IPV6LLPEER_DESC=	Support nexthop using IPv6 link-local address
+OPTIONS_DEFINE=	IPV6LLPEER
+OPTIONS_DEFAULT=IPV6LLPEER
+IPV6LLPEER_DESC=Support nexthop using IPv6 link-local address
 IPV6LLPEER_MAKE_ARGS=	-DIPV6_LINKLOCAL_PEER
+
+post-patch:
+	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g"	\
+		${WRKSRC}/bgpd/bgpd.8			\
+		${WRKSRC}/bgpd/bgpd.conf.5		\
+		${WRKSRC}/bgpctl/bgpctl.8
 
 .include <bsd.port.mk>

Modified: head/net/openbgpd/distinfo
==============================================================================
--- head/net/openbgpd/distinfo	Mon Jun  3 20:03:12 2019	(r503420)
+++ head/net/openbgpd/distinfo	Mon Jun  3 20:08:36 2019	(r503421)
@@ -1,3 +1,3 @@
 TIMESTAMP = 1556692508
-SHA256 (openbgpd-6.5p0.tar.gz) = 20c1a40bafcbbea60c4ecc6dd2e87fcba6847bfad62739b705a3806b6b442a56
-SIZE (openbgpd-6.5p0.tar.gz) = 677691
+SHA256 (openbgpd/openbgpd-4.6.tgz) = d9a0a3542e5ec744889ca12871f01aa1d86f12844e093010f37d0601796e15cf
+SIZE (openbgpd/openbgpd-4.6.tgz) = 168197

Copied: head/net/openbgpd/files/patch-Makefile (from r503177, head/net/openbgpd/files/patch-Makefile)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/openbgpd/files/patch-Makefile	Mon Jun  3 20:08:36 2019	(r503421, copy of r503177, head/net/openbgpd/files/patch-Makefile)
@@ -0,0 +1,12 @@
+Index: Makefile
+===================================================================
+RCS file: Makefile
+diff -N Makefile
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ Makefile	30 Jun 2009 07:07:55 -0000	1.2
+@@ -0,0 +1,5 @@
++# $hrs: openbgpd/Makefile,v 1.2 2009/06/30 07:07:55 hrs Exp $
++
++SUBDIR=	bgpd bgpctl
++
++.include <bsd.subdir.mk>

Copied: head/net/openbgpd/files/patch-Makefile.inc (from r503177, head/net/openbgpd/files/patch-Makefile.inc)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/openbgpd/files/patch-Makefile.inc	Mon Jun  3 20:08:36 2019	(r503421, copy of r503177, head/net/openbgpd/files/patch-Makefile.inc)
@@ -0,0 +1,12 @@
+Index: Makefile.inc
+===================================================================
+RCS file: Makefile.inc
+diff -N Makefile.inc
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ Makefile.inc	16 May 2014 01:06:14 -0000	1.5
+@@ -0,0 +1,5 @@
++# $hrs: openbgpd/Makefile.inc,v 1.5 2014/05/16 01:06:14 hrs Exp $
++
++PREFIX?=	/usr/local
++BINDIR?=	${PREFIX}/sbin
++MANDIR?=	${PREFIX}/man/man

Copied: head/net/openbgpd/files/patch-bgpctl_Makefile (from r503177, head/net/openbgpd/files/patch-bgpctl_Makefile)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/openbgpd/files/patch-bgpctl_Makefile	Mon Jun  3 20:08:36 2019	(r503421, copy of r503177, head/net/openbgpd/files/patch-bgpctl_Makefile)
@@ -0,0 +1,31 @@
+Index: bgpctl/Makefile
+===================================================================
+RCS file: /home/cvs/private/hrs/openbgpd/bgpctl/Makefile,v
+retrieving revision 1.1.1.1
+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	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 $
+ 
+-.PATH:		${.CURDIR}/../bgpd
++.PATH:		${.CURDIR}/../bgpd ${.CURDIR}/../openbsd-compat
+ 
+ PROG=	bgpctl
+-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 mrtparser.c
++SRCS+=	fmt_scaled.c imsg.c imsg-buffer.c
+ CFLAGS+= -Wall
+ CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
+ CFLAGS+= -Wmissing-declarations
+ CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual
+ CFLAGS+= -Wsign-compare
+-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../bgpd
++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../bgpd -I${.CURDIR}/../openbsd-compat
+ MAN=	bgpctl.8
+ LDADD= -lutil
+ DPADD+= ${LIBUTIL}

Copied: head/net/openbgpd/files/patch-bgpctl_bgpctl.8 (from r503177, head/net/openbgpd/files/patch-bgpctl_bgpctl.8)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/openbgpd/files/patch-bgpctl_bgpctl.8	Mon Jun  3 20:08:36 2019	(r503421, copy of r503177, head/net/openbgpd/files/patch-bgpctl_bgpctl.8)
@@ -0,0 +1,287 @@
+Index: bgpctl/bgpctl.8
+===================================================================
+RCS file: /home/cvs/private/hrs/openbgpd/bgpctl/bgpctl.8,v
+retrieving revision 1.1.1.6
+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	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.59 2012/05/27 20:49:42 jmc Exp $
+ .\"
+ .\" Copyright (c) 2003 Henning Brauer <henning at openbsd.org>
+ .\"
+@@ -14,7 +14,7 @@
+ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ .\"
+-.Dd $Mdocdate: June 6 2009 $
++.Dd $Mdocdate: May 27 2012 $
+ .Dt BGPCTL 8
+ .Os
+ .Sh NAME
+@@ -32,8 +32,7 @@ The
+ program controls the
+ .Xr bgpd 8
+ daemon.
+-Commands to switch between displays may be abbreviated to the
+-minimum unambiguous prefix; for example,
++Commands may be abbreviated to the minimum unambiguous prefix; for example,
+ .Cm s s
+ for
+ .Cm show summary .
+@@ -53,11 +52,19 @@ to communicate with
+ .Pp
+ The commands are as follows:
+ .Bl -tag -width xxxxxx
+-.It Cm fib couple
+-Insert the learned routes into the Forwarding Information Base
++.It Xo
++.Cm fib
++.Op Cm table Ar number
++.Cm couple
++.Xc
++Insert the learned routes into the specified Forwarding Information Base
+ a.k.a. the kernel routing table.
+-.It Cm fib decouple
+-Remove the learned routes from the Forwarding Information Base
++.It Xo
++.Cm fib
++.Op Cm table Ar number
++.Cm decouple
++.Xc
++Remove the learned routes from the specified Forwarding Information Base
+ a.k.a. the kernel routing table.
+ .It Xo
+ .Cm irrfilter
+@@ -79,7 +86,15 @@ The options are as follows:
+ Use
+ .Ar directory
+ to write the filter files to.
++.It Fl 4
++Fetch only IPv4 prefixes from the registry.
++.It Fl 6
++Fetch only IPv6 prefixes from the registry.
+ .El
++.It Cm log brief
++Disable verbose debug logging.
++.It Cm log verbose
++Enable verbose debug logging.
+ .It Cm neighbor Ar peer Cm up
+ Take the BGP session to the specified neighbor up.
+ .Ar peer
+@@ -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.
+-.It Cm network add Ar prefix
++.It Cm network add Ar prefix Op Ar arguments
+ Add the specified prefix to the list of announced networks.
++It is possible to set various path attributes with additional
++.Ar arguments .
+ .It Cm network delete Ar prefix
+ Remove the specified prefix from the list of announced networks.
+ .It Cm network flush
+ 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
+-.Bl -tag -width connected -compact
++.Bl -tag -width tableXnumber -compact
+ .It Cm connected
+ Show only connected routes.
+ .It Cm static
+@@ -133,9 +157,81 @@ Show only routes originating from
+ itself.
+ .It Cm nexthop
+ Show only routes required to reach a BGP nexthop.
++.It Cm inet
++Show only IPv4 routes.
++.It Cm inet6
++Show only IPv6 routes.
++.It Cm table Ar number
++Show the routing table with ID
++.Ar number
++instead of the default routing table with ID 0.
+ .El
+ .It Cm show interfaces
+ Show the interface states.
++.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.
++.It Cm show tables
++Show a list of all currently loaded fib routing tables.
+ .El
+ .Sh FILES
+ .Bl -tag -width "/var/run/bgpd.sockXXX" -compact
+-.It Pa /etc/bgpd.conf
++.It Pa %%PREFIX%%/etc/bgpd.conf
+ 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

Copied: head/net/openbgpd/files/patch-bgpctl_bgpctl.c (from r503177, head/net/openbgpd/files/patch-bgpctl_bgpctl.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/openbgpd/files/patch-bgpctl_bgpctl.c	Mon Jun  3 20:08:36 2019	(r503421, copy of r503177, head/net/openbgpd/files/patch-bgpctl_bgpctl.c)
@@ -0,0 +1,1529 @@
+Index: bgpctl/bgpctl.c
+===================================================================
+RCS file: /home/cvs/private/hrs/openbgpd/bgpctl/bgpctl.c,v
+retrieving revision 1.1.1.7
+retrieving revision 1.10
+diff -u -p -r1.1.1.7 -r1.10
+--- bgpctl/bgpctl.c	14 Feb 2010 20:20:14 -0000	1.1.1.7
++++ bgpctl/bgpctl.c	8 Dec 2012 20:17:55 -0000	1.10
+@@ -1,4 +1,4 @@
+-/*	$OpenBSD: bgpctl.c,v 1.142 2009/06/06 06:33:15 eric Exp $ */
++/*	$OpenBSD: bgpctl.c,v 1.167 2012/11/15 19:55:08 sthen Exp $ */
+ 
+ /*
+  * Copyright (c) 2003 Henning Brauer <henning at openbsd.org>
+@@ -16,11 +16,19 @@
+  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+ 
++#if defined(__FreeBSD__)	/* compat */
++#include "openbsd-compat.h"
++#endif /* defined(__FreeBSD__) */
++
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/un.h>
+ #include <net/if.h>
++#if defined(__FreeBSD__)	/* net/if_media.h */
++#include "if_media.h"
++#else
+ #include <net/if_media.h>
++#endif /* defined(__FreeBSD__) */
+ #include <net/if_types.h>
+ 
+ #include <err.h>
+@@ -29,7 +37,11 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
++#if defined(__FreeBSD__)	/* util.h */
++#include "util.h"
++#else
+ #include <util.h>
++#endif /* defined(__FreeBSD__) */
+ 
+ #include "bgpd.h"
+ #include "session.h"
+@@ -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,
+@@ -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);
+ static char	*fmt_timeframe_core(time_t t);
+ void		 show_fib_head(void);
++void		 show_fib_tables_head(void);
+ void		 show_network_head(void);
+ void		 show_fib_flags(u_int16_t);
+ int		 show_fib_msg(struct imsg *);
+@@ -65,7 +84,7 @@ void		 show_interface_head(void);
+ int		 ift2ifm(int);
+ const char *	 get_media_descr(int);
+ const char *	 get_linkstate(int, int);
+-void		 print_baudrate(u_int64_t);
++const char *	 get_baudrate(u_int64_t, char *);
+ int		 show_interface_msg(struct imsg *);
+ void		 show_rib_summary_head(void);
+ void		 print_prefix(struct bgpd_addr *, u_int8_t, u_int8_t);
+@@ -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 *);
+ 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;
+-	int			 fd, n, done, ch, nodescr = 0;
++	int			 fd, n, done, ch, nodescr = 0, verbose = 0;
+ 	struct imsg		 imsg;
+ 	struct network_config	 net;
+ 	struct parse_result	*res;
+@@ -128,8 +156,11 @@ main(int argc, char *argv[])
+ 	if ((res = parse(argc, argv)) == NULL)
+ 		exit(1);
+ 
+-	if (res->action == IRRFILTER)
++	if (res->action == IRRFILTER) {
++		if (!(res->flags & (F_IPV4|F_IPV6)))
++			res->flags |= (F_IPV4|F_IPV6);
+ 		irr_main(res->as.as, res->flags, res->irr_outdir);
++	}
+ 
+ 	memcpy(&neighbor.addr, &res->peeraddr, sizeof(neighbor.addr));
+ 	strlcpy(neighbor.descr, res->peerdesc, sizeof(neighbor.descr));
+@@ -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:
+-		if (!res->addr.af) {
+-			struct buf	*msg;
+-
+-			if ((msg = imsg_create(ibuf, IMSG_CTL_KROUTE, 0, 0,
+-			    sizeof(res->flags) + sizeof(res->af))) == NULL)
++		if (!res->addr.aid) {
++			struct ibuf	*msg;
++			sa_family_t	 af;
++
++			af = aid2af(res->aid);
++			if ((msg = imsg_create(ibuf, IMSG_CTL_KROUTE,
++			    res->rtableid, 0, sizeof(res->flags) +
++			    sizeof(af))) == NULL)
+ 				errx(1, "imsg_create failure");
+ 			if (imsg_add(msg, &res->flags, sizeof(res->flags)) ==
+ 			    -1 ||
+-			    imsg_add(msg, &res->af, sizeof(res->af)) == -1)
++			    imsg_add(msg, &af, sizeof(af)) == -1)
+ 				errx(1, "imsg_add failure");
+ 			imsg_close(ibuf, msg);
+ 		} else
+-			imsg_compose(ibuf, IMSG_CTL_KROUTE_ADDR, 0, 0, -1,
+-			    &res->addr, sizeof(res->addr));
++			imsg_compose(ibuf, IMSG_CTL_KROUTE_ADDR, res->rtableid,
++			    0, -1, &res->addr, sizeof(res->addr));
+ 		show_fib_head();
+ 		break;
++	case SHOW_FIB_TABLES:
++		imsg_compose(ibuf, IMSG_CTL_SHOW_FIB_TABLES, 0, 0, -1, NULL, 0);
++		show_fib_tables_head();
++		break;
+ 	case SHOW_NEXTHOP:
+-		imsg_compose(ibuf, IMSG_CTL_SHOW_NEXTHOP, 0, 0, -1, NULL, 0);
++		imsg_compose(ibuf, IMSG_CTL_SHOW_NEXTHOP, res->rtableid, 0, -1,
++		    NULL, 0);
+ 		show_nexthop_head();
+ 		break;
+ 	case SHOW_INTERFACE:
+@@ -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);
+-		if (res->peeraddr.af || res->peerdesc[0])
++		if (res->peeraddr.aid || res->peerdesc[0])
+ 			imsg_compose(ibuf, IMSG_CTL_SHOW_NEIGHBOR, 0, 0, -1,
+ 			    &neighbor, sizeof(neighbor));
+ 		else
+@@ -206,7 +245,7 @@ main(int argc, char *argv[])
+ 			memcpy(&ribreq.as, &res->as, sizeof(res->as));
+ 			type = IMSG_CTL_SHOW_RIB_AS;
+ 		}
+-		if (res->addr.af) {
++		if (res->addr.aid) {
+ 			memcpy(&ribreq.prefix, &res->addr, sizeof(res->addr));
+ 			ribreq.prefixlen = res->prefixlen;
+ 			type = IMSG_CTL_SHOW_RIB_PREFIX;
+@@ -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))
+ 			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:
+-		imsg_compose(ibuf, IMSG_CTL_FIB_COUPLE, 0, 0, -1, NULL, 0);
++		imsg_compose(ibuf, IMSG_CTL_FIB_COUPLE, res->rtableid, 0, -1,
++		    NULL, 0);
+ 		printf("couple request sent.\n");
+ 		done = 1;
+ 		break;
+ 	case FIB_DECOUPLE:
+-		imsg_compose(ibuf, IMSG_CTL_FIB_DECOUPLE, 0, 0, -1, NULL, 0);
++		imsg_compose(ibuf, IMSG_CTL_FIB_DECOUPLE, res->rtableid, 0, -1,
++		    NULL, 0);
+ 		printf("decouple request sent.\n");
+ 		done = 1;
+ 		break;
+@@ -290,12 +351,40 @@ main(int argc, char *argv[])
+ 		break;
+ 	case NETWORK_SHOW:
+ 		bzero(&ribreq, sizeof(ribreq));
+-		ribreq.af = res->af;
++		ribreq.aid = res->aid;
+ 		strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib));
+ 		imsg_compose(ibuf, IMSG_CTL_SHOW_NETWORK, 0, 0, -1,
+ 		    &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 */
++	case LOG_BRIEF:
++		imsg_compose(ibuf, IMSG_CTL_LOG_VERBOSE, 0, 0, -1,
++		    &verbose, sizeof(verbose));
++		printf("logging request sent.\n");
++		done = 1;
++		break;
+ 	}
+ 
+ 	while (ibuf->w.queued)
+@@ -304,13 +393,13 @@ main(int argc, char *argv[])
+ 
+ 	while (!done) {
+ 		if ((n = imsg_read(ibuf)) == -1)
+-			errx(1, "imsg_read error");
++			err(1, "imsg_read error");
+ 		if (n == 0)
+ 			errx(1, "pipe closed");
+ 
+ 		while (!done) {
+ 			if ((n = imsg_get(ibuf, &imsg)) == -1)
+-				errx(1, "imsg_get error");
++				err(1, "imsg_get error");
+ 			if (n == 0)
+ 				break;
+ 
+@@ -329,6 +418,8 @@ main(int argc, char *argv[])
+ 				done = show_summary_terse_msg(&imsg, nodescr);
+ 				break;
+ 			case SHOW_FIB:
++			case SHOW_FIB_TABLES:
++			case NETWORK_SHOW:
+ 				done = show_fib_msg(&imsg);
+ 				break;
+ 			case SHOW_NEXTHOP:
+@@ -356,9 +447,6 @@ main(int argc, char *argv[])
+ 			case SHOW_RIB_MEM:
+ 				done = show_rib_memory_msg(&imsg);
+ 				break;
+-			case NETWORK_SHOW:
+-				done = show_fib_msg(&imsg);
+-				break;
+ 			case NEIGHBOR:
+ 			case NEIGHBOR_UP:
+ 			case NEIGHBOR_DOWN:
+@@ -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 +490,8 @@ fmt_peer(const char *descr, const struct
+ 	}
+ 
+ 	ip = log_addr(remote_addr);
+-	if (masklen != -1 && ((remote_addr->af == AF_INET && masklen != 32) ||
+-	    (remote_addr->af == AF_INET6 && masklen != 128))) {
++	if (masklen != -1 && ((remote_addr->aid == AID_INET && masklen != 32) ||
++	    (remote_addr->aid == AID_INET6 && masklen != 128))) {
+ 		if (asprintf(&p, "%s/%u", ip, masklen) == -1)
+ 			err(1, NULL);
+ 	} else {
+@@ -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;
++	int			 hascapamp = 0;
++	u_int8_t		 i;
+ 
+ 	switch (imsg->hdr.type) {
+ 	case IMSG_CTL_SHOW_NEIGHBOR:
+ 		p = imsg->data;
+-		if ((p->conf.remote_addr.af == AF_INET &&
++		if ((p->conf.remote_addr.aid == AID_INET &&
+ 		    p->conf.remote_masklen != 32) ||
+-		    (p->conf.remote_addr.af == AF_INET6 &&
++		    (p->conf.remote_addr.aid == AID_INET6 &&
+ 		    p->conf.remote_masklen != 128)) {
+ 			if (asprintf(&s, "%s/%u",
+ 			    log_addr(&p->conf.remote_addr),
+@@ -549,9 +643,20 @@ show_neighbor_msg(struct imsg *imsg, enu
+ 			printf(", Template");
+ 		if (p->conf.cloned)
+ 			printf(", Cloned");
++		if (p->conf.passive)
++			printf(", Passive");
++		if (p->conf.ebgp && p->conf.distance > 1)
++			printf(", Multihop (%u)", (int)p->conf.distance);
+ 		printf("\n");
+ 		if (p->conf.descr[0])
+ 			printf(" Description: %s\n", p->conf.descr);
++		if (p->conf.max_prefix) {
++			printf(" Max-prefix: %u", p->conf.max_prefix);
++			if (p->conf.max_prefix_restart)
++				printf(" (restart %u)",
++				    p->conf.max_prefix_restart);
++			printf("\n");
++		}
+ 		printf("  BGP version 4, remote router-id %s\n",
+ 		    inet_ntoa(ina));
+ 		printf("  BGP state = %s", statenames[p->state]);
+@@ -563,22 +668,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);
+-		if (p->capa.peer.mp_v4 || p->capa.peer.mp_v6 ||
+-		    p->capa.peer.refresh || p->capa.peer.restart ||
+-		    p->capa.peer.as4byte) {
++		for (i = 0; i < AID_MAX; i++)
++			if (p->capa.peer.mp[i])
++				hascapamp = 1;
++		if (hascapamp || p->capa.peer.refresh ||
++		    p->capa.peer.grestart.restart || p->capa.peer.as4byte) {
+ 			printf("  Neighbor capabilities:\n");
+-			if (p->capa.peer.mp_v4) {
+-				printf("    Multiprotocol extensions: IPv4");
+-				print_neighbor_capa_mp_safi(p->capa.peer.mp_v4);
+-			}
+-			if (p->capa.peer.mp_v6) {
+-				printf("    Multiprotocol extensions: IPv6");
+-				print_neighbor_capa_mp_safi(p->capa.peer.mp_v6);
++			if (hascapamp) {
++				printf("    Multiprotocol extensions: ");
++				print_neighbor_capa_mp(p);
++				printf("\n");
+ 			}
+ 			if (p->capa.peer.refresh)
+ 				printf("    Route Refresh\n");
+-			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 +740,38 @@ show_neighbor_msg(struct imsg *imsg, enu
+ }
+ 
+ void
+-print_neighbor_capa_mp_safi(u_int8_t safi)
++print_neighbor_capa_mp(struct peer *p)
+ {
+-	switch (safi) {
+-	case SAFI_UNICAST:
+-		printf(" Unicast");
+-		break;
+-	case SAFI_MULTICAST:
+-		printf(" Multicast");
+-		break;
+-	default:
+-		printf(" unknown (%u)", safi);
+-		break;
+-	}
+-	printf("\n");
++	int		comma;
++	u_int8_t	i;
++
++	for (i = 0, comma = 0; i < AID_MAX; i++)
++		if (p->capa.peer.mp[i]) {
++			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
+@@ -654,17 +779,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 +798,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
+-print_timer(const char *name, timer_t d)
++print_timer(const char *name, time_t d)
+ {
+ 	printf("  %-20s ", name);
+ 
+@@ -745,6 +872,12 @@ show_fib_head(void)
+ }
+ 
+ void
++show_fib_tables_head(void)
++{
++	printf("%-5s %-20s %-8s\n", "Table", "Description", "State");
++}
++
++void
+ show_network_head(void)
+ {
+ 	printf("flags: S = Static\n");
+@@ -788,56 +921,44 @@ show_fib_flags(u_int16_t flags)
+ int
+ show_fib_msg(struct imsg *imsg)
+ {
+-	struct kroute		*k;
+-	struct kroute6		*k6;
++	struct kroute_full	*kf;
++	struct ktable		*kt;
+ 	char			*p;
+ 
+ 	switch (imsg->hdr.type) {
+ 	case IMSG_CTL_KROUTE:
+ 	case IMSG_CTL_SHOW_NETWORK:
+-		if (imsg->hdr.len < IMSG_HEADER_SIZE + sizeof(struct kroute))
++		if (imsg->hdr.len < IMSG_HEADER_SIZE + sizeof(*kf))
+ 			errx(1, "wrong imsg len");
+-		k = imsg->data;
++		kf = imsg->data;
+ 
+-		show_fib_flags(k->flags);

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


More information about the svn-ports-all mailing list