Merge remote-tracking branch 'origin/master' into pim_lib_work2

This commit is contained in:
Donald Sharp 2017-01-17 21:01:56 -05:00
commit b58ed1f8a8
357 changed files with 5216 additions and 7135 deletions

6
.gitignore vendored
View file

@ -26,9 +26,8 @@ conftest
conftest.err
aclocal.m4
Makefile.in
zebra-[0-9.][0-9.][0-9.]*.tar.gz
quagga-[0-9.][0-9.][0-9.]*.tar.gz
quagga-[0-9.][0-9.][0-9.]*.tar.gz.asc
*.tar.gz
*.tar.gz.asc
.nfs*
libtool
.arch-inventory
@ -42,6 +41,7 @@ build
m4/*.m4
!m4/ax_sys_weak_alias.m4
!m4/ax_compare_version.m4
!m4/ax_prog_perl_modules.m4
debian/autoreconf.after
debian/autoreconf.before
debian/files

View file

@ -300,4 +300,11 @@ at scale and in ways that can be unexpected for the original implementor.
As such debugs MUST be guarded in such a way that they can be turned off.
This PROJECT has the ability to turn on/off debugs from the CLI and it is
expected that the developer will use this convention to allow control
of their debugs.
of their debugs.
### CLI-Changes
CLI's are a complicated ugly beast. Additions or changes to the CLI
should use a DEFUN to encapsulate one setting as much as is possible.
Additionally as new DEFUN's are added to the system, documentation
should be provided for the new commands.

View file

@ -1,111 +0,0 @@
--------------------------------------------------------------------------
Building and Installing Quagga from releases or snapshots:
The 'INSTALL' file contains generic instructions on how to use 'configure'
scripts.
Quagga requires a C compiler (and associated header files and
libraries) supporting the C99 standard.
Quagga requires a reasonable make. It is considered a bug if quagga
does not compile with the system make on recent FreeBSD, NetBSD or
OpenBSD, and a very serious bug if it does not compile with GNU make.
Quagga expects a POSIX.2 compliant system, more or less. Clean
workarounds for POSIX non-compliance are welcome.
It is considered a bug if Quagga fails to build and run on any of the
following systems (where .x indicates the most recent release), or
such systems "-current" versions. Or, it might be that this list is
out of date and will be updated. (Note that considering it a bug is
not a guarantee of support, merely "we agree that it is broken".)
Dragonfly ?
FreeBSD (stable branches currently supported, plus perhaps one)
FreeBSD-current
Linux [kernel/distribution information needed]
NetBSD 4.x
NetBSD 5.x
NetBSD 6.x
NetBSD-current
OpenBSD ? [info needed on what should work]
Solaris (modern/supported versions, including OpenSolaris forks)
On BSD systems, installing libexecinfo is strongly recommended in order
to get backtrace support.
For further Quagga specific information on 'configure' and build-time
configuration of the software, please read the Quagga info
documentation, (doc/quagga.info). To read the info page included with
the Quagga sources without first installing Quagga:
cd doc
# one of the following, depending on your info viewer preferences
info quagga.info
pinfo -r quagga.info
emacs -eval '(info "quagga.info")'
The Quagga website (http://www.quagga.net) currently has the info
files available in various formats.
--------------------------------------------------------------------------
Building Quagga from git checkouts:
In order to build from git, you will need recent versions of several GNU
tools, particularly autoconf, automake, libtool, GNU awk and texinfo. Note
that the CVS snapshots on the Quagga website should not require these tools;
everything is already setup ready to run 'configure'. If you have trouble
building from CVS checkout it is recommended that you try a CVS snapshot
instead.
We declare that the following versions should work for building from
CVS checkouts. Earlier versions may work, but failure to do so is not
a bug. Required versions can be moved earlier if no problems, or
later after a judgement that a system without a higher version is
deficient is made.
[TODO: this list is out of date as of 2013-07]
automake: 1.9.6 (released 2005-07-10)
autoconf: 2.59 (2.60 on 2006-06-26 is too recent to require)
libtool: 1.5.22 (released 2005-12-18)
texinfo: 4.7 (released 2004-04-10; 4.8 is not yet common)
For running tests, one also needs:
DejaGnu:
[TODO: texinfo 4.6 is now ancient and this should be revisited/fixed]
Because some systems provide texinfo 4.6 (4.7 is new), quagga.info is
checked in so that texinfo will generally not be invoked. When
texinfo 4.7 is widespread, quagga.info will be removed from CVS and
texinfo will become required again. (4.7 has figure support, needed
for the route server docs, which is why 4.6 doesn't work.)
In order to create PostScript or PDF versions of the Texinfo documentation,
you will need the convert utility, from the ImageMagick toolset installed,
and epstopdf from the TeTeX suite.
To create the required autotools files (Makefile.in, configure, etc.),
run "./bootstrap.sh". After this you may run configure as for a
snapshot or release.
Please refer to "Building and Installing Quagga" above for further
instructions.
--------------------------------------------------------------------------
Notes on required versions:
The general goal is to use a modern baseline of tools, while not
imposing pain on those tracking supported (or almost supported) stable
distributions. The notes below explain what versions are present in
various environments.
NetBSD 4 provides texinfo 4.7.
NetBSD 5 and 6 provides texinfo 4.8
Fedora Core ? provides autoconf 2.59.
OpenBSD 3.6 provides texinfo 4.2.
OpenBSD [3.6] ports provides automake 1.4-p6 autoconf 2.5.9 libtool 1.5.8
--------------------------------------------------------------------------

View file

@ -2,14 +2,14 @@
SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \
@BGPD@ @RIPD@ @RIPNGD@ @OSPFD@ @OSPF6D@ @LDPD@ \
@ISISD@ @PIMD@ @WATCHQUAGGA@ @VTYSH@ @OSPFCLIENT@ @DOC@ m4 @pkgsrcdir@ \
@ISISD@ @PIMD@ @WATCHFRR@ @VTYSH@ @OSPFCLIENT@ @DOC@ m4 @pkgsrcdir@ \
redhat @SOLARIS@ tests tools cumulus
DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \
isisd watchquagga vtysh ospfclient doc m4 pkgsrc redhat tests \
isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests \
solaris pimd @LIBRFP@ @RFPTEST@ tools cumulus
EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS INSTALL.quagga.txt \
EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \
update-autotools \
vtysh/Makefile.in vtysh/Makefile.am \
tools/rrcheck.pl tools/rrlookup.pl tools/zc.pl \

12
README
View file

@ -1,11 +1,9 @@
Quagga is free software that manages various IPv4 and IPv6 routing
Free Range Routing is free software that manages various IPv4 and IPv6 routing
protocols.
Currently Quagga supports BGP4, BGP4+, OSPFv2, OSPFv3, RIPv1,
Currently Free Range Routing supports BGP4, BGP4+, OSPFv2, OSPFv3, RIPv1,
RIPv2, RIPng, PIM-SSM and LDP as well as very early support for IS-IS.
See the file INSTALL.quagga.txt for building and installation instructions.
See the file REPORTING-BUGS to report bugs.
Quagga is free software. See the file COPYING for copying conditions.
Free Range Routing is free software. See the file COPYING for copying conditions.

View file

@ -1,7 +1,5 @@
#!/bin/sh
# $QuaggaId: Format:%an, %ai, %h$ $
# This file is helpful for building quagga from cvs on NetBSD, and
# probably on any system using pkgsrc.
# One should have readline installed already (pkgsrc/devel/readline).

View file

@ -18,3 +18,4 @@ ospf6d 2606/tcp
ospfapi 2607/tcp
isisd 2608/tcp
pimd 2611/tcp
ldpd 2612/tcp

View file

@ -221,6 +221,11 @@ cluster_finish (void)
cluster_hash = NULL;
}
static struct hash *encap_hash = NULL;
#if ENABLE_BGP_VNC
static struct hash *vnc_hash = NULL;
#endif
struct bgp_attr_encap_subtlv *
encap_tlv_dup(struct bgp_attr_encap_subtlv *orig)
{
@ -288,14 +293,10 @@ encap_same(struct bgp_attr_encap_subtlv *h1, struct bgp_attr_encap_subtlv *h2)
struct bgp_attr_encap_subtlv *p;
struct bgp_attr_encap_subtlv *q;
if (!h1 && !h2)
return 1;
if (h1 && !h2)
return 0;
if (!h1 && h2)
return 0;
if (h1 == h2)
return 1;
if (h1 == NULL || h2 == NULL)
return 0;
for (p = h1; p; p = p->next) {
for (q = h2; q; q = q->next) {
@ -326,6 +327,96 @@ encap_same(struct bgp_attr_encap_subtlv *h1, struct bgp_attr_encap_subtlv *h2)
return 1;
}
static void *
encap_hash_alloc (void *p)
{
/* Encap structure is already allocated. */
return p;
}
typedef enum
{
ENCAP_SUBTLV_TYPE,
#if ENABLE_BGP_VNC
VNC_SUBTLV_TYPE
#endif
} encap_subtlv_type;
static struct bgp_attr_encap_subtlv *
encap_intern (struct bgp_attr_encap_subtlv *encap, encap_subtlv_type type)
{
struct bgp_attr_encap_subtlv *find;
struct hash *hash = encap_hash;
#if ENABLE_BGP_VNC
if (type == VNC_SUBTLV_TYPE)
hash = vnc_hash;
#endif
find = hash_get (hash, encap, encap_hash_alloc);
if (find != encap)
encap_free (encap);
find->refcnt++;
return find;
}
static void
encap_unintern (struct bgp_attr_encap_subtlv **encapp, encap_subtlv_type type)
{
struct bgp_attr_encap_subtlv *encap = *encapp;
if (encap->refcnt)
encap->refcnt--;
if (encap->refcnt == 0)
{
struct hash *hash = encap_hash;
#if ENABLE_BGP_VNC
if (type == VNC_SUBTLV_TYPE)
hash = vnc_hash;
#endif
hash_release (hash, encap);
encap_free (encap);
*encapp = NULL;
}
}
static unsigned int
encap_hash_key_make (void *p)
{
const struct bgp_attr_encap_subtlv * encap = p;
return jhash(encap->value, encap->length, 0);
}
static int
encap_hash_cmp (const void *p1, const void *p2)
{
return encap_same((struct bgp_attr_encap_subtlv *)p1,
(struct bgp_attr_encap_subtlv *)p2);
}
static void
encap_init (void)
{
encap_hash = hash_create (encap_hash_key_make, encap_hash_cmp);
#if ENABLE_BGP_VNC
vnc_hash = hash_create (encap_hash_key_make, encap_hash_cmp);
#endif
}
static void
encap_finish (void)
{
hash_clean (encap_hash, (void (*)(void *))encap_free);
hash_free (encap_hash);
encap_hash = NULL;
#if ENABLE_BGP_VNC
hash_clean (vnc_hash, (void (*)(void *))encap_free);
hash_free (vnc_hash);
vnc_hash = NULL;
#endif
}
/* Unknown transit attribute. */
static struct hash *transit_hash;
@ -434,16 +525,6 @@ bgp_attr_extra_free (struct attr *attr)
{
if (attr->extra)
{
if (attr->extra->encap_subtlvs) {
encap_free(attr->extra->encap_subtlvs);
attr->extra->encap_subtlvs = NULL;
}
#if ENABLE_BGP_VNC
if (attr->extra->vnc_subtlvs) {
encap_free(attr->extra->vnc_subtlvs);
attr->extra->vnc_subtlvs = NULL;
}
#endif
XFREE (MTYPE_ATTR_EXTRA, attr->extra);
attr->extra = NULL;
}
@ -481,28 +562,12 @@ bgp_attr_dup (struct attr *new, struct attr *orig)
memset(new->extra, 0, sizeof(struct attr_extra));
if (orig->extra) {
*new->extra = *orig->extra;
if (orig->extra->encap_subtlvs) {
new->extra->encap_subtlvs = encap_tlv_dup(orig->extra->encap_subtlvs);
}
#if ENABLE_BGP_VNC
if (orig->extra->vnc_subtlvs) {
new->extra->vnc_subtlvs = encap_tlv_dup(orig->extra->vnc_subtlvs);
}
#endif
}
}
else if (orig->extra)
{
new->extra = bgp_attr_extra_new();
*new->extra = *orig->extra;
if (orig->extra->encap_subtlvs) {
new->extra->encap_subtlvs = encap_tlv_dup(orig->extra->encap_subtlvs);
}
#if ENABLE_BGP_VNC
if (orig->extra->vnc_subtlvs) {
new->extra->vnc_subtlvs = encap_tlv_dup(orig->extra->vnc_subtlvs);
}
#endif
}
}
@ -523,6 +588,12 @@ bgp_attr_deep_dup (struct attr *new, struct attr *orig)
new->extra->cluster = cluster_dup(orig->extra->cluster);
if (orig->extra->transit)
new->extra->transit = transit_dup(orig->extra->transit);
if (orig->extra->encap_subtlvs)
new->extra->encap_subtlvs = encap_tlv_dup(orig->extra->encap_subtlvs);
#if ENABLE_BGP_VNC
if (orig->extra->vnc_subtlvs)
new->extra->vnc_subtlvs = encap_tlv_dup(orig->extra->vnc_subtlvs);
#endif
}
}
@ -543,6 +614,12 @@ bgp_attr_deep_free (struct attr *attr)
cluster_free(attr->extra->cluster);
if (attr->extra->transit)
transit_free(attr->extra->transit);
if (attr->extra->encap_subtlvs)
encap_free(attr->extra->encap_subtlvs);
#if ENABLE_BGP_VNC
if (attr->extra->vnc_subtlvs)
encap_free(attr->extra->vnc_subtlvs);
#endif
}
}
@ -599,12 +676,15 @@ attrhash_key_make (void *p)
MIX(cluster_hash_key_make (extra->cluster));
if (extra->transit)
MIX(transit_hash_key_make (extra->transit));
#ifdef HAVE_IPV6
if (extra->encap_subtlvs)
MIX(encap_hash_key_make (extra->encap_subtlvs));
#if ENABLE_BGP_VNC
if (extra->vnc_subtlvs)
MIX(encap_hash_key_make (extra->vnc_subtlvs));
#endif
MIX(extra->mp_nexthop_len);
key = jhash(extra->mp_nexthop_global.s6_addr, IPV6_MAX_BYTELEN, key);
key = jhash(extra->mp_nexthop_local.s6_addr, IPV6_MAX_BYTELEN, key);
#endif /* HAVE_IPV6 */
}
return key;
@ -633,11 +713,9 @@ attrhash_cmp (const void *p1, const void *p2)
&& ae1->aggregator_addr.s_addr == ae2->aggregator_addr.s_addr
&& ae1->weight == ae2->weight
&& ae1->tag == ae2->tag
#ifdef HAVE_IPV6
&& ae1->mp_nexthop_len == ae2->mp_nexthop_len
&& IPV6_ADDR_SAME (&ae1->mp_nexthop_global, &ae2->mp_nexthop_global)
&& IPV6_ADDR_SAME (&ae1->mp_nexthop_local, &ae2->mp_nexthop_local)
#endif /* HAVE_IPV6 */
&& IPV4_ADDR_SAME (&ae1->mp_nexthop_global_in, &ae2->mp_nexthop_global_in)
&& ae1->ecommunity == ae2->ecommunity
&& ae1->cluster == ae2->cluster
@ -712,13 +790,12 @@ bgp_attr_hash_alloc (void *p)
{
attr->extra = bgp_attr_extra_new ();
*attr->extra = *val->extra;
if (attr->extra->encap_subtlvs) {
attr->extra->encap_subtlvs = encap_tlv_dup(attr->extra->encap_subtlvs);
if (val->extra->encap_subtlvs) {
val->extra->encap_subtlvs = NULL;
}
#if ENABLE_BGP_VNC
if (attr->extra->vnc_subtlvs) {
attr->extra->vnc_subtlvs = encap_tlv_dup(attr->extra->vnc_subtlvs);
if (val->extra->vnc_subtlvs) {
val->extra->vnc_subtlvs = NULL;
}
#endif
}
@ -773,11 +850,27 @@ bgp_attr_intern (struct attr *attr)
else
attre->transit->refcnt++;
}
if (attre->encap_subtlvs)
{
if (! attre->encap_subtlvs->refcnt)
attre->encap_subtlvs = encap_intern (attre->encap_subtlvs, ENCAP_SUBTLV_TYPE);
else
attre->encap_subtlvs->refcnt++;
}
#if ENABLE_BGP_VNC
if (attre->vnc_subtlvs)
{
if (! attre->vnc_subtlvs->refcnt)
attre->vnc_subtlvs = encap_intern (attre->vnc_subtlvs, VNC_SUBTLV_TYPE);
else
attre->vnc_subtlvs->refcnt++;
}
#endif
}
find = (struct attr *) hash_get (attrhash, attr, bgp_attr_hash_alloc);
find->refcnt++;
return find;
}
@ -811,6 +904,14 @@ bgp_attr_refcount (struct attr *attr)
if (attre->transit)
attre->transit->refcnt++;
if (attre->encap_subtlvs)
attre->encap_subtlvs->refcnt++;
#if ENABLE_BGP_VNC
if (attre->vnc_subtlvs)
attre->vnc_subtlvs->refcnt++;
#endif
}
attr->refcnt++;
return attr;
@ -830,9 +931,7 @@ bgp_attr_default_set (struct attr *attr, u_char origin)
attr->extra->weight = BGP_ATTR_DEFAULT_WEIGHT;
attr->extra->tag = 0;
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
#ifdef HAVE_IPV6
attr->extra->mp_nexthop_len = IPV6_MAX_BYTELEN;
#endif
return attr;
}
@ -893,9 +992,7 @@ bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
}
attre.weight = BGP_ATTR_DEFAULT_WEIGHT;
#ifdef HAVE_IPV6
attre.mp_nexthop_len = IPV6_MAX_BYTELEN;
#endif
if (! as_set || atomic_aggregate)
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE);
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR);
@ -936,6 +1033,14 @@ bgp_attr_unintern_sub (struct attr *attr)
if (attr->extra->transit)
transit_unintern (attr->extra->transit);
if (attr->extra->encap_subtlvs)
encap_unintern (&attr->extra->encap_subtlvs, ENCAP_SUBTLV_TYPE);
#if ENABLE_BGP_VNC
if (attr->extra->vnc_subtlvs)
encap_unintern (&attr->extra->vnc_subtlvs, VNC_SUBTLV_TYPE);
#endif
}
}
@ -1001,11 +1106,17 @@ bgp_attr_flush (struct attr *attr)
transit_free (attre->transit);
attre->transit = NULL;
}
encap_free(attre->encap_subtlvs);
attre->encap_subtlvs = NULL;
if (attre->encap_subtlvs && ! attre->encap_subtlvs->refcnt)
{
encap_free(attre->encap_subtlvs);
attre->encap_subtlvs = NULL;
}
#if ENABLE_BGP_VNC
encap_free(attre->vnc_subtlvs);
attre->vnc_subtlvs = NULL;
if (attre->vnc_subtlvs && ! attre->vnc_subtlvs->refcnt)
{
encap_free(attre->vnc_subtlvs);
attre->vnc_subtlvs = NULL;
}
#endif
}
}
@ -1738,8 +1849,9 @@ int
bgp_mp_reach_parse (struct bgp_attr_parser_args *args,
struct bgp_nlri *mp_update)
{
afi_t afi;
safi_t safi;
iana_afi_t pkt_afi;
afi_t afi;
safi_t pkt_safi, safi;
bgp_size_t nlri_len;
size_t start;
struct stream *s;
@ -1763,8 +1875,20 @@ bgp_mp_reach_parse (struct bgp_attr_parser_args *args,
}
/* Load AFI, SAFI. */
afi = stream_getw (s);
safi = stream_getc (s);
pkt_afi = stream_getw (s);
pkt_safi = stream_getc (s);
/* Convert AFI, SAFI to internal values, check. */
if (bgp_map_afi_safi_iana2int (pkt_afi, pkt_safi, &afi, &safi))
{
/* Log if AFI or SAFI is unrecognized. This is not an error unless
* the attribute is otherwise malformed.
*/
if (bgp_debug_update(peer, NULL, NULL, 0))
zlog_debug ("%s: MP_REACH received AFI %u or SAFI %u is unrecognized",
peer->host, pkt_afi, pkt_safi);
return BGP_ATTR_PARSE_ERROR;
}
/* Get nexthop length. */
attre->mp_nexthop_len = stream_getc (s);
@ -1790,7 +1914,6 @@ bgp_mp_reach_parse (struct bgp_attr_parser_args *args,
stream_getl (s); /* RD low */
stream_get (&attre->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
break;
#ifdef HAVE_IPV6
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL:
if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV6_GLOBAL)
@ -1830,7 +1953,6 @@ bgp_mp_reach_parse (struct bgp_attr_parser_args *args,
attre->mp_nexthop_len = IPV6_MAX_BYTELEN;
}
break;
#endif /* HAVE_IPV6 */
default:
zlog_info ("%s: (%s) Wrong multiprotocol next hop length: %d",
__func__, peer->host, attre->mp_nexthop_len);
@ -1879,8 +2001,9 @@ bgp_mp_unreach_parse (struct bgp_attr_parser_args *args,
struct bgp_nlri *mp_withdraw)
{
struct stream *s;
iana_afi_t pkt_afi;
afi_t afi;
safi_t safi;
safi_t pkt_safi, safi;
u_int16_t withdraw_len;
struct peer *const peer = args->peer;
struct attr *const attr = args->attr;
@ -1892,9 +2015,21 @@ bgp_mp_unreach_parse (struct bgp_attr_parser_args *args,
if ((length > STREAM_READABLE(s)) || (length < BGP_MP_UNREACH_MIN_SIZE))
return BGP_ATTR_PARSE_ERROR_NOTIFYPLS;
afi = stream_getw (s);
safi = stream_getc (s);
pkt_afi = stream_getw (s);
pkt_safi = stream_getc (s);
/* Convert AFI, SAFI to internal values, check. */
if (bgp_map_afi_safi_iana2int (pkt_afi, pkt_safi, &afi, &safi))
{
/* Log if AFI or SAFI is unrecognized. This is not an error unless
* the attribute is otherwise malformed.
*/
if (bgp_debug_update(peer, NULL, NULL, 0))
zlog_debug ("%s: MP_UNREACH received AFI %u or SAFI %u is unrecognized",
peer->host, pkt_afi, pkt_safi);
return BGP_ATTR_PARSE_ERROR;
}
withdraw_len = length - BGP_MP_UNREACH_MIN_SIZE;
mp_withdraw->afi = afi;
@ -2493,10 +2628,18 @@ bgp_attr_parse (struct peer *peer, struct attr *attr, bgp_size_t size,
if (ret != BGP_ATTR_PARSE_PROCEED)
return ret;
}
/* Finally intern unknown attribute. */
if (attr->extra && attr->extra->transit)
attr->extra->transit = transit_intern (attr->extra->transit);
if (attr->extra)
{
/* Finally intern unknown attribute. */
if (attr->extra->transit)
attr->extra->transit = transit_intern (attr->extra->transit);
if (attr->extra->encap_subtlvs)
attr->extra->encap_subtlvs = encap_intern (attr->extra->encap_subtlvs, ENCAP_SUBTLV_TYPE);
#if ENABLE_BGP_VNC
if (attr->extra->vnc_subtlvs)
attr->extra->vnc_subtlvs = encap_intern (attr->extra->vnc_subtlvs, VNC_SUBTLV_TYPE);
#endif
}
return BGP_ATTR_PARSE_PROCEED;
}
@ -2507,6 +2650,8 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi,
struct attr *attr)
{
size_t sizep;
iana_afi_t pkt_afi;
safi_t pkt_safi;
/* Set extended bit always to encode the attribute length as 2 bytes */
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_EXTLEN);
@ -2514,8 +2659,12 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi,
sizep = stream_get_endp (s);
stream_putw (s, 0); /* Marker: Attribute length. */
stream_putw (s, afi);
stream_putc (s, (safi == SAFI_MPLS_VPN) ? SAFI_MPLS_LABELED_VPN : safi);
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana (afi, safi, &pkt_afi, &pkt_safi);
stream_putw (s, pkt_afi); /* AFI */
stream_putc (s, pkt_safi); /* SAFI */
/* Nexthop */
switch (nh_afi)
@ -2544,7 +2693,6 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi,
break;
}
break;
#ifdef HAVE_IPV6
case AFI_IP6:
switch (safi)
{
@ -2591,7 +2739,6 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi,
break;
}
break;
#endif /*HAVE_IPV6*/
default:
break;
}
@ -3134,6 +3281,8 @@ size_t
bgp_packet_mpunreach_start (struct stream *s, afi_t afi, safi_t safi)
{
unsigned long attrlen_pnt;
iana_afi_t pkt_afi;
safi_t pkt_safi;
/* Set extended bit always to encode the attribute length as 2 bytes */
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_EXTLEN);
@ -3142,8 +3291,12 @@ bgp_packet_mpunreach_start (struct stream *s, afi_t afi, safi_t safi)
attrlen_pnt = stream_get_endp (s);
stream_putw (s, 0); /* Length of this attribute. */
stream_putw (s, afi);
stream_putc (s, (safi == SAFI_MPLS_VPN) ? SAFI_MPLS_LABELED_VPN : safi);
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana (afi, safi, &pkt_afi, &pkt_safi);
stream_putw (s, pkt_afi);
stream_putc (s, pkt_safi);
return attrlen_pnt;
}
@ -3184,6 +3337,7 @@ bgp_attr_init (void)
ecommunity_init ();
cluster_init ();
transit_init ();
encap_init ();
}
void
@ -3195,6 +3349,7 @@ bgp_attr_finish (void)
ecommunity_finish ();
cluster_finish ();
transit_finish ();
encap_finish ();
}
/* Make attribute packet. */
@ -3232,11 +3387,7 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr,
/* Nexthop attribute. */
/* If it's an IPv6 prefix, don't dump the IPv4 nexthop to save space */
if(prefix != NULL
#ifdef HAVE_IPV6
&& prefix->family != AF_INET6
#endif /* HAVE_IPV6 */
)
if(prefix != NULL && prefix->family != AF_INET6)
{
stream_putc (s, BGP_ATTR_FLAG_TRANS);
stream_putc (s, BGP_ATTR_NEXT_HOP);
@ -3299,7 +3450,6 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr,
stream_put (s, attr->community->val, attr->community->size * 4);
}
#ifdef HAVE_IPV6
/* Add a MP_NLRI attribute to dump the IPv6 next hop */
if (prefix != NULL && prefix->family == AF_INET6 && attr->extra &&
(attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL ||
@ -3332,7 +3482,6 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr,
/* Set MP attribute length. */
stream_putc_at (s, sizep, (stream_get_endp (s) - sizep) - 1);
}
#endif /* HAVE_IPV6 */
/* Return total size of attribute. */
len = stream_get_endp (s) - cp - 2;

View file

@ -58,6 +58,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
struct bgp_attr_encap_subtlv {
struct bgp_attr_encap_subtlv *next; /* for chaining */
/* Reference count of this attribute. */
unsigned long refcnt;
uint16_t type;
uint16_t length;
uint8_t value[1]; /* will be extended */

View file

@ -339,7 +339,6 @@ bgp_bfd_dest_update (int command, struct zclient *zclient,
if (dp.u.prefix4.s_addr != peer->su.sin.sin_addr.s_addr)
continue;
}
#ifdef HAVE_IPV6
else if ((dp.family == AF_INET6) &&
(peer->su.sa.sa_family == AF_INET6))
{
@ -347,7 +346,6 @@ bgp_bfd_dest_update (int command, struct zclient *zclient,
sizeof (struct in6_addr)))
continue;
}
#endif
else
continue;
@ -366,7 +364,6 @@ bgp_bfd_dest_update (int command, struct zclient *zclient,
if (sp.u.prefix4.s_addr != peer->su_local->sin.sin_addr.s_addr)
continue;
}
#ifdef HAVE_IPV6
else if ((sp.family == AF_INET6) &&
(peer->su_local->sa.sa_family == AF_INET6))
{
@ -374,7 +371,6 @@ bgp_bfd_dest_update (int command, struct zclient *zclient,
sizeof (struct in6_addr)))
continue;
}
#endif
else
continue;

View file

@ -44,9 +44,9 @@ static zebra_capabilities_t _caps_p [] =
struct zebra_privs_t bgpd_privs =
{
#if defined(QUAGGA_USER) && defined(QUAGGA_GROUP)
.user = QUAGGA_USER,
.group = QUAGGA_GROUP,
#if defined(FRR_USER) && defined(FRR_GROUP)
.user = FRR_USER,
.group = FRR_GROUP,
#endif
#ifdef VTY_GROUP
.vty_group = VTY_GROUP,

View file

@ -392,7 +392,6 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size)
snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s",
bgp_origin_str[attr->origin]);
#ifdef HAVE_IPV6
if (attr->extra)
{
char addrbuf[BUFSIZ];
@ -409,7 +408,6 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size)
inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local,
addrbuf, BUFSIZ));
}
#endif /* HAVE_IPV6 */
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF)))
snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %u",

View file

@ -364,11 +364,7 @@ bgp_dump_route_node_record (int afi, struct bgp_node *rn,
stream_putw (obuf, info->peer->table_dump_index);
/* Originated */
#ifdef HAVE_CLOCK_MONOTONIC
stream_putl (obuf, time(NULL) - (bgp_clock() - info->uptime));
#else
stream_putl (obuf, info->uptime);
#endif /* HAVE_CLOCK_MONOTONIC */
/* Dump attribute. */
/* Skip prefix & AFI/SAFI for MP_NLRI */

View file

@ -54,6 +54,13 @@ ecommunity_free (struct ecommunity **ecom)
ecom = NULL;
}
static void
ecommunity_hash_free (struct ecommunity *ecom)
{
ecommunity_free(&ecom);
}
/* Add a new Extended Communities value to Extended Communities
Attribute structure. When the value is already exists in the
structure, we don't add the value. Newly added value is sorted by
@ -282,6 +289,7 @@ ecommunity_init (void)
void
ecommunity_finish (void)
{
hash_clean (ecomhash, (void (*)(void *))ecommunity_hash_free);
hash_free (ecomhash);
ecomhash = NULL;
}

View file

@ -467,7 +467,7 @@ bgp_show_encap (
vty_out (vty, "No prefixes displayed, %ld exist%s", total_count, VTY_NEWLINE);
}
else
vty_out (vty, "%sDisplayed %ld out of %ld total prefixes%s",
vty_out (vty, "%sDisplayed %ld routes and %ld total paths%s",
VTY_NEWLINE, output_count, total_count, VTY_NEWLINE);
return CMD_SUCCESS;
@ -484,7 +484,7 @@ DEFUN (show_bgp_ipv4_encap,
{
return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0);
}
#ifdef HAVE_IPV6
DEFUN (show_bgp_ipv6_encap,
show_bgp_ipv6_encap_cmd,
"show [ip] bgp ipv6 encap",
@ -496,7 +496,6 @@ DEFUN (show_bgp_ipv6_encap,
{
return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 0);
}
#endif
DEFUN (show_bgp_ipv4_encap_rd,
show_bgp_ipv4_encap_rd_cmd,
@ -521,7 +520,7 @@ DEFUN (show_bgp_ipv4_encap_rd,
}
return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0);
}
#ifdef HAVE_IPV6
DEFUN (show_bgp_ipv6_encap_rd,
show_bgp_ipv6_encap_rd_cmd,
"show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn",
@ -546,7 +545,6 @@ DEFUN (show_bgp_ipv6_encap_rd,
}
return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0);
}
#endif
DEFUN (show_bgp_ipv4_encap_tags,
show_bgp_ipv4_encap_tags_cmd,
@ -560,7 +558,7 @@ DEFUN (show_bgp_ipv4_encap_tags,
{
return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 1);
}
#ifdef HAVE_IPV6
DEFUN (show_bgp_ipv6_encap_tags,
show_bgp_ipv6_encap_tags_cmd,
"show [ip] bgp ipv6 encap tags",
@ -573,7 +571,6 @@ DEFUN (show_bgp_ipv6_encap_tags,
{
return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 1);
}
#endif
DEFUN (show_bgp_ipv4_encap_rd_tags,
show_bgp_ipv4_encap_rd_tags_cmd,
@ -599,7 +596,7 @@ DEFUN (show_bgp_ipv4_encap_rd_tags,
}
return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1);
}
#ifdef HAVE_IPV6
DEFUN (show_bgp_ipv6_encap_rd_tags,
show_bgp_ipv6_encap_rd_tags_cmd,
"show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags",
@ -624,7 +621,6 @@ DEFUN (show_bgp_ipv6_encap_rd_tags,
}
return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 1);
}
#endif
DEFUN (show_bgp_ipv4_encap_neighbor_routes,
show_bgp_ipv4_encap_neighbor_routes_cmd,
@ -657,7 +653,7 @@ DEFUN (show_bgp_ipv4_encap_neighbor_routes,
return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_neighbor, &su, 0);
}
#ifdef HAVE_IPV6
DEFUN (show_bgp_ipv6_encap_neighbor_routes,
show_bgp_ipv6_encap_neighbor_routes_cmd,
"show [ip] bgp ipv6 encap neighbors A.B.C.D routes",
@ -689,7 +685,6 @@ DEFUN (show_bgp_ipv6_encap_neighbor_routes,
return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_neighbor, &su, 0);
}
#endif
DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes,
show_bgp_ipv4_encap_rd_neighbor_routes_cmd,
@ -735,7 +730,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes,
return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_neighbor, &su, 0);
}
#ifdef HAVE_IPV6
DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes,
show_bgp_ipv6_encap_rd_neighbor_routes_cmd,
"show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes",
@ -780,7 +775,6 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes,
return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_neighbor, &su, 0);
}
#endif
DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes,
show_bgp_ipv4_encap_neighbor_advertised_routes_cmd,
@ -814,7 +808,7 @@ DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes,
return show_adj_route_encap (vty, peer, NULL);
}
#ifdef HAVE_IPV6
DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes,
show_bgp_ipv6_encap_neighbor_advertised_routes_cmd,
"show [ip] bgp ipv6 encap neighbors A.B.C.D advertised-routes",
@ -847,7 +841,6 @@ DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes,
return show_adj_route_encap (vty, peer, NULL);
}
#endif
DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes,
show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd,
@ -893,7 +886,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes,
return show_adj_route_encap (vty, peer, &prd);
}
#ifdef HAVE_IPV6
DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes,
show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd,
"show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes",
@ -938,7 +931,6 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes,
return show_adj_route_encap (vty, peer, &prd);
}
#endif
void
bgp_encap_init (void)
@ -955,7 +947,6 @@ bgp_encap_init (void)
install_element (VIEW_NODE, &show_bgp_ipv4_encap_neighbor_advertised_routes_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd);
#ifdef HAVE_IPV6
install_element (VIEW_NODE, &show_bgp_ipv6_encap_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_encap_tags_cmd);
@ -964,5 +955,4 @@ bgp_encap_init (void)
install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_encap_neighbor_advertised_routes_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd);
#endif
}

View file

@ -509,7 +509,7 @@ bgp_graceful_restart_timer_expire (struct thread *thread)
/* NSF delete stale route */
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_3 ; safi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_4 ; safi++)
if (peer->nsf[afi][safi])
bgp_clear_stale_route (peer, afi, safi);
@ -542,7 +542,7 @@ bgp_graceful_stale_timer_expire (struct thread *thread)
/* NSF delete stale route */
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_3 ; safi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_4 ; safi++)
if (peer->nsf[afi][safi])
bgp_clear_stale_route (peer, afi, safi);
@ -1051,7 +1051,7 @@ bgp_stop (struct peer *peer)
UNSET_FLAG (peer->sflags, PEER_STATUS_NSF_MODE);
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_3 ; safi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_4 ; safi++)
peer->nsf[afi][safi] = 0;
}
@ -1468,7 +1468,7 @@ bgp_establish (struct peer *peer)
/* graceful restart */
UNSET_FLAG (peer->sflags, PEER_STATUS_NSF_WAIT);
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_3 ; safi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_4 ; safi++)
{
if (peer->afc_nego[afi][safi]
&& CHECK_FLAG (peer->cap, PEER_CAP_RESTART_ADV)

View file

@ -134,9 +134,9 @@ static zebra_capabilities_t _caps_p [] =
struct zebra_privs_t bgpd_privs =
{
#if defined(QUAGGA_USER) && defined(QUAGGA_GROUP)
.user = QUAGGA_USER,
.group = QUAGGA_GROUP,
#if defined(FRR_USER) && defined(FRR_GROUP)
.user = FRR_USER,
.group = FRR_GROUP,
#endif
#ifdef VTY_GROUP
.vty_group = VTY_GROUP,
@ -174,7 +174,7 @@ redistribution between different routing protocols.\n\n\
-C, --dryrun Check configuration for validity and exit\n\
-h, --help Display this help and exit\n\
\n\
Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS);
Report bugs to %s\n", progname, FRR_BUG_ADDRESS);
}
exit (status);
@ -547,7 +547,7 @@ main (int argc, char **argv)
vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH);
/* Print banner. */
zlog_notice ("BGPd %s starting: vty@%d, bgp@%s:%d", QUAGGA_VERSION,
zlog_notice ("BGPd %s starting: vty@%d, bgp@%s:%d", FRR_COPYRIGHT,
vty_port,
(bm->address ? bm->address : "<all>"),
bm->port);

View file

@ -1,5 +1,4 @@
/* $QuaggaId: Format:%an, %ai, %h$ $
*
/*
* BGP Multipath
* Copyright (C) 2010 Google Inc.
*
@ -114,7 +113,6 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2)
ae2 = bi2->attr->extra;
compare = IPV4_ADDR_CMP (&bi1->attr->nexthop, &bi2->attr->nexthop);
if (!compare && ae1 && ae2)
{
if (ae1->mp_nexthop_len == ae2->mp_nexthop_len)
@ -126,8 +124,8 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2)
compare = IPV4_ADDR_CMP (&ae1->mp_nexthop_global_in,
&ae2->mp_nexthop_global_in);
break;
#ifdef HAVE_IPV6
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL:
compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_global,
&ae2->mp_nexthop_global);
break;
@ -138,11 +136,9 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2)
compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_local,
&ae2->mp_nexthop_local);
break;
#endif /* HAVE_IPV6 */
}
}
#ifdef HAVE_IPV6
/* This can happen if one IPv6 peer sends you global and link-local
* nexthops but another IPv6 peer only sends you global
*/
@ -159,7 +155,6 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2)
compare = 1;
}
}
#endif /* HAVE_IPV6 */
}
return compare;
@ -756,10 +751,8 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best,
/* Zap multipath attr nexthop so we set nexthop to self */
attr.nexthop.s_addr = 0;
#ifdef HAVE_IPV6
if (attr.extra)
memset (&attr.extra->mp_nexthop_global, 0, sizeof (struct in6_addr));
#endif /* HAVE_IPV6 */
/* TODO: should we set ATOMIC_AGGREGATE and AGGREGATOR? */
}

View file

@ -1,5 +1,4 @@
/* $QuaggaId: Format:%an, %ai, %h$ $
*
/*
* BGP Multipath
* Copyright (C) 2010 Google Inc.
*

View file

@ -35,11 +35,35 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_attr.h"
#include "bgpd/bgp_mplsvpn.h"
#include "bgpd/bgp_packet.h"
#include "bgpd/bgp_vty.h"
#if ENABLE_BGP_VNC
#include "bgpd/rfapi/rfapi_backend.h"
#endif
#define BGP_VPNVX_HELP_STR \
"Address Family \n" \
"Address Family \n"
static int
argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, int *index, afi_t *afi)
{
int ret = 0;
if (argv_find (argv, argc, "vpnv4", index))
{
ret = 1;
if (afi)
*afi = AFI_IP;
}
else if (argv_find (argv, argc, "vpnv6", index))
{
ret = 1;
if (afi)
*afi = AFI_IP6;
}
return ret;
}
u_int16_t
decode_rd_type (u_char *pnt)
{
@ -336,12 +360,24 @@ str2prefix_rd (const char *str, struct prefix_rd *prd)
if (! p2)
{
unsigned long as_val;
if (! all_digit (half))
goto out;
stream_putw (s, RD_TYPE_AS);
stream_putw (s, atoi (half));
stream_putl (s, atol (p + 1));
as_val = atol(half);
if (as_val > 0xffff)
{
stream_putw (s, RD_TYPE_AS4);
stream_putl (s, as_val);
stream_putw (s, atol (p + 1));
}
else
{
stream_putw (s, RD_TYPE_AS);
stream_putw (s, as_val);
stream_putl (s, atol (p + 1));
}
}
else
{
@ -494,8 +530,46 @@ DEFUN (no_vpnv4_network,
return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg);
}
DEFUN (vpnv6_network,
vpnv6_network_cmd,
"network X:X::X:X/M rd ASN:nn_or_IP-address:nn tag WORD [route-map WORD]",
"Specify a network to announce via BGP\n"
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
"Specify Route Distinguisher\n"
"VPN Route Distinguisher\n"
"BGP tag\n"
"tag value\n")
{
int idx_ipv6_prefix = 1;
int idx_ext_community = 3;
int idx_word = 5;
int idx_word_2 = 7;
if (argv[idx_word_2])
return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, argv[idx_word_2]->arg);
else
return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, NULL);
}
/* For testing purpose, static route of MPLS-VPN. */
DEFUN (no_vpnv6_network,
no_vpnv6_network_cmd,
"no network X:X::X:X/M rd ASN:nn_or_IP-address:nn tag WORD",
NO_STR
"Specify a network to announce via BGP\n"
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
"Specify Route Distinguisher\n"
"VPN Route Distinguisher\n"
"BGP tag\n"
"tag value\n")
{
int idx_ipv6_prefix = 2;
int idx_ext_community = 4;
int idx_word = 6;
return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg);
}
static int
show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u_char use_json)
show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u_char use_json, afi_t afi)
{
struct bgp *bgp;
struct bgp_table *table;
@ -538,7 +612,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u
json_object_string_add(json_ocode, "incomplete", "?");
}
for (rn = bgp_table_top (bgp->rib[AFI_IP][SAFI_MPLS_VPN]); rn;
for (rn = bgp_table_top (bgp->rib[afi][SAFI_MPLS_VPN]); rn;
rn = bgp_route_next (rn))
{
if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
@ -888,46 +962,20 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
if (output_count == 0)
vty_out (vty, "No prefixes displayed, %ld exist%s", total_count, VTY_NEWLINE);
else
vty_out (vty, "%sDisplayed %ld out of %ld total prefixes%s",
vty_out (vty, "%sDisplayed %ld routes and %ld total paths%s",
VTY_NEWLINE, output_count, total_count, VTY_NEWLINE);
}
return CMD_SUCCESS;
}
DEFUN (show_bgp_ivp4_vpn,
show_bgp_ipv4_vpn_cmd,
"show [ip] bgp ipv4 vpn [json]",
DEFUN (show_bgp_ip_vpn_rd,
show_bgp_ip_vpn_rd_cmd,
"show [ip] bgp "BGP_AFI_CMD_STR" vpn [rd ASN:nn_or_IP-address:nn] [json]",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n"
JSON_STR)
{
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
}
DEFUN (show_bgp_ipv6_vpn,
show_bgp_ipv6_vpn_cmd,
"show [ip] bgp ipv6 vpn [json]",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n"
JSON_STR)
{
return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
}
DEFUN (show_bgp_ipv4_vpn_rd,
show_bgp_ipv4_vpn_rd_cmd,
"show [ip] bgp ipv4 vpn rd ASN:nn_or_IP-address:nn [json]",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
BGP_VPNVX_HELP_STR
"Display VPN NLRI specific information\n"
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n"
@ -936,97 +984,99 @@ DEFUN (show_bgp_ipv4_vpn_rd,
int idx_ext_community = 5;
int ret;
struct prefix_rd prd;
afi_t afi;
int idx = 0;
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
if (argv_find_and_parse_afi (argv, argc, &idx, &afi))
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
if (argv[idx_ext_community]->arg)
{
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
}
else
{
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
}
}
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
return CMD_SUCCESS;
}
DEFUN (show_bgp_ipv6_vpn_rd,
show_bgp_ipv6_vpn_rd_cmd,
"show [ip] bgp ipv6 vpn rd ASN:nn_or_IP-address:nn [json]",
DEFUN (show_ip_bgp_vpn_all,
show_ip_bgp_vpn_all_cmd,
"show [ip] bgp <vpnv4|vpnv6>",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n"
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n"
JSON_STR)
BGP_VPNVX_HELP_STR)
{
int idx_ext_community = 5;
int ret;
struct prefix_rd prd;
afi_t afi;
int idx = 0;
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (!ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, 0);
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_vpnv4_all,
show_ip_bgp_vpnv4_all_cmd,
"show [ip] bgp vpnv4 all",
DEFUN (show_ip_bgp_vpn_rd,
show_ip_bgp_vpn_rd_cmd,
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
"Display information about all VPNv4 NLRIs\n")
{
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, 0);
}
DEFUN (show_ip_bgp_vpnv4_rd,
show_ip_bgp_vpnv4_rd_cmd,
"show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
BGP_VPNVX_HELP_STR
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n")
{
int idx_ext_community = 5;
int ret;
struct prefix_rd prd;
afi_t afi;
int idx = 0;
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_normal, NULL, 0, 0);
}
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0, 0);
}
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_vpnv4_all_tags,
show_ip_bgp_vpnv4_all_tags_cmd,
"show [ip] bgp vpnv4 all tags",
DEFUN (show_ip_bgp_vpn_all_tags,
show_ip_bgp_vpn_all_tags_cmd,
"show [ip] bgp <vpnv4|vpnv6> all tags",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
"Display information about all VPNv4 NLRIs\n"
BGP_VPNVX_HELP_STR
"Display information about all VPNv4/VPNV6 NLRIs\n"
"Display BGP tags for prefixes\n")
{
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 1, 0);
afi_t afi;
int idx = 0;
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 1, 0);
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_vpnv4_rd_tags,
show_ip_bgp_vpnv4_rd_tags_cmd,
"show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn tags",
DEFUN (show_ip_bgp_vpn_rd_tags,
show_ip_bgp_vpn_rd_tags_cmd,
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn tags",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
BGP_VPNVX_HELP_STR
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n"
"Display BGP tags for prefixes\n")
@ -1034,24 +1084,30 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags,
int idx_ext_community = 5;
int ret;
struct prefix_rd prd;
afi_t afi;
int idx = 0;
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_normal, NULL, 1, 0);
}
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1, 0);
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
show_ip_bgp_vpnv4_all_neighbor_routes_cmd,
"show [ip] bgp vpnv4 all neighbors A.B.C.D routes [json]",
DEFUN (show_ip_bgp_vpn_all_neighbor_routes,
show_ip_bgp_vpn_all_neighbor_routes_cmd,
"show [ip] bgp <vpnv4|vpnv6> all neighbors A.B.C.D routes [json]",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
"Display information about all VPNv4 NLRIs\n"
BGP_VPNVX_HELP_STR
"Display information about all VPNv4/VPNv6 NLRIs\n"
"Detailed information on TCP and BGP neighbor connections\n"
"Neighbor to display information about\n"
"Display routes learned from neighbor\n"
@ -1062,49 +1118,55 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
struct peer *peer;
int ret;
u_char uj = use_json(argc, argv);
afi_t afi;
int idx = 0;
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
if (ret < 0)
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
{
if (uj)
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
if (ret < 0)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
if (uj)
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_neighbor, &su, 0, uj);
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_neighbor, &su, 0, uj);
}
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
show_ip_bgp_vpnv4_rd_neighbor_routes_cmd,
"show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes [json]",
DEFUN (show_ip_bgp_vpn_rd_neighbor_routes,
show_ip_bgp_vpn_rd_neighbor_routes_cmd,
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes [json]",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
BGP_VPNVX_HELP_STR
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n"
"Detailed information on TCP and BGP neighbor connections\n"
@ -1119,66 +1181,72 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
struct peer *peer;
struct prefix_rd prd;
u_char uj = use_json(argc, argv);
afi_t afi;
int idx = 0;
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
{
if (uj)
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
if (ret < 0)
{
if (uj)
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
if (ret < 0)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
if (uj)
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_neighbor, &su, 0, uj);
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_neighbor, &su, 0, uj);
}
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd,
"show [ip] bgp vpnv4 all neighbors A.B.C.D advertised-routes [json]",
DEFUN (show_ip_bgp_vpn_all_neighbor_advertised_routes,
show_ip_bgp_vpn_all_neighbor_advertised_routes_cmd,
"show [ip] bgp <vpnv4|vpnv6> all neighbors A.B.C.D advertised-routes [json]",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
"Display information about all VPNv4 NLRIs\n"
BGP_VPNVX_HELP_STR
"Display information about all VPNv4/VPNv6 NLRIs\n"
"Detailed information on TCP and BGP neighbor connections\n"
"Neighbor to display information about\n"
"Display the routes advertised to a BGP neighbor\n"
@ -1189,48 +1257,54 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
struct peer *peer;
union sockunion su;
u_char uj = use_json(argc, argv);
afi_t afi;
int idx = 0;
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
if (ret < 0)
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
{
if (uj)
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
if (ret < 0)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
if (uj)
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
return show_adj_route_vpn (vty, peer, NULL, uj);
return show_adj_route_vpn (vty, peer, NULL, uj, afi);
}
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd,
"show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes [json]",
DEFUN (show_ip_bgp_vpn_rd_neighbor_advertised_routes,
show_ip_bgp_vpn_rd_neighbor_advertised_routes_cmd,
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes [json]",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
BGP_VPNVX_HELP_STR
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n"
"Detailed information on TCP and BGP neighbor connections\n"
@ -1245,55 +1319,61 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
struct prefix_rd prd;
union sockunion su;
u_char uj = use_json(argc, argv);
afi_t afi;
int idx = 0;
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
if (ret < 0)
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
{
if (uj)
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
if (ret < 0)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
if (uj)
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
{
if (uj)
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
else
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
return show_adj_route_vpn (vty, peer, &prd, uj);
return show_adj_route_vpn (vty, peer, &prd, uj, afi);
}
return CMD_SUCCESS;
}
void
@ -1303,16 +1383,16 @@ bgp_mplsvpn_init (void)
install_element (BGP_VPNV4_NODE, &vpnv4_network_route_map_cmd);
install_element (BGP_VPNV4_NODE, &no_vpnv4_network_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_tags_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_tags_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd);
install_element (BGP_VPNV6_NODE, &vpnv6_network_cmd);
install_element (BGP_VPNV6_NODE, &no_vpnv6_network_cmd);
install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_tags_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_tags_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_neighbor_advertised_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_neighbor_advertised_routes_cmd);
}

View file

@ -598,10 +598,8 @@ bgp_connect (struct peer *peer)
zlog_err ("%s: could not raise privs", __func__);
if (sockunion_family (&peer->su) == AF_INET)
setsockopt_ipv4_tos (peer->fd, IPTOS_PREC_INTERNETCONTROL);
# ifdef HAVE_IPV6
else if (sockunion_family (&peer->su) == AF_INET6)
setsockopt_ipv6_tclass (peer->fd, IPTOS_PREC_INTERNETCONTROL);
# endif
if (bgpd_privs.change (ZPRIVS_LOWER))
zlog_err ("%s: could not lower privs", __func__);
#endif
@ -618,10 +616,8 @@ bgp_connect (struct peer *peer)
return connect_error;
}
#ifdef HAVE_IPV6
if (peer->conf_if || peer->ifname)
ifindex = ifname2ifindex (peer->conf_if ? peer->conf_if : peer->ifname);
#endif /* HAVE_IPV6 */
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s [Event] Connect start to %s fd %d",
@ -681,10 +677,8 @@ bgp_listener (int sock, struct sockaddr *sa, socklen_t salen)
#ifdef IPTOS_PREC_INTERNETCONTROL
if (sa->sa_family == AF_INET)
setsockopt_ipv4_tos (sock, IPTOS_PREC_INTERNETCONTROL);
# ifdef HAVE_IPV6
else if (sa->sa_family == AF_INET6)
setsockopt_ipv6_tclass (sock, IPTOS_PREC_INTERNETCONTROL);
# endif
#endif
sockopt_v6only (sa->sa_family, sock);
@ -717,7 +711,6 @@ bgp_listener (int sock, struct sockaddr *sa, socklen_t salen)
}
/* IPv6 supported version of BGP server socket setup. */
#ifdef HAVE_IPV6
int
bgp_socket (unsigned short port, const char *address)
{
@ -774,50 +767,6 @@ bgp_socket (unsigned short port, const char *address)
return 0;
}
#else
/* Traditional IPv4 only version. */
int
bgp_socket (unsigned short port, const char *address)
{
int sock;
int socklen;
struct sockaddr_in sin;
int ret;
sock = socket (AF_INET, SOCK_STREAM, 0);
if (sock < 0)
{
zlog_err ("socket: %s", safe_strerror (errno));
return sock;
}
/* if we intend to implement ttl-security, this socket needs ttl=255 */
sockopt_ttl (AF_INET, sock, MAXTTL);
memset (&sin, 0, sizeof (struct sockaddr_in));
sin.sin_family = AF_INET;
sin.sin_port = htons (port);
socklen = sizeof (struct sockaddr_in);
if (address && ((ret = inet_aton(address, &sin.sin_addr)) < 1))
{
zlog_err("bgp_socket: could not parse ip address %s: %s",
address, safe_strerror (errno));
return ret;
}
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
sin.sin_len = socklen;
#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
ret = bgp_listener (sock, (struct sockaddr *) &sin, socklen);
if (ret < 0)
{
close (sock);
return ret;
}
return sock;
}
#endif /* HAVE_IPV6 */
void
bgp_close (void)

View file

@ -243,7 +243,6 @@ bgp_connected_add (struct bgp *bgp, struct connected *ifc)
}
}
}
#ifdef HAVE_IPV6
else if (addr->family == AF_INET6)
{
apply_mask_ipv6 ((struct prefix_ipv6 *) &p);
@ -267,7 +266,6 @@ bgp_connected_add (struct bgp *bgp, struct connected *ifc)
rn->info = bc;
}
}
#endif /* HAVE_IPV6 */
}
void
@ -304,7 +302,6 @@ bgp_connected_delete (struct bgp *bgp, struct connected *ifc)
bgp_unlock_node (rn);
bgp_unlock_node (rn);
}
#ifdef HAVE_IPV6
else if (addr->family == AF_INET6)
{
apply_mask_ipv6 ((struct prefix_ipv6 *) &p);
@ -329,7 +326,6 @@ bgp_connected_delete (struct bgp *bgp, struct connected *ifc)
bgp_unlock_node (rn);
bgp_unlock_node (rn);
}
#endif /* HAVE_IPV6 */
}
int
@ -450,12 +446,8 @@ bgp_show_nexthops (struct vty *vty, struct bgp *bgp, int detail)
if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED))
vty_out (vty, " Must be Connected%s", VTY_NEWLINE);
}
#ifdef HAVE_CLOCK_MONOTONIC
tbuf = time(NULL) - (bgp_clock() - bnc->last_update);
vty_out (vty, " Last update: %s", ctime(&tbuf));
#else
vty_out (vty, " Last update: %s", ctime(&bnc->uptime));
#endif /* HAVE_CLOCK_MONOTONIC */
vty_out(vty, "%s", VTY_NEWLINE);
}
}

View file

@ -509,7 +509,6 @@ make_prefix (int afi, struct bgp_info *ri, struct prefix *p)
p->prefixlen = IPV4_MAX_BITLEN;
}
break;
#ifdef HAVE_IPV6
case AFI_IP6:
/* We don't register link local NH */
if (ri->attr->extra->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL
@ -529,7 +528,6 @@ make_prefix (int afi, struct bgp_info *ri, struct prefix *p)
p->prefixlen = IPV6_MAX_BITLEN;
}
break;
#endif
default:
if (BGP_DEBUG(nht, NHT))
{
@ -582,11 +580,9 @@ sendmsg_zebra_rnh (struct bgp_nexthop_cache *bnc, int command)
case AF_INET:
stream_put_in_addr (s, &p->u.prefix4);
break;
#ifdef HAVE_IPV6
case AF_INET6:
stream_put(s, &(p->u.prefix6), 16);
break;
#endif
default:
break;
}

View file

@ -79,9 +79,13 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso
if (hdr->code == CAPABILITY_CODE_MP)
{
afi_t afi;
safi_t safi;
bgp_map_afi_safi_iana2int (ntohs(mpc.afi), mpc.safi, &afi, &safi);
if (use_json)
{
switch (ntohs (mpc.afi))
switch (afi)
{
case AFI_IP:
json_object_string_add(json_cap, "capabilityErrorMultiProtocolAfi", "IPv4");
@ -93,7 +97,7 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso
json_object_int_add(json_cap, "capabilityErrorMultiProtocolAfiUnknown", ntohs (mpc.afi));
break;
}
switch (mpc.safi)
switch (safi)
{
case SAFI_UNICAST:
json_object_string_add(json_cap, "capabilityErrorMultiProtocolSafi", "unicast");
@ -101,7 +105,7 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso
case SAFI_MULTICAST:
json_object_string_add(json_cap, "capabilityErrorMultiProtocolSafi", "multicast");
break;
case SAFI_MPLS_LABELED_VPN:
case SAFI_MPLS_VPN:
json_object_string_add(json_cap, "capabilityErrorMultiProtocolSafi", "MPLS-labeled VPN");
break;
case SAFI_ENCAP:
@ -115,7 +119,7 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso
else
{
vty_out (vty, " Capability error for: Multi protocol ");
switch (ntohs (mpc.afi))
switch (afi)
{
case AFI_IP:
vty_out (vty, "AFI IPv4, ");
@ -127,7 +131,7 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso
vty_out (vty, "AFI Unknown %d, ", ntohs (mpc.afi));
break;
}
switch (mpc.safi)
switch (safi)
{
case SAFI_UNICAST:
vty_out (vty, "SAFI Unicast");
@ -135,7 +139,7 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso
case SAFI_MULTICAST:
vty_out (vty, "SAFI Multicast");
break;
case SAFI_MPLS_LABELED_VPN:
case SAFI_MPLS_VPN:
vty_out (vty, "SAFI MPLS-labeled VPN");
break;
case SAFI_ENCAP:
@ -178,42 +182,15 @@ bgp_capability_mp_data (struct stream *s, struct capability_mp_data *mpc)
mpc->safi = stream_getc (s);
}
int
bgp_afi_safi_valid_indices (afi_t afi, safi_t *safi)
{
switch (afi)
{
case AFI_IP:
case AFI_IP6:
switch (*safi)
{
/* BGP MPLS-labeled VPN SAFI isn't contigious with others, remap */
case SAFI_MPLS_LABELED_VPN:
*safi = SAFI_MPLS_VPN;
case SAFI_UNICAST:
case SAFI_MULTICAST:
case SAFI_MPLS_VPN:
case SAFI_ENCAP:
return 1;
}
break;
case AFI_ETHER:
default:
break;
}
zlog_debug ("unknown afi/safi (%u/%u)", afi, *safi);
return 0;
}
/* Set negotiated capability value. */
static int
bgp_capability_mp (struct peer *peer, struct capability_header *hdr)
{
struct capability_mp_data mpc;
struct stream *s = BGP_INPUT (peer);
afi_t afi;
safi_t safi;
/* Verify length is 4 */
if (hdr->length != 4)
{
@ -228,14 +205,15 @@ bgp_capability_mp (struct peer *peer, struct capability_header *hdr)
zlog_debug ("%s OPEN has MP_EXT CAP for afi/safi: %u/%u",
peer->host, mpc.afi, mpc.safi);
if (!bgp_afi_safi_valid_indices (mpc.afi, &mpc.safi))
/* Convert AFI, SAFI to internal values, check. */
if (bgp_map_afi_safi_iana2int (mpc.afi, mpc.safi, &afi, &safi))
return -1;
/* Now safi remapped, and afi/safi are valid array indices */
peer->afc_recv[mpc.afi][mpc.safi] = 1;
peer->afc_recv[afi][safi] = 1;
if (peer->afc[mpc.afi][mpc.safi])
peer->afc_nego[mpc.afi][mpc.safi] = 1;
if (peer->afc[afi][safi])
peer->afc_nego[afi][safi] = 1;
else
return -1;
@ -243,7 +221,7 @@ bgp_capability_mp (struct peer *peer, struct capability_header *hdr)
}
static void
bgp_capability_orf_not_support (struct peer *peer, afi_t afi, safi_t safi,
bgp_capability_orf_not_support (struct peer *peer, iana_afi_t afi, safi_t safi,
u_char type, u_char mode)
{
if (bgp_debug_neighbor_events(peer))
@ -271,8 +249,9 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
{
struct stream *s = BGP_INPUT (peer);
struct capability_orf_entry entry;
iana_afi_t pkt_afi;
afi_t afi;
safi_t safi;
safi_t pkt_safi, safi;
u_char type;
u_char mode;
u_int16_t sm_cap = 0; /* capability send-mode receive */
@ -282,22 +261,25 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
/* ORF Entry header */
bgp_capability_mp_data (s, &entry.mpc);
entry.num = stream_getc (s);
afi = entry.mpc.afi;
safi = entry.mpc.safi;
pkt_afi = entry.mpc.afi;
pkt_safi = entry.mpc.safi;
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s ORF Cap entry for afi/safi: %u/%u",
peer->host, entry.mpc.afi, entry.mpc.safi);
/* Check AFI and SAFI. */
if (!bgp_afi_safi_valid_indices (entry.mpc.afi, &safi))
/* Convert AFI, SAFI to internal values, check. */
if (bgp_map_afi_safi_iana2int (pkt_afi, pkt_safi, &afi, &safi))
{
zlog_info ("%s Addr-family %d/%d not supported."
" Ignoring the ORF capability",
peer->host, entry.mpc.afi, entry.mpc.safi);
peer->host, pkt_afi, pkt_safi);
return 0;
}
entry.mpc.afi = pkt_afi;
entry.mpc.safi = safi;
/* validate number field */
if (CAPABILITY_CODE_ORF_LEN + (entry.num * 2) > hdr->length)
{
@ -321,7 +303,7 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
case ORF_MODE_RECEIVE:
break;
default:
bgp_capability_orf_not_support (peer, afi, safi, type, mode);
bgp_capability_orf_not_support (peer, pkt_afi, pkt_safi, type, mode);
continue;
}
/* ORF Type and afi/safi error checks */
@ -334,7 +316,7 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
case ORF_TYPE_PREFIX:
break;
default:
bgp_capability_orf_not_support (peer, afi, safi, type, mode);
bgp_capability_orf_not_support (peer, pkt_afi, pkt_safi, type, mode);
continue;
}
break;
@ -344,12 +326,12 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
case ORF_TYPE_PREFIX_OLD:
break;
default:
bgp_capability_orf_not_support (peer, afi, safi, type, mode);
bgp_capability_orf_not_support (peer, pkt_afi, pkt_safi, type, mode);
continue;
}
break;
default:
bgp_capability_orf_not_support (peer, afi, safi, type, mode);
bgp_capability_orf_not_support (peer, pkt_afi, pkt_safi, type, mode);
continue;
}
@ -358,7 +340,7 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
|| (afi == AFI_IP && safi == SAFI_MULTICAST)
|| (afi == AFI_IP6 && safi == SAFI_UNICAST)))
{
bgp_capability_orf_not_support (peer, afi, safi, type, mode);
bgp_capability_orf_not_support (peer, pkt_afi, pkt_safi, type, mode);
continue;
}
@ -367,7 +349,7 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
" as %s for afi/safi: %d/%d",
peer->host, LOOKUP (orf_type_str, type),
LOOKUP (orf_mode_str, mode),
entry.mpc.afi, safi);
pkt_afi, pkt_safi);
if (hdr->code == CAPABILITY_CODE_ORF)
{
@ -381,7 +363,7 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
}
else
{
bgp_capability_orf_not_support (peer, afi, safi, type, mode);
bgp_capability_orf_not_support (peer, pkt_afi, pkt_safi, type, mode);
continue;
}
@ -437,23 +419,26 @@ bgp_capability_restart (struct peer *peer, struct capability_header *caphdr)
while (stream_get_getp (s) + 4 <= end)
{
afi_t afi = stream_getw (s);
safi_t safi = stream_getc (s);
afi_t afi;
safi_t safi;
iana_afi_t pkt_afi = stream_getw (s);
safi_t pkt_safi = stream_getc (s);
u_char flag = stream_getc (s);
if (!bgp_afi_safi_valid_indices (afi, &safi))
/* Convert AFI, SAFI to internal values, check. */
if (bgp_map_afi_safi_iana2int (pkt_afi, pkt_safi, &afi, &safi))
{
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Addr-family %d/%d(afi/safi) not supported."
" Ignore the Graceful Restart capability for this AFI/SAFI",
peer->host, afi, safi);
peer->host, pkt_afi, pkt_safi);
}
else if (!peer->afc[afi][safi])
{
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Addr-family %d/%d(afi/safi) not enabled."
" Ignore the Graceful Restart capability",
peer->host, afi, safi);
peer->host, pkt_afi, pkt_safi);
}
else
{
@ -512,22 +497,25 @@ bgp_capability_addpath (struct peer *peer, struct capability_header *hdr)
while (stream_get_getp (s) + 4 <= end)
{
afi_t afi = stream_getw (s);
safi_t safi = stream_getc (s);
afi_t afi;
safi_t safi;
iana_afi_t pkt_afi = stream_getw (s);
safi_t pkt_safi = stream_getc (s);
u_char send_receive = stream_getc (s);
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s OPEN has AddPath CAP for afi/safi: %u/%u%s%s",
peer->host, afi, safi,
peer->host, pkt_afi, pkt_safi,
(send_receive & BGP_ADDPATH_RX) ? ", receive" : "",
(send_receive & BGP_ADDPATH_TX) ? ", transmit" : "");
if (!bgp_afi_safi_valid_indices (afi, &safi))
/* Convert AFI, SAFI to internal values, check. */
if (bgp_map_afi_safi_iana2int (pkt_afi, pkt_safi, &afi, &safi))
{
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Addr-family %d/%d(afi/safi) not supported."
" Ignore the Addpath Attribute for this AFI/SAFI",
peer->host, afi, safi);
peer->host, pkt_afi, pkt_safi);
continue;
}
else if (!peer->afc[afi][safi])
@ -535,7 +523,7 @@ bgp_capability_addpath (struct peer *peer, struct capability_header *hdr)
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Addr-family %d/%d(afi/safi) not enabled."
" Ignore the AddPath capability for this AFI/SAFI",
peer->host, afi, safi);
peer->host, pkt_afi, pkt_safi);
continue;
}
@ -565,20 +553,23 @@ bgp_capability_enhe (struct peer *peer, struct capability_header *hdr)
while (stream_get_getp (s) + 6 <= end)
{
afi_t afi = stream_getw (s);
safi_t safi = stream_getw (s);
afi_t nh_afi = stream_getw (s);
iana_afi_t pkt_afi = stream_getw (s);
afi_t afi;
safi_t safi, pkt_safi = stream_getw (s);
iana_afi_t pkt_nh_afi = stream_getw (s);
afi_t nh_afi;
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Received with afi/safi/next-hop afi: %u/%u/%u",
peer->host, afi, safi, nh_afi);
peer->host, pkt_afi, pkt_safi, pkt_nh_afi);
if (!bgp_afi_safi_valid_indices (afi, &safi))
/* Convert AFI, SAFI to internal values, check. */
if (bgp_map_afi_safi_iana2int (pkt_afi, pkt_safi, &afi, &safi))
{
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Addr-family %d/%d(afi/safi) not supported."
" Ignore the ENHE Attribute for this AFI/SAFI",
peer->host, afi, safi);
peer->host, pkt_afi, pkt_safi);
continue;
}
@ -587,11 +578,13 @@ bgp_capability_enhe (struct peer *peer, struct capability_header *hdr)
* possibilities, so we ignore other values with a log. Also, only
* Unicast SAFI is currently supported (and expected).
*/
nh_afi = afi_iana2int (pkt_nh_afi);
if (afi != AFI_IP || safi != SAFI_UNICAST || nh_afi != AFI_IP6)
{
zlog_warn ("%s Unexpected afi/safi/next-hop afi: %u/%u/%u "
"in Extended Next-hop capability, ignoring",
peer->host, afi, safi, nh_afi);
peer->host, pkt_afi, pkt_safi, pkt_nh_afi);
continue;
}
@ -1174,9 +1167,11 @@ bgp_open_capability_orf (struct stream *s, struct peer *peer,
unsigned long orfp;
unsigned long numberp;
int number_of_orfs = 0;
iana_afi_t pkt_afi;
safi_t pkt_safi;
if (safi == SAFI_MPLS_VPN)
safi = SAFI_MPLS_LABELED_VPN;
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana (afi, safi, &pkt_afi, &pkt_safi);
stream_putc (s, BGP_OPEN_OPT_CAP);
capp = stream_get_endp (s); /* Set Capability Len Pointer */
@ -1184,9 +1179,9 @@ bgp_open_capability_orf (struct stream *s, struct peer *peer,
stream_putc (s, code); /* Capability Code */
orfp = stream_get_endp (s); /* Set ORF Len Pointer */
stream_putc (s, 0); /* ORF Length */
stream_putw (s, afi);
stream_putw (s, pkt_afi);
stream_putc (s, 0);
stream_putc (s, safi);
stream_putc (s, pkt_safi);
numberp = stream_get_endp (s); /* Set Number Pointer */
stream_putc (s, 0); /* Number of ORFs */
@ -1235,8 +1230,9 @@ bgp_open_capability (struct stream *s, struct peer *peer)
{
u_char len;
unsigned long cp, capp, rcapp;
iana_afi_t pkt_afi;
afi_t afi;
safi_t safi;
safi_t safi, pkt_safi;
as_t local_as;
u_int32_t restart_time;
u_char afi_safi_count = 0;
@ -1254,56 +1250,29 @@ bgp_open_capability (struct stream *s, struct peer *peer)
|| CHECK_FLAG (peer->flags, PEER_FLAG_DONT_CAPABILITY))
return;
/* IPv4 unicast. */
if (peer->afc[AFI_IP][SAFI_UNICAST])
{
peer->afc_adv[AFI_IP][SAFI_UNICAST] = 1;
stream_putc (s, BGP_OPEN_OPT_CAP);
stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, AFI_IP);
stream_putc (s, 0);
stream_putc (s, SAFI_UNICAST);
}
/* IPv4 multicast. */
if (peer->afc[AFI_IP][SAFI_MULTICAST])
{
peer->afc_adv[AFI_IP][SAFI_MULTICAST] = 1;
stream_putc (s, BGP_OPEN_OPT_CAP);
stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, AFI_IP);
stream_putc (s, 0);
stream_putc (s, SAFI_MULTICAST);
}
/* IPv4 VPN */
if (peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
peer->afc_adv[AFI_IP][SAFI_MPLS_VPN] = 1;
stream_putc (s, BGP_OPEN_OPT_CAP);
stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, AFI_IP);
stream_putc (s, 0);
stream_putc (s, SAFI_MPLS_LABELED_VPN);
}
/* ENCAP */
if (peer->afc[AFI_IP][SAFI_ENCAP])
{
peer->afc_adv[AFI_IP][SAFI_ENCAP] = 1;
stream_putc (s, BGP_OPEN_OPT_CAP);
stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, AFI_IP);
stream_putc (s, 0);
stream_putc (s, SAFI_ENCAP);
}
#ifdef HAVE_IPV6
/* Currently supporting RFC-5549 for Link-Local peering only */
/* MP capability for configured AFI, SAFI */
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
{
if (peer->afc[afi][safi])
{
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana (afi, safi, &pkt_afi, &pkt_safi);
peer->afc_adv[afi][safi] = 1;
stream_putc (s, BGP_OPEN_OPT_CAP);
stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, pkt_afi);
stream_putc (s, 0);
stream_putc (s, pkt_safi);
}
}
/* Extended nexthop capability - currently supporting RFC-5549 for
* Link-Local peering only
*/
if (CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE) &&
peer->su.sa.sa_family == AF_INET6 &&
IN6_IS_ADDR_LINKLOCAL(&peer->su.sin6.sin6_addr))
@ -1323,55 +1292,6 @@ bgp_open_capability (struct stream *s, struct peer *peer)
if (CHECK_FLAG (peer->af_cap[AFI_IP][SAFI_UNICAST], PEER_CAP_ENHE_AF_RCV))
SET_FLAG (peer->af_cap[AFI_IP][SAFI_UNICAST], PEER_CAP_ENHE_AF_NEGO);
}
/* IPv6 unicast. */
if (peer->afc[AFI_IP6][SAFI_UNICAST])
{
peer->afc_adv[AFI_IP6][SAFI_UNICAST] = 1;
stream_putc (s, BGP_OPEN_OPT_CAP);
stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, AFI_IP6);
stream_putc (s, 0);
stream_putc (s, SAFI_UNICAST);
}
/* IPv6 multicast. */
if (peer->afc[AFI_IP6][SAFI_MULTICAST])
{
peer->afc_adv[AFI_IP6][SAFI_MULTICAST] = 1;
stream_putc (s, BGP_OPEN_OPT_CAP);
stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, AFI_IP6);
stream_putc (s, 0);
stream_putc (s, SAFI_MULTICAST);
}
/* IPv6 VPN. */
if (peer->afc[AFI_IP6][SAFI_MPLS_VPN])
{
peer->afc_adv[AFI_IP6][SAFI_MPLS_VPN] = 1;
stream_putc (s, BGP_OPEN_OPT_CAP);
stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, AFI_IP6);
stream_putc (s, 0);
stream_putc (s, SAFI_MPLS_LABELED_VPN);
}
/* IPv6 ENCAP. */
if (peer->afc[AFI_IP6][SAFI_ENCAP])
{
peer->afc_adv[AFI_IP6][SAFI_ENCAP] = 1;
stream_putc (s, BGP_OPEN_OPT_CAP);
stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, AFI_IP6);
stream_putc (s, 0);
stream_putc (s, SAFI_ENCAP);
}
#endif /* HAVE_IPV6 */
/* Route refresh. */
SET_FLAG (peer->cap, PEER_CAP_REFRESH_ADV);
@ -1420,8 +1340,11 @@ bgp_open_capability (struct stream *s, struct peer *peer)
for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
if (peer->afc[afi][safi])
{
stream_putw (s, afi);
stream_putc (s, safi);
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana (afi, safi, &pkt_afi, &pkt_safi);
stream_putw (s, pkt_afi);
stream_putc (s, pkt_safi);
if (adv_addpath_tx)
{
@ -1535,9 +1458,14 @@ bgp_open_capability (struct stream *s, struct peer *peer)
for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
if (peer->afc[afi][safi])
{
stream_putw (s, afi);
stream_putc (s, safi);
stream_putc (s, 0); //Forwarding is not retained as of now.
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana (afi, safi, &pkt_afi, &pkt_safi);
stream_putw (s, pkt_afi);
stream_putc (s, pkt_safi);
if (bgp_flag_check(peer->bgp, BGP_FLAG_GR_PRESERVE_FWD))
stream_putc (s, RESTART_F_BIT);
else
stream_putc (s, 0);
}
}

View file

@ -31,7 +31,7 @@ struct capability_header
/* Generic MP capability data */
struct capability_mp_data
{
afi_t afi;
iana_afi_t afi;
u_char reserved;
safi_t safi;
};
@ -115,6 +115,5 @@ extern int bgp_open_option_parse (struct peer *, u_char, int *);
extern void bgp_open_capability (struct stream *, struct peer *);
extern void bgp_capability_vty_out (struct vty *, struct peer *, u_char, json_object *);
extern as_t peek_for_as4_capability (struct peer *, u_char);
extern int bgp_afi_safi_valid_indices (afi_t, safi_t *);
#endif /* _QUAGGA_BGP_OPEN_H */

View file

@ -147,6 +147,8 @@ static struct stream *
bgp_update_packet_eor (struct peer *peer, afi_t afi, safi_t safi)
{
struct stream *s;
iana_afi_t pkt_afi;
safi_t pkt_safi;
if (DISABLE_BGP_ANNOUNCE)
return NULL;
@ -169,13 +171,16 @@ bgp_update_packet_eor (struct peer *peer, afi_t afi, safi_t safi)
}
else
{
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana (afi, safi, &pkt_afi, &pkt_safi);
/* Total Path Attribute Length */
stream_putw (s, 6);
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL);
stream_putc (s, BGP_ATTR_MP_UNREACH_NLRI);
stream_putc (s, 3);
stream_putw (s, afi);
stream_putc (s, safi);
stream_putw (s, pkt_afi);
stream_putc (s, pkt_safi);
}
bgp_packet_set_size (s);
@ -240,8 +245,7 @@ bgp_write_packet (struct peer *peer)
if (!(PAF_SUBGRP(paf))->t_coalesce &&
peer->afc_nego[afi][safi] && peer->synctime
&& ! CHECK_FLAG (peer->af_sflags[afi][safi],
PEER_STATUS_EOR_SEND)
&& safi != SAFI_MPLS_VPN)
PEER_STATUS_EOR_SEND))
{
SET_FLAG (peer->af_sflags[afi][safi],
PEER_STATUS_EOR_SEND);
@ -691,15 +695,16 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi,
struct stream *s;
struct bgp_filter *filter;
int orf_refresh = 0;
iana_afi_t pkt_afi;
safi_t pkt_safi;
if (DISABLE_BGP_ANNOUNCE)
return;
filter = &peer->filter[afi][safi];
/* Adjust safi code. */
if (safi == SAFI_MPLS_VPN)
safi = SAFI_MPLS_LABELED_VPN;
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana (afi, safi, &pkt_afi, &pkt_safi);
s = stream_new (BGP_MAX_PACKET_SIZE);
@ -710,9 +715,9 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi,
bgp_packet_set_marker (s, BGP_MSG_ROUTE_REFRESH_OLD);
/* Encode Route Refresh message. */
stream_putw (s, afi);
stream_putw (s, pkt_afi);
stream_putc (s, 0);
stream_putc (s, safi);
stream_putc (s, pkt_safi);
if (orf_type == ORF_TYPE_PREFIX
|| orf_type == ORF_TYPE_PREFIX_OLD)
@ -735,7 +740,7 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi,
zlog_debug ("%s sending REFRESH_REQ to remove ORF(%d) (%s) for afi/safi: %d/%d",
peer->host, orf_type,
(when_to_refresh == REFRESH_DEFER ? "defer" : "immediate"),
afi, safi);
pkt_afi, pkt_safi);
}
else
{
@ -747,7 +752,7 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi,
zlog_debug ("%s sending REFRESH_REQ with pfxlist ORF(%d) (%s) for afi/safi: %d/%d",
peer->host, orf_type,
(when_to_refresh == REFRESH_DEFER ? "defer" : "immediate"),
afi, safi);
pkt_afi, pkt_safi);
}
/* Total ORF Entry Len. */
@ -762,7 +767,7 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi,
{
if (! orf_refresh)
zlog_debug ("%s sending REFRESH_REQ for afi/safi: %d/%d",
peer->host, afi, safi);
peer->host, pkt_afi, pkt_safi);
}
/* Add packet to the peer. */
@ -777,10 +782,11 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi,
int capability_code, int action)
{
struct stream *s;
iana_afi_t pkt_afi;
safi_t pkt_safi;
/* Adjust safi code. */
if (safi == SAFI_MPLS_VPN)
safi = SAFI_MPLS_LABELED_VPN;
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana (afi, safi, &pkt_afi, &pkt_safi);
s = stream_new (BGP_MAX_PACKET_SIZE);
@ -793,14 +799,14 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi,
stream_putc (s, action);
stream_putc (s, CAPABILITY_CODE_MP);
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, afi);
stream_putw (s, pkt_afi);
stream_putc (s, 0);
stream_putc (s, safi);
stream_putc (s, pkt_safi);
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s sending CAPABILITY has %s MP_EXT CAP for afi/safi: %d/%d",
peer->host, action == CAPABILITY_ACTION_SET ?
"Advertising" : "Removing", afi, safi);
"Advertising" : "Removing", pkt_afi, pkt_safi);
}
/* Set packet size. */
@ -1330,7 +1336,6 @@ bgp_nlri_parse (struct peer *peer, struct attr *attr, struct bgp_nlri *packet)
case SAFI_MULTICAST:
return bgp_nlri_parse_ip (peer, attr, packet);
case SAFI_MPLS_VPN:
case SAFI_MPLS_LABELED_VPN:
return bgp_nlri_parse_vpn (peer, attr, packet);
case SAFI_ENCAP:
return bgp_nlri_parse_encap (peer, attr, packet);
@ -1509,26 +1514,6 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
if (!nlris[i].nlri)
continue;
/* We use afi and safi as indices into tables and what not. It would
* be impossible, at this time, to support unknown afi/safis. And
* anyway, the peer needs to be configured to enable the afi/safi
* explicitly which requires UI support.
*
* Ignore unknown afi/safi NLRIs.
*
* Note: This means nlri[x].afi/safi still can not be trusted for
* indexing later in this function!
*
* Note2: This will also remap the wire code-point for VPN safi to the
* internal safi_t point, as needs be.
*/
if(!bgp_afi_safi_valid_indices (nlris[i].afi, &nlris[i].safi))
{
zlog_info ("%s [Info] UPDATE with unsupported AFI/SAFI %u/%u",
peer->host, nlris[i].afi, nlris[i].safi);
continue;
}
/* NLRI is processed iff the peer if configured for the specific afi/safi */
if (!peer->afc[nlris[i].afi][nlris[i].safi])
{
@ -1587,9 +1572,7 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
safi = SAFI_UNICAST;
}
else if (attr.flag & ATTR_FLAG_BIT (BGP_ATTR_MP_UNREACH_NLRI)
&& nlris[NLRI_MP_WITHDRAW].length == 0
&& bgp_afi_safi_valid_indices (nlris[NLRI_MP_WITHDRAW].afi,
&nlris[NLRI_MP_WITHDRAW].safi))
&& nlris[NLRI_MP_WITHDRAW].length == 0)
{
afi = nlris[NLRI_MP_WITHDRAW].afi;
safi = nlris[NLRI_MP_WITHDRAW].safi;
@ -1728,8 +1711,9 @@ bgp_keepalive_receive (struct peer *peer, bgp_size_t size)
static void
bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
{
iana_afi_t pkt_afi;
afi_t afi;
safi_t safi;
safi_t pkt_safi, safi;
struct stream *s;
struct peer_af *paf;
struct update_group *updgrp;
@ -1758,28 +1742,22 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
s = peer->ibuf;
/* Parse packet. */
afi = stream_getw (s);
pkt_afi = stream_getw (s);
(void)stream_getc (s);
safi = stream_getc (s);
pkt_safi = stream_getc (s);
if (bgp_debug_update(peer, NULL, NULL, 0))
zlog_debug ("%s rcvd REFRESH_REQ for afi/safi: %d/%d",
peer->host, afi, safi);
peer->host, pkt_afi, pkt_safi);
/* Check AFI and SAFI. */
if ((afi != AFI_IP && afi != AFI_IP6)
|| (safi != SAFI_UNICAST && safi != SAFI_MULTICAST
&& safi != SAFI_MPLS_LABELED_VPN))
/* Convert AFI, SAFI to internal values and check. */
if (bgp_map_afi_safi_iana2int (pkt_afi, pkt_safi, &afi, &safi))
{
zlog_info ("%s REFRESH_REQ for unrecognized afi/safi: %d/%d - ignored",
peer->host, afi, safi);
peer->host, pkt_afi, pkt_safi);
return;
}
/* Adjust safi code. */
if (safi == SAFI_MPLS_LABELED_VPN)
safi = SAFI_MPLS_VPN;
if (size != BGP_MSG_ROUTE_REFRESH_MIN_SIZE - BGP_HEADER_SIZE)
{
u_char *end;
@ -1955,8 +1933,9 @@ bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length)
struct capability_mp_data mpc;
struct capability_header *hdr;
u_char action;
iana_afi_t pkt_afi;
afi_t afi;
safi_t safi;
safi_t pkt_safi, safi;
end = pnt + length;
@ -2000,18 +1979,19 @@ bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length)
/* We know MP Capability Code. */
if (hdr->code == CAPABILITY_CODE_MP)
{
afi = ntohs (mpc.afi);
safi = mpc.safi;
pkt_afi = ntohs (mpc.afi);
pkt_safi = mpc.safi;
/* Ignore capability when override-capability is set. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
continue;
if (!bgp_afi_safi_valid_indices (afi, &safi))
/* Convert AFI, SAFI to internal values. */
if (bgp_map_afi_safi_iana2int (pkt_afi, pkt_safi, &afi, &safi))
{
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Dynamic Capability MP_EXT afi/safi invalid "
"(%u/%u)", peer->host, afi, safi);
"(%u/%u)", peer->host, pkt_afi, pkt_safi);
continue;
}
@ -2021,7 +2001,7 @@ bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length)
peer->host,
action == CAPABILITY_ACTION_SET
? "Advertising" : "Removing",
ntohs(mpc.afi) , mpc.safi);
pkt_afi, pkt_safi);
if (action == CAPABILITY_ACTION_SET)
{

View file

@ -630,8 +630,9 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
{
if (peer_sort (new->peer) == BGP_PEER_IBGP
&& peer_sort (exist->peer) == BGP_PEER_IBGP
&& CHECK_FLAG (mpath_cfg->ibgp_flags,
BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))
&& (mpath_cfg == NULL ||
CHECK_FLAG (mpath_cfg->ibgp_flags,
BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)))
{
newm = BGP_CLUSTER_LIST_LENGTH(new->attr);
existm = BGP_CLUSTER_LIST_LENGTH(exist->attr);
@ -867,9 +868,8 @@ bgp_info_cmp_compatible (struct bgp *bgp, struct bgp_info *new, struct bgp_info
afi_t afi, safi_t safi)
{
int paths_eq;
struct bgp_maxpaths_cfg mpath_cfg;
int ret;
ret = bgp_info_cmp (bgp, new, exist, &paths_eq, &mpath_cfg, 0, __func__);
ret = bgp_info_cmp (bgp, new, exist, &paths_eq, NULL, 0, __func__);
if (paths_eq)
ret = 0;
@ -1172,10 +1172,8 @@ subgroup_announce_reset_nhop (u_char family, struct attr *attr)
{
if (family == AF_INET)
attr->nexthop.s_addr = 0;
#ifdef HAVE_IPV6
if (family == AF_INET6)
memset (&attr->extra->mp_nexthop_global, 0, IPV6_MAX_BYTELEN);
#endif
}
int
@ -1266,10 +1264,8 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp,
{
if (p->family == AF_INET && p->u.prefix4.s_addr == INADDR_ANY)
return 0;
#ifdef HAVE_IPV6
else if (p->family == AF_INET6 && p->prefixlen == 0)
return 0;
#endif /* HAVE_IPV6 */
}
/* Transparency check. */
@ -1432,7 +1428,6 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp,
if (reflect)
SET_FLAG(attr->rmap_change_flags, BATTR_REFLECTED);
#ifdef HAVE_IPV6
#define NEXTHOP_IS_V6 (\
(safi != SAFI_ENCAP && \
(p->family == AF_INET6 || peer_cap_enhe(peer))) || \
@ -1463,7 +1458,6 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp,
PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED)))
memset (&attr->extra->mp_nexthop_local, 0, IPV6_MAX_BYTELEN);
}
#endif /* HAVE_IPV6 */
bgp_peer_remove_private_as(bgp, afi, safi, peer, attr);
bgp_peer_as_override(bgp, afi, safi, peer, attr);
@ -1799,6 +1793,7 @@ subgroup_process_announce_selected (struct update_subgroup *subgrp,
PEER_STATUS_ORF_WAIT_REFRESH))
return 0;
memset(&extra, 0, sizeof(struct attr_extra));
/* It's initialized in bgp_announce_check() */
attr.extra = &extra;
@ -2115,9 +2110,12 @@ bgp_maximum_prefix_restart_timer (struct thread *thread)
}
int
bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi,
bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi,
safi_t safi, int always)
{
iana_afi_t pkt_afi;
safi_t pkt_safi;
if (!CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
return 0;
@ -2135,15 +2133,15 @@ bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi,
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
return 0;
/* Convert AFI, SAFI to values for packet. */
pkt_afi = afi_int2iana (afi);
pkt_safi = safi_int2iana (safi);
{
u_int8_t ndata[7];
if (safi == SAFI_MPLS_VPN)
safi = SAFI_MPLS_LABELED_VPN;
ndata[0] = (afi >> 8);
ndata[1] = afi;
ndata[2] = safi;
ndata[0] = (pkt_afi >> 8);
ndata[1] = pkt_afi;
ndata[2] = pkt_safi;
ndata[3] = (peer->pmax[afi][safi] >> 24);
ndata[4] = (peer->pmax[afi][safi] >> 16);
ndata[5] = (peer->pmax[afi][safi] >> 8);
@ -2316,14 +2314,13 @@ bgp_update_martian_nexthop (struct bgp *bgp, afi_t afi, safi_t safi, struct attr
IPV4_CLASS_DE (ntohl (attre->mp_nexthop_global_in.s_addr)));
break;
#ifdef HAVE_IPV6
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL:
ret = (IN6_IS_ADDR_UNSPECIFIED(&attre->mp_nexthop_global) ||
IN6_IS_ADDR_LOOPBACK(&attre->mp_nexthop_global) ||
IN6_IS_ADDR_MULTICAST(&attre->mp_nexthop_global));
break;
#endif /* HAVE_IPV6 */
default:
ret = 1;
@ -3307,17 +3304,37 @@ bgp_clear_stale_route (struct peer *peer, afi_t afi, safi_t safi)
struct bgp_info *ri;
struct bgp_table *table;
table = peer->bgp->rib[afi][safi];
for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn))
if ( safi == SAFI_MPLS_VPN)
{
for (ri = rn->info; ri; ri = ri->next)
if (ri->peer == peer)
{
if (CHECK_FLAG (ri->flags, BGP_INFO_STALE))
bgp_rib_remove (rn, ri, peer, afi, safi);
break;
}
for (rn = bgp_table_top (peer->bgp->rib[afi][safi]); rn; rn = bgp_route_next (rn))
{
struct bgp_node *rm;
struct bgp_info *ri;
/* look for neighbor in tables */
if ((table = rn->info) != NULL)
{
for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
for (ri = rm->info; ri; ri = ri->next)
if (ri->peer == peer)
{
if (CHECK_FLAG (ri->flags, BGP_INFO_STALE))
bgp_rib_remove (rm, ri, peer, afi, safi);
break;
}
}
}
}
else
{
for (rn = bgp_table_top (peer->bgp->rib[afi][safi]); rn; rn = bgp_route_next (rn))
for (ri = rn->info; ri; ri = ri->next)
if (ri->peer == peer)
{
if (CHECK_FLAG (ri->flags, BGP_INFO_STALE))
bgp_rib_remove (rn, ri, peer, afi, safi);
break;
}
}
}
@ -3502,7 +3519,6 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr,
}
}
#ifdef HAVE_IPV6
/* Check address. */
if (afi == AFI_IP6 && safi == SAFI_UNICAST)
{
@ -3525,7 +3541,6 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr,
continue;
}
}
#endif /* HAVE_IPV6 */
/* Normal process. */
if (attr)
@ -4008,14 +4023,12 @@ bgp_static_set (struct vty *vty, const char *ip_str,
vty_out (vty, "%% Malformed prefix%s", VTY_NEWLINE);
return CMD_WARNING;
}
#ifdef HAVE_IPV6
if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&p.u.prefix6))
{
vty_out (vty, "%% Malformed prefix (link-local address)%s",
VTY_NEWLINE);
return CMD_WARNING;
}
#endif /* HAVE_IPV6 */
apply_mask (&p);
@ -4097,14 +4110,12 @@ bgp_static_unset (struct vty *vty, const char *ip_str,
vty_out (vty, "%% Malformed prefix%s", VTY_NEWLINE);
return CMD_WARNING;
}
#ifdef HAVE_IPV6
if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&p.u.prefix6))
{
vty_out (vty, "%% Malformed prefix (link-local address)%s",
VTY_NEWLINE);
return CMD_WARNING;
}
#endif /* HAVE_IPV6 */
apply_mask (&p);
@ -4289,6 +4300,7 @@ bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str,
struct bgp_table *table;
struct bgp_static *bgp_static;
u_char tag[3];
afi_t afi;
ret = str2prefix (ip_str, &p);
if (! ret)
@ -4311,11 +4323,19 @@ bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str,
vty_out (vty, "%% Malformed tag%s", VTY_NEWLINE);
return CMD_WARNING;
}
prn = bgp_node_get (bgp->route[AFI_IP][safi],
if (p.family == AF_INET)
afi = AFI_IP;
else if (p.family == AF_INET6)
afi = AFI_IP6;
else
{
vty_out (vty, "%% Non Supported prefix%s", VTY_NEWLINE);
return CMD_WARNING;
}
prn = bgp_node_get (bgp->route[afi][safi],
(struct prefix *)&prd);
if (prn->info == NULL)
prn->info = bgp_table_init (AFI_IP, safi);
prn->info = bgp_table_init (afi, safi);
else
bgp_unlock_node (prn);
table = prn->info;
@ -4348,7 +4368,7 @@ bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str,
rn->info = bgp_static;
bgp_static->valid = 1;
bgp_static_update_safi (bgp, &p, bgp_static, AFI_IP, safi);
bgp_static_update_safi (bgp, &p, bgp_static, afi, safi);
}
return CMD_SUCCESS;
@ -4478,7 +4498,6 @@ bgp_config_write_table_map (struct vty *vty, struct bgp *bgp, afi_t afi,
return 0;
}
DEFUN (bgp_table_map,
bgp_table_map_cmd,
"table-map WORD",
@ -5531,14 +5550,12 @@ bgp_redistribute_add (struct bgp *bgp, struct prefix *p, const struct in_addr *n
attr.nexthop = *nexthop;
attr.nh_ifindex = ifindex;
#ifdef HAVE_IPV6
if (nexthop6)
{
struct attr_extra *extra = bgp_attr_extra_get(&attr);
extra->mp_nexthop_global = *nexthop6;
extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
}
#endif
attr.med = metric;
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC);
@ -5867,12 +5884,10 @@ route_vty_out (struct vty *vty, struct prefix *p,
vty_out (vty, "%s", inet_ntop(af,
&attr->extra->mp_nexthop_global_in, buf, BUFSIZ));
break;
#if HAVE_IPV6
case AF_INET6:
vty_out (vty, "%s", inet_ntop(af,
&attr->extra->mp_nexthop_global, buf, BUFSIZ));
break;
#endif
default:
vty_out(vty, "?");
break;
@ -6119,7 +6134,6 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
else
json_object_string_add(json_net, "nextHop", inet_ntoa (attr->nexthop));
}
#ifdef HAVE_IPV6
else if (p->family == AF_INET6 || BGP_ATTR_NEXTHOP_AFI_IP6(attr))
{
char buf[BUFSIZ];
@ -6127,7 +6141,6 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
json_object_string_add(json_net, "netHopGloabal", inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
buf, BUFSIZ));
}
#endif /* HAVE_IPV6 */
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))
json_object_int_add(json_net, "metric", attr->med);
@ -6160,7 +6173,6 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
else
vty_out (vty, "%-16s", inet_ntoa (attr->nexthop));
}
#ifdef HAVE_IPV6
else if (p->family == AF_INET6 || BGP_ATTR_NEXTHOP_AFI_IP6(attr))
{
int len;
@ -6177,7 +6189,6 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
else
vty_out (vty, "%*s", len, " ");
}
#endif /* HAVE_IPV6 */
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))
vty_out (vty, "%10u", attr->med);
else
@ -6258,7 +6269,6 @@ route_vty_out_tag (struct vty *vty, struct prefix *p,
vty_out (vty, "%-16s", inet_ntoa (attr->nexthop));
}
}
#ifdef HAVE_IPV6
else if (p->family == AF_INET6 || BGP_ATTR_NEXTHOP_AFI_IP6(attr))
{
assert (attr->extra);
@ -6295,7 +6305,6 @@ route_vty_out_tag (struct vty *vty, struct prefix *p,
}
}
#endif /* HAVE_IPV6 */
}
label = decode_label (binfo->extra->tag);
@ -6537,9 +6546,7 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
char buf1[BUFSIZ];
struct attr *attr;
int sockunion_vty_out (struct vty *, union sockunion *);
#ifdef HAVE_CLOCK_MONOTONIC
time_t tbuf;
#endif
json_object *json_bestpath = NULL;
json_object *json_cluster_list = NULL;
json_object *json_cluster_list_list = NULL;
@ -7164,7 +7171,6 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
}
/* Line 8 display Uptime */
#ifdef HAVE_CLOCK_MONOTONIC
tbuf = time(NULL) - (bgp_clock() - binfo->uptime);
if (json_paths)
{
@ -7175,17 +7181,6 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
}
else
vty_out (vty, " Last update: %s", ctime(&tbuf));
#else
if (json_paths)
{
json_last_update = json_object_new_object();
json_object_int_add(json_last_update, "epoch", tbuf);
json_object_string_add(json_last_update, "string", ctime(&binfo->uptime));
json_object_object_add(json_path, "lastUpdate", json_last_update);
}
else
vty_out (vty, " Last update: %s", ctime(&binfo->uptime));
#endif /* HAVE_CLOCK_MONOTONIC */
}
/* We've constructed the json object for this path, add it to the json
@ -7486,7 +7481,7 @@ bgp_show_table (struct vty *vty, struct bgp *bgp, struct bgp_table *table,
vty_out (vty, "No BGP prefixes displayed, %ld exist%s", total_count, VTY_NEWLINE);
}
else
vty_out (vty, "%sDisplayed %ld out of %ld total prefixes%s",
vty_out (vty, "%sDisplayed %ld routes and %ld total paths%s",
VTY_NEWLINE, output_count, total_count, VTY_NEWLINE);
}
@ -7840,7 +7835,7 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str,
/* BGP route print out function. */
DEFUN (show_ip_bgp_ipv4,
show_ip_bgp_ipv4_cmd,
"show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>]\
"show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast|vpn|encap>]|ipv6 [<unicast|multicast|vpn|encap>]]\
[<\
cidr-only\
|dampening <flap-statistics|dampened-paths|parameters>\
@ -7860,12 +7855,12 @@ DEFUN (show_ip_bgp_ipv4,
"Address Family\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family\n"
"Address Family modifier\n"
"Address Family\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Display only routes with non-natural netmasks\n"
"Display detailed information about dampening\n"
@ -7910,7 +7905,7 @@ DEFUN (show_ip_bgp_ipv4,
{
afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP;
if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx))
safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST;
safi = bgp_vty_safi_from_arg (argv[idx]->text);
}
else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx))
{
@ -7987,7 +7982,7 @@ DEFUN (show_ip_bgp_ipv4,
DEFUN (show_ip_bgp_route,
show_ip_bgp_route_cmd,
"show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>]"
"show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast|vpn|encap>]|ipv6 [<unicast|multicast|vpn|encap>]]"
"<A.B.C.D|A.B.C.D/M|X:X::X:X|X:X::X:X/M> [<bestpath|multipath>] [json]",
SHOW_STR
IP_STR
@ -7996,12 +7991,12 @@ DEFUN (show_ip_bgp_route,
"Address Family\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family\n"
"Address Family modifier\n"
"Address Family\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Network in the BGP routing table to display\n"
"IPv4 prefix\n"
@ -8076,16 +8071,20 @@ DEFUN (show_ip_bgp_route,
DEFUN (show_ip_bgp_regexp,
show_ip_bgp_regexp_cmd,
"show [ip] bgp [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] regexp REGEX...",
"show [ip] bgp [<ipv4 [<unicast|multicast|vpn|encap>]|ipv6 [<unicast|multicast|vpn|encap>]|encap [unicast]|vpnv4 [unicast]>] regexp REGEX...",
SHOW_STR
IP_STR
BGP_STR
"Address Family\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family\n"
"Address Family modifier\n"
"Address Family\n"
@ -8780,39 +8779,20 @@ bgp_table_stats_vty (struct vty *vty, const char *name,
vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
return CMD_WARNING;
}
if (strncmp (afi_str, "ipv", 3) == 0)
{
if (strncmp (afi_str, "ipv4", 4) == 0)
afi = AFI_IP;
else if (strncmp (afi_str, "ipv6", 4) == 0)
afi = AFI_IP6;
else
{
vty_out (vty, "%% Invalid address family %s%s",
afi_str, VTY_NEWLINE);
return CMD_WARNING;
}
if (strncmp (safi_str, "m", 1) == 0)
safi = SAFI_MULTICAST;
else if (strncmp (safi_str, "u", 1) == 0)
safi = SAFI_UNICAST;
else if (strncmp (safi_str, "e", 1) == 0)
safi = SAFI_ENCAP;
else if (strncmp (safi_str, "vpnv4", 5) == 0 || strncmp (safi_str, "vpnv6", 5) == 0)
safi = SAFI_MPLS_VPN;
else
{
vty_out (vty, "%% Invalid subsequent address family %s%s",
safi_str, VTY_NEWLINE);
return CMD_WARNING;
}
}
else
afi = bgp_vty_afi_from_arg(afi_str);
if (afi == AFI_MAX)
{
vty_out (vty, "%% Invalid address family \"%s\"%s",
afi_str, VTY_NEWLINE);
return CMD_WARNING;
}
safi = bgp_vty_safi_from_arg(safi_str);
if (safi == SAFI_MAX)
{
vty_out (vty, "%% Invalid subsequent address family %s%s",
safi_str, VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_table_stats (vty, bgp, afi, safi);
}
@ -9497,7 +9477,7 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route,
char *vrf = NULL;
char *rmap_name = NULL;
char *peerstr = NULL;
int rcvd;
int rcvd = 0;
struct peer *peer;
@ -10309,7 +10289,7 @@ DEFUN (clear_ip_bgp_dampening_address_mask,
/* also used for encap safi */
static int
bgp_config_write_network_vpnv4 (struct vty *vty, struct bgp *bgp,
bgp_config_write_network_vpn (struct vty *vty, struct bgp *bgp,
afi_t afi, safi_t safi, int *write)
{
struct bgp_node *prn;
@ -10359,8 +10339,8 @@ bgp_config_write_network (struct vty *vty, struct bgp *bgp,
struct bgp_aggregate *bgp_aggregate;
char buf[SU_ADDRSTRLEN];
if (afi == AFI_IP && ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)))
return bgp_config_write_network_vpnv4 (vty, bgp, afi, safi, write);
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP))
return bgp_config_write_network_vpn (vty, bgp, afi, safi, write);
/* Network configuration. */
for (rn = bgp_table_top (bgp->route[afi][safi]); rn; rn = bgp_route_next (rn))
@ -10556,17 +10536,6 @@ bgp_route_init (void)
install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd);
install_element (VIEW_NODE, &show_ip_bgp_route_cmd);
install_element (VIEW_NODE, &show_ip_bgp_regexp_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd);
install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd);
install_element (VIEW_NODE, &show_ip_bgp_dampening_params_cmd);
install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd);
/* Restricted node: VIEW_NODE - (set of dangerous commands) */
install_element (VIEW_NODE, &show_ip_bgp_instance_all_cmd);
install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd);
install_element (VIEW_NODE, &show_ip_bgp_route_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd);
install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd);
@ -10585,7 +10554,6 @@ bgp_route_init (void)
install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_prefix_counts_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd);
#ifdef HAVE_IPV6
install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_prefix_counts_cmd);
install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbor_prefix_counts_cmd);
@ -10605,7 +10573,6 @@ bgp_route_init (void)
/* Statistics */
install_element (ENABLE_NODE, &show_bgp_statistics_cmd);
install_element (ENABLE_NODE, &show_bgp_statistics_view_cmd);
#endif /* HAVE_IPV6 */
install_element (BGP_NODE, &bgp_distance_cmd);
install_element (BGP_NODE, &no_bgp_distance_cmd);

View file

@ -1916,7 +1916,6 @@ static struct route_map_rule_cmd route_set_tag_cmd =
};
#ifdef HAVE_IPV6
/* `match ipv6 address IP_ACCESS_LIST' */
static route_map_result_t
@ -2341,8 +2340,6 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_peer_cmd =
route_set_ipv6_nexthop_peer_free
};
#endif /* HAVE_IPV6 */
/* `set vpnv4 nexthop A.B.C.D' */
static route_map_result_t
@ -3755,7 +3752,6 @@ DEFUN (no_set_aggregator_as,
return ret;
}
#ifdef HAVE_IPV6
DEFUN (match_ipv6_next_hop,
match_ipv6_next_hop_cmd,
"match ipv6 next-hop X:X::X:X",
@ -3884,7 +3880,6 @@ DEFUN (no_set_ipv6_nexthop_global,
return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
"ipv6 next-hop global", argv[idx_ipv6]->arg);
}
#endif /* HAVE_IPV6 */
DEFUN (set_vpnv4_nexthop,
set_vpnv4_nexthop_cmd,
@ -4085,7 +4080,6 @@ bgp_route_map_init (void)
install_element (RMAP_NODE, &set_originator_id_cmd);
install_element (RMAP_NODE, &no_set_originator_id_cmd);
#ifdef HAVE_IPV6
route_map_install_match (&route_match_ipv6_address_cmd);
route_map_install_match (&route_match_ipv6_next_hop_cmd);
route_map_install_match (&route_match_ipv6_address_prefix_list_cmd);
@ -4102,7 +4096,6 @@ bgp_route_map_init (void)
install_element (RMAP_NODE, &no_set_ipv6_nexthop_prefer_global_cmd);
install_element (RMAP_NODE, &set_ipv6_nexthop_peer_cmd);
install_element (RMAP_NODE, &no_set_ipv6_nexthop_peer_cmd);
#endif /* HAVE_IPV6 */
}
void

View file

@ -222,8 +222,6 @@ bgp_node_match_ipv4 (const struct bgp_table *table, struct in_addr *addr)
addr));
}
#ifdef HAVE_IPV6
/*
* bgp_node_match_ipv6
*/
@ -234,8 +232,6 @@ bgp_node_match_ipv6 (const struct bgp_table *table, struct in6_addr *addr)
addr));
}
#endif /* HAVE_IPV6 */
static inline unsigned long
bgp_table_count (const struct bgp_table *const table)
{

View file

@ -573,8 +573,9 @@ subgroup_clear_table (struct update_subgroup *subgrp)
SUBGRP_FOREACH_ADJ_SAFE (subgrp, aout, taout)
{
bgp_adj_out_remove_subgroup (aout->rn, aout, subgrp);
bgp_unlock_node (aout->rn);
struct bgp_node *rn = aout->rn;
bgp_adj_out_remove_subgroup (rn, aout, subgrp);
bgp_unlock_node (rn);
}
}
@ -710,7 +711,6 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw)
if (afi == AFI_IP)
str2prefix ("0.0.0.0/0", &p);
#ifdef HAVE_IPV6
else if (afi == AFI_IP6)
{
struct attr_extra *ae = attr.extra;
@ -726,7 +726,6 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw)
&& !IN6_IS_ADDR_UNSPECIFIED (&peer->nexthop.v6_local))
ae->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
}
#endif /* HAVE_IPV6 */
if (peer->default_rmap[afi][safi].name)
{
@ -784,10 +783,8 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw)
*/
if (afi == AFI_IP)
str2prefix ("0.0.0.0/0", &p);
#ifdef HAVE_IPV6
else
str2prefix ("::/0", &p);
#endif /* HAVE_IPV6 */
rn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, &p, NULL);
bgp_adj_out_unset_subgroup (rn, subgrp, 0, BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE);

View file

@ -988,10 +988,8 @@ subgroup_default_update_packet (struct update_subgroup *subgrp,
if (afi == AFI_IP)
str2prefix ("0.0.0.0/0", &p);
#ifdef HAVE_IPV6
else
str2prefix ("::/0", &p);
#endif /* HAVE_IPV6 */
/* Logging the attribute. */
if (bgp_debug_update(NULL, &p, subgrp->update_group, 0))
@ -1066,10 +1064,8 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp)
if (afi == AFI_IP)
str2prefix ("0.0.0.0/0", &p);
#ifdef HAVE_IPV6
else
str2prefix ("::/0", &p);
#endif /* HAVE_IPV6 */
if (bgp_debug_update(NULL, &p, subgrp->update_group, 0))
{

File diff suppressed because it is too large Load diff

View file

@ -26,8 +26,20 @@ struct bgp;
#define BGP_INSTANCE_HELP_STR "BGP view\nBGP VRF\nView/VRF name\n"
#define BGP_INSTANCE_ALL_HELP_STR "BGP view\nBGP VRF\nAll Views/VRFs\n"
#define BGP_AFI_CMD_STR "<ipv4|ipv6>"
#define BGP_AFI_HELP_STR "Address Family\nAddress Family\n"
#define BGP_SAFI_CMD_STR "<unicast|multicast|vpn|encap>"
#define BGP_SAFI_HELP_STR \
"Address Family modifier\n" \
"Address Family modifier\n" \
"Address Family modifier\n" \
"Address Family modifier\n"
#define BGP_AFI_SAFI_CMD_STR BGP_AFI_CMD_STR" "BGP_SAFI_CMD_STR
#define BGP_AFI_SAFI_HELP_STR BGP_AFI_HELP_STR BGP_SAFI_HELP_STR
extern void bgp_vty_init (void);
extern const char *afi_safi_print (afi_t, safi_t);
extern const char *afi_safi_json (afi_t, safi_t);
extern int bgp_config_write_update_delay (struct vty *, struct bgp *);
extern int bgp_config_write_wpkt_quanta(struct vty *vty, struct bgp *bgp);
extern int bgp_config_write_listen(struct vty *vty, struct bgp *bgp);
@ -42,4 +54,16 @@ bgp_parse_afi(const char *str, afi_t *afi);
extern int
bgp_parse_safi(const char *str, safi_t *safi);
extern afi_t
bgp_vty_afi_from_arg(const char *afi_str);
extern safi_t
bgp_vty_safi_from_arg(const char *safi_str);
extern int
argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *afi);
extern int
argv_find_and_parse_safi(struct cmd_token **argv, int argc, int *index, safi_t *safi);
#endif /* _QUAGGA_BGP_VTY_H */

View file

@ -698,7 +698,6 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length,
return 0;
}
#ifdef HAVE_IPV6
/* Zebra route add and delete treatment. */
static int
zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length,
@ -817,7 +816,6 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length,
return 0;
}
#endif /* HAVE_IPV6 */
struct interface *
if_lookup_by_ipv4 (struct in_addr *addr, vrf_id_t vrf_id)
@ -870,7 +868,6 @@ if_lookup_by_ipv4_exact (struct in_addr *addr, vrf_id_t vrf_id)
return NULL;
}
#ifdef HAVE_IPV6
struct interface *
if_lookup_by_ipv6 (struct in6_addr *addr, ifindex_t ifindex, vrf_id_t vrf_id)
{
@ -979,7 +976,6 @@ if_get_ipv6_local (struct interface *ifp, struct in6_addr *addr)
}
return 0;
}
#endif /* HAVE_IPV6 */
static int
if_get_ipv4_address (struct interface *ifp, struct in_addr *addr)
@ -1022,7 +1018,6 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote,
else
ifp = if_lookup_by_ipv4_exact (&local->sin.sin_addr, peer->bgp->vrf_id);
}
#ifdef HAVE_IPV6
if (local->sa.sa_family == AF_INET6)
{
if (IN6_IS_ADDR_LINKLOCAL (&local->sin6.sin6_addr))
@ -1037,7 +1032,6 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote,
local->sin6.sin6_scope_id,
peer->bgp->vrf_id);
}
#endif /* HAVE_IPV6 */
if (!ifp)
return -1;
@ -1047,7 +1041,6 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote,
/* IPv4 connection, fetch and store IPv6 local address(es) if any. */
if (local->sa.sa_family == AF_INET)
{
#ifdef HAVE_IPV6
/* IPv6 nexthop*/
ret = if_get_ipv6_global (ifp, &nexthop->v6_global);
@ -1069,10 +1062,8 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote,
peer->shared_network = 1;
else
peer->shared_network = 0;
#endif /* HAVE_IPV6 */
}
#ifdef HAVE_IPV6
/* IPv6 connection, fetch and store IPv4 local address if any. */
if (local->sa.sa_family == AF_INET6)
{
@ -1135,7 +1126,6 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote,
SET_IN6_LINKLOCAL_IFINDEX (nexthop->v6_local, 0);
}
#endif /* KAME */
#endif /* HAVE_IPV6 */
/* If we have identified the local interface, there is no error for now. */
return 0;
@ -1390,7 +1380,6 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp,
zapi_ipv4_route (valid_nh_count ? ZEBRA_IPV4_ROUTE_ADD: ZEBRA_IPV4_ROUTE_DELETE,
zclient, (struct prefix_ipv4 *) p, &api);
}
#ifdef HAVE_IPV6
/* We have to think about a IPv6 link-local address curse. */
if (p->family == AF_INET6 ||
@ -1601,7 +1590,6 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp,
zclient, (struct prefix_ipv6 *) p, &api);
}
}
#endif /* HAVE_IPV6 */
}
/* Announce all routes of a table to zebra */
@ -1700,7 +1688,6 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi)
zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, zclient,
(struct prefix_ipv4 *) p, &api);
}
#ifdef HAVE_IPV6
/* We have to think about a IPv6 link-local address curse. */
if (p->family == AF_INET6)
{
@ -1740,8 +1727,8 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi)
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient,
(struct prefix_ipv6 *) p, &api);
}
#endif /* HAVE_IPV6 */
}
struct bgp_redist *
bgp_redist_lookup (struct bgp *bgp, afi_t afi, u_char type, u_short instance)
{

View file

@ -57,10 +57,8 @@ extern int bgp_redistribute_unreg (struct bgp *, afi_t, int, u_short);
extern struct interface *if_lookup_by_ipv4 (struct in_addr *, vrf_id_t);
extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *, vrf_id_t);
#ifdef HAVE_IPV6
extern struct interface *if_lookup_by_ipv6 (struct in6_addr *, ifindex_t, vrf_id_t);
extern struct interface *if_lookup_by_ipv6_exact (struct in6_addr *, ifindex_t, vrf_id_t);
#endif /* HAVE_IPV6 */
extern int bgp_zebra_num_connects(void);

View file

@ -651,6 +651,35 @@ bgp_listen_limit_unset (struct bgp *bgp)
return 0;
}
int
bgp_map_afi_safi_iana2int (iana_afi_t pkt_afi, safi_t pkt_safi,
afi_t *afi, safi_t *safi)
{
/* Map from IANA values to internal values, return error if
* values are unrecognized.
*/
*afi = afi_iana2int (pkt_afi);
*safi = safi_iana2int (pkt_safi);
if (*afi == AFI_MAX || *safi == SAFI_MAX)
return -1;
return 0;
}
int
bgp_map_afi_safi_int2iana (afi_t afi, safi_t safi,
iana_afi_t *pkt_afi, safi_t *pkt_safi)
{
/* Map from internal values to IANA values, return error if
* internal values are bad (unexpected).
*/
if (afi == AFI_MAX || safi == SAFI_MAX)
return -1;
*pkt_afi = afi_int2iana (afi);
*pkt_safi = safi_int2iana (safi);
return 0;
}
struct peer_af *
peer_af_create (struct peer *peer, afi_t afi, safi_t safi)
{
@ -1902,7 +1931,7 @@ peer_nsf_stop (struct peer *peer)
UNSET_FLAG (peer->sflags, PEER_STATUS_NSF_MODE);
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_3 ; safi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_4 ; safi++)
peer->nsf[afi][safi] = 0;
if (peer->t_gr_restart)
@ -7371,6 +7400,10 @@ bgp_config_write (struct vty *vty)
if (bgp_flag_check (bgp, BGP_FLAG_GRACEFUL_RESTART))
vty_out (vty, " bgp graceful-restart%s", VTY_NEWLINE);
/* BGP graceful-restart Preserve State F bit. */
if (bgp_flag_check (bgp, BGP_FLAG_GR_PRESERVE_FWD))
vty_out (vty, " bgp graceful-restart preserve-fw-state%s", VTY_NEWLINE);
/* BGP bestpath method. */
if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_IGNORE))
vty_out (vty, " bgp bestpath as-path ignore%s", VTY_NEWLINE);

View file

@ -289,6 +289,7 @@ struct bgp
#define BGP_FLAG_MULTIPATH_RELAX_AS_SET (1 << 17)
#define BGP_FLAG_FORCE_STATIC_PROCESS (1 << 18)
#define BGP_FLAG_SHOW_HOSTNAME (1 << 19)
#define BGP_FLAG_GR_PRESERVE_FWD (1 << 20)
/* BGP Per AF flags */
u_int16_t af_flags[AFI_MAX][SAFI_MAX];
@ -404,10 +405,8 @@ struct bgp_nexthop
{
struct interface *ifp;
struct in_addr v4;
#ifdef HAVE_IPV6
struct in6_addr v6_global;
struct in6_addr v6_local;
#endif /* HAVE_IPV6 */
};
/* BGP addpath values */
@ -1079,10 +1078,6 @@ struct bgp_nlri
#define BGP_DEFAULT_RESTART_TIME 120
#define BGP_DEFAULT_STALEPATH_TIME 360
/* RFC4364 */
#define SAFI_MPLS_LABELED_VPN 128
#define BGP_SAFI_VPN 128
/* BGP uptime string length. */
#define BGP_UPTIME_LEN 25
@ -1359,6 +1354,13 @@ extern void bgp_route_map_terminate(void);
extern int peer_cmp (struct peer *p1, struct peer *p2);
extern int
bgp_map_afi_safi_iana2int (iana_afi_t pkt_afi, safi_t pkt_safi,
afi_t *afi, safi_t *safi);
extern int
bgp_map_afi_safi_int2iana (afi_t afi, safi_t safi,
iana_afi_t *pkt_afi, safi_t *pkt_safi);
extern struct peer_af * peer_af_create (struct peer *, afi_t, safi_t);
extern struct peer_af * peer_af_find (struct peer *, afi_t, safi_t);
extern int peer_af_delete (struct peer *, afi_t, safi_t);
@ -1458,13 +1460,9 @@ peer_group_af_configured (struct peer_group *group)
static inline char *
timestamp_string (time_t ts)
{
#ifdef HAVE_CLOCK_MONOTONIC
time_t tbuf;
tbuf = time(NULL) - (bgp_clock() - ts);
return ctime(&tbuf);
#else
return ctime(&ts);
#endif /* HAVE_CLOCK_MONOTONIC */
}
static inline int

View file

@ -3497,7 +3497,7 @@ static struct cmd_node bgp_vnc_l2_group_node = {
1
};
static struct rfapi_l2_group_cfg *
struct rfapi_l2_group_cfg *
bgp_rfapi_get_group_by_lni_label (
struct bgp *bgp,
uint32_t logical_net_id,

View file

@ -300,6 +300,12 @@ bgp_rfapi_show_summary (struct bgp *bgp, struct vty *vty);
extern struct rfapi_cfg *
bgp_rfapi_get_config (struct bgp *bgp);
extern struct rfapi_l2_group_cfg *
bgp_rfapi_get_group_by_lni_label (
struct bgp *bgp,
uint32_t logical_net_id,
uint32_t label);
extern struct ecommunity *
bgp_rfapi_get_ecommunity_by_lni_label (
struct bgp *bgp,

View file

@ -2842,13 +2842,39 @@ rfapi_register (
* If mac address is set, add an RT based on the registered LNI
*/
memset ((char *) &ecom_value, 0, sizeof (ecom_value));
ecom_value.val[1] = 0x02;
ecom_value.val[1] = ECOMMUNITY_ROUTE_TARGET;
ecom_value.val[5] = (l2o->logical_net_id >> 16) & 0xff;
ecom_value.val[6] = (l2o->logical_net_id >> 8) & 0xff;
ecom_value.val[7] = (l2o->logical_net_id >> 0) & 0xff;
rtlist = ecommunity_new();
ecommunity_add_val (rtlist, &ecom_value);
}
if (l2o->tag_id)
{
as_t as = bgp->as;
uint16_t val = l2o->tag_id;
memset ((char *) &ecom_value, 0, sizeof (ecom_value));
ecom_value.val[1] = ECOMMUNITY_ROUTE_TARGET;
if (as > BGP_AS_MAX)
{
ecom_value.val[0] = ECOMMUNITY_ENCODE_AS4;
ecom_value.val[2] = (as >>24) & 0xff;
ecom_value.val[3] = (as >>16) & 0xff;
ecom_value.val[4] = (as >>8) & 0xff;
ecom_value.val[5] = as & 0xff;
}
else
{
ecom_value.val[0] = ECOMMUNITY_ENCODE_AS;
ecom_value.val[2] = (as >>8) & 0xff;
ecom_value.val[3] = as & 0xff;
}
ecom_value.val[6] = (val >> 8) & 0xff;
ecom_value.val[7] = val & 0xff;
if (rtlist == NULL)
rtlist = ecommunity_new();
ecommunity_add_val (rtlist, &ecom_value);
}
}
/*

View file

@ -89,6 +89,7 @@ struct rfapi_l2address_option
uint32_t logical_net_id; /* ~= EVPN Ethernet Segment Id,
must not be zero for mac regis. */
uint8_t local_nve_id;
uint16_t tag_id; /* EVPN Ethernet Tag ID, 0 = none */
};
typedef enum

View file

@ -1130,6 +1130,49 @@ rfapiEcommunityGetLNI (struct ecommunity *ecom, uint32_t * lni)
return ENOENT;
}
int
rfapiEcommunityGetEthernetTag (struct ecommunity *ecom, uint16_t * tag_id)
{
struct bgp *bgp = bgp_get_default ();
*tag_id = 0; /* default to untagged */
if (ecom)
{
int i;
for (i = 0; i < ecom->size; ++i)
{
as_t as = 0;
int encode = 0;
uint8_t *p = ecom->val + (i * ECOMMUNITY_SIZE);
/* High-order octet of type. */
encode = *p++;
if (*p++ == ECOMMUNITY_ROUTE_TARGET) {
if (encode == ECOMMUNITY_ENCODE_AS4)
{
as = (*p++ << 24);
as |= (*p++ << 16);
as |= (*p++ << 8);
as |= (*p++);
}
else if (encode == ECOMMUNITY_ENCODE_AS)
{
as = (*p++ << 8);
as |= (*p++);
p += 2; /* skip next two, tag/vid always in lowest bytes */
}
if (as == bgp->as)
{
*tag_id = *p++ << 8;
*tag_id |= (*p++);
return 0;
}
}
}
}
return ENOENT;
}
static int
rfapiVpnBiNhEqualsPt (struct bgp_info *bi, struct rfapi_ip_addr *hpt)
{
@ -1377,6 +1420,8 @@ rfapiRouteInfo2NextHopEntry (
{
(void) rfapiEcommunityGetLNI (bi->attr->extra->ecommunity,
&vo->v.l2addr.logical_net_id);
(void) rfapiEcommunityGetEthernetTag (bi->attr->extra->ecommunity,
&vo->v.l2addr.tag_id);
}
/* local_nve_id comes from lower byte of RD type */
@ -2106,6 +2151,7 @@ rfapiBgpInfoAttachSorted (
info_new->next = next;
if (next)
next->prev = info_new;
bgp_attr_intern (info_new->attr);
}
static void
@ -2114,6 +2160,7 @@ rfapiBgpInfoDetach (struct route_node *rn, struct bgp_info *bi)
/*
* Remove the route (doubly-linked)
*/
// bgp_attr_unintern (&bi->attr);
if (bi->next)
bi->next->prev = bi->prev;
if (bi->prev)
@ -2464,6 +2511,7 @@ rfapiMonitorEncapAdd (
__func__, import_table, vpn_bi, afi, rn, m);
RFAPI_CHECK_REFCOUNT (rn, SAFI_ENCAP, 0);
bgp_attr_intern (vpn_bi->attr);
}
static void
@ -2966,6 +3014,7 @@ rfapiBiStartWithdrawTimer (
wcb->node = rn;
wcb->info = bi;
wcb->import_table = import_table;
bgp_attr_intern (bi->attr);
if (VNC_DEBUG(VERBOSE))
{
@ -4037,7 +4086,6 @@ rfapiBgpInfoFilteredImportFunction (safi_t safi)
switch (safi)
{
case SAFI_MPLS_VPN:
case BGP_SAFI_VPN:
return rfapiBgpInfoFilteredImportVPN;
case SAFI_ENCAP:
@ -4154,7 +4202,7 @@ rfapiProcessUpdate (
label);
}
if (safi == SAFI_MPLS_VPN || safi == BGP_SAFI_VPN)
if (safi == SAFI_MPLS_VPN)
{
vnc_direct_bgp_rh_add_route (bgp, afi, p, peer, attr);
}
@ -4283,7 +4331,7 @@ rfapiProcessWithdraw (
}
/* TBD the deletion should happen after the lifetime expires */
if (safi == SAFI_MPLS_VPN || safi == BGP_SAFI_VPN)
if (safi == SAFI_MPLS_VPN)
vnc_direct_bgp_rh_del_route (bgp, afi, p, peer);
if (safi == SAFI_MPLS_VPN)

View file

@ -203,6 +203,9 @@ extern int rfapiEcommunityGetLNI (
struct ecommunity *ecom,
uint32_t *lni);
extern int rfapiEcommunityGetEthernetTag (
struct ecommunity *ecom,
uint16_t * tag_id);
/* enable for debugging; disable for performance */
#if 0

View file

@ -707,6 +707,8 @@ rfapiRibBi2Ri(
{
(void) rfapiEcommunityGetLNI (bi->attr->extra->ecommunity,
&vo->v.l2addr.logical_net_id);
(void) rfapiEcommunityGetEthernetTag (bi->attr->extra->ecommunity,
&vo->v.l2addr.tag_id);
}
/* local_nve_id comes from RD */

View file

@ -2553,7 +2553,7 @@ DEFUN (add_vnc_prefix_cost_life_lnh,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> cost (0-255) lifetime (1-4294967295) .LNH_OPTIONS",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2579,7 +2579,7 @@ DEFUN (add_vnc_prefix_life_cost_lnh,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> lifetime (1-4294967295) cost (0-255) .LNH_OPTIONS",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2605,7 +2605,7 @@ DEFUN (add_vnc_prefix_cost_lnh,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> cost (0-255) .LNH_OPTIONS",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2629,7 +2629,7 @@ DEFUN (add_vnc_prefix_life_lnh,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> lifetime (1-4294967295) .LNH_OPTIONS",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2653,7 +2653,7 @@ DEFUN (add_vnc_prefix_lnh,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> .LNH_OPTIONS",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2678,7 +2678,7 @@ DEFUN (add_vnc_prefix_cost_life,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> cost (0-255) lifetime (1-4294967295)",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2704,7 +2704,7 @@ DEFUN (add_vnc_prefix_life_cost,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> lifetime (1-4294967295) cost (0-255)",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2730,7 +2730,7 @@ DEFUN (add_vnc_prefix_cost,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> cost (0-255)",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2754,7 +2754,7 @@ DEFUN (add_vnc_prefix_life,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> lifetime (1-4294967295)",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2778,7 +2778,7 @@ DEFUN (add_vnc_prefix,
"add vnc prefix <A.B.C.D/M|X:X::X:X/M> vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X>",
"Add registration\n"
"VNC Information\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"VN address of NVE\n"
@ -2803,7 +2803,7 @@ DEFUN (add_vnc_mac_vni_prefix_cost_life,
"add vnc mac YY:YY:YY:YY:YY:YY virtual-network-identifier (1-4294967295) vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> prefix <A.B.C.D/M|X:X::X:X/M> cost (0-255) lifetime (1-4294967295)",
"Add registration\n"
"VNC Information\n"
"Add/modify mac address infomation\n"
"Add/modify mac address information\n"
"MAC address\n"
"Virtual Network Identifier follows\n"
"Virtual Network Identifier\n"
@ -2813,7 +2813,7 @@ DEFUN (add_vnc_mac_vni_prefix_cost_life,
"UN address of NVE\n"
"UN IPv4 interface address\n"
"UN IPv6 interface address\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"Administrative cost [default: 255]\n"
@ -2833,7 +2833,7 @@ DEFUN (add_vnc_mac_vni_prefix_life,
"add vnc mac YY:YY:YY:YY:YY:YY virtual-network-identifier (1-4294967295) vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> prefix <A.B.C.D/M|X:X::X:X/M> lifetime (1-4294967295)",
"Add registration\n"
"VNC Information\n"
"Add/modify mac address infomation\n"
"Add/modify mac address information\n"
"MAC address\n"
"Virtual Network Identifier follows\n"
"Virtual Network Identifier\n"
@ -2843,7 +2843,7 @@ DEFUN (add_vnc_mac_vni_prefix_life,
"UN address of NVE\n"
"UN IPv4 interface address\n"
"UN IPv6 interface address\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"Registration lifetime [default: infinite]\n"
@ -2860,7 +2860,7 @@ DEFUN (add_vnc_mac_vni_prefix_cost,
"add vnc mac YY:YY:YY:YY:YY:YY virtual-network-identifier (1-4294967295) vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> prefix <A.B.C.D/M|X:X::X:X/M> cost (0-255)",
"Add registration\n"
"VNC Information\n"
"Add/modify mac address infomation\n"
"Add/modify mac address information\n"
"MAC address\n"
"Virtual Network Identifier follows\n"
"Virtual Network Identifier\n"
@ -2870,7 +2870,7 @@ DEFUN (add_vnc_mac_vni_prefix_cost,
"UN address of NVE\n"
"UN IPv4 interface address\n"
"UN IPv6 interface address\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
"Administrative cost [default: 255]\n" "Administrative cost\n")
@ -2886,7 +2886,7 @@ DEFUN (add_vnc_mac_vni_prefix,
"add vnc mac YY:YY:YY:YY:YY:YY virtual-network-identifier (1-4294967295) vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> prefix <A.B.C.D/M|X:X::X:X/M>",
"Add registration\n"
"VNC Information\n"
"Add/modify mac address infomation\n"
"Add/modify mac address information\n"
"MAC address\n"
"Virtual Network Identifier follows\n"
"Virtual Network Identifier\n"
@ -2896,7 +2896,7 @@ DEFUN (add_vnc_mac_vni_prefix,
"UN address of NVE\n"
"UN IPv4 interface address\n"
"UN IPv6 interface address\n"
"Add/modify prefix related infomation\n"
"Add/modify prefix related information\n"
"IPv4 prefix\n" "IPv6 prefix\n")
{
/* pfx vn un cost life */
@ -2910,7 +2910,7 @@ DEFUN (add_vnc_mac_vni_cost_life,
"add vnc mac YY:YY:YY:YY:YY:YY virtual-network-identifier (1-4294967295) vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> cost (0-255) lifetime (1-4294967295)",
"Add registration\n"
"VNC Information\n"
"Add/modify mac address infomation\n"
"Add/modify mac address information\n"
"MAC address\n"
"Virtual Network Identifier follows\n"
"Virtual Network Identifier\n"
@ -2937,7 +2937,7 @@ DEFUN (add_vnc_mac_vni_cost,
"add vnc mac YY:YY:YY:YY:YY:YY virtual-network-identifier (1-4294967295) vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> cost (0-255)",
"Add registration\n"
"VNC Information\n"
"Add/modify mac address infomation\n"
"Add/modify mac address information\n"
"MAC address\n"
"Virtual Network Identifier follows\n"
"Virtual Network Identifier\n"
@ -2961,7 +2961,7 @@ DEFUN (add_vnc_mac_vni_life,
"add vnc mac YY:YY:YY:YY:YY:YY virtual-network-identifier (1-4294967295) vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> lifetime (1-4294967295)",
"Add registration\n"
"VNC Information\n"
"Add/modify mac address infomation\n"
"Add/modify mac address information\n"
"MAC address\n"
"Virtual Network Identifier follows\n"
"Virtual Network Identifier\n"
@ -2986,7 +2986,7 @@ DEFUN (add_vnc_mac_vni,
"add vnc mac YY:YY:YY:YY:YY:YY virtual-network-identifier (1-4294967295) vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X>",
"Add registration\n"
"VNC Information\n"
"Add/modify mac address infomation\n"
"Add/modify mac address information\n"
"MAC address\n"
"Virtual Network Identifier follows\n"
"Virtual Network Identifier\n"
@ -3735,7 +3735,7 @@ DEFUN (clear_vnc_nve_vn_un,
"clear vnc nve vn <*|A.B.C.D|X:X::X:X> un <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"VN address of NVE\n"
"VN IPv4 interface address\n"
"VN IPv6 interface address\n"
@ -3765,7 +3765,7 @@ DEFUN (clear_vnc_nve_un_vn,
"clear vnc nve un <*|A.B.C.D|X:X::X:X> vn <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"UN address of NVE\n"
"UN IPv4 interface address\n"
"UN IPv6 interface address\n"
@ -3795,7 +3795,7 @@ DEFUN (clear_vnc_nve_vn,
"clear vnc nve vn <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"VN address of NVE\n"
"VN IPv4 interface address\n" "VN IPv6 interface address\n")
{
@ -3820,7 +3820,7 @@ DEFUN (clear_vnc_nve_un,
"clear vnc nve un <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"UN address of NVE\n"
"UN IPv4 interface address\n" "UN IPv6 interface address\n")
{
@ -3853,7 +3853,7 @@ DEFUN (clear_vnc_prefix_vn_un,
"clear vnc prefix <*|A.B.C.D/M|X:X::X:X/M> vn <*|A.B.C.D|X:X::X:X> un <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"All prefixes\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
@ -3883,7 +3883,7 @@ DEFUN (clear_vnc_prefix_un_vn,
"clear vnc prefix <*|A.B.C.D/M|X:X::X:X/M> un <*|A.B.C.D|X:X::X:X> vn <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"All prefixes\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
@ -3913,7 +3913,7 @@ DEFUN (clear_vnc_prefix_un,
"clear vnc prefix <*|A.B.C.D/M|X:X::X:X/M> un <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"All prefixes\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
@ -3939,7 +3939,7 @@ DEFUN (clear_vnc_prefix_vn,
"clear vnc prefix <*|A.B.C.D/M|X:X::X:X/M> vn <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"All prefixes\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
@ -3965,7 +3965,7 @@ DEFUN (clear_vnc_prefix_all,
"clear vnc prefix <*|A.B.C.D/M|X:X::X:X/M> *",
"clear\n"
"VNC Information\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"All prefixes\n"
"IPv4 prefix\n"
"IPv6 prefix\n"
@ -3995,7 +3995,7 @@ DEFUN (clear_vnc_mac_vn_un,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> vn <*|A.B.C.D|X:X::X:X> un <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"
@ -4030,7 +4030,7 @@ DEFUN (clear_vnc_mac_un_vn,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> un <*|A.B.C.D|X:X::X:X> vn <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"
@ -4064,7 +4064,7 @@ DEFUN (clear_vnc_mac_un,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> un <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"
@ -4093,7 +4093,7 @@ DEFUN (clear_vnc_mac_vn,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> vn <*|A.B.C.D|X:X::X:X>",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"
@ -4122,7 +4122,7 @@ DEFUN (clear_vnc_mac_all,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> *",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"
@ -4152,7 +4152,7 @@ DEFUN (clear_vnc_mac_vn_un_prefix,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> vn <*|A.B.C.D|X:X::X:X> un <*|A.B.C.D|X:X::X:X> prefix <*|A.B.C.D/M|X:X::X:X/M>",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"
@ -4167,7 +4167,7 @@ DEFUN (clear_vnc_mac_vn_un_prefix,
"All UN addresses\n"
"UN IPv4 interface address\n"
"UN IPv6 interface address\n"
"Clear prefix registration infomation\n"
"Clear prefix registration information\n"
"All prefixes\n"
"IPv4 prefix\n"
"IPv6 prefix\n")
@ -4191,7 +4191,7 @@ DEFUN (clear_vnc_mac_un_vn_prefix,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> un <*|A.B.C.D|X:X::X:X> vn <*|A.B.C.D|X:X::X:X> prefix <*|A.B.C.D/M|X:X::X:X/M> prefix <*|A.B.C.D/M|X:X::X:X/M>",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"
@ -4225,7 +4225,7 @@ DEFUN (clear_vnc_mac_un_prefix,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> un <*|A.B.C.D|X:X::X:X> prefix <*|A.B.C.D/M|X:X::X:X/M>",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"
@ -4255,7 +4255,7 @@ DEFUN (clear_vnc_mac_vn_prefix,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> vn <*|A.B.C.D|X:X::X:X> prefix <*|A.B.C.D/M|X:X::X:X/M>",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"
@ -4285,7 +4285,7 @@ DEFUN (clear_vnc_mac_all_prefix,
"clear vnc mac <*|YY:YY:YY:YY:YY:YY> virtual-network-identifier <*|(1-4294967295)> prefix <*|A.B.C.D/M|X:X::X:X/M>",
"clear\n"
"VNC Information\n"
"Clear mac registration infomation\n"
"Clear mac registration information\n"
"All macs\n"
"MAC address\n"
"VNI keyword\n"

View file

@ -76,7 +76,6 @@ encap_attr_export_ce (
memset (new, 0, sizeof (struct attr));
bgp_attr_dup (new, orig);
bgp_attr_extra_get (new);
bgp_attr_flush_encap (new);
/*
* Set nexthop

1
bgpd/rfp-example/rfptest/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/rfptest

View file

@ -1,5 +1,5 @@
##
## Configure template file for Quagga.
## Configure template file for FreeRangeRouting.
## autoconf will generate configure script.
##
## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
@ -7,9 +7,14 @@
##
AC_PREREQ(2.60)
AC_INIT(Quagga, 2.0.999, [https://bugzilla.quagga.net])
AC_INIT(frr, 2.0-rc0, [https://bugzilla.quagga.net])
PACKAGE_URL="https://freerangerouting.org/"
PACKAGE_FULLNAME="FreeRangeRouting"
AC_SUBST(PACKAGE_FULLNAME)
CONFIG_ARGS="$ac_configure_args"
AC_SUBST(CONFIG_ARGS)
AC_CONFIG_SRCDIR(lib/zebra.h)
AC_CONFIG_MACRO_DIR([m4])
@ -208,8 +213,8 @@ AC_ARG_ENABLE(ospf6d,
AS_HELP_STRING([--disable-ospf6d], [do not build ospf6d]))
AC_ARG_ENABLE(ldpd,
AS_HELP_STRING([--enable-ldpd], [build ldpd]))
AC_ARG_ENABLE(watchquagga,
AS_HELP_STRING([--disable-watchquagga], [do not build watchquagga]))
AC_ARG_ENABLE(watchfrr,
AS_HELP_STRING([--disable-watchfrr], [do not build watchfrr]))
AC_ARG_ENABLE(isisd,
AS_HELP_STRING([--disable-isisd], [do not build isisd]))
AC_ARG_ENABLE(pimd,
@ -234,9 +239,9 @@ AC_ARG_ENABLE(ospfclient,
AC_ARG_ENABLE(multipath,
AS_HELP_STRING([--enable-multipath=ARG], [enable multipath function, ARG must be digit]))
AC_ARG_ENABLE(user,
AS_HELP_STRING([--enable-user=USER], [user to run Quagga suite as (default quagga)]))
AS_HELP_STRING([--enable-user=USER], [user to run FRR suite as (default frr)]))
AC_ARG_ENABLE(group,
AS_HELP_STRING([--enable-group=GROUP], [group to run Quagga suite as (default quagga)]))
AS_HELP_STRING([--enable-group=GROUP], [group to run FRR suite as (default frr)]))
AC_ARG_ENABLE(vty_group,
AS_HELP_STRING([--enable-vty-group=ARG], [set vty sockets to have specified group as owner]))
AC_ARG_ENABLE(configfile_mask,
@ -422,18 +427,18 @@ if test x"${enable_user}" = x"no"; then
enable_user=""
else
if test x"${enable_user}" = x"yes" || test x"${enable_user}" = x""; then
enable_user="quagga"
enable_user="frr"
fi
AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
AC_DEFINE_UNQUOTED(FRR_USER, "${enable_user}", frr User)
fi
if test x"${enable_group}" = x"no"; then
enable_group=""
else
if test x"${enable_group}" = x"yes" || test x"${enable_group}" = x""; then
enable_group="quagga"
enable_group="frr"
fi
AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
AC_DEFINE_UNQUOTED(FRR_GROUP, "${enable_group}", frr Group)
fi
if test x"${enable_vty_group}" = x"yes" ; then
@ -511,7 +516,7 @@ AC_CHECK_HEADERS([stropts.h sys/ksym.h \
sys/cdefs.h])
dnl Utility macro to avoid retyping includes all the time
m4_define([QUAGGA_INCLUDES],
m4_define([FRR_INCLUDES],
[#ifdef SUNOS_5
#define _XPG4_2
#define __EXTENSIONS__
@ -538,10 +543,10 @@ dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
dnl an additional round for it.
AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
AC_CHECK_HEADERS([net/if_var.h], [], [], FRR_INCLUDES)
m4_define([QUAGGA_INCLUDES],
QUAGGA_INCLUDES
m4_define([FRR_INCLUDES],
FRR_INCLUDES
[#if HAVE_NET_IF_VAR_H
# include <net/if_var.h>
#endif
@ -551,13 +556,13 @@ AC_CHECK_HEADERS([netinet/in_var.h \
net/if_dl.h net/netopt.h \
inet/nd.h netinet/ip_icmp.h \
sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
[], [], QUAGGA_INCLUDES)
[], [], FRR_INCLUDES)
AC_CHECK_HEADERS([ucontext.h], [], [],
[#ifndef __USE_GNU
#define __USE_GNU
#endif /* __USE_GNU */
QUAGGA_INCLUDES
FRR_INCLUDES
])
m4_define([UCONTEXT_INCLUDES],
@ -572,8 +577,8 @@ AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs],
AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.gregs],
[], [], [UCONTEXT_INCLUDES])
m4_define([QUAGGA_INCLUDES],
QUAGGA_INCLUDES
m4_define([FRR_INCLUDES],
FRR_INCLUDES
[
#include <sys/un.h>
#include <netinet/in_systm.h>
@ -701,13 +706,13 @@ if test "$with_libpam" = "yes"; then
AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
pam_conv_func="misc_conv"
],
[], QUAGGA_INCLUDES)
[], FRR_INCLUDES)
AC_CHECK_HEADER([security/openpam.h],
[AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
pam_conv_func="openpam_ttyconv"
],
[], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
[], FRR_INCLUDES[#include <security/pam_appl.h>])
if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
AC_MSG_WARN([*** pam support will not be built ***])
with_libpam="no"
@ -774,7 +779,6 @@ AC_CHECK_HEADER([math.h],
[AC_CHECK_LIB([m], [pow],
[LIBM="-lm"
LIBS="$LIBS $LIBM"
AC_DEFINE(HAVE_LIBM,, Have libm)
AC_CHECK_FUNCS(pow,[],[LIBM=""])
])
])
@ -795,7 +799,7 @@ AC_CHECK_FUNCS([ \
AC_CHECK_HEADER([asm-generic/unistd.h],
[AC_CHECK_DECL(__NR_setns,
AC_DEFINE(HAVE_NETNS,, Have netns),,
QUAGGA_INCLUDES [#include <asm-generic/unistd.h>
FRR_INCLUDES [#include <asm-generic/unistd.h>
])
AC_CHECK_FUNCS(setns)]
)
@ -882,25 +886,25 @@ main()
dnl ------------------------------
dnl check kernel route read method
dnl ------------------------------
AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
AC_CACHE_CHECK([route read method], [frr_cv_rtread_method],
[if test "x$netlink" = xyes; then
quagga_cv_rtread_method="netlink"
frr_cv_rtread_method="netlink"
else
for quagga_cv_rtread_method in /dev/ip /dev/null;
for frr_cv_rtread_method in /dev/ip /dev/null;
do
test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
test x`ls $frr_cv_rtread_method 2>/dev/null` = x"$frr_cv_rtread_method" && break
done
case $quagga_cv_rtread_method in
case $frr_cv_rtread_method in
"/dev/ip")
case "$host" in
*-freebsd*) quagga_cv_rtread_method="sysctl";;
*) quagga_cv_rtread_method="getmsg";;
*-freebsd*) frr_cv_rtread_method="sysctl";;
*) frr_cv_rtread_method="getmsg";;
esac;;
*)
quagga_cv_rtread_method="sysctl";;
frr_cv_rtread_method="sysctl";;
esac
fi])
RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
RTREAD_METHOD=rtread_${frr_cv_rtread_method}.o
AC_SUBST(RTREAD_METHOD)
dnl -----------------------------
@ -935,7 +939,7 @@ AC_SUBST(IOCTL_METHOD)
dnl ---------------------------------------------------------------
dnl figure out how to specify an interface in multicast sockets API
dnl ---------------------------------------------------------------
AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], FRR_INCLUDES)
AC_CHECK_HEADERS([linux/mroute.h], [], [],[
#include <sys/socket.h>
@ -944,8 +948,8 @@ AC_CHECK_HEADERS([linux/mroute.h], [], [],[
#include <linux/types.h>
])
m4_define([QUAGGA_INCLUDES],
QUAGGA_INCLUDES
m4_define([FRR_INCLUDES],
FRR_INCLUDES
[#if HAVE_LINUX_MROUTE_H
# include <linux/mroute.h>
#endif
@ -958,8 +962,8 @@ AC_CHECK_HEADERS([netinet/ip_mroute.h], [], [],[
#include <net/route.h>
])
m4_define([QUAGGA_INCLUDES],
QUAGGA_INCLUDES
m4_define([FRR_INCLUDES],
FRR_INCLUDES
[#if HAVE_NETINET_IP_MROUTE_H
# include <netinet/ip_mroute.h>
#endif
@ -989,14 +993,14 @@ dnl figure out how to check link-state
dnl ---------------------------------------------------------------
AC_CHECK_HEADER( [net/if_media.h],
[m4_define([LINK_DETECT_INCLUDES],
QUAGGA_INCLUDES
FRR_INCLUDES
[#include <net/if_media.h>
])
AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
[], LINK_DETECT_INCLUDES)],
[],
QUAGGA_INCLUDES)
FRR_INCLUDES)
dnl ---------------------------------------------------------------
dnl Additional, newer way to check link-state using ifi_link_state.
@ -1004,7 +1008,7 @@ dnl Not available in all BSD's when ifmediareq available
dnl ---------------------------------------------------------------
AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
AC_DEFINE(HAVE_BSD_IFI_LINK_STATE,,[BSD ifi_link_state available]),
[], QUAGGA_INCLUDES)
[], FRR_INCLUDES)
dnl ------------------------
dnl TCP_MD5SIG socket option
@ -1012,16 +1016,16 @@ dnl ------------------------
AC_CHECK_HEADER([netinet/tcp.h],
[m4_define([MD5_INCLUDES],
QUAGGA_INCLUDES
FRR_INCLUDES
[#include <netinet/tcp.h>
])
AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
[],
QUAGGA_INCLUDES)
FRR_INCLUDES)
if test $ac_cv_have_decl_TCP_MD5SIG = no; then
AC_CHECK_HEADER([linux/tcp.h],
[m4_define([MD5_INCLUDES],
QUAGGA_INCLUDES
FRR_INCLUDES
[#include <linux/tcp.h>
])
AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
@ -1030,29 +1034,29 @@ fi
dnl -----------------------------
dnl check ipforward detect method
dnl -----------------------------
AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
AC_CACHE_CHECK([ipforward method], [frr_cv_ipforward_method],
[if test x$cross_compiling = xyes; then
if test x"$opsys" = x"gnu-linux"; then
quagga_cv_ipforward_method=/proc/net/snmp
frr_cv_ipforward_method=/proc/net/snmp
else
quagga_cv_ipforward_method=/dev/ip
frr_cv_ipforward_method=/dev/ip
fi
else
for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
for frr_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
do
test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
test x`ls $frr_cv_ipforward_method 2>/dev/null` = x"$frr_cv_ipforward_method" && break
done
fi
case $quagga_cv_ipforward_method in
"/proc/net/snmp") quagga_cv_ipforward_method="proc";;
case $frr_cv_ipforward_method in
"/proc/net/snmp") frr_cv_ipforward_method="proc";;
"/dev/ip")
case "$host" in
*-freebsd*) quagga_cv_ipforward_method="sysctl";;
*) quagga_cv_ipforward_method="solaris";;
*-freebsd*) frr_cv_ipforward_method="sysctl";;
*) frr_cv_ipforward_method="solaris";;
esac;;
*) quagga_cv_ipforward_method="sysctl";;
*) frr_cv_ipforward_method="sysctl";;
esac])
IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
IPFORWARD=ipforward_${frr_cv_ipforward_method}.o
AC_SUBST(IPFORWARD)
dnl ----------------------------------------------------------------------------
@ -1092,18 +1096,15 @@ dnl ----------
AC_MSG_ERROR([Failed to detect IPv6 stack])
fi
dnl this is unconditial, for compatibility
AC_DEFINE(HAVE_IPV6,1,IPv6)
dnl ------------------
dnl IPv6 header checks
dnl ------------------
AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h \
netinet6/in6_var.h netinet6/nd6.h], [], [],
QUAGGA_INCLUDES)
FRR_INCLUDES)
m4_define([QUAGGA_INCLUDES],dnl
QUAGGA_INCLUDES
m4_define([FRR_INCLUDES],dnl
FRR_INCLUDES
[#if HAVE_NETINET6_IN6_H
#include <netinet6/in6.h>
#endif
@ -1160,17 +1161,25 @@ AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
if test "${enable_ldpd}" = "no";then
LDPD=""
else
AX_PROG_PERL_MODULES(XML::LibXML, , [
if test -f "${srcdir}/ldpd/ldp_vty_cmds.c"; then
AC_MSG_WARN([XML::LibXML perl module not found, using pregenerated ldp_vty_cmds.c])
else
AC_MSG_ERROR([XML::LibXML perl module not found and pregenerated ldp_vty_cmds.c missing])
fi
])
LDPD="ldpd"
AC_DEFINE(HAVE_LDPD, 1, ldpd)
fi
AM_CONDITIONAL(LDPD, test "x$LDPD" = "xldpd")
if test "${enable_watchquagga}" = "no";then
WATCHQUAGGA=""
if test "${enable_watchfrr}" = "no";then
WATCHFRR=""
else
WATCHQUAGGA="watchquagga"
WATCHFRR="watchfrr"
fi
AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
AM_CONDITIONAL(WATCHFRR, test "x$WATCHFRR" = "xwatchfrr")
OSPFCLIENT=""
if test "${enable_ospfapi}" != "no";then
@ -1245,7 +1254,7 @@ AC_SUBST(RIPNGD)
AC_SUBST(OSPFD)
AC_SUBST(OSPF6D)
AC_SUBST(LDPD)
AC_SUBST(WATCHQUAGGA)
AC_SUBST(WATCHFRR)
AC_SUBST(ISISD)
AC_SUBST(PIMD)
AC_SUBST(SOLARIS)
@ -1313,14 +1322,14 @@ AC_CHECK_TYPES([
struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
struct nd_opt_adv_interval, struct rt_addrinfo,
struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
[], [], QUAGGA_INCLUDES)
[], [], FRR_INCLUDES)
AC_CHECK_MEMBERS([struct sockaddr.sa_len,
struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
struct sockaddr_dl.sdl_len,
struct if6_aliasreq.ifra_lifetime,
struct nd_opt_adv_interval.nd_opt_ai_type],
[], [], QUAGGA_INCLUDES)
[], [], FRR_INCLUDES)
dnl ---------------------------
dnl IRDP/pktinfo/icmphdr checks
@ -1332,10 +1341,10 @@ AC_CHECK_TYPES([struct in_pktinfo],
fi],
[if test "${enable_irdp}" = "yes"; then
AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
fi], [QUAGGA_INCLUDES])],
fi], [FRR_INCLUDES])],
[if test "${enable_irdp}" = "yes"; then
AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
fi], [QUAGGA_INCLUDES])
fi], [FRR_INCLUDES])
dnl -----------------------
dnl checking for IP_PKTINFO
@ -1408,7 +1417,7 @@ dnl --------------------------------------
AC_CHECK_DECL(CLOCK_MONOTONIC,
[AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
], [AC_MSG_RESULT(no)], [FRR_INCLUDES])
dnl --------------------------------------
dnl checking for flex and bison
@ -1478,17 +1487,17 @@ if test "${enable_capabilities}" != "no"; then
AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
quagga_ac_keepcaps="yes"],
frr_ac_keepcaps="yes"],
AC_MSG_RESULT(no)
)
if test x"${quagga_ac_keepcaps}" = x"yes"; then
if test x"${frr_ac_keepcaps}" = x"yes"; then
AC_CHECK_HEADERS(sys/capability.h)
fi
if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
AC_CHECK_LIB(cap, cap_init,
[AC_DEFINE(HAVE_LCAPS,1,Capabilities)
LIBCAP="-lcap"
quagga_ac_lcaps="yes"]
frr_ac_lcaps="yes"]
)
else
AC_CHECK_HEADERS(priv.h,
@ -1496,14 +1505,14 @@ if test "${enable_capabilities}" != "no"; then
AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
quagga_ac_scaps="yes"],
frr_ac_scaps="yes"],
AC_MSG_RESULT(no)
)
]
)
fi
if test x"${quagga_ac_scaps}" = x"yes" \
-o x"${quagga_ac_lcaps}" = x"yes"; then
if test x"${frr_ac_scaps}" = x"yes" \
-o x"${frr_ac_lcaps}" = x"yes"; then
AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
fi
fi
@ -1543,7 +1552,7 @@ AC_CHECK_HEADER([malloc.h],
AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
AC_MSG_RESULT(no)
)
], [], QUAGGA_INCLUDES)
], [], FRR_INCLUDES)
dnl ----------
dnl configure date
@ -1568,54 +1577,54 @@ dnl set paths for state directory
dnl ------------------------------
AC_MSG_CHECKING(directory to use for state file)
if test "${prefix}" = "NONE"; then
quagga_statedir_prefix="";
frr_statedir_prefix="";
else
quagga_statedir_prefix=${prefix}
frr_statedir_prefix=${prefix}
fi
if test "${localstatedir}" = '${prefix}/var'; then
for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
${quagga_statedir_prefix}/var/adm dnl
${quagga_statedir_prefix}/etc dnl
for FRR_STATE_DIR in ${frr_statedir_prefix}/var/run dnl
${frr_statedir_prefix}/var/adm dnl
${frr_statedir_prefix}/etc dnl
/var/run dnl
/var/adm dnl
/etc dnl
/dev/null;
do
test -d $QUAGGA_STATE_DIR && break
test -d $FRR_STATE_DIR && break
done
quagga_statedir=$QUAGGA_STATE_DIR
frr_statedir=$FRR_STATE_DIR
else
quagga_statedir=${localstatedir}
frr_statedir=${localstatedir}
fi
if test $quagga_statedir = "/dev/null"; then
if test $frr_statedir = "/dev/null"; then
AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
fi
AC_MSG_RESULT(${quagga_statedir})
AC_SUBST(quagga_statedir)
AC_MSG_RESULT(${frr_statedir})
AC_SUBST(frr_statedir)
AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
AC_DEFINE_UNQUOTED(PATH_LDPD_PID, "$quagga_statedir/ldpd.pid",ldpd PID)
AC_DEFINE_UNQUOTED(LDPD_SOCKET, "$quagga_statedir/ldpd.sock",ldpd control socket)
AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
AC_DEFINE_UNQUOTED(PATH_PIMD_PID, "$quagga_statedir/pimd.pid",pimd PID)
AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
AC_DEFINE_UNQUOTED(LDP_VTYSH_PATH, "$quagga_statedir/ldpd.vty",ldpd vty socket)
AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
AC_DEFINE_UNQUOTED(PIM_VTYSH_PATH, "$quagga_statedir/pimd.vty",pimd vty socket)
AC_DEFINE_UNQUOTED(WATCHQUAGGA_VTYSH_PATH, "$quagga_statedir/watchquagga.vty",watchquagga vty socket)
AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$frr_statedir/zebra.pid",zebra PID)
AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$frr_statedir/ripd.pid",ripd PID)
AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$frr_statedir/ripngd.pid",ripngd PID)
AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$frr_statedir/bgpd.pid",bgpd PID)
AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$frr_statedir/ospfd.pid",ospfd PID)
AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$frr_statedir/ospf6d.pid",ospf6d PID)
AC_DEFINE_UNQUOTED(PATH_LDPD_PID, "$frr_statedir/ldpd.pid",ldpd PID)
AC_DEFINE_UNQUOTED(LDPD_SOCKET, "$frr_statedir/ldpd.sock",ldpd control socket)
AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$frr_statedir/isisd.pid",isisd PID)
AC_DEFINE_UNQUOTED(PATH_PIMD_PID, "$frr_statedir/pimd.pid",pimd PID)
AC_DEFINE_UNQUOTED(PATH_WATCHFRR_PID, "$frr_statedir/watchfrr.pid",watchfrr PID)
AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$frr_statedir/zserv.api",zebra api socket)
AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$frr_statedir/zebra.vty",zebra vty socket)
AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$frr_statedir/ripd.vty",rip vty socket)
AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$frr_statedir/ripngd.vty",ripng vty socket)
AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$frr_statedir/bgpd.vty",bgpd vty socket)
AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$frr_statedir/ospfd.vty",ospfd vty socket)
AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$frr_statedir/ospf6d.vty",ospf6d vty socket)
AC_DEFINE_UNQUOTED(LDP_VTYSH_PATH, "$frr_statedir/ldpd.vty",ldpd vty socket)
AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$frr_statedir/isisd.vty",isisd vty socket)
AC_DEFINE_UNQUOTED(PIM_VTYSH_PATH, "$frr_statedir/pimd.vty",pimd vty socket)
AC_DEFINE_UNQUOTED(WATCHFRR_VTYSH_PATH, "$frr_statedir/watchfrr.vty",watchfrr vty socket)
AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$frr_statedir",daemon vty directory)
dnl autoconf does this, but it does it too late...
test "x$prefix" = xNONE && prefix=$ac_default_prefix
@ -1628,6 +1637,18 @@ for I in 1 2 3 4 5 6 7 8 9 10; do
done
AC_DEFINE_UNQUOTED(VTYSH_BIN_PATH, "$vtysh_bin",path to vtysh binary)
CFG_SYSCONF="$sysconfdir"
CFG_SBIN="$sbindir"
CFG_STATE="$frr_statedir"
for I in 1 2 3 4 5 6 7 8 9 10; do
eval CFG_SYSCONF="\"$CFG_SYSCONF\""
eval CFG_SBIN="\"$CFG_SBIN\""
eval CFG_STATE="\"$CFG_STATE\""
done
AC_SUBST(CFG_SYSCONF)
AC_SUBST(CFG_SBIN)
AC_SUBST(CFG_STATE)
dnl -------------------------------
dnl Quagga sources should always be
dnl current wrt interfaces. Dont
@ -1641,14 +1662,14 @@ dnl Check htonl works correctly
dnl ---------------------------
AC_MSG_CHECKING(for working htonl)
AC_CACHE_VAL(ac_cv_htonl_works,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES],[htonl (0);])],
[ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
]
)
AC_MSG_RESULT($ac_cv_htonl_works)
AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
ripngd/Makefile bgpd/Makefile ospfd/Makefile watchfrr/Makefile
ospf6d/Makefile ldpd/Makefile isisd/Makefile vtysh/Makefile
doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
pimd/Makefile
@ -1659,9 +1680,22 @@ AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
cumulus/Makefile
pkgsrc/Makefile
fpm/Makefile
redhat/quagga.spec
redhat/frr.spec
lib/version.h
doc/defines.texi
doc/bgpd.8
doc/isisd.8
doc/ospf6d.8
doc/ospfclient.8
doc/ospfd.8
doc/ldpd.8
doc/ripd.8
doc/ripngd.8
doc/pimd.8
doc/vtysh.1
doc/watchfrr.8
doc/zebra.8
doc/frr.1
pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
@ -1682,21 +1716,21 @@ AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
AC_OUTPUT
echo "
Quagga configuration
--------------------
quagga version : ${PACKAGE_VERSION}
FreeRangeRouting configuration
------------------------------
FRR version : ${PACKAGE_VERSION}
host operating system : ${host_os}
source code location : ${srcdir}
compiler : ${CC}
compiler flags : ${CFLAGS}
make : ${MAKE-make}
linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
state file directory : ${quagga_statedir}
state file directory : ${frr_statedir}
config file directory : `eval echo \`echo ${sysconfdir}\``
example directory : `eval echo \`echo ${exampledir}\``
user to run as : ${enable_user}
group to run as : ${enable_group}
group for vty sockets : ${enable_vty_group}
user to run as : ${enable_user}
group to run as : ${enable_group}
group for vty sockets : ${enable_vty_group}
config file mask : ${enable_configfile_mask}
log file mask : ${enable_logfile_mask}
zebra protobuf enabled : ${have_protobuf:-no}

View file

@ -1,5 +1,5 @@
sbin_PROGRAMS = ssd
EXTRA_DIST = etc/quagga/debian.conf etc/quagga/daemons etc/default/quagga
EXTRA_DIST = etc/frr/debian.conf etc/frr/daemons etc/default/frr
ssd_SOURCES = start-stop-daemon.c

2
cumulus/etc/frr/Frr.conf Normal file
View file

@ -0,0 +1,2 @@
log file /var/log/frr/frr.log
log timestamp precision 6

View file

@ -1,25 +1,25 @@
# This file tells the quagga package which daemons to start.
# This file tells the frr package which daemons to start.
#
# Entries are in the format: <daemon>=(yes|no|priority)
# 0, "no" = disabled
# 1, "yes" = highest priority
# 2 .. 10 = lower priorities
# Read /usr/share/doc/quagga/README.Debian for details.
# Read /usr/share/doc/frr/README.Debian for details.
#
# Sample configurations for these daemons can be found in
# /usr/share/doc/quagga/examples/.
# /usr/share/doc/frr/examples/.
#
# ATTENTION:
#
# When activation a daemon at the first time, a config file, even if it is
# empty, has to be present *and* be owned by the user and group "quagga", else
# the daemon will not be started by /etc/init.d/quagga. The permissions should
# empty, has to be present *and* be owned by the user and group "frr", else
# the daemon will not be started by /etc/init.d/frr. The permissions should
# be u=rw,g=r,o=.
# When using "vtysh" such a config file is also needed. It should be owned by
# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too.
# group "frrvty" and set to ug=rw,o= though. Check /etc/pam.d/frr, too.
#
# The watchquagga daemon is always started. Per default in monitoring-only but
# that can be changed via /etc/quagga/debian.conf.
# The watchfrr daemon is always started. Per default in monitoring-only but
# that can be changed via /etc/frr/debian.conf.
#
zebra=no
bgpd=no

View file

@ -1,7 +1,7 @@
#
# If this option is set the /etc/init.d/quagga script automatically loads
# If this option is set the /etc/init.d/frr script automatically loads
# the config via "vtysh -b" when the servers are started.
# Check /etc/pam.d/quagga if you intend to use "vtysh"!
# Check /etc/pam.d/frr if you intend to use "vtysh"!
#
vtysh_enable=yes
zebra_options=" -s 90000000 --daemon -A 127.0.0.1"
@ -14,5 +14,5 @@ isisd_options=" --daemon -A 127.0.0.1"
pimd_options=" --daemon -A 127.0.0.1"
# The list of daemons to watch is automatically generated by the init script.
watchquagga_enable=yes
watchquagga_options=(-adz -r /usr/sbin/servicebBquaggabBrestartbB%s -s /usr/sbin/servicebBquaggabBstartbB%s -k /usr/sbin/servicebBquaggabBstopbB%s -b bB -t 30)
watchfrr_enable=yes
watchfrr_options=(-adz -r /usr/sbin/servicebBfrrbBrestartbB%s -s /usr/sbin/servicebBfrrbBstartbB%s -k /usr/sbin/servicebBfrrbBstopbB%s -b bB -t 30)

View file

@ -1,2 +0,0 @@
log file /var/log/quagga/quagga.log
log timestamp precision 6

View file

@ -1,7 +1,7 @@
Defaults env_keep += VTYSH_PAGER
# Allow user in group quagga to run vtysh show commands
# without a password by uncommenting the "%quagga" line below.
# Allow user in group frr to run vtysh show commands
# without a password by uncommenting the "%frr" line below.
# Subshell commands need to be disallowed, including
# preventing the user passing command line args like 'start-shell'
@ -11,5 +11,5 @@ Defaults env_keep += VTYSH_PAGER
# Instead, use NOEXEC, to prevent any exec'ed commands.
Cmnd_Alias VTY_SHOW = /usr/bin/vtysh -c show *
# %quagga ALL = (root) NOPASSWD:NOEXEC: VTY_SHOW
# %frr ALL = (root) NOPASSWD:NOEXEC: VTY_SHOW

50
debian/README.Debian vendored
View file

@ -2,34 +2,34 @@
==================
Please consider setting this package "on hold" by typing
echo "quagga hold" | dpkg --set-selections
echo "frr hold" | dpkg --set-selections
and verifying this using
dpkg --get-selections | grep 'hold$'
Setting a package "on hold" means that it will not automatically be upgraded.
Instead apt-get only displays a warning saying that a new version would be
available forcing you to explicitly type "apt-get install quagga" to upgrade it.
available forcing you to explicitly type "apt-get install frr" to upgrade it.
* What is quagga?
* What is frr?
=================
http://www.quagga.net/
> Quagga is a routing software suite, providing implementations of OSPFv2,
http://www.freerangerouting.net/
> Frr is a routing software suite, providing implementations of OSPFv2,
> OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for Unix platforms, particularly
> FreeBSD and Linux and also NetBSD, to mention a few. Quagga is a fork of GNU
> FreeBSD and Linux and also NetBSD, to mention a few. Frr is a fork of GNU
> Zebra which was developed by Kunihiro Ishiguro. Development of GNU Zebra
> slowed dramatically to the point where eventually GNU Zebra was forked into
> Quagga.
> Frr.
> The Quagga tree is an attempt to provide a zebra tree with at least the
> The Frr tree is an attempt to provide a zebra tree with at least the
> bug-fixes, which have accumulated, applied, while tracking any significant
> changes made to the zebra.org tree. Ultimately, this tree hopes to revitalise
> development of this code base.
I packaged zebra-pj which was then renamed to quagga to get people used to it
I packaged zebra-pj which was then renamed to frr to get people used to it
and offer Debian users the choice which versions they like to use. I hope this
brings quagga some feedback and helps it evolving to a good successor of the
brings frr some feedback and helps it evolving to a good successor of the
orphaned zebra.
-- Christian Hammers <ch@debian.org>, Jul/Aug 2003
@ -37,16 +37,16 @@ orphaned zebra.
* Why has SNMP support been disabled?
=====================================
Quagga used to link against the NetSNMP libraries to provide SNMP
Frr used to link against the NetSNMP libraries to provide SNMP
support. Those libraries sadly link against the OpenSSL libraries
to provide crypto support for SNMPv3 among others.
OpenSSL now is not compatible with the GNU GENERAL PUBLIC LICENSE (GPL)
licence that Quagga is distributed under. For more explanation read:
licence that Frr is distributed under. For more explanation read:
http://www.gnome.org/~markmc/openssl-and-the-gpl.html
http://www.gnu.org/licenses/gpl-faq.html#GPLIncompatibleLibs
Updating the licence to explecitly allow linking against OpenSSL
would requite the affirmation of all people that ever contributed
a significant part to Zebra or Quagga and thus are the collective
a significant part to Zebra or Frr and thus are the collective
"copyright holder". That's too much work. Using a shrinked down
version of NetSNMP without OpenSSL or convincing the NetSNMP people
to change to GnuTLS are maybe good solutions but not reachable
@ -55,17 +55,17 @@ during the last days before the Sarge release :-(
*BUT*
It is allowed by the used licence mix that you fetch the sources and
build Quagga yourself with SNMP with
<remove the "grep ^smux" block at the end of debian/quagga.preinst>
build Frr yourself with SNMP with
<remove the "grep ^smux" block at the end of debian/frr.preinst>
# export WANT_SNMP=1
# apt-get -b source quagga
# apt-get -b source frr
Just distributing it in binary form, linked against OpenSSL, is forbidden.
* Daemon selection:
===================
The Debian package uses /etc/quagga/daemons to tell the
The Debian package uses /etc/frr/daemons to tell the
initscript which daemons to start. It's in the format
<daemon>=<yes|no|priority>
with no spaces (it's simply source-d into the initscript).
@ -73,13 +73,13 @@ Default is not to start anything, since it can hose your
system's routing table if not set up properly.
Priorities were suggested by Dancer <dancer@zeor.simegen.com>.
They're used to start the Quagga daemons in more than one step
They're used to start the Frr daemons in more than one step
(for example start one or two at network initialization and the
rest later). The number of Quagga daemons being small, priorities
rest later). The number of Frr daemons being small, priorities
must be between 1 and 9, inclusive (or the initscript has to be
changed). /etc/init.d/quagga then can be started as
changed). /etc/init.d/frr then can be started as
/etc/init.d/quagga <start|stop|restart|<priority>>
/etc/init.d/frr <start|stop|restart|<priority>>
where priority 0 is the same as 'stop', priority 10 or 'start'
means 'start all'
@ -96,15 +96,15 @@ into the kernel.
=====================================================================
If this message occurs the receive buffer should be increased by adding the
following to /etc/sysctl.conf and "--nl-bufsize" to /etc/quagga/debian.conf.
following to /etc/sysctl.conf and "--nl-bufsize" to /etc/frr/debian.conf.
> net.core.rmem_default = 262144
> net.core.rmem_max = 262144
See message #4525 from 2005-05-09 in the quagga-users mailing list.
See message #4525 from 2005-05-09 in the frr-users mailing list.
* vtysh immediately exists:
===========================
Check /etc/pam.d/quagga, it probably denies access to your user. The passwords
configured in /etc/quagga/Quagga.conf are only for telnet access.
Check /etc/pam.d/frr, it probably denies access to your user. The passwords
configured in /etc/frr/Frr.conf are only for telnet access.

View file

@ -4,19 +4,19 @@
for i in debian/patches/*.diff; do echo -e "#\n# $i\n#"; patch --fuzz=3 --dry-run -p1 < $i; done
#
# Filename transition from zebra to quagga
# Filename transition from zebra to frr
#
Files that keep their names
/usr/bin/vtysh
Files that got an -pj suffix
/etc/default/zebra -> /etc/quagga/debian.conf
/etc/init.d/zebra -> /etc/init.d/quagga
/etc/zebra/ -> /etc/quagga/
/usr/share/doc/zebra/ -> /usr/share/doc/quagga/
/var/log/zebra/ -> /var/log/quagga/
/var/run/ -> /var/run/quagga/
/etc/default/zebra -> /etc/frr/debian.conf
/etc/init.d/zebra -> /etc/init.d/frr
/etc/zebra/ -> /etc/frr/
/usr/share/doc/zebra/ -> /usr/share/doc/frr/
/var/log/zebra/ -> /var/log/frr/
/var/run/ -> /var/run/frr/
Files that were moved
/usr/sbin/* -> /usr/lib/quagga/
/usr/sbin/* -> /usr/lib/frr/

4
debian/changelog vendored
View file

@ -1,3 +1,7 @@
frr (2.0) Released; urgency=medium
* Switchover to FRR
quagga (0.99.24+cl3u5) RELEASED; urgency=medium
* Closes: CM-12846 - Resolve Memory leaks in 'show ip bgp neighbor json'

30
debian/control vendored
View file

@ -1,14 +1,14 @@
Source: quagga
Source: frr
Section: net
Priority: optional
Maintainer: Christian Hammers <ch@debian.org>
Uploaders: Florian Weimer <fw@debian.org>
Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), imagemagick, ghostscript, groff, po-debconf, autotools-dev, hardening-wrapper, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson0, libjson0-dev, dh-systemd, libsystemd-dev, python-ipaddr, bison, flex
Standards-Version: 3.9.6
Homepage: http://www.quagga.net/
Homepage: http://www.frr.net/
XS-Testsuite: autopkgtest
Package: quagga
Package: frr
Architecture: any
Depends: ${shlibs:Depends}, logrotate (>= 3.2-11), iproute, ${misc:Depends}
Pre-Depends: adduser
@ -16,37 +16,33 @@ Conflicts: zebra, zebra-pj
Replaces: zebra, zebra-pj
Suggests: snmpd
Description: BGP/OSPF/RIP routing daemon
GNU Quagga is free software which manages TCP/IP based routing protocols.
Frr is free software which manages TCP/IP based routing protocols.
It supports BGP4, BGP4+, OSPFv2, OSPFv3, IS-IS, RIPv1, RIPv2, and RIPng as
well as the IPv6 versions of these.
.
As the precessor Zebra has been considered orphaned, the Quagga project
has been formed by members of the zebra mailing list and the former
zebra-pj project to continue developing.
.
Quagga uses threading if the kernel supports it, but can also run on
Frr uses threading if the kernel supports it, but can also run on
kernels that do not support threading. Each protocol has its own daemon.
.
It is more than a routed replacement, it can be used as a Route Server and
a Route Reflector.
Package: quagga-dbg
Package: frr-dbg
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, quagga (= ${binary:Version})
Depends: ${shlibs:Depends}, ${misc:Depends}, frr (= ${binary:Version})
Priority: extra
Section: debug
Description: BGP/OSPF/RIP routing daemon (debug symbols)
This package provides debugging symbols for all binary packages built from
quagga source package. It's highly recommended to have this package installed
before reporting any Quagga crashes to either Quagga developers or Debian
frr source package. It's highly recommended to have this package installed
before reporting any Frr crashes to either Frr developers or Debian
package maintainers.
Package: quagga-doc
Package: frr-doc
Section: net
Architecture: all
Depends: ${misc:Depends}
Suggests: quagga
Description: documentation files for quagga
This package includes info files for quagga, a free software which manages
Suggests: frr
Description: documentation files for frr
This package includes info files for frr, a free software which manages
TCP/IP based routing protocols. It supports BGP4, BGP4+, OSPFv2, OSPFv3,
IS-IS, RIPv1, RIPv2, and RIPng as well as the IPv6 versions of these.

6
debian/copyright vendored
View file

@ -1,7 +1,7 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Quagga
Upstream-Contact: maintainers@quagga.net, security@quagga.net
Source: http://www.quagga.net/
Upstream-Name: Frr
Upstream-Contact: maintainers@freerangerouting.net, security@freerangerouting.net
Source: http://www.freerangerouting.net/
Files: *
Copyright: 1996-2003 by the original Zebra authors:

1
debian/frr-doc.info vendored Normal file
View file

@ -0,0 +1 @@
doc/frr.info*

1
debian/frr-doc.lintian-overrides vendored Normal file
View file

@ -0,0 +1 @@
frr-doc: wrong-section-according-to-package-name frr-doc => doc

2
debian/frr.conf vendored Normal file
View file

@ -0,0 +1,2 @@
# Create the /run/frr directory at boot or from systemd-tmpfiles on install
d /run/frr 0755 frr frr

7
debian/frr.dirs vendored Normal file
View file

@ -0,0 +1,7 @@
etc/logrotate.d/
etc/frr/
usr/share/doc/frr/
usr/share/doc/frr/examples/
usr/share/lintian/overrides/
usr/share/snmp/mibs/
var/log/frr/

View file

@ -1,12 +1,12 @@
etc/quagga/
etc/frr/
usr/bin/vtysh
usr/include/quagga/
usr/include/frr/
usr/lib/
tools/quagga-reload.py usr/lib/quagga/
tools/quagga usr/lib/quagga
usr/share/doc/quagga/
tools/frr-reload.py usr/lib/frr/
tools/frr usr/lib/frr
usr/share/doc/frr/
usr/share/man/man1/vtysh.1
usr/share/man/man1/quagga.1
usr/share/man/man1/frr.1
usr/share/man/man8
usr/share/man/man8/bgpd.8
usr/share/man/man8/ospf6d.8
@ -15,8 +15,8 @@ usr/share/man/man8/ripd.8
usr/share/man/man8/ripngd.8
usr/share/man/man8/zebra.8
usr/share/man/man8/isisd.8
usr/share/man/man8/watchquagga.8
usr/share/man/man8/watchfrr.8
usr/share/snmp/mibs/
cumulus/etc/* etc/
tools/*.service lib/systemd/system
debian/quagga.conf usr/lib/tmpfiles.d
debian/frr.conf usr/lib/tmpfiles.d

4
debian/frr.lintian-overrides vendored Normal file
View file

@ -0,0 +1,4 @@
frr: non-dev-pkg-with-shlib-symlink usr/lib/libospfapiclient.so.0.0.0 usr/lib/libospfapiclient.so
frr: non-dev-pkg-with-shlib-symlink usr/lib/libospf.so.0.0.0 usr/lib/libospf.so
frr: non-dev-pkg-with-shlib-symlink usr/lib/libzebra.so.0.0.0 usr/lib/libzebra.so
frr: package-name-doesnt-match-sonames libospf0 libospfapiclient0 libzebra0

View file

@ -1,15 +1,15 @@
/var/log/quagga/*.log {
/var/log/frr/*.log {
size 500k
sharedscripts
missingok
compress
rotate 14
create 640 quagga quaggavty
create 640 frr frrvty
postrotate
for i in zebra bgpd ripd ospfd ripngd ospf6d isisd pimd; do
if [ -e /var/run/quagga/$i.pid ] ; then
kill -USR1 `cat /var/run/quagga/$i.pid`
if [ -e /var/run/frr/$i.pid ] ; then
kill -USR1 `cat /var/run/frr/$i.pid`
fi
done

View file

@ -6,4 +6,4 @@ doc/ripngd.8
doc/vtysh.1
doc/zebra.8
doc/isisd.8
doc/watchquagga.8
doc/watchfrr.8

View file

@ -1,3 +1,3 @@
# Any user may call vtysh but only those belonging to the group quaggavty can
# Any user may call vtysh but only those belonging to the group frrvty can
# actually connect to the socket and use the program.
auth sufficient pam_permit.so

41
debian/frr.postinst vendored Normal file
View file

@ -0,0 +1,41 @@
#!/bin/bash -e
######################
PASSWDFILE=/etc/passwd
GROUPFILE=/etc/group
frruid=`egrep "^frr:" $PASSWDFILE | awk -F ":" '{ print $3 }'`
frrgid=`egrep "^frr:" $GROUPFILE | awk -F ":" '{ print $3 }'`
frrvtygid=`egrep "^frrvty:" $GROUPFILE | awk -F ":" '{ print $3 }'`
[ -n ${frruid} ] || (echo "No uid for frr in ${PASSWDFILE}" && /bin/false)
[ -n ${frrgid} ] || (echo "No gid for frr in ${GROUPFILE}" && /bin/false)
[ -n ${frrVTYgid} ] || (echo "No gid for frrvty in ${GROUPFILE}" && /bin/false)
chown -R ${frruid}:${frrgid} /etc/frr
touch /etc/frr/vtysh.conf
chgrp ${frrvtygid} /etc/frr/vtysh*
chmod 440 /etc/sudoers.d/frr_sudoers
chmod 644 /etc/frr/*
ENVIRONMENTFILE=/etc/environment
if ! grep --quiet VTYSH_PAGER=/bin/cat ${ENVIRONMENTFILE}; then
echo "VTYSH_PAGER=/bin/cat" >> ${ENVIRONMENTFILE}
fi
##################################################
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*"}
# This is most likely due to the answer "no" to the "really stop the server"
# question in the prerm script.
if [ "$1" = "abort-upgrade" ]; then
exit 0
fi
. /usr/share/debconf/confmodule
db_stop
#DEBHELPER#

View file

@ -5,8 +5,8 @@ ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*"}
# set -u not because of debhelper
if [ "$1" = "purge" ]; then
rm -rf /etc/quagga /var/run/quagga /var/log/quagga
userdel quagga >/dev/null 2>&1 || true
rm -rf /etc/frr /var/run/frr /var/log/frr
userdel frr >/dev/null 2>&1 || true
fi
#DEBHELPER#

View file

@ -5,73 +5,73 @@ ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*"}
set -e
set -u
# creating quaggavty group if it isn't already there
if ! getent group quaggavty >/dev/null; then
addgroup --system quaggavty >/dev/null
# creating frrvty group if it isn't already there
if ! getent group frrvty >/dev/null; then
addgroup --system frrvty >/dev/null
fi
# creating quagga group if it isn't already there
if ! getent group quagga >/dev/null; then
addgroup --system quagga >/dev/null
# creating frr group if it isn't already there
if ! getent group frr >/dev/null; then
addgroup --system frr >/dev/null
fi
# creating quagga user if he isn't already there
if ! getent passwd quagga >/dev/null; then
# creating frr user if he isn't already there
if ! getent passwd frr >/dev/null; then
adduser \
--system \
--ingroup quagga \
--home /var/run/quagga/ \
--gecos "Quagga routing suite" \
--ingroup frr \
--home /var/run/frr/ \
--gecos "Frr routing suite" \
--shell /bin/false \
quagga >/dev/null
frr >/dev/null
fi
# We may be installing over an older version of
# quagga and as such we need to intelligently
# check to see if the quagga user is in the quaggavty
# frr and as such we need to intelligently
# check to see if the frr user is in the frrvty
# group.
if ! /usr/bin/id quagga | grep &>/dev/null 'quaggavty'; then
usermod -a -G quaggavty quagga >/dev/null
if ! /usr/bin/id frr | grep &>/dev/null 'frrvty'; then
usermod -a -G frrvty frr >/dev/null
fi
# Do not change permissions when upgrading as it would violate policy.
if [ "$1" = "install" ]; then
# Logfiles are group readable in case users were put into the quagga group.
d=/var/log/quagga/
# Logfiles are group readable in case users were put into the frr group.
d=/var/log/frr/
mkdir -p $d
chown -R quagga:quagga $d
chown -R frr:frr $d
chmod u=rwx,go=rx $d
find $d -type f -print0 | xargs -0 --no-run-if-empty chmod u=rw,g=r,o=
# Strict permissions for the sockets.
d=/var/run/quagga/
d=/var/run/frr/
mkdir -p $d
chown -R quagga:quagga $d
chown -R frr:frr $d
chmod u=rwx,go=rx $d
find $d -type f -print0 | xargs -0 --no-run-if-empty chmod u=rw,go=
# Config files. Vtysh does not have access to the individual daemons config file
d=/etc/quagga/
d=/etc/frr/
mkdir -p $d
chown quagga:quaggavty $d
chown frr:frrvty $d
chmod ug=rwx,o=rx $d
find $d -type f -print0 | xargs -0 --no-run-if-empty chown quagga:quagga
find $d -type f -print0 | xargs -0 --no-run-if-empty chown frr:frr
find $d -type f -print0 | xargs -0 --no-run-if-empty chmod u=rw,g=r,o=
# Exceptions for vtysh.
f=$d/vtysh.conf
if [ -f $f ]; then
chown quagga:quaggavty $f
chown frr:frrvty $f
chmod u=rw,g=r,o= $f
fi
# Exceptions for vtysh.
f=$d/Quagga.conf
f=$d/Frr.conf
if [ -f $d/Zebra.conf ]; then
mv $d/Zebra.conf $f
fi
if [ -f $f ]; then
chown quagga:quaggavty $f
chown frr:frrvty $f
chmod u=rw,g=r,o= $f
fi
fi

View file

@ -15,7 +15,7 @@ case $1 in
;;
failed-upgrade)
# If quagga/really_stop was negated then this script exits with return
# If frr/really_stop was negated then this script exits with return
# code 1 and is called again with "failed-upgrade". Well, exit again.
exit 1
;;

View file

@ -1 +0,0 @@
doc/quagga.info*

View file

@ -1 +0,0 @@
quagga-doc: wrong-section-according-to-package-name quagga-doc => doc

2
debian/quagga.conf vendored
View file

@ -1,2 +0,0 @@
# Create the /run/quagga directory at boot or from systemd-tmpfiles on install
d /run/quagga 0755 quagga quagga

7
debian/quagga.dirs vendored
View file

@ -1,7 +0,0 @@
etc/logrotate.d/
etc/quagga/
usr/share/doc/quagga/
usr/share/doc/quagga/examples/
usr/share/lintian/overrides/
usr/share/snmp/mibs/
var/log/quagga/

View file

@ -1,4 +0,0 @@
quagga: non-dev-pkg-with-shlib-symlink usr/lib/libospfapiclient.so.0.0.0 usr/lib/libospfapiclient.so
quagga: non-dev-pkg-with-shlib-symlink usr/lib/libospf.so.0.0.0 usr/lib/libospf.so
quagga: non-dev-pkg-with-shlib-symlink usr/lib/libzebra.so.0.0.0 usr/lib/libzebra.so
quagga: package-name-doesnt-match-sonames libospf0 libospfapiclient0 libzebra0

View file

@ -1,41 +0,0 @@
#!/bin/bash -e
######################
PASSWDFILE=/etc/passwd
GROUPFILE=/etc/group
quaggauid=`egrep "^quagga:" $PASSWDFILE | awk -F ":" '{ print $3 }'`
quaggagid=`egrep "^quagga:" $GROUPFILE | awk -F ":" '{ print $3 }'`
quaggavtygid=`egrep "^quaggavty:" $GROUPFILE | awk -F ":" '{ print $3 }'`
[ -n ${quaggauid} ] || (echo "No uid for quagga in ${PASSWDFILE}" && /bin/false)
[ -n ${quaggagid} ] || (echo "No gid for quagga in ${GROUPFILE}" && /bin/false)
[ -n ${quaggaVTYgid} ] || (echo "No gid for quaggavty in ${GROUPFILE}" && /bin/false)
chown -R ${quaggauid}:${quaggagid} /etc/quagga
touch /etc/quagga/vtysh.conf
chgrp ${quaggavtygid} /etc/quagga/vtysh*
chmod 440 /etc/sudoers.d/quagga_sudoers
chmod 644 /etc/quagga/*
ENVIRONMENTFILE=/etc/environment
if ! grep --quiet VTYSH_PAGER=/bin/cat ${ENVIRONMENTFILE}; then
echo "VTYSH_PAGER=/bin/cat" >> ${ENVIRONMENTFILE}
fi
##################################################
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*"}
# This is most likely due to the answer "no" to the "really stop the server"
# question in the prerm script.
if [ "$1" = "abort-upgrade" ]; then
exit 0
fi
. /usr/share/debconf/confmodule
db_stop
#DEBHELPER#

38
debian/rules vendored
View file

@ -20,10 +20,10 @@ MAKEFLAGS += -j$(DEBIAN_JOBS)
endif
%:
dh $@ --with=systemd,autoreconf --parallel --dbg-package=quagga-dbg --list-missing
dh $@ --with=systemd,autoreconf --parallel --dbg-package=frr-dbg --list-missing
override_dh_auto_configure:
# Quagga needs /proc to check some BSD vs Linux specific stuff.
# Frr needs /proc to check some BSD vs Linux specific stuff.
# Else it fails with an obscure error message pointing out that
# IPCTL_FORWARDING is an undefined symbol which is not very helpful.
@if ! [ -d /proc/1 ]; then \
@ -33,18 +33,18 @@ override_dh_auto_configure:
if ! [ -e config.status ]; then \
dh_auto_configure -- \
--enable-exampledir=/usr/share/doc/quagga/examples/ \
--localstatedir=/var/run/quagga \
--sbindir=/usr/lib/quagga \
--sysconfdir=/etc/quagga \
--enable-exampledir=/usr/share/doc/frr/examples/ \
--localstatedir=/var/run/frr \
--sbindir=/usr/lib/frr \
--sysconfdir=/etc/frr \
$(USE_SNMP) \
--enable-ospfapi=yes \
--enable-vtysh=yes \
--enable-isisd=yes \
--enable-multipath=256 \
--enable-user=quagga \
--enable-group=quagga \
--enable-vty-group=quaggavty \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-werror \
@ -53,7 +53,7 @@ override_dh_auto_configure:
--enable-systemd=yes \
--enable-poll=yes \
--enable-cumulus=yes \
--enable-pimd=no \
--enable-pimd=yes \
--enable-dependency-tracking \
--enable-bgp-vnc=no; \
fi
@ -66,11 +66,11 @@ override_dh_auto_build:
# doc/ is a bit crazy
ifeq ($(GENERATE_PDF), 1)
dh_auto_build -- -C doc quagga.pdf || true # pdfetex fails with exit code 1 but still produces a good looking .pdf
dh_auto_build -- -C doc frr.pdf || true # pdfetex fails with exit code 1 but still produces a good looking .pdf
endif
rm -vf doc/quagga.info
dh_auto_build -- -C doc quagga.info
rm -vf doc/quagga.info.html*
rm -vf doc/frr.info
dh_auto_build -- -C doc frr.info
rm -vf doc/frr.info.html*
override_dh_auto_test:
@ -81,18 +81,18 @@ override_dh_auto_install:
rm -f debian/tmp/usr/share/info/dir*
# install config files
mkdir -p debian/tmp/etc/quagga/
perl -pi -e 's#^!log file #!log file /var/log/quagga/#' debian/tmp/usr/share/doc/quagga/examples/*sample*
mkdir -p debian/tmp/etc/frr/
perl -pi -e 's#^!log file #!log file /var/log/frr/#' debian/tmp/usr/share/doc/frr/examples/*sample*
# installing the Quagga specific SNMP MIB
# installing the Frr specific SNMP MIB
install -D -m 644 ./zebra/GNOME-PRODUCT-ZEBRA-MIB debian/tmp/usr/share/snmp/mibs/GNOME-PRODUCT-ZEBRA-MIB
# cleaning .la files
sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/*.la
override_dh_systemd_start:
dh_systemd_start quagga.service
dh_systemd_start frr.service
override_dh_systemd_enable:
dh_systemd_enable quagga.service
dh_systemd_enable frr.service

View file

@ -1,3 +1,3 @@
Tests: daemons
Depends: quagga
Depends: frr
Restrictions: needs-root

10
debian/tests/daemons vendored
View file

@ -1,21 +1,21 @@
#!/bin/bash
#---------------
# Testing quagga
# Testing frr
#---------------
set -e
# modify config file to enable all daemons and copy config files
CONFIG_FILE=/etc/quagga/daemons
CONFIG_FILE=/etc/frr/daemons
DAEMONS=("zebra" "bgpd" "ospfd" "ospf6d" "ripd" "ripngd" "isisd" "pimd")
for daemon in "${DAEMONS[@]}"
do
sed -i -e "s/${daemon}=no/${daemon}=yes/g" $CONFIG_FILE
cp /usr/share/doc/quagga/examples/${daemon}.conf.sample /etc/quagga/${daemon}.conf
cp /usr/share/doc/frr/examples/${daemon}.conf.sample /etc/frr/${daemon}.conf
done
# reload quagga
/etc/init.d/quagga restart > /dev/null 2>&1
# reload frr
/etc/init.d/frr restart > /dev/null 2>&1
# check daemons
for daemon in "${DAEMONS[@]}"

2
debian/watch vendored
View file

@ -4,5 +4,5 @@
# Site Directory Pattern Version Script
version=3
opts=uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|b|a)[\-\.]?\d*)$/$1~$2/ \
http://download.savannah.gnu.org/releases/quagga/quagga-(\d.*)\.(?:tgz|tar\.(?:gz|bz2|xz))
http://download.savannah.gnu.org/releases/frr/quagga-(\d.*)\.(?:tgz|tar\.(?:gz|bz2|xz))
# Bart Martens <bartm@debian.org> Fri, 25 Jan 2013 06:38:53 +0000

4
debian/watchfrr.rc vendored Normal file
View file

@ -0,0 +1,4 @@
check process watchfrr with pidfile /var/run/frr/watchfrr.pid
start program = "/etc/init.d/frr start watchfrr" with timeout 120 seconds
stop program = "/etc/init.d/frr stop watchfrr"
if 3 restarts within 10 cycles then timeout

View file

@ -1,4 +0,0 @@
check process watchquagga with pidfile /var/run/quagga/watchquagga.pid
start program = "/etc/init.d/quagga start watchquagga" with timeout 120 seconds
stop program = "/etc/init.d/quagga stop watchquagga"
if 3 restarts within 10 cycles then timeout

12
doc/.gitignore vendored
View file

@ -2,17 +2,17 @@ Makefile
Makefile.in
mdate-sh
draft-zebra-00.txt
quagga.info-*
frr.info-*
zebra.html
defines.texi
version.texi
texinfo.tex
quagga.html
quagga.info
frr.html
frr.info
*.pdf
*.eps
quagga.ps
quagga.dvi
frr.ps
frr.dvi
stamp-vti
.nfs*
*.aux
@ -28,6 +28,8 @@ stamp-vti
*.toc
*.tp
*.vr
*.8
*.1
.arch-inventory
.arch-ids
*~

View file

@ -7,7 +7,7 @@
#
# Here we use 'convert' from the well known 'ImageMagick' package
# to do conversion from png to eps/pdf for figures.
# PDF form is required for quagga.pdf, using PDFTex at least.
# PDF form is required for frr.pdf, using PDFTex at least.
#
# TeX implementation, which we depend on already anyway.
#
@ -20,7 +20,7 @@ PNGTOPDF = $(PNGTOEPS)
EPSTOPDF = epstopdf
VNCFIGURES_PNG =
VNCFIGURES_DIA = -vnc-mesh -vnc-quagga-route-reflector \
VNCFIGURES_DIA = -vnc-mesh -vnc-frr-route-reflector \
-vnc-commercial-route-reflector -vnc-redundant-route-reflectors \
-vnc-gw -vnc-gw-rr
@ -40,7 +40,7 @@ figures_eps = $(figures_names_parts:%=fig%.eps) $(VNCFIGURES_PNG:%.png=%.eps)
figures_txt = $(figures_names_parts:%=fig%.txt)
# rather twisted logic because we have to build PDFs of the EPS figures for
# PDFTex and yet build one PDF, quagga.pdf, from texi source. Which means we
# PDFTex and yet build one PDF, frr.pdf, from texi source. Which means we
# cant rely on a single automatic rule for *.pdf, eg the one automatically
# provided by automake. If you are an automake wizard, please feel free to
# compact it somehow.
@ -48,16 +48,16 @@ figures_txt = $(figures_names_parts:%=fig%.txt)
# Built from defines.texi.in
BUILT_SOURCES = defines.texi
info_TEXINFOS = quagga.texi
info_TEXINFOS = frr.texi
# Have to manually specify the quagga.pdf rule in order to allow
# Have to manually specify the frr.pdf rule in order to allow
# us to have a generic automatic .pdf rule to build the figure sources
# because it cant just work from the png's directly it seems - contrary
# to the documentation...
quagga.pdf: $(info_TEXINFOS) $(figures_pdf) $(quagga_TEXINFOS)
frr.pdf: $(info_TEXINFOS) $(figures_pdf) $(frr_TEXINFOS)
$(TEXI2PDF) -o "$@" $< || true
quagga_TEXINFOS = appendix.texi basic.texi bgpd.texi isisd.texi filter.texi \
frr_TEXINFOS = appendix.texi basic.texi bgpd.texi isisd.texi filter.texi \
vnc.texi \
install.texi ipv6.texi kernel.texi main.texi ospf6d.texi ospfd.texi \
overview.texi protocol.texi ripd.texi ripngd.texi routemap.texi \
@ -73,7 +73,7 @@ quagga_TEXINFOS = appendix.texi basic.texi bgpd.texi isisd.texi filter.texi \
.dia.png:
$(DIATOPNG) "$@" $<
man_MANS = quagga.1
man_MANS = frr.1
if PIMD
man_MANS += pimd.8
@ -115,8 +115,8 @@ if VTYSH
man_MANS += vtysh.1
endif
if WATCHQUAGGA
man_MANS += watchquagga.8
if WATCHFRR
man_MANS += watchfrr.8
endif
if ZEBRA
@ -124,8 +124,21 @@ man_MANS += zebra.8
endif
EXTRA_DIST = BGP-TypeCode draft-zebra-00.ms draft-zebra-00.txt \
bgpd.8 isisd.8 ospf6d.8 ospfclient.8 ospfd.8 ldpd.8 ripd.8 \
ripngd.8 pimd.8 vtysh.1 watchquagga.8 zebra.8 quagga.1 \
\
bgpd.8.in \
isisd.8.in \
ospf6d.8.in \
ospfclient.8.in \
ospfd.8.in \
ldpd.8.in \
ripd.8.in \
ripngd.8.in \
pimd.8.in \
vtysh.1.in \
watchfrr.8.in \
zebra.8.in \
frr.1.in \
\
mpls/ChangeLog.opaque.txt mpls/cli_summary.txt \
mpls/opaque_lsa.txt mpls/ospfd.conf \
$(figures_sources) $(figures_png) $(figures_txt)

View file

@ -110,7 +110,7 @@ with severity @code{errors}.
If you want to log into a file, please specify @code{filename} as
in this example:
@example
log file /var/log/quagga/bgpd.log informational
log file /var/log/frr/bgpd.log informational
@end example
If the optional second argument specifying the
logging level is not present, the default logging level (typically debugging,
@ -119,7 +119,7 @@ The @code{no} form of the command disables logging to a file.
Note: if you do not configure any file logging, and a daemon crashes due
to a signal or an assertion failure, it will attempt to save the crash
information in a file named /var/tmp/quagga.<daemon name>.crashlog.
information in a file named /var/tmp/frr.<daemon name>.crashlog.
For security reasons, this will not happen if the file exists already, so
it is important to delete the file after reporting the crash information.
@end deffn

View file

@ -1,7 +1,6 @@
.TH BGPD 8 "25 November 2004" "Quagga BGPD daemon" "Version 0.97.3"
.TH BGPD 8 "25 November 2004" "@PACKAGE_FULLNAME@ BGPD daemon" "Version @PACKAGE_VERSION@"
.SH NAME
bgpd \- a BGPv4, BGPv4\+, BGPv4\- routing engine for use with Quagga routing
software
bgpd \- a BGPv4, BGPv4\+, BGPv4\- routing engine for use with @PACKAGE_FULLNAME@.
.SH SYNOPSIS
.B bgpd
@ -32,7 +31,7 @@ software
.SH DESCRIPTION
.B bgpd
is a routing component that works with the
.B Quagga
.B @PACKAGE_FULLNAME@
routing engine.
.SH OPTIONS
Options available for the
@ -44,10 +43,10 @@ Runs in daemon mode, forking and exiting from tty.
.TP
\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR
Specifies the config file to use for startup. If not specified this
option will likely default to \fB\fI/usr/local/etc/bgpd.conf\fR.
option will default to \fB\fI@CFG_SYSCONF@/bgpd.conf\fR.
.TP
\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR
Specify the group to run as. Default is \fIquagga\fR.
Specify the group to run as. Default is \fI@enable_group@\fR.
.TP
\fB\-h\fR, \fB\-\-help\fR
A brief message.
@ -55,7 +54,7 @@ A brief message.
\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR
When bgpd starts its process identifier is written to
\fB\fIpid-file\fR. The init system uses the recorded PID to stop or
restart bgpd. The likely default is \fB\fI/var/run/bgpd.pid\fR.
restart bgpd. The default is \fB\fI@CFG_STATE@/bgpd.pid\fR.
.TP
\fB\-p\fR, \fB\-\-bgp_port \fR\fIbgp-port-number\fR
Set the port that bgpd will listen to for bgp data.
@ -69,7 +68,7 @@ Specify the address that the bgpd VTY will listen on. Default is all
interfaces.
.TP
\fB\-u\fR, \fB\-\-user \fR\fIuser\fR
Specify the user to run as. Default is \fIquagga\fR.
Specify the user to run as. Default is \fI@enable_user@\fR.
.TP
\fB\-r\fR, \fB\-\-retain\fR
When the program terminates, retain routes added by \fBbgpd\fR.
@ -81,12 +80,12 @@ Skip setting the process effective user and group.
Print the version and exit.
.SH FILES
.TP
.BI /usr/lib/quagga/bgpd
.BI @CFG_SBIN@/bgpd
The default location of the
.B bgpd
binary.
.TP
.BI /etc/quagga/bgpd.conf
.BI @CFG_SYSCONF@/bgpd.conf
The default location of the
.B bgpd
config file.
@ -98,7 +97,7 @@ process is config'd to output logs to a file, then you will find this
file in the directory where you started \fBbgpd\fR.
.SH WARNING
This man page is intended to be a quick reference for command line
options. The definitive document is the Info file \fBQuagga\fR.
options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR.
.SH DIAGNOSTICS
The bgpd process may log to standard output, to a VTY, to a log
file, or through syslog to the system logs. \fBbgpd\fR supports many
@ -114,11 +113,11 @@ debugging options, see the Info file, or the source for details.
.SH BUGS
.B bgpd
eats bugs for breakfast. If you have food for the maintainers try
.BI http://bugzilla.quagga.net
.BI @PACKAGE_BUGREPORT@
.SH AUTHORS
See
.BI http://www.zebra.org
and
.BI http://www.quagga.net
.BI @PACKAGE_URL@
or the Info file for an accurate list of authors.

View file

@ -1,9 +1,9 @@
@c -*-texinfo-*-
@c This is part of the Quagga Manual.
@c This is part of the Frr Manual.
@c @value{COPYRIGHT_STR}
@c Portions:
@c Copyright @copyright{} 2015 Hewlett Packard Enterprise Development LP
@c See file quagga.texi for copying conditions.
@c See file frr.texi for copying conditions.
@node BGP
@chapter BGP
@ -114,7 +114,7 @@ This command set distance value to
@node BGP decision process
@subsection BGP decision process
The decision process Quagga BGP uses to select routes is as follows:
The decision process Frr BGP uses to select routes is as follows:
@table @asis
@item 1. Weight check
@ -240,7 +240,7 @@ The BGP MED (Multi_Exit_Discriminator) attribute has properties which can
cause subtle convergence problems in BGP. These properties and problems
have proven to be hard to understand, at least historically, and may still
not be widely understood. The following attempts to collect together and
present what is known about MED, to help operators and Quagga users in
present what is known about MED, to help operators and Frr users in
designing and configuring their networks.
The BGP @acronym{MED, Multi_Exit_Discriminator} attribute is intended to
@ -263,7 +263,7 @@ MED values to those of AS X. The MED values have been set by different
administrators, with different frames of reference.
The default behaviour of BGP therefore is to not compare MED values across
routes received from different neighbouring ASes. In Quagga this is done by
routes received from different neighbouring ASes. In Frr this is done by
comparing the neighbouring, left-most AS in the received AS_PATHs of the
routes and only comparing MED if those are the same.
@ -341,7 +341,7 @@ in response to the most common sequence of received updates.
A deterministic order of evaluation tends to imply an additional overhead of
sorting over any set of n routes to a destination. The implementation of
deterministic MED in Quagga scales significantly worse than most sorting
deterministic MED in Frr scales significantly worse than most sorting
algorithms at present, with the number of paths to a given destination.
That number is often low enough to not cause any issues, but where there are
many paths, the deterministic comparison may quickly become increasingly
@ -408,7 +408,7 @@ preferences between the routes:
This particular type of oscillation in full-mesh iBGP topologies can be
avoided by speakers preferring already selected, external routes rather than
choosing to update to new a route based on a post-MED metric (e.g.
router-ID), at the cost of a non-deterministic selection process. Quagga
router-ID), at the cost of a non-deterministic selection process. Frr
implements this, as do many other implementations, so long as it is not
overridden by setting @ref{bgp bestpath compare-routerid}, and see also
@ref{BGP decision process}, .
@ -480,7 +480,7 @@ with MED may be determined largely by the order that routes were received
in.
Setting this option will have a performance cost that may be noticeable when
there are many routes for each destination. Currently in Quagga it is
there are many routes for each destination. Currently in Frr it is
implemented in a way that scales poorly as the number of routes per
destination increases.
@ -1478,11 +1478,11 @@ unicast neighbor, @command{bgpd} does not send these Capability
Negotiation packets (at least not unless other optional BGP features
require capability negotation).
By default, Quagga will bring up peering with minimal common capability
By default, Frr will bring up peering with minimal common capability
for the both sides. For example, local router has unicast and
multicast capabilitie and remote router has unicast capability. In
this case, the local router will establish the connection with unicast
only capability. When there are no common capabilities, Quagga sends
only capability. When there are no common capabilities, Frr sends
Unsupported Capability error and then resets the connection.
If you want to completely match capabilities with remote peer. Please
@ -1588,10 +1588,10 @@ When bgp config-type cisco is specified,
``network'' and ``aggregate-address'' argument is displayed as
``A.B.C.D M.M.M.M''
Quagga: network 10.0.0.0/8
Frr: network 10.0.0.0/8
Cisco: network 10.0.0.0
Quagga: aggregate-address 192.168.0.0/24
Frr: aggregate-address 192.168.0.0/24
Cisco: aggregate-address 192.168.0.0 255.255.255.0
Community attribute handling is also different. If there is no
@ -1615,7 +1615,7 @@ router bgp 1
@end example
@deffn {Command} {bgp config-type zebra} {}
Quagga style BGP configuration. This is default.
Frr style BGP configuration. This is default.
@end deffn
@node BGP instance and view

View file

@ -10,7 +10,9 @@
@set COPYRIGHT_STR Copyright @copyright{} @value{COPYRIGHT_YEAR} @value{AUTHORS}
@c These may vary with installation environment.
@set INSTALL_PREFIX_ETC /etc/quagga
@set INSTALL_PREFIX_SBIN /usr/sbin
@set INSTALL_PREFIX_STATE /var/run/quagga
@set INSTALL_PREFIX_ETC @CFG_SYSCONF@
@set INSTALL_PREFIX_SBIN @CFG_SBIN@
@set INSTALL_PREFIX_STATE @CFG_STATE@
@set INSTALL_USER @enable_user@
@set INSTALL_GROUP @enable_group@
@set INSTALL_VTY_GROUP @enable_vty_group@

View file

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View file

@ -2,7 +2,7 @@
@comment node-name, next, previous, up
@chapter Filtering
Quagga provides many very flexible filtering features. Filtering is used
Frr provides many very flexible filtering features. Filtering is used
for both input and output of the routing information. Once filtering is
defined, it can be applied in any direction.

Some files were not shown because too many files have changed in this diff Show more