2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP message definition header.
|
2017-05-13 10:25:29 +02:00
|
|
|
* Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
|
|
|
|
*/
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-05-23 16:19:54 +02:00
|
|
|
#ifndef _QUAGGA_BGPD_H
|
|
|
|
#define _QUAGGA_BGPD_H
|
|
|
|
|
2016-12-07 12:25:24 +01:00
|
|
|
#include "qobj.h"
|
2017-02-07 00:39:06 +01:00
|
|
|
#include <pthread.h>
|
|
|
|
|
2019-05-10 15:31:04 +02:00
|
|
|
#include "hook.h"
|
2018-09-12 21:23:52 +02:00
|
|
|
#include "frr_pthread.h"
|
2015-08-12 15:59:18 +02:00
|
|
|
#include "lib/json.h"
|
2016-02-02 13:36:20 +01:00
|
|
|
#include "vrf.h"
|
2017-03-02 02:45:55 +01:00
|
|
|
#include "vty.h"
|
2020-12-19 09:45:26 +01:00
|
|
|
#include "srv6.h"
|
2019-06-02 21:02:07 +02:00
|
|
|
#include "iana_afi.h"
|
2022-11-02 18:17:21 +01:00
|
|
|
#include "asn.h"
|
2016-02-02 13:36:20 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* For union sockunion. */
|
2015-05-20 03:03:47 +02:00
|
|
|
#include "queue.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "sockunion.h"
|
2015-05-20 02:40:45 +02:00
|
|
|
#include "routemap.h"
|
2015-05-20 03:12:17 +02:00
|
|
|
#include "linklist.h"
|
2017-03-09 19:00:19 +01:00
|
|
|
#include "defaults.h"
|
2015-05-29 05:48:31 +02:00
|
|
|
#include "bgp_memory.h"
|
2017-05-15 23:27:51 +02:00
|
|
|
#include "bitfield.h"
|
2017-10-09 02:46:08 +02:00
|
|
|
#include "vxlan.h"
|
2018-04-07 20:13:07 +02:00
|
|
|
#include "bgp_labelpool.h"
|
bgpd: Re-use TX Addpath IDs where possible
The motivation for this patch is to address a concerning behavior of
tx-addpath-bestpath-per-AS. Prior to this patch, all paths' TX ID was
pre-determined as the path was received from a peer. However, this meant
that any time the path selected as best from an AS changed, bgpd had no
choice but to withdraw the previous best path, and advertise the new
best-path under a new TX ID. This could cause significant network
disruption, especially for the subset of prefixes coming from only one
AS that were also communicated over a bestpath-per-AS session.
The patch's general approach is best illustrated by
txaddpath_update_ids. After a bestpath run (required for best-per-AS to
know what will and will not be sent as addpaths) ID numbers will be
stripped from paths that no longer need to be sent, and held in a pool.
Then, paths that will be sent as addpaths and do not already have ID
numbers will allocate new ID numbers, pulling first from that pool.
Finally, anything left in the pool will be returned to the allocator.
In order for this to work, ID numbers had to be split by strategy. The
tx-addpath-All strategy would keep every ID number "in use" constantly,
preventing IDs from being transferred to different paths. Rather than
create two variables for ID, this patch create a more generic array that
will easily enable more addpath strategies to be implemented. The
previously described ID manipulations will happen per addpath strategy,
and will only be run for strategies that are enabled on at least one
peer.
Finally, the ID numbers are allocated from an allocator that tracks per
AFI/SAFI/Addpath Strategy which IDs are in use. Though it would be very
improbable, there was the possibility with the free-running counter
approach for rollover to cause two paths on the same prefix to get
assigned the same TX ID. As remote as the possibility is, we prefer to
not leave it to chance.
This ID re-use method is not perfect. In some cases you could still get
withdraw-then-add behaviors where not strictly necessary. In the case of
bestpath-per-AS this requires one AS to advertise a prefix for the first
time, then a second AS withdraws that prefix, all within the space of an
already pending MRAI timer. In those situations a withdraw-then-add is
more forgivable, and fixing it would probably require a much more
significant effort, as IDs would need to be moved to ADVs instead of
paths.
Signed-off-by Mitchell Skiba <mskiba@amazon.com>
2018-05-10 01:10:02 +02:00
|
|
|
#include "bgp_addpath_types.h"
|
2020-04-09 20:56:11 +02:00
|
|
|
#include "bgp_nexthop.h"
|
2021-04-27 00:59:48 +02:00
|
|
|
#include "bgp_io.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-02-26 20:50:51 +01:00
|
|
|
#include "lib/bfd.h"
|
|
|
|
|
2015-09-11 05:10:16 +02:00
|
|
|
#define BGP_MAX_HOSTNAME 64 /* Linux max, is larger than most other sys */
|
2017-07-31 23:22:23 +02:00
|
|
|
#define BGP_PEER_MAX_HASH_SIZE 16384
|
2015-09-11 05:10:16 +02:00
|
|
|
|
2016-05-13 01:51:43 +02:00
|
|
|
/* Default interval for IPv6 RAs when triggered by BGP unnumbered neighbor. */
|
|
|
|
#define BGP_UNNUM_DEFAULT_RA_INTERVAL 10
|
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
struct update_subgroup;
|
|
|
|
struct bpacket;
|
2018-04-25 18:29:35 +02:00
|
|
|
struct bgp_pbr_config;
|
2015-05-20 03:03:47 +02:00
|
|
|
|
2015-05-20 03:04:25 +02:00
|
|
|
/*
|
|
|
|
* Allow the neighbor XXXX remote-as to take internal or external
|
|
|
|
* AS_SPECIFIED is zero to auto-inherit original non-feature/enhancement
|
|
|
|
* behavior
|
|
|
|
* in the system.
|
|
|
|
*/
|
|
|
|
enum { AS_UNSPECIFIED = 0,
|
|
|
|
AS_SPECIFIED,
|
|
|
|
AS_INTERNAL,
|
|
|
|
AS_EXTERNAL,
|
|
|
|
};
|
|
|
|
|
2019-10-25 17:42:39 +02:00
|
|
|
/* Zebra Gracaful Restart states */
|
|
|
|
enum zebra_gr_mode {
|
|
|
|
ZEBRA_GR_DISABLE = 0,
|
|
|
|
ZEBRA_GR_ENABLE
|
|
|
|
};
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Typedef BGP specific types. */
|
2018-03-27 21:13:34 +02:00
|
|
|
typedef uint16_t as16_t; /* we may still encounter 16 Bit asnums */
|
|
|
|
typedef uint16_t bgp_size_t;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
enum bgp_af_index {
|
|
|
|
BGP_AF_START,
|
|
|
|
BGP_AF_IPV4_UNICAST = BGP_AF_START,
|
|
|
|
BGP_AF_IPV4_MULTICAST,
|
|
|
|
BGP_AF_IPV4_VPN,
|
|
|
|
BGP_AF_IPV6_UNICAST,
|
|
|
|
BGP_AF_IPV6_MULTICAST,
|
2016-06-11 20:36:42 +02:00
|
|
|
BGP_AF_IPV6_VPN,
|
2016-01-12 19:42:02 +01:00
|
|
|
BGP_AF_IPV4_ENCAP,
|
|
|
|
BGP_AF_IPV6_ENCAP,
|
2017-01-20 17:13:24 +01:00
|
|
|
BGP_AF_L2VPN_EVPN,
|
2017-03-09 15:54:20 +01:00
|
|
|
BGP_AF_IPV4_LBL_UNICAST,
|
|
|
|
BGP_AF_IPV6_LBL_UNICAST,
|
2017-01-23 03:45:30 +01:00
|
|
|
BGP_AF_IPV4_FLOWSPEC,
|
|
|
|
BGP_AF_IPV6_FLOWSPEC,
|
2015-05-20 03:03:47 +02:00
|
|
|
BGP_AF_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
#define AF_FOREACH(af) for ((af) = BGP_AF_START; (af) < BGP_AF_MAX; (af)++)
|
|
|
|
|
2019-02-24 10:30:31 +01:00
|
|
|
#define FOREACH_SAFI(safi) \
|
|
|
|
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
|
2015-05-20 03:03:47 +02:00
|
|
|
|
2018-09-12 21:23:52 +02:00
|
|
|
extern struct frr_pthread *bgp_pth_io;
|
|
|
|
extern struct frr_pthread *bgp_pth_ka;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP master for system wide configurations and variables. */
|
|
|
|
struct bgp_master {
|
|
|
|
/* BGP instance list. */
|
|
|
|
struct list *bgp;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-10-13 22:00:55 +02:00
|
|
|
/* BGP thread master. */
|
|
|
|
struct thread_master *master;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
[bgpd] TCP-MD5: password vty configuration and initial Linux support
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* bgp_packet.c: (bgp_open_receive) fix warning in a zlog call
* bgp_vty.c: (bgp_vty_return) add return code
* bgpd.c: (bgp_master_init) setup the socket list.
* bgp_network.c: Remove the dual IPv4/6 socket thing for now, which
was implemented by Michael, until such time as its clear its
required for Linux (see sockopt comments). IPv6 support, including
IPv4 sessions on AF_INET6 sockets, therefore is broken, and the
'-l 0.0.0.0' arguments would need to be given to bgpd to make
things work here.
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Tomohiko Kusuda <kusuda@inetcore.com>
Leigh Brown <leigh@solinno.co.uk>
* bgp_network.c: (bgp_md5_set_one) shim between libzebra tcp-md5
sockopt and bgpd.
(bgp_md5_set_socket) Helper for bgp_connect
(bgp_md5_set) setup TCP-MD5SIG for the given peer.
(bgp_connect) call out to bgp_md5_set_socket for the outgoing
connect socket.
(bgp_socket) save references to the listen sockets, needed if
TCP-MD5SIG is applied later or changed.
* bgp_vty.c: (*neighbor_password_cmd) New 'neighbor ... password'
commands.
* bgpd.c: (peer_{new,delete) manage TCP-MD5 password
(peer_group2peer_config_copy) inherit TCP-MD5 password
(peer_password_{un,}set) orchestrate the whole add/remove of TCP-MD5
passwords: applying checks, stopping peers, and trying to return
errors to UI, etc.
(bgp_config_write_peer) save password.
Fix missing newline in writeout of neighbor ... port.
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* sockunion.c: ifdef out various places that converted
v4mapped sockets to pure v4. Doesn't seem necessary at all,
presumably a workaround for now historical inet_ntop bugs (?)
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
* sockopt.{c,h}: (sockopt_tcp_signature) Add TCP-MD5SIG support.
2008-07-21 23:02:49 +02:00
|
|
|
/* Listening sockets */
|
|
|
|
struct list *listen_sockets;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2007-11-01 15:29:11 +01:00
|
|
|
/* BGP port number. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint16_t port;
|
2007-11-01 15:29:11 +01:00
|
|
|
|
2021-01-03 05:56:48 +01:00
|
|
|
/* Listener addresses */
|
|
|
|
struct list *addresses;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-10-12 15:49:15 +02:00
|
|
|
/* The Mac table */
|
|
|
|
struct hash *self_mac_hash;
|
|
|
|
|
2015-05-20 02:40:42 +02:00
|
|
|
/* BGP start time. */
|
2002-12-13 21:15:29 +01:00
|
|
|
time_t start_time;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Various BGP global configuration. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t options;
|
2021-11-08 09:48:24 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
#define BGP_OPT_NO_FIB (1 << 0)
|
2019-06-03 21:06:16 +02:00
|
|
|
#define BGP_OPT_NO_LISTEN (1 << 1)
|
|
|
|
#define BGP_OPT_NO_ZEBRA (1 << 2)
|
2015-05-20 03:03:47 +02:00
|
|
|
|
2016-08-24 17:11:00 +02:00
|
|
|
uint64_t updgrp_idspace;
|
|
|
|
uint64_t subgrp_idspace;
|
2016-03-22 18:46:30 +01:00
|
|
|
|
|
|
|
/* timer to dampen route map changes */
|
|
|
|
struct thread *t_rmap_update; /* Handle route map updates */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t rmap_update_timer; /* Route map update timer */
|
2016-03-22 18:46:30 +01:00
|
|
|
#define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
|
2016-12-07 12:25:24 +01:00
|
|
|
|
2017-10-26 01:13:32 +02:00
|
|
|
/* Id space for automatic RD derivation for an EVI/VRF */
|
|
|
|
bitfield_t rd_idspace;
|
|
|
|
|
2018-04-07 20:13:07 +02:00
|
|
|
/* dynamic mpls label allocation pool */
|
|
|
|
struct labelpool labelpool;
|
|
|
|
|
2019-03-06 19:09:25 +01:00
|
|
|
/* BGP-EVPN VRF ID. Defaults to default VRF (if any) */
|
|
|
|
struct bgp* bgp_evpn;
|
|
|
|
|
2019-10-04 20:33:01 +02:00
|
|
|
/* How big should we set the socket buffer size */
|
|
|
|
uint32_t socket_buffer;
|
|
|
|
|
2020-12-03 21:48:59 +01:00
|
|
|
/* Should we do wait for fib install globally? */
|
|
|
|
bool wait_for_fib;
|
|
|
|
|
bgpd: support for Ethernet Segments and Type-1/EAD routes
This is the base patch that brings in support for Type-1 routes.
It includes support for -
- Ethernet Segment (ES) management
- EAD route handling
- MAC-IP (Type-2) routes with a non-zero ESI i.e. Aliasing for
active-active multihoming
- Initial infra for consistency checking. Consistency checking
is a fundamental feature for active-active solutions like MLAG.
We will try to levarage the info in the EAD-ES/EAD-EVI routes to
detect inconsitencies in access config across VTEPs attached to
the same Ethernet Segment.
Functionality Overview -
========================
1. Ethernet segments are created in zebra and associated with
access VLANs. zebra sends that info as ES and ES-EVI objects to BGP.
2. BGP advertises EAD-ES and EAD-EVI routes for the locally attached
ethernet segments.
3. Similarly BGP processes EAD-ES and EAD-EVI routes from peers
and translates them into ES-VTEP objects which are then sent to zebra
as remote ESs.
4. Each ES in zebra is associated with a list of active VTEPs which
is then translated into a L2-NHG (nexthop group). This is the ES
"Alias" entry
5. MAC-IP routes with a non-zero ESI use the alias entry created in
(4.) to forward traffic i.e. a MAC-ECMP is done to these remote-ES
destinations.
EAD route management (route table and key) -
============================================
1. Local EAD-ES routes
a. route-table: per-ES route-table
key: {RD=ES-RD, ESI, ET=0xffffffff, VTEP-IP)
b. route-table: per-VNI route-table
Not added
c. route-table: global route-table
key: {RD=ES-RD, ESI, ET=0xffffffff)
2. Remote EAD-ES routes
a. route-table: per-ES route-table
Not added
b. route-table: per-VNI route-table
key: {RD=ES-RD, ESI, ET=0xffffffff, VTEP-IP)
c. route-table: global route-table
key: {RD=ES-RD, ESI, ET=0xffffffff)
3. Local EAD-EVI routes
a. route-table: per-ES route-table
Not added
b. route-table: per-VNI route-table
key: {RD=0, ESI, ET=0, VTEP-IP)
c. route-table: global route-table
key: {RD=L2-VNI-RD, ESI, ET=0)
4. Remote EAD-EVI routes
a. route-table: per-ES route-table
Not added
b. route-table: per-VNI route-table
key: {RD=0, ESI, ET=0, VTEP-IP)
c. route-table: global route-table
key: {RD=L2-VNI-RD, ESI, ET=0)
Please refer to bgp_evpn_mh.h for info on how the data-structures are
organized.
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-27 22:43:50 +01:00
|
|
|
/* EVPN multihoming */
|
|
|
|
struct bgp_evpn_mh_info *mh_info;
|
|
|
|
|
2020-08-05 21:08:17 +02:00
|
|
|
/* global update-delay timer values */
|
|
|
|
uint16_t v_update_delay;
|
|
|
|
uint16_t v_establish_wait;
|
|
|
|
|
2020-09-19 23:22:17 +02:00
|
|
|
uint32_t flags;
|
|
|
|
#define BM_FLAG_GRACEFUL_SHUTDOWN (1 << 0)
|
2020-12-14 19:28:44 +01:00
|
|
|
#define BM_FLAG_SEND_EXTRA_DATA_TO_ZEBRA (1 << 1)
|
2020-12-05 21:34:59 +01:00
|
|
|
|
2018-05-10 14:47:11 +02:00
|
|
|
bool terminating; /* global flag that sigint terminate seen */
|
2022-05-05 20:16:27 +02:00
|
|
|
|
|
|
|
/* DSCP value for TCP sessions */
|
|
|
|
uint8_t tcp_dscp;
|
|
|
|
|
2023-01-19 17:43:12 +01:00
|
|
|
#define BM_DEFAULT_Q_LIMIT 10000
|
bgpd,doc: limit InQ buf to allow for back pressure
Add a default limit to the InQ for messages off the bgp peer
socket. Make the limit configurable via cli.
Adding in this limit causes the messages to be retained in the tcp
socket and allow for tcp back pressure and congestion control to kick
in.
Before this change, we allow the InQ to grow indefinitely just taking
messages off the socket and adding them to the fifo queue, never letting
the kernel know we need to slow down. We were seeing under high loads of
messages and large perf-heavy routemaps (regex matching) this queue
would cause a memory spike and BGP would get OOM killed. Modifying this
leaves the messages in the socket and distributes that load where it
should be in the socket buffers on both send/recv while we handle the
mesages.
Also, changes were made to allow the ringbuffer to hold messages and
continue to be filled by the IO pthread while we wait for the Main
pthread to handle the work on the InQ.
Memory spike seen with large numbers of routes flapping and route-maps
with dozens of regex matching:
```
Memory statistics for bgpd:
System allocator statistics:
Total heap allocated: > 2GB
Holding block headers: 516 KiB
Used small blocks: 0 bytes
Used ordinary blocks: 160 MiB
Free small blocks: 3680 bytes
Free ordinary blocks: > 2GB
Ordinary blocks: 121244
Small blocks: 83
Holding blocks: 1
```
With most of it being held by the inQ (seen from the stream datastructure info here):
```
Type : Current# Size Total Max# MaxBytes
...
...
Stream : 115543 variable 26963208 15970740 3571708768
```
With this change that memory is capped and load is left in the sockets:
RECV Side:
```
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
ESTAB 265350 0 [fe80::4080:30ff:feb0:cee3]%veth1:36950 [fe80::4c14:9cff:fe1d:5bfd]:179 users:(("bgpd",pid=1393334,fd=26))
skmem:(r403688,rb425984,t0,tb425984,f1816,w0,o0,bl0,d61)
```
SEND Side:
```
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
ESTAB 0 1275012 [fe80::4c14:9cff:fe1d:5bfd]%veth1:179 [fe80::4080:30ff:feb0:cee3]:36950 users:(("bgpd",pid=1393443,fd=27))
skmem:(r0,rb131072,t0,tb1453568,f1916,w1300612,o0,bl0,d0)
```
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-10-21 18:45:50 +02:00
|
|
|
uint32_t inq_limit;
|
2023-01-19 17:43:12 +01:00
|
|
|
uint32_t outq_limit;
|
bgpd,doc: limit InQ buf to allow for back pressure
Add a default limit to the InQ for messages off the bgp peer
socket. Make the limit configurable via cli.
Adding in this limit causes the messages to be retained in the tcp
socket and allow for tcp back pressure and congestion control to kick
in.
Before this change, we allow the InQ to grow indefinitely just taking
messages off the socket and adding them to the fifo queue, never letting
the kernel know we need to slow down. We were seeing under high loads of
messages and large perf-heavy routemaps (regex matching) this queue
would cause a memory spike and BGP would get OOM killed. Modifying this
leaves the messages in the socket and distributes that load where it
should be in the socket buffers on both send/recv while we handle the
mesages.
Also, changes were made to allow the ringbuffer to hold messages and
continue to be filled by the IO pthread while we wait for the Main
pthread to handle the work on the InQ.
Memory spike seen with large numbers of routes flapping and route-maps
with dozens of regex matching:
```
Memory statistics for bgpd:
System allocator statistics:
Total heap allocated: > 2GB
Holding block headers: 516 KiB
Used small blocks: 0 bytes
Used ordinary blocks: 160 MiB
Free small blocks: 3680 bytes
Free ordinary blocks: > 2GB
Ordinary blocks: 121244
Small blocks: 83
Holding blocks: 1
```
With most of it being held by the inQ (seen from the stream datastructure info here):
```
Type : Current# Size Total Max# MaxBytes
...
...
Stream : 115543 variable 26963208 15970740 3571708768
```
With this change that memory is capped and load is left in the sockets:
RECV Side:
```
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
ESTAB 265350 0 [fe80::4080:30ff:feb0:cee3]%veth1:36950 [fe80::4c14:9cff:fe1d:5bfd]:179 users:(("bgpd",pid=1393334,fd=26))
skmem:(r403688,rb425984,t0,tb425984,f1816,w0,o0,bl0,d61)
```
SEND Side:
```
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
ESTAB 0 1275012 [fe80::4c14:9cff:fe1d:5bfd]%veth1:179 [fe80::4080:30ff:feb0:cee3]:36950 users:(("bgpd",pid=1393443,fd=27))
skmem:(r0,rb131072,t0,tb1453568,f1916,w1300612,o0,bl0,d0)
```
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-10-21 18:45:50 +02:00
|
|
|
|
2016-12-07 12:25:24 +01:00
|
|
|
QOBJ_FIELDS;
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
2016-12-07 12:25:24 +01:00
|
|
|
DECLARE_QOBJ_TYPE(bgp_master);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
bgpd: bgpd-table-map.patch
COMMAND:
table-map <route-map-name>
DESCRIPTION:
This feature is used to apply a route-map on route updates from BGP to Zebra.
All the applicable match operations are allowed, such as match on prefix,
next-hop, communities, etc. Set operations for this attach-point are limited
to metric and next-hop only. Any operation of this feature does not affect
BGPs internal RIB.
Supported for ipv4 and ipv6 address families. It works on multi-paths as well,
however, metric setting is based on the best-path only.
IMPLEMENTATION NOTES:
The route-map application at this point is not supposed to modify any of BGP
route's attributes (anything in bgp_info for that matter). To achieve that,
creating a copy of the bgp_attr was inevitable. Implementation tries to keep
the memory footprint low, code comments do point out the rationale behind a
few choices made.
bgp_zebra_announce() was already a big routine, adding this feature would
extend it further. Patch has created a few smaller routines/macros whereever
possible to keep the size of the routine in check without compromising on the
readability of the code/flow inside this routine.
For updating a partially filtered route (with its nexthops), BGP to Zebra
replacement semantic of the next-hops serves the purpose well. However, with
this patch there could be some redundant withdraws each time BGP announces a
route thats (all the nexthops) gets denied by the route-map application.
Handling of this case could be optimized by keeping state with the prefix and
the nexthops in BGP. The patch doesn't optimizing that case, as even with the
redundant withdraws the total number of updates to zebra are still be capped
by the total number of routes in the table.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
2015-05-20 02:40:34 +02:00
|
|
|
/* BGP route-map structure. */
|
|
|
|
struct bgp_rmap {
|
|
|
|
char *name;
|
|
|
|
struct route_map *map;
|
|
|
|
};
|
|
|
|
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
struct bgp_redist {
|
2018-03-27 21:13:34 +02:00
|
|
|
unsigned short instance;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
|
|
|
|
/* BGP redistribute metric configuration. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t redist_metric_flag;
|
|
|
|
uint32_t redist_metric;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
|
|
|
|
/* BGP redistribute route-map. */
|
|
|
|
struct bgp_rmap rmap;
|
|
|
|
};
|
|
|
|
|
2022-04-12 10:34:27 +02:00
|
|
|
enum vpn_policy_direction {
|
2018-03-09 21:52:55 +01:00
|
|
|
BGP_VPN_POLICY_DIR_FROMVPN = 0,
|
|
|
|
BGP_VPN_POLICY_DIR_TOVPN = 1,
|
|
|
|
BGP_VPN_POLICY_DIR_MAX = 2
|
2022-04-12 10:34:27 +02:00
|
|
|
};
|
2018-03-09 21:52:55 +01:00
|
|
|
|
2018-04-07 20:32:52 +02:00
|
|
|
struct vpn_policy {
|
|
|
|
struct bgp *bgp; /* parent */
|
|
|
|
afi_t afi;
|
|
|
|
struct ecommunity *rtlist[BGP_VPN_POLICY_DIR_MAX];
|
|
|
|
struct ecommunity *import_redirect_rtlist;
|
|
|
|
char *rmap_name[BGP_VPN_POLICY_DIR_MAX];
|
|
|
|
struct route_map *rmap[BGP_VPN_POLICY_DIR_MAX];
|
|
|
|
|
|
|
|
/* should be mpls_label_t? */
|
|
|
|
uint32_t tovpn_label; /* may be MPLS_LABEL_NONE */
|
|
|
|
uint32_t tovpn_zebra_vrf_label_last_sent;
|
2022-11-22 11:20:51 +01:00
|
|
|
char *tovpn_rd_pretty;
|
2018-04-07 20:32:52 +02:00
|
|
|
struct prefix_rd tovpn_rd;
|
|
|
|
struct prefix tovpn_nexthop; /* unset => set to 0 */
|
|
|
|
uint32_t flags;
|
|
|
|
#define BGP_VPN_POLICY_TOVPN_LABEL_AUTO (1 << 0)
|
|
|
|
#define BGP_VPN_POLICY_TOVPN_RD_SET (1 << 1)
|
|
|
|
#define BGP_VPN_POLICY_TOVPN_NEXTHOP_SET (1 << 2)
|
2020-12-19 09:45:26 +01:00
|
|
|
#define BGP_VPN_POLICY_TOVPN_SID_AUTO (1 << 3)
|
2018-03-19 20:41:17 +01:00
|
|
|
|
2018-04-17 14:21:03 +02:00
|
|
|
/*
|
|
|
|
* If we are importing another vrf into us keep a list of
|
|
|
|
* vrf names that are being imported into us.
|
|
|
|
*/
|
2018-03-19 20:41:17 +01:00
|
|
|
struct list *import_vrf;
|
2018-04-17 14:21:03 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* if we are being exported to another vrf keep a list of
|
|
|
|
* vrf names that we are being exported to.
|
|
|
|
*/
|
2018-03-19 20:41:17 +01:00
|
|
|
struct list *export_vrf;
|
2020-12-19 09:45:26 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Segment-Routing SRv6 Mode
|
|
|
|
*/
|
|
|
|
uint32_t tovpn_sid_index; /* unset => set to 0 */
|
|
|
|
struct in6_addr *tovpn_sid;
|
2022-09-20 11:41:55 +02:00
|
|
|
struct srv6_locator_chunk *tovpn_sid_locator;
|
2021-08-31 08:31:44 +02:00
|
|
|
uint32_t tovpn_sid_transpose_label;
|
2020-12-19 09:45:26 +01:00
|
|
|
struct in6_addr *tovpn_zebra_vrf_sid_last_sent;
|
2018-04-07 20:32:52 +02:00
|
|
|
};
|
|
|
|
|
2016-02-12 21:18:28 +01:00
|
|
|
/*
|
|
|
|
* Type of 'struct bgp'.
|
|
|
|
* - Default: The default instance
|
|
|
|
* - VRF: A specific (non-default) VRF
|
|
|
|
* - View: An instance used for route exchange
|
|
|
|
* The "default" instance is treated separately to simplify the code. Note
|
|
|
|
* that if deployed in a Multi-VRF environment, it may not exist.
|
|
|
|
*/
|
|
|
|
enum bgp_instance_type {
|
|
|
|
BGP_INSTANCE_TYPE_DEFAULT,
|
|
|
|
BGP_INSTANCE_TYPE_VRF,
|
|
|
|
BGP_INSTANCE_TYPE_VIEW
|
|
|
|
};
|
|
|
|
|
2020-01-31 19:04:00 +01:00
|
|
|
#define BGP_SEND_EOR(bgp, afi, safi) \
|
2020-02-06 15:37:20 +01:00
|
|
|
(!CHECK_FLAG(bgp->flags, BGP_FLAG_GR_DISABLE_EOR) \
|
2020-01-31 19:04:00 +01:00
|
|
|
&& ((bgp->gr_info[afi][safi].t_select_deferral == NULL) \
|
|
|
|
|| (bgp->gr_info[afi][safi].eor_required \
|
|
|
|
== bgp->gr_info[afi][safi].eor_received)))
|
2019-10-23 07:32:45 +02:00
|
|
|
|
|
|
|
/* BGP GR Global ds */
|
|
|
|
|
2019-11-25 16:18:15 +01:00
|
|
|
#define BGP_GLOBAL_GR_MODE 4
|
|
|
|
#define BGP_GLOBAL_GR_EVENT_CMD 4
|
2019-10-23 07:32:45 +02:00
|
|
|
|
|
|
|
/* Graceful restart selection deferral timer info */
|
|
|
|
struct graceful_restart_info {
|
|
|
|
/* Count of EOR message expected */
|
|
|
|
uint32_t eor_required;
|
|
|
|
/* Count of EOR received */
|
|
|
|
uint32_t eor_received;
|
|
|
|
/* Deferral Timer */
|
|
|
|
struct thread *t_select_deferral;
|
2020-10-30 18:34:30 +01:00
|
|
|
/* Routes Deferred */
|
|
|
|
uint32_t gr_deferred;
|
2019-10-23 07:32:45 +02:00
|
|
|
/* Best route select */
|
|
|
|
struct thread *t_route_select;
|
2019-10-25 17:42:39 +02:00
|
|
|
/* AFI, SAFI enabled */
|
|
|
|
bool af_enabled[AFI_MAX][SAFI_MAX];
|
|
|
|
/* Route update completed */
|
|
|
|
bool route_sync[AFI_MAX][SAFI_MAX];
|
2019-10-23 07:32:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum global_mode {
|
|
|
|
GLOBAL_HELPER = 0, /* This is the default mode */
|
|
|
|
GLOBAL_GR,
|
|
|
|
GLOBAL_DISABLE,
|
|
|
|
GLOBAL_INVALID
|
|
|
|
};
|
|
|
|
|
|
|
|
enum global_gr_command {
|
|
|
|
GLOBAL_GR_CMD = 0,
|
|
|
|
NO_GLOBAL_GR_CMD,
|
|
|
|
GLOBAL_DISABLE_CMD,
|
|
|
|
NO_GLOBAL_DISABLE_CMD
|
|
|
|
};
|
|
|
|
|
|
|
|
#define BGP_GR_SUCCESS 0
|
|
|
|
#define BGP_GR_FAILURE 1
|
|
|
|
|
2020-03-24 22:38:37 +01:00
|
|
|
/* Handling of BGP link bandwidth (LB) on receiver - whether and how to
|
|
|
|
* do weighted ECMP. Note: This applies after multipath computation.
|
|
|
|
*/
|
|
|
|
enum bgp_link_bw_handling {
|
|
|
|
/* Do ECMP if some paths don't have LB - default */
|
|
|
|
BGP_LINK_BW_ECMP,
|
|
|
|
/* Completely ignore LB, just do regular ECMP */
|
|
|
|
BGP_LINK_BW_IGNORE_BW,
|
|
|
|
/* Skip paths without LB, do wECMP on others */
|
|
|
|
BGP_LINK_BW_SKIP_MISSING,
|
|
|
|
/* Do wECMP with default weight for paths not having LB */
|
|
|
|
BGP_LINK_BW_DEFWT_4_MISSING
|
|
|
|
};
|
|
|
|
|
2020-05-09 04:24:56 +02:00
|
|
|
RB_HEAD(bgp_es_vrf_rb_head, bgp_evpn_es_vrf);
|
|
|
|
RB_PROTOTYPE(bgp_es_vrf_rb_head, bgp_evpn_es_vrf, rb_node, bgp_es_vrf_rb_cmp);
|
|
|
|
|
2020-09-28 17:35:35 +02:00
|
|
|
struct bgp_snmp_stats {
|
|
|
|
/* SNMP variables for mplsL3Vpn*/
|
|
|
|
time_t creation_time;
|
|
|
|
time_t modify_time;
|
|
|
|
bool active;
|
2020-10-02 13:45:08 +02:00
|
|
|
uint32_t routes_added;
|
|
|
|
uint32_t routes_deleted;
|
2020-09-28 17:35:35 +02:00
|
|
|
};
|
|
|
|
|
2020-12-19 09:45:26 +01:00
|
|
|
struct bgp_srv6_function {
|
|
|
|
struct in6_addr sid;
|
|
|
|
char locator_name[SRV6_LOCNAME_SIZE];
|
|
|
|
};
|
|
|
|
|
2022-11-18 16:56:09 +01:00
|
|
|
struct as_confed {
|
|
|
|
as_t as;
|
|
|
|
char *as_pretty;
|
|
|
|
};
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP instance structure. */
|
|
|
|
struct bgp {
|
|
|
|
/* AS number of this BGP instance. */
|
|
|
|
as_t as;
|
2022-11-15 16:42:40 +01:00
|
|
|
char *as_pretty;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Name of this BGP instance. */
|
|
|
|
char *name;
|
2018-03-28 19:11:56 +02:00
|
|
|
char *name_pretty; /* printable "VRF|VIEW name|default" */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-02-12 21:18:28 +01:00
|
|
|
/* Type of instance and VRF id. */
|
|
|
|
enum bgp_instance_type inst_type;
|
2016-02-02 13:36:20 +01:00
|
|
|
vrf_id_t vrf_id;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-05-21 17:51:03 +02:00
|
|
|
/* Reference count to allow peer_delete to finish after bgp_delete */
|
|
|
|
int lock;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Self peer. */
|
|
|
|
struct peer *peer_self;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP peer. */
|
|
|
|
struct list *peer;
|
2015-10-23 19:34:50 +02:00
|
|
|
struct hash *peerhash;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP peer group. */
|
|
|
|
struct list *group;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/* The maximum number of BGP dynamic neighbors that can be created */
|
|
|
|
int dynamic_neighbors_limit;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/* The current number of BGP dynamic neighbors */
|
|
|
|
int dynamic_neighbors_count;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
struct hash *update_groups[BGP_AF_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/*
|
|
|
|
* Global statistics for update groups.
|
|
|
|
*/
|
|
|
|
struct {
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t join_events;
|
|
|
|
uint32_t prune_events;
|
|
|
|
uint32_t merge_events;
|
|
|
|
uint32_t split_events;
|
|
|
|
uint32_t updgrp_switch_events;
|
|
|
|
uint32_t peer_refreshes_combined;
|
|
|
|
uint32_t adj_count;
|
|
|
|
uint32_t merge_checks_triggered;
|
|
|
|
|
|
|
|
uint32_t updgrps_created;
|
|
|
|
uint32_t updgrps_deleted;
|
|
|
|
uint32_t subgrps_created;
|
|
|
|
uint32_t subgrps_deleted;
|
2015-05-20 03:03:47 +02:00
|
|
|
} update_group_stats;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-09-28 17:35:35 +02:00
|
|
|
struct bgp_snmp_stats *snmp_stats;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP configuration. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint16_t config;
|
2015-11-17 22:57:56 +01:00
|
|
|
#define BGP_CONFIG_CLUSTER_ID (1 << 0)
|
|
|
|
#define BGP_CONFIG_CONFEDERATION (1 << 1)
|
bgpd: add as-notation keyword to 'router bgp' vty command
A new keyword permits changing the BGP as-notation output:
- [no] router bgp <> [vrf BLABLA] [as-notation [<dot|plain|dot+>]]
At the BGP instance creation, the output will inherit the way the
BGP instance is declared. For instance, the 'router bgp 1.1'
command will configure the output in the dot format. However, if
the client wants to choose an alternate output, he will have to
add the extra command: 'router bgp 1.1 as-notation dot+'.
Also, if the user wants to have plain format, even if the BGP
instance is declared in dot format, the keyword can also be used
for that.
The as-notation output is only taken into account at the BGP
instance creation. In the case where VPN instances are used,
a separate instance may be dynamically created. In that case,
the real as-notation format will be taken into acccount at the
first configuration.
Linking the as-notation format with the BGP instance makes sense,
as the operators want to keep consistency of what they configure.
One technical reason why to link the as-notation output with the
BGP instance creation is that the as-path segment lists stored
in the BGP updates use a string representation to handle aspath
operations (by using regexp for instance). Changing on the fly
the output needs to regenerate this string representation to the
correct format. Linking the configuration to the BGP instance
creation avoids refreshing the BGP updates. A similar mechanism
is put in place in junos too.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-11-03 21:17:57 +01:00
|
|
|
#define BGP_CONFIG_ASNOTATION (1 << 2)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* BGP router identifier. */
|
|
|
|
struct in_addr router_id;
|
2004-10-03 20:18:34 +02:00
|
|
|
struct in_addr router_id_static;
|
2016-02-02 13:36:20 +01:00
|
|
|
struct in_addr router_id_zebra;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* BGP route reflector cluster ID. */
|
|
|
|
struct in_addr cluster_id;
|
|
|
|
|
|
|
|
/* BGP confederation information. */
|
|
|
|
as_t confed_id;
|
2022-11-18 16:56:09 +01:00
|
|
|
char *confed_id_pretty;
|
|
|
|
struct as_confed *confed_peers;
|
2002-12-13 21:15:29 +01:00
|
|
|
int confed_peers_cnt;
|
|
|
|
|
2015-05-20 02:40:42 +02:00
|
|
|
struct thread
|
|
|
|
*t_startup; /* start-up timer on only once at the beginning */
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t v_maxmed_onstartup; /* Duration of max-med on start-up */
|
2015-05-20 02:40:42 +02:00
|
|
|
#define BGP_MAXMED_ONSTARTUP_UNCONFIGURED 0 /* 0 means off, its the default */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t maxmed_onstartup_value; /* Max-med value when active on
|
|
|
|
start-up */
|
2015-05-20 02:40:42 +02:00
|
|
|
struct thread
|
|
|
|
*t_maxmed_onstartup; /* non-null when max-med onstartup is on */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t maxmed_onstartup_over; /* Flag to make it effective only once */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-08-12 22:30:24 +02:00
|
|
|
bool v_maxmed_admin; /* true/false if max-med administrative is on/off
|
|
|
|
*/
|
|
|
|
#define BGP_MAXMED_ADMIN_UNCONFIGURED false /* Off by default */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t maxmed_admin_value; /* Max-med value when administrative in on
|
|
|
|
*/
|
2015-05-20 02:40:42 +02:00
|
|
|
#define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t maxmed_active; /* 1/0 if max-med is active or not */
|
|
|
|
uint32_t maxmed_value; /* Max-med value when its active */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
bgpd: bgpd-update-delay.patch
COMMAND:
'update-delay <max-delay in seconds> [<establish-wait in seconds>]'
DESCRIPTION:
This feature is used to enable read-only mode on BGP process restart or when
BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode
would begin as soon as the first peer reaches Established state and a timer
for <max-delay> seconds is started.
During this mode BGP doesn't run any best-path or generate any updates to its
peers. This mode continues until:
1. All the configured peers, except the shutdown peers, have sent explicit EOR
(End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
Established is considered an implicit-EOR.
If the <establish-wait> optional value is given, then BGP will wait for
peers to reach establish from the begining of the update-delay till the
establish-wait period is over, i.e. the minimum set of established peers for
which EOR is expected would be peers established during the establish-wait
window, not necessarily all the configured neighbors.
2. max-delay period is over.
On hitting any of the above two conditions, BGP resumes the decision process
and generates updates to its peers.
Default <max-delay> is 0, i.e. the feature is off by default.
This feature can be useful in reducing CPU/network used as BGP restarts/clears.
Particularly useful in the topologies where BGP learns a prefix from many peers.
Intermediate bestpaths are possible for the same prefix as peers get established
and start receiving updates at different times. This feature should offer a
value-add if the network has a high number of such prefixes.
IMPLEMENTATION OBJECTIVES:
Given this is an optional feature, minimized the code-churn. Used existing
constructs wherever possible (existing queue-plug/unplug were used to achieve
delay and resume of best-paths/update-generation). As a result, no new
data-structure(s) had to be defined and allocated. When the feature is disabled,
the new node is not exercised for the most part.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-20 02:40:33 +02:00
|
|
|
/* BGP update delay on startup */
|
|
|
|
struct thread *t_update_delay;
|
|
|
|
struct thread *t_establish_wait;
|
2022-11-08 14:10:49 +01:00
|
|
|
struct thread *t_revalidate[AFI_MAX][SAFI_MAX];
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t update_delay_over;
|
|
|
|
uint8_t main_zebra_update_hold;
|
|
|
|
uint8_t main_peers_update_hold;
|
|
|
|
uint16_t v_update_delay;
|
|
|
|
uint16_t v_establish_wait;
|
bgpd: bgpd-update-delay.patch
COMMAND:
'update-delay <max-delay in seconds> [<establish-wait in seconds>]'
DESCRIPTION:
This feature is used to enable read-only mode on BGP process restart or when
BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode
would begin as soon as the first peer reaches Established state and a timer
for <max-delay> seconds is started.
During this mode BGP doesn't run any best-path or generate any updates to its
peers. This mode continues until:
1. All the configured peers, except the shutdown peers, have sent explicit EOR
(End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
Established is considered an implicit-EOR.
If the <establish-wait> optional value is given, then BGP will wait for
peers to reach establish from the begining of the update-delay till the
establish-wait period is over, i.e. the minimum set of established peers for
which EOR is expected would be peers established during the establish-wait
window, not necessarily all the configured neighbors.
2. max-delay period is over.
On hitting any of the above two conditions, BGP resumes the decision process
and generates updates to its peers.
Default <max-delay> is 0, i.e. the feature is off by default.
This feature can be useful in reducing CPU/network used as BGP restarts/clears.
Particularly useful in the topologies where BGP learns a prefix from many peers.
Intermediate bestpaths are possible for the same prefix as peers get established
and start receiving updates at different times. This feature should offer a
value-add if the network has a high number of such prefixes.
IMPLEMENTATION OBJECTIVES:
Given this is an optional feature, minimized the code-churn. Used existing
constructs wherever possible (existing queue-plug/unplug were used to achieve
delay and resume of best-paths/update-generation). As a result, no new
data-structure(s) had to be defined and allocated. When the feature is disabled,
the new node is not exercised for the most part.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-20 02:40:33 +02:00
|
|
|
char update_delay_begin_time[64];
|
|
|
|
char update_delay_end_time[64];
|
2015-05-20 02:40:42 +02:00
|
|
|
char update_delay_zebra_resume_time[64];
|
|
|
|
char update_delay_peers_resume_time[64];
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t established;
|
|
|
|
uint32_t restarted_peers;
|
|
|
|
uint32_t implicit_eors;
|
|
|
|
uint32_t explicit_eors;
|
bgpd: bgpd-update-delay.patch
COMMAND:
'update-delay <max-delay in seconds> [<establish-wait in seconds>]'
DESCRIPTION:
This feature is used to enable read-only mode on BGP process restart or when
BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode
would begin as soon as the first peer reaches Established state and a timer
for <max-delay> seconds is started.
During this mode BGP doesn't run any best-path or generate any updates to its
peers. This mode continues until:
1. All the configured peers, except the shutdown peers, have sent explicit EOR
(End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
Established is considered an implicit-EOR.
If the <establish-wait> optional value is given, then BGP will wait for
peers to reach establish from the begining of the update-delay till the
establish-wait period is over, i.e. the minimum set of established peers for
which EOR is expected would be peers established during the establish-wait
window, not necessarily all the configured neighbors.
2. max-delay period is over.
On hitting any of the above two conditions, BGP resumes the decision process
and generates updates to its peers.
Default <max-delay> is 0, i.e. the feature is off by default.
This feature can be useful in reducing CPU/network used as BGP restarts/clears.
Particularly useful in the topologies where BGP learns a prefix from many peers.
Intermediate bestpaths are possible for the same prefix as peers get established
and start receiving updates at different times. This feature should offer a
value-add if the network has a high number of such prefixes.
IMPLEMENTATION OBJECTIVES:
Given this is an optional feature, minimized the code-churn. Used existing
constructs wherever possible (existing queue-plug/unplug were used to achieve
delay and resume of best-paths/update-generation). As a result, no new
data-structure(s) had to be defined and allocated. When the feature is disabled,
the new node is not exercised for the most part.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-20 02:40:33 +02:00
|
|
|
#define BGP_UPDATE_DELAY_DEF 0
|
|
|
|
#define BGP_UPDATE_DELAY_MIN 0
|
|
|
|
#define BGP_UPDATE_DELAY_MAX 3600
|
|
|
|
|
2020-03-24 21:57:44 +01:00
|
|
|
/* Reference bandwidth for BGP link-bandwidth. Used when
|
|
|
|
* the LB value has to be computed based on some other
|
|
|
|
* factor (e.g., number of multipaths for the prefix)
|
|
|
|
* Value is in Mbps
|
|
|
|
*/
|
|
|
|
uint32_t lb_ref_bw;
|
|
|
|
#define BGP_LINK_BW_REF_BW 1
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP flags. */
|
2022-05-06 21:10:56 +02:00
|
|
|
uint64_t flags;
|
2022-10-12 20:06:47 +02:00
|
|
|
#define BGP_FLAG_ALWAYS_COMPARE_MED (1ULL << 0)
|
|
|
|
#define BGP_FLAG_DETERMINISTIC_MED (1ULL << 1)
|
|
|
|
#define BGP_FLAG_MED_MISSING_AS_WORST (1ULL << 2)
|
|
|
|
#define BGP_FLAG_MED_CONFED (1ULL << 3)
|
|
|
|
#define BGP_FLAG_NO_CLIENT_TO_CLIENT (1ULL << 4)
|
|
|
|
#define BGP_FLAG_COMPARE_ROUTER_ID (1ULL << 5)
|
|
|
|
#define BGP_FLAG_ASPATH_IGNORE (1ULL << 6)
|
|
|
|
#define BGP_FLAG_IMPORT_CHECK (1ULL << 7)
|
|
|
|
#define BGP_FLAG_NO_FAST_EXT_FAILOVER (1ULL << 8)
|
|
|
|
#define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1ULL << 9)
|
2019-10-23 07:32:45 +02:00
|
|
|
|
|
|
|
/* This flag is set when we have full BGP Graceful-Restart mode enable */
|
2022-10-12 20:06:47 +02:00
|
|
|
#define BGP_FLAG_GRACEFUL_RESTART (1ULL << 10)
|
|
|
|
|
|
|
|
#define BGP_FLAG_ASPATH_CONFED (1ULL << 11)
|
|
|
|
#define BGP_FLAG_ASPATH_MULTIPATH_RELAX (1ULL << 12)
|
|
|
|
#define BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY (1ULL << 13)
|
|
|
|
#define BGP_FLAG_DISABLE_NH_CONNECTED_CHK (1ULL << 14)
|
|
|
|
#define BGP_FLAG_MULTIPATH_RELAX_AS_SET (1ULL << 15)
|
|
|
|
#define BGP_FLAG_FORCE_STATIC_PROCESS (1ULL << 16)
|
|
|
|
#define BGP_FLAG_SHOW_HOSTNAME (1ULL << 17)
|
|
|
|
#define BGP_FLAG_GR_PRESERVE_FWD (1ULL << 18)
|
|
|
|
#define BGP_FLAG_GRACEFUL_SHUTDOWN (1ULL << 19)
|
|
|
|
#define BGP_FLAG_DELETE_IN_PROGRESS (1ULL << 20)
|
|
|
|
#define BGP_FLAG_SELECT_DEFER_DISABLE (1ULL << 21)
|
|
|
|
#define BGP_FLAG_GR_DISABLE_EOR (1ULL << 22)
|
|
|
|
#define BGP_FLAG_EBGP_REQUIRES_POLICY (1ULL << 23)
|
|
|
|
#define BGP_FLAG_SHOW_NEXTHOP_HOSTNAME (1ULL << 24)
|
2019-10-23 07:32:45 +02:00
|
|
|
|
2020-08-13 17:52:49 +02:00
|
|
|
/* This flag is set if the instance is in administrative shutdown */
|
2022-10-12 20:06:47 +02:00
|
|
|
#define BGP_FLAG_SHUTDOWN (1ULL << 25)
|
|
|
|
#define BGP_FLAG_SUPPRESS_FIB_PENDING (1ULL << 26)
|
|
|
|
#define BGP_FLAG_SUPPRESS_DUPLICATES (1ULL << 27)
|
|
|
|
#define BGP_FLAG_PEERTYPE_MULTIPATH_RELAX (1ULL << 29)
|
2022-05-04 20:52:01 +02:00
|
|
|
/* Indicate Graceful Restart support for BGP NOTIFICATION messages */
|
2022-10-12 20:06:47 +02:00
|
|
|
#define BGP_FLAG_GRACEFUL_NOTIFICATION (1ULL << 30)
|
2022-05-06 09:21:15 +02:00
|
|
|
/* Send Hard Reset CEASE Notification for 'Administrative Reset' */
|
2022-10-12 20:06:47 +02:00
|
|
|
#define BGP_FLAG_HARD_ADMIN_RESET (1ULL << 31)
|
|
|
|
/* Evaluate the AIGP attribute during the best path selection process */
|
|
|
|
#define BGP_FLAG_COMPARE_AIGP (1ULL << 32)
|
2021-04-03 07:22:17 +02:00
|
|
|
|
|
|
|
/* BGP default address-families.
|
|
|
|
* New peers inherit enabled afi/safis from bgp instance.
|
|
|
|
*/
|
|
|
|
uint16_t default_af[AFI_MAX][SAFI_MAX];
|
2020-08-13 17:52:49 +02:00
|
|
|
|
2019-11-25 16:18:15 +01:00
|
|
|
enum global_mode GLOBAL_GR_FSM[BGP_GLOBAL_GR_MODE]
|
2020-01-31 19:04:00 +01:00
|
|
|
[BGP_GLOBAL_GR_EVENT_CMD];
|
2019-10-23 07:32:45 +02:00
|
|
|
enum global_mode global_gr_present_state;
|
|
|
|
|
2019-10-25 17:42:39 +02:00
|
|
|
/* This variable stores the current Graceful Restart state of Zebra
|
|
|
|
* - ZEBRA_GR_ENABLE / ZEBRA_GR_DISABLE
|
|
|
|
*/
|
|
|
|
enum zebra_gr_mode present_zebra_gr_state;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP Per AF flags */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint16_t af_flags[AFI_MAX][SAFI_MAX];
|
2018-03-26 10:55:28 +02:00
|
|
|
#define BGP_CONFIG_DAMPENING (1 << 0)
|
2018-02-27 11:19:57 +01:00
|
|
|
/* l2vpn evpn flags - 1 << 0 is used for DAMPENNG */
|
2021-01-05 03:31:11 +01:00
|
|
|
#define BGP_L2VPN_EVPN_ADV_IPV4_UNICAST (1 << 1)
|
|
|
|
#define BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP (1 << 2)
|
|
|
|
#define BGP_L2VPN_EVPN_ADV_IPV6_UNICAST (1 << 3)
|
|
|
|
#define BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP (1 << 4)
|
|
|
|
#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 (1 << 5)
|
|
|
|
#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 (1 << 6)
|
2018-03-26 10:55:28 +02:00
|
|
|
/* import/export between address families */
|
2021-01-05 03:31:11 +01:00
|
|
|
#define BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT (1 << 7)
|
|
|
|
#define BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT (1 << 8)
|
2018-03-26 10:55:28 +02:00
|
|
|
/* vrf-route leaking flags */
|
2021-01-05 03:31:11 +01:00
|
|
|
#define BGP_CONFIG_VRF_TO_VRF_IMPORT (1 << 9)
|
|
|
|
#define BGP_CONFIG_VRF_TO_VRF_EXPORT (1 << 10)
|
2022-07-01 14:50:40 +02:00
|
|
|
/* vpnvx retain flag */
|
|
|
|
#define BGP_VPNVX_RETAIN_ROUTE_TARGET_ALL (1 << 11)
|
2018-02-20 09:46:22 +01:00
|
|
|
|
bgpd: Incorrect number of peers count in "show bgp ipv6 summary output
The "show bgp ipv6 summary" output displays incorrect number of peers count.
sonic# show bgp ipv6 summary
IPv6 Unicast Summary:
BGP router identifier 10.1.0.1, local AS number 65100 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 5, using 103 KiB of memory
Peer groups 1, using 64 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2003::1 4 65099 0 0 0 0 0 never Active
2088::1 4 65100 0 0 0 0 0 never Active
3021::2 4 65100 0 0 0 0 0 never Active
Total number of neighbors 3
sonic#
In the above output, the peers count displays as 5 but the actual peer count is 3, i.e.. 3 neighbors are activated in ipv6 unicast address family.
Displayed peer count (5) is the number of the neighbors activated in a BGP instance.
Fix : Now the peers count displays the number of neighbors activated per afi/safi.
After Fix:
sonic# show bgp ipv6 summary
IPv6 Unicast Summary:
BGP router identifier 10.1.0.1, local AS number 65100 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 3, using 62 KiB of memory
Peer groups 1, using 64 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2003::1 4 65099 0 0 0 0 0 never Active
2088::1 4 65100 0 0 0 0 0 never Active
3021::2 4 65100 0 0 0 0 0 never Active
Total number of neighbors 3
sonic#
Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
2019-03-07 08:47:25 +01:00
|
|
|
/* BGP per AF peer count */
|
|
|
|
uint32_t af_peer_count[AFI_MAX][SAFI_MAX];
|
|
|
|
|
2020-04-09 20:56:11 +02:00
|
|
|
/* Tree for next-hop lookup cache. */
|
|
|
|
struct bgp_nexthop_cache_head nexthop_cache_table[AFI_MAX];
|
2016-02-02 13:36:20 +01:00
|
|
|
|
2020-04-09 20:56:11 +02:00
|
|
|
/* Tree for import-check */
|
|
|
|
struct bgp_nexthop_cache_head import_check_table[AFI_MAX];
|
2016-02-02 13:36:20 +01:00
|
|
|
|
|
|
|
struct bgp_table *connected_table[AFI_MAX];
|
|
|
|
|
|
|
|
struct hash *address_hash;
|
|
|
|
|
2017-08-17 08:19:58 +02:00
|
|
|
/* DB for all local tunnel-ips - used mainly for martian checks
|
|
|
|
Currently it only has all VxLan tunnel IPs*/
|
|
|
|
struct hash *tip_hash;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Static route configuration. */
|
|
|
|
struct bgp_table *route[AFI_MAX][SAFI_MAX];
|
|
|
|
|
|
|
|
/* Aggregate address configuration. */
|
|
|
|
struct bgp_table *aggregate[AFI_MAX][SAFI_MAX];
|
|
|
|
|
|
|
|
/* BGP routing information base. */
|
|
|
|
struct bgp_table *rib[AFI_MAX][SAFI_MAX];
|
|
|
|
|
bgpd: bgpd-table-map.patch
COMMAND:
table-map <route-map-name>
DESCRIPTION:
This feature is used to apply a route-map on route updates from BGP to Zebra.
All the applicable match operations are allowed, such as match on prefix,
next-hop, communities, etc. Set operations for this attach-point are limited
to metric and next-hop only. Any operation of this feature does not affect
BGPs internal RIB.
Supported for ipv4 and ipv6 address families. It works on multi-paths as well,
however, metric setting is based on the best-path only.
IMPLEMENTATION NOTES:
The route-map application at this point is not supposed to modify any of BGP
route's attributes (anything in bgp_info for that matter). To achieve that,
creating a copy of the bgp_attr was inevitable. Implementation tries to keep
the memory footprint low, code comments do point out the rationale behind a
few choices made.
bgp_zebra_announce() was already a big routine, adding this feature would
extend it further. Patch has created a few smaller routines/macros whereever
possible to keep the size of the routine in check without compromising on the
readability of the code/flow inside this routine.
For updating a partially filtered route (with its nexthops), BGP to Zebra
replacement semantic of the next-hops serves the purpose well. However, with
this patch there could be some redundant withdraws each time BGP announces a
route thats (all the nexthops) gets denied by the route-map application.
Handling of this case could be optimized by keeping state with the prefix and
the nexthops in BGP. The patch doesn't optimizing that case, as even with the
redundant withdraws the total number of updates to zebra are still be capped
by the total number of routes in the table.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
2015-05-20 02:40:34 +02:00
|
|
|
/* BGP table route-map. */
|
|
|
|
struct bgp_rmap table_map[AFI_MAX][SAFI_MAX];
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP redistribute configuration. */
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
struct list *redist[AFI_MAX][ZEBRA_ROUTE_MAX];
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-08-22 20:14:50 +02:00
|
|
|
/* Allocate MPLS labels */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t allocate_mpls_labels[AFI_MAX][SAFI_MAX];
|
2017-08-22 20:14:50 +02:00
|
|
|
|
2018-03-08 17:23:02 +01:00
|
|
|
/* Allocate hash entries to store policy routing information
|
|
|
|
* The hash are used to host pbr rules somewhere.
|
|
|
|
* Actually, pbr will only be used by flowspec
|
|
|
|
* those hash elements will have relationship together as
|
|
|
|
* illustrated in below diagram:
|
|
|
|
*
|
|
|
|
* pbr_action a <----- pbr_match i <--- pbr_match_entry 1..n
|
|
|
|
* <----- pbr_match j <--- pbr_match_entry 1..m
|
2018-11-29 15:12:03 +01:00
|
|
|
* <----- pbr_rule k
|
2018-03-08 17:23:02 +01:00
|
|
|
*
|
|
|
|
* - here in BGP structure, the list of match and actions will
|
|
|
|
* stand for the list of ipset sets, and table_ids in the kernel
|
|
|
|
* - the arrow above between pbr_match and pbr_action indicate
|
|
|
|
* that a backpointer permits match to find the action
|
|
|
|
* - the arrow betwen match_entry and match is a hash list
|
|
|
|
* contained in match, that lists the whole set of entries
|
|
|
|
*/
|
|
|
|
struct hash *pbr_match_hash;
|
2018-11-29 15:12:03 +01:00
|
|
|
struct hash *pbr_rule_hash;
|
2018-03-08 17:23:02 +01:00
|
|
|
struct hash *pbr_action_hash;
|
|
|
|
|
2015-05-20 03:04:20 +02:00
|
|
|
/* timer to re-evaluate neighbor default-originate route-maps */
|
|
|
|
struct thread *t_rmap_def_originate_eval;
|
|
|
|
#define RMAP_DEFAULT_ORIGINATE_EVAL_TIMER 5
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP distance configuration. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t distance_ebgp[AFI_MAX][SAFI_MAX];
|
|
|
|
uint8_t distance_ibgp[AFI_MAX][SAFI_MAX];
|
|
|
|
uint8_t distance_local[AFI_MAX][SAFI_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP default local-preference. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t default_local_pref;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/* BGP default subgroup pkt queue max */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t default_subgroup_pkt_queue_max;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP default timer. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t default_holdtime;
|
|
|
|
uint32_t default_keepalive;
|
2019-08-01 18:50:56 +02:00
|
|
|
uint32_t default_connect_retry;
|
2020-10-20 16:49:58 +02:00
|
|
|
uint32_t default_delayopen;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-08-14 07:32:40 +02:00
|
|
|
/* BGP minimum holdtime. */
|
|
|
|
uint16_t default_min_holdtime;
|
|
|
|
|
2004-05-21 11:31:30 +02:00
|
|
|
/* BGP graceful restart */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t restart_time;
|
|
|
|
uint32_t stalepath_time;
|
2019-10-23 07:32:45 +02:00
|
|
|
uint32_t select_defer_time;
|
|
|
|
struct graceful_restart_info gr_info[AFI_MAX][SAFI_MAX];
|
2019-10-25 17:42:39 +02:00
|
|
|
uint32_t rib_stale_time;
|
|
|
|
|
bgpd: Add Long-lived Graceful Restart capability (restarter)
Restart Router mode.
FRRouting (Restarter):
```
bgp long-lived-graceful-restart stale-time 10
bgp graceful-restart restart-time 1
```
Tested with GoBGP (Helper):
```
long-lived-graceful-restart: advertised and received
Local:
ipv4-unicast, restart time 100000 sec
Remote:
ipv4-unicast, restart time 10 sec, forward flag set
```
Logs:
```
{"Key":"192.168.10.123","Reason":"graceful-restart","State":"BGP_FSM_ESTABLISHED","Topic":"Peer","level":"info","msg":"Peer Down","time":"2021-10-25T17:48:36+03:00"}
{"Key":"192.168.10.123","State":"BGP_FSM_IDLE","Topic":"Peer","level":"warning","msg":"graceful restart timer expired","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"start LLGR restart timer (10 sec) for ipv4-unicast","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"LLGR restart timer (10 sec) for ipv4-unicast expired","time":"2021-10-25T17:48:47+03:00"}
% ./gobgp global rib
Network Next Hop AS_PATH Age Attrs
S*>10.0.2.0/24 192.168.10.123 174 00:12:08 [{Origin: ?} {Med: 0} {Communities: llgr-stale} {Extcomms: [174:1282304808]}]
```
Helper mode will be added with upcoming PRs.
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-25 16:23:02 +02:00
|
|
|
/* BGP Long-lived Graceful Restart */
|
|
|
|
uint32_t llgr_stale_time;
|
|
|
|
|
2019-10-23 19:45:57 +02:00
|
|
|
#define BGP_ROUTE_SELECT_DELAY 1
|
|
|
|
#define BGP_MAX_BEST_ROUTE_SELECT 10000
|
2011-07-21 05:43:22 +02:00
|
|
|
/* Maximum-paths configuration */
|
|
|
|
struct bgp_maxpaths_cfg {
|
2018-03-27 21:13:34 +02:00
|
|
|
uint16_t maxpaths_ebgp;
|
|
|
|
uint16_t maxpaths_ibgp;
|
2022-05-12 14:06:14 +02:00
|
|
|
bool same_clusterlen;
|
2011-07-21 05:43:22 +02:00
|
|
|
} maxpaths[AFI_MAX][SAFI_MAX];
|
bgpd: bgpd-mrai.patch
BGP: Event-driven route announcement taking into account min route advertisement interval
ISSUE
BGP starts the routeadv timer (peer->t_routeadv) to expire in 1 sec
when a peer is established. From then on, the timer expires
periodically based on the configured MRAI value (default: 30sec for
EBGP, 5sec for IBGP). At the expiry, the write thread is triggered
that takes the routes from peer's sync FIFO (adj-rib-out) and sends
UPDATEs. This has a few drawbacks:
(1) Delay in new route announcement: Even when the last UPDATE message
was sent a while back, the next route change will necessarily have
to wait for routeadv expiry
(2) CPU usage: The timer is always armed. If the operator chooses to
configure a lower value of MRAI (zero second is a preferred choice
in many deployments) for better convergence, it leads to high CPU
usage for BGP process, even at the times of no network churn.
PATCH
Make the route advertisement event-driven - When routes are added to
peer's sync FIFO, check if the routeadv timer needs to be adjusted (or
started). Conversely, do not arm the routeadv timer unconditionally.
The patch also addresses route announcements during read-only mode
(update-delay). During read-only mode operation, the routeadv timer
is not started. When BGP comes out of read-only mode and all the
routes are processed, the timer is started for all peers with zero
expiry, so that the UPDATEs can be sent all at once. This leads to
(near-)optimal UPDATE packing.
Finally, the patch makes the "max # packets to write to peer socket at
a time" configurable. Currently it is hard-coded to 10. The command is
at the top router-bgp mode and is called "write-quanta <number>". It
is a useful convergence parameter to tweak.
Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-20 02:40:37 +02:00
|
|
|
|
2017-06-05 22:14:47 +02:00
|
|
|
_Atomic uint32_t wpkt_quanta; // max # packets to write per i/o cycle
|
|
|
|
_Atomic uint32_t rpkt_quanta; // max # packets to read per i/o cycle
|
|
|
|
|
2017-12-14 22:43:31 +01:00
|
|
|
/* Automatic coalesce adjust on/off */
|
|
|
|
bool heuristic_coalesce;
|
2017-12-06 23:35:21 +01:00
|
|
|
/* Actual coalesce time */
|
|
|
|
uint32_t coalesce_time;
|
BGP: support for addpath TX
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com
Ticket: CM-8014
This implements addpath TX with the first feature to use it
being "neighbor x.x.x.x addpath-tx-all-paths".
One change to show output is 'show ip bgp x.x.x.x'. If no addpath-tx
features are configured for any peers then everything looks the same
as it is today in that "Advertised to" is at the top and refers to
which peers the bestpath was advertise to.
root@superm-redxp-05[quagga-stash5]# vtysh -c 'show ip bgp 1.1.1.1'
BGP routing table entry for 1.1.1.1/32
Paths: (6 available, best #6, table Default-IP-Routing-Table)
Advertised to non peer-group peers:
r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8)
Local, (Received from a RR-client)
12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 8
Last update: Fri Oct 30 18:26:44 2015
[snip]
but once you enable an addpath feature we must display "Advertised to" on a path-by-path basis:
superm-redxp-05# show ip bgp 1.1.1.1/32
BGP routing table entry for 1.1.1.1/32
Paths: (6 available, best #6, table Default-IP-Routing-Table)
Local, (Received from a RR-client)
12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 8
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:44 2015
Local, (Received from a RR-client)
34.34.34.34 (metric 20) from r3(10.0.0.3) (10.0.0.3)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 7
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:39 2015
Local, (Received from a RR-client)
56.56.56.56 (metric 20) from r6(10.0.0.6) (10.0.0.6)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 6
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:39 2015
Local, (Received from a RR-client)
56.56.56.56 (metric 20) from r5(10.0.0.5) (10.0.0.5)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 5
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:39 2015
Local, (Received from a RR-client)
34.34.34.34 (metric 20) from r4(10.0.0.4) (10.0.0.4)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 4
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:39 2015
Local, (Received from a RR-client)
12.12.12.12 (metric 20) from r1(10.0.0.1) (10.0.0.1)
Origin IGP, metric 0, localpref 100, valid, internal, best
AddPath ID: RX 0, TX 3
Advertised to: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8)
Last update: Fri Oct 30 18:26:34 2015
superm-redxp-05#
2015-11-05 18:29:43 +01:00
|
|
|
|
2018-01-11 18:50:08 +01:00
|
|
|
/* Auto-shutdown new peers */
|
|
|
|
bool autoshutdown;
|
|
|
|
|
bgpd: Re-use TX Addpath IDs where possible
The motivation for this patch is to address a concerning behavior of
tx-addpath-bestpath-per-AS. Prior to this patch, all paths' TX ID was
pre-determined as the path was received from a peer. However, this meant
that any time the path selected as best from an AS changed, bgpd had no
choice but to withdraw the previous best path, and advertise the new
best-path under a new TX ID. This could cause significant network
disruption, especially for the subset of prefixes coming from only one
AS that were also communicated over a bestpath-per-AS session.
The patch's general approach is best illustrated by
txaddpath_update_ids. After a bestpath run (required for best-per-AS to
know what will and will not be sent as addpaths) ID numbers will be
stripped from paths that no longer need to be sent, and held in a pool.
Then, paths that will be sent as addpaths and do not already have ID
numbers will allocate new ID numbers, pulling first from that pool.
Finally, anything left in the pool will be returned to the allocator.
In order for this to work, ID numbers had to be split by strategy. The
tx-addpath-All strategy would keep every ID number "in use" constantly,
preventing IDs from being transferred to different paths. Rather than
create two variables for ID, this patch create a more generic array that
will easily enable more addpath strategies to be implemented. The
previously described ID manipulations will happen per addpath strategy,
and will only be run for strategies that are enabled on at least one
peer.
Finally, the ID numbers are allocated from an allocator that tracks per
AFI/SAFI/Addpath Strategy which IDs are in use. Though it would be very
improbable, there was the possibility with the free-running counter
approach for rollover to cause two paths on the same prefix to get
assigned the same TX ID. As remote as the possibility is, we prefer to
not leave it to chance.
This ID re-use method is not perfect. In some cases you could still get
withdraw-then-add behaviors where not strictly necessary. In the case of
bestpath-per-AS this requires one AS to advertise a prefix for the first
time, then a second AS withdraws that prefix, all within the space of an
already pending MRAI timer. In those situations a withdraw-then-add is
more forgivable, and fixing it would probably require a much more
significant effort, as IDs would need to be moved to ADVs instead of
paths.
Signed-off-by Mitchell Skiba <mskiba@amazon.com>
2018-05-10 01:10:02 +02:00
|
|
|
struct bgp_addpath_bgp_data tx_addpath;
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
|
2020-03-10 16:50:03 +01:00
|
|
|
#ifdef ENABLE_BGP_VNC
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
struct rfapi_cfg *rfapi_cfg;
|
|
|
|
struct rfapi *rfapi;
|
|
|
|
#endif
|
2016-12-07 12:25:24 +01:00
|
|
|
|
2017-05-15 23:27:51 +02:00
|
|
|
/* EVPN related information */
|
|
|
|
|
|
|
|
/* EVI hash table */
|
|
|
|
struct hash *vnihash;
|
|
|
|
|
bgpd: EVPN route type-5 to type-2 recursive resolution using gateway IP
When EVPN prefix route with a gateway IP overlay index is imported into the IP
vrf at the ingress PE, BGP nexthop of this route is set to the gateway IP.
For this vrf route to be valid, following conditions must be met.
- Gateway IP nexthop of this route should be L3 reachable, i.e., this route
should be resolved in RIB.
- A remote MAC/IP route should be present for the gateway IP address in the
EVI(L2VPN table).
To check for the first condition, gateway IP is registered with nht (nexthop
tracking) to receive the reachability notifications for this IP from zebra RIB.
If the gateway IP is reachable, zebra sends the reachability information (i.e.,
nexthop interface) for the gateway IP.
This nexthop interface should be the SVI interface.
Now, to find out type-2 route corresponding to the gateway IP, we need to fetch
the VNI for the above SVI.
To do this VNI lookup effitiently, define a hashtable of struct bgpevpn with
svi_ifindex as key.
struct hash *vni_svi_hash;
An EVI instance is added to vni_svi_hash if its svi_ifindex is nonzero.
Using this hash, we obtain struct bgpevpn corresponding to the gateway IP.
For gateway IP overlay index recursive lookup, once we find the correct EVI, we
have to lookup its route table for a MAC/IP prefix. As we have to iterate the
entire route table for every lookup, this lookup is expensive. We can optimize
this lookup by adding all the remote IP addresses in a hash table.
Following hash table is defined for this purpose in struct bgpevpn
Struct hash *remote_ip_hash;
When a MAC/IP route is installed in the EVI table, it is also added to
remote_ip_hash.
It is possible to have multiple MAC/IP routes with the same IP address because
of host move scenarios. Thus, for every address addr in remote_ip_hash, we
maintain list of all the MAC/IP routes having addr as their IP address.
Following structure defines an address in remote_ip_hash.
struct evpn_remote_ip {
struct ipaddr addr;
struct list *macip_path_list;
};
A Boolean field is added to struct bgp_nexthop_cache to indicate that the
nexthop is EVPN gateway IP overlay index.
bool is_evpn_gwip_nexthop;
A flag BGP_NEXTHOP_EVPN_INCOMPLETE is added to struct bgp_nexthop_cache.
This flag is set when the gateway IP is L3 reachable but not yet resolved by a
MAC/IP route.
Following table explains the combination of L3 and L2 reachability w.r.t.
BGP_NEXTHOP_VALID and BGP_NEXTHOP_EVPN_INCOMPLETE flags
* | MACIP resolved | MACIP unresolved
*----------------|----------------|------------------
* L3 reachable | VALID = 1 | VALID = 0
* | INCOMPLETE = 0 | INCOMPLETE = 1
* ---------------|----------------|--------------------
* L3 unreachable | VALID = 0 | VALID = 0
* | INCOMPLETE = 0 | INCOMPLETE = 0
Procedure that we use to check if the gateway IP is resolvable by a MAC/IP
route:
- Find the EVI/L2VRF that belongs to the nexthop SVI using vni_svi_hash.
- Check if the gateway IP is present in remote_ip_hash in this EVI.
When the gateway IP is L3 reachable and it is also resolved by a MAC/IP route,
unset BGP_NEXTHOP_EVPN_INCOMPLETE flag and set BGP_NEXTHOP_VALID flag.
Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2021-01-11 12:51:56 +01:00
|
|
|
/*
|
|
|
|
* VNI hash table based on SVI ifindex as its key.
|
|
|
|
* We use SVI ifindex as key to lookup a VNI table for gateway IP
|
|
|
|
* overlay index recursive lookup.
|
|
|
|
* For this purpose, a hashtable is added which optimizes this lookup.
|
|
|
|
*/
|
|
|
|
struct hash *vni_svi_hash;
|
|
|
|
|
2017-06-28 10:51:10 +02:00
|
|
|
/* EVPN enable - advertise gateway macip routes */
|
|
|
|
int advertise_gw_macip;
|
|
|
|
|
2017-05-15 23:27:51 +02:00
|
|
|
/* EVPN enable - advertise local VNIs and their MACs etc. */
|
|
|
|
int advertise_all_vni;
|
|
|
|
|
2019-11-09 19:24:34 +01:00
|
|
|
/* draft-ietf-idr-deprecate-as-set-confed-set
|
|
|
|
* Reject aspaths with AS_SET and/or AS_CONFED_SET.
|
|
|
|
*/
|
|
|
|
bool reject_as_sets;
|
|
|
|
|
2018-11-01 00:53:28 +01:00
|
|
|
struct bgp_evpn_info *evpn_info;
|
|
|
|
|
2017-04-12 11:24:07 +02:00
|
|
|
/* EVPN - use RFC 8365 to auto-derive RT */
|
|
|
|
int advertise_autort_rfc8365;
|
|
|
|
|
2018-10-05 01:20:12 +02:00
|
|
|
/*
|
|
|
|
* Flooding mechanism for BUM packets for VxLAN-EVPN.
|
|
|
|
*/
|
|
|
|
enum vxlan_flood_control vxlan_flood_ctrl;
|
|
|
|
|
2017-05-15 23:27:51 +02:00
|
|
|
/* Hash table of Import RTs to EVIs */
|
|
|
|
struct hash *import_rt_hash;
|
|
|
|
|
2017-10-10 03:12:05 +02:00
|
|
|
/* Hash table of VRF import RTs to VRFs */
|
|
|
|
struct hash *vrf_import_rt_hash;
|
|
|
|
|
2017-10-09 02:46:08 +02:00
|
|
|
/* L3-VNI corresponding to this vrf */
|
|
|
|
vni_t l3vni;
|
|
|
|
|
|
|
|
/* router-mac to be used in mac-ip routes for this vrf */
|
|
|
|
struct ethaddr rmac;
|
|
|
|
|
2017-10-31 00:58:15 +01:00
|
|
|
/* originator ip - to be used as NH for type-5 routes */
|
|
|
|
struct in_addr originator_ip;
|
|
|
|
|
2019-02-27 12:52:34 +01:00
|
|
|
/* SVI associated with the L3-VNI corresponding to this vrf */
|
|
|
|
ifindex_t l3vni_svi_ifindex;
|
|
|
|
|
2020-05-09 04:24:56 +02:00
|
|
|
/* RB tree of ES-VRFs */
|
|
|
|
struct bgp_es_vrf_rb_head es_vrf_rb_tree;
|
|
|
|
|
2020-09-12 19:36:01 +02:00
|
|
|
/* Hash table of EVPN nexthops maintained per-tenant-VRF */
|
|
|
|
struct hash *evpn_nh_table;
|
|
|
|
|
2021-05-12 00:26:29 +02:00
|
|
|
/*
|
|
|
|
* Flag resolve_overlay_index is used for recursive resolution
|
|
|
|
* procedures for EVPN type-5 route's gateway IP overlay index.
|
|
|
|
* When this flag is set, we build remote-ip-hash for
|
|
|
|
* all L2VNIs and resolve overlay index nexthops using this hash.
|
|
|
|
* Overlay index nexthops remain unresolved if this flag is not set.
|
|
|
|
*/
|
|
|
|
bool resolve_overlay_index;
|
|
|
|
|
2017-10-09 02:46:08 +02:00
|
|
|
/* vrf flags */
|
|
|
|
uint32_t vrf_flags;
|
2017-10-26 01:49:18 +02:00
|
|
|
#define BGP_VRF_AUTO (1 << 0)
|
2018-02-20 09:46:22 +01:00
|
|
|
#define BGP_VRF_IMPORT_RT_CFGD (1 << 1)
|
|
|
|
#define BGP_VRF_EXPORT_RT_CFGD (1 << 2)
|
2021-02-25 22:27:07 +01:00
|
|
|
#define BGP_VRF_IMPORT_AUTO_RT_CFGD (1 << 3) /* retain auto when cfgd */
|
|
|
|
#define BGP_VRF_EXPORT_AUTO_RT_CFGD (1 << 4) /* retain auto when cfgd */
|
|
|
|
#define BGP_VRF_RD_CFGD (1 << 5)
|
|
|
|
#define BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY (1 << 6)
|
2022-07-23 11:49:56 +02:00
|
|
|
/* per-VRF toVPN SID */
|
|
|
|
#define BGP_VRF_TOVPN_SID_AUTO (1 << 7)
|
2018-02-27 10:46:26 +01:00
|
|
|
|
2017-10-26 01:49:18 +02:00
|
|
|
/* unique ID for auto derivation of RD for this vrf */
|
|
|
|
uint16_t vrf_rd_id;
|
|
|
|
|
2018-03-27 02:11:39 +02:00
|
|
|
/* Automatically derived RD for this VRF */
|
|
|
|
struct prefix_rd vrf_prd_auto;
|
|
|
|
|
2017-10-26 01:49:18 +02:00
|
|
|
/* RD for this VRF */
|
|
|
|
struct prefix_rd vrf_prd;
|
2022-11-22 11:20:51 +01:00
|
|
|
char *vrf_prd_pretty;
|
2017-10-09 03:34:29 +02:00
|
|
|
|
|
|
|
/* import rt list for the vrf instance */
|
|
|
|
struct list *vrf_import_rtl;
|
|
|
|
|
|
|
|
/* export rt list for the vrf instance */
|
|
|
|
struct list *vrf_export_rtl;
|
2017-10-09 02:46:08 +02:00
|
|
|
|
2017-10-09 05:43:14 +02:00
|
|
|
/* list of corresponding l2vnis (struct bgpevpn) */
|
|
|
|
struct list *l2vnis;
|
|
|
|
|
2018-02-09 10:09:20 +01:00
|
|
|
/* route map for advertise ipv4/ipv6 unicast (type-5 routes) */
|
|
|
|
struct bgp_rmap adv_cmd_rmap[AFI_MAX][SAFI_MAX];
|
|
|
|
|
2018-04-07 20:32:52 +02:00
|
|
|
struct vpn_policy vpn_policy[AFI_MAX];
|
2018-03-09 21:52:55 +01:00
|
|
|
|
2018-04-25 18:29:35 +02:00
|
|
|
struct bgp_pbr_config *bgp_pbr_cfg;
|
|
|
|
|
2018-11-19 13:35:32 +01:00
|
|
|
/* Count of peers in established state */
|
|
|
|
uint32_t established_peers;
|
|
|
|
|
2020-03-24 22:38:37 +01:00
|
|
|
/* Weighted ECMP related config. */
|
|
|
|
enum bgp_link_bw_handling lb_handling;
|
|
|
|
|
2020-10-17 15:43:14 +02:00
|
|
|
/* Process Queue for handling routes */
|
|
|
|
struct work_queue *process_queue;
|
2020-10-23 18:09:12 +02:00
|
|
|
|
2021-08-06 17:17:04 +02:00
|
|
|
bool fast_convergence;
|
|
|
|
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
/* BGP Conditional advertisement */
|
2021-05-14 20:57:06 +02:00
|
|
|
uint32_t condition_check_period;
|
bgpd: conditional advertisement - other match rules support
Sample Configuration with prefix-list and community match rules
---------------------------------------------------------------
R1 ------- R2(DUT) ------- R3
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 20.20.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/32
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.20.3 soft-reconfiguration inbound
neighbor 10.10.20.3 advertise-map ADV-MAP non-exist-map EXIST-MAP
exit-address-family
!
ip prefix-list DEFAULT seq 5 permit 1.1.1.5/32
ip prefix-list DEFAULT seq 10 permit 1.1.1.1/32
ip prefix-list EXIST seq 5 permit 10.10.10.10/32
ip prefix-list DEFAULT-ROUTE seq 5 permit 0.0.0.0/0
ip prefix-list IP1 seq 5 permit 10.139.224.0/20
ip prefix-list T2 seq 5 permit 1.1.1.5/32
!
bgp community-list standard DC-ROUTES seq 5 permit 64952:3008
bgp community-list standard DC-ROUTES seq 10 permit 64671:501
bgp community-list standard DC-ROUTES seq 15 permit 64950:3009
bgp community-list standard DEFAULT-ROUTE seq 5 permit 65013:200
!
route-map ADV-MAP permit 10
match ip address prefix-list IP1
!
route-map ADV-MAP permit 20
match community DC-ROUTES
!
route-map EXIST-MAP permit 10
match community DEFAULT-ROUTE
match ip address prefix-list DEFAULT-ROUTE
!
line vty
!
end
Router2#
Router2# show ip bgp 0.0.0.0
BGP routing table entry for 0.0.0.0/0
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
10.10.10.1 10.10.20.3
1
10.10.10.1 from 10.10.10.1 (10.139.224.1)
Origin IGP, metric 0, valid, external, best (First path received)
Community: 64848:3011 65011:200 65013:200
Last update: Tue Oct 6 02:39:42 2020
Router2#
Sample output with non-exist-map when default route present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 10.10.10.1 0 0 1 i
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 4 routes and 4 total paths
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 0.0.0.0 0 1 i
*> 1.1.1.5/32 0.0.0.0 0 1 i <<<<<<<<< non-exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 not advertised
Total number of prefixes 2
Sample output with non-exist-map when default route not present in table
------------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 3 routes and 3 total paths
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 1 i
*> 1.1.1.5/32 0.0.0.0 0 1 i
*> 10.139.224.0/20 0.0.0.0 0 1 ? <<<<<<<<< non-exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 advertised
Total number of prefixes 3
Router2#
Sample output with exist-map when default route present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 10.10.10.1 0 0 1 i
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 4 routes and 4 total paths
Router2#
Router2#
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 0.0.0.0 0 1 i
*> 1.1.1.1/32 0.0.0.0 0 1 i
*> 1.1.1.5/32 0.0.0.0 0 1 i
*> 10.139.224.0/20 0.0.0.0 0 1 ? <<<<<<<<< exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 advertised
Total number of prefixes 4
Router2#
Sample output with exist-map when default route not present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 3 routes and 3 total paths
Router2#
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.5/32 0.0.0.0 0 1 i <<<<<<<<< exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 not advertised
Total number of prefixes 1
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-10-05 19:40:56 +02:00
|
|
|
uint32_t condition_filter_count;
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
struct thread *t_condition_check;
|
2020-10-17 15:43:14 +02:00
|
|
|
|
2020-12-19 09:45:26 +01:00
|
|
|
/* BGP VPN SRv6 backend */
|
|
|
|
bool srv6_enabled;
|
|
|
|
char srv6_locator_name[SRV6_LOCNAME_SIZE];
|
|
|
|
struct list *srv6_locator_chunks;
|
|
|
|
struct list *srv6_functions;
|
2022-07-23 11:49:56 +02:00
|
|
|
uint32_t tovpn_sid_index; /* unset => set to 0 */
|
|
|
|
struct in6_addr *tovpn_sid;
|
|
|
|
struct srv6_locator_chunk *tovpn_sid_locator;
|
|
|
|
uint32_t tovpn_sid_transpose_label;
|
|
|
|
struct in6_addr *tovpn_zebra_vrf_sid_last_sent;
|
|
|
|
|
2021-11-08 09:48:24 +01:00
|
|
|
/* TCP keepalive parameters for BGP connection */
|
|
|
|
uint16_t tcp_keepalive_idle;
|
|
|
|
uint16_t tcp_keepalive_intvl;
|
|
|
|
uint16_t tcp_keepalive_probes;
|
2020-12-19 09:45:26 +01:00
|
|
|
|
2022-02-14 13:57:45 +01:00
|
|
|
struct timeval ebgprequirespolicywarning;
|
|
|
|
#define FIFTEENMINUTE2USEC (int64_t)15 * 60 * 1000000
|
|
|
|
|
2022-04-25 22:30:36 +02:00
|
|
|
bool allow_martian;
|
|
|
|
|
bgpd: add as-notation keyword to 'router bgp' vty command
A new keyword permits changing the BGP as-notation output:
- [no] router bgp <> [vrf BLABLA] [as-notation [<dot|plain|dot+>]]
At the BGP instance creation, the output will inherit the way the
BGP instance is declared. For instance, the 'router bgp 1.1'
command will configure the output in the dot format. However, if
the client wants to choose an alternate output, he will have to
add the extra command: 'router bgp 1.1 as-notation dot+'.
Also, if the user wants to have plain format, even if the BGP
instance is declared in dot format, the keyword can also be used
for that.
The as-notation output is only taken into account at the BGP
instance creation. In the case where VPN instances are used,
a separate instance may be dynamically created. In that case,
the real as-notation format will be taken into acccount at the
first configuration.
Linking the as-notation format with the BGP instance makes sense,
as the operators want to keep consistency of what they configure.
One technical reason why to link the as-notation output with the
BGP instance creation is that the as-path segment lists stored
in the BGP updates use a string representation to handle aspath
operations (by using regexp for instance). Changing on the fly
the output needs to regenerate this string representation to the
correct format. Linking the configuration to the BGP instance
creation avoids refreshing the BGP updates. A similar mechanism
is put in place in junos too.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-11-03 21:17:57 +01:00
|
|
|
enum asnotation_mode asnotation;
|
|
|
|
|
2016-12-07 12:25:24 +01:00
|
|
|
QOBJ_FIELDS;
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
2016-12-07 12:25:24 +01:00
|
|
|
DECLARE_QOBJ_TYPE(bgp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-08-17 11:52:51 +02:00
|
|
|
struct bgp_interface {
|
|
|
|
#define BGP_INTERFACE_MPLS_BGP_FORWARDING (1 << 0)
|
|
|
|
uint32_t flags;
|
|
|
|
};
|
|
|
|
|
2019-05-10 15:31:04 +02:00
|
|
|
DECLARE_HOOK(bgp_inst_delete, (struct bgp *bgp), (bgp));
|
|
|
|
DECLARE_HOOK(bgp_inst_config_write,
|
|
|
|
(struct bgp *bgp, struct vty *vty),
|
|
|
|
(bgp, vty));
|
2022-03-09 14:28:38 +01:00
|
|
|
DECLARE_HOOK(bgp_config_end, (struct bgp *bgp), (bgp));
|
2019-05-10 15:31:04 +02:00
|
|
|
|
2020-01-31 19:04:00 +01:00
|
|
|
/* Thread callback information */
|
|
|
|
struct afi_safi_info {
|
|
|
|
afi_t afi;
|
|
|
|
safi_t safi;
|
|
|
|
struct bgp *bgp;
|
|
|
|
};
|
2019-10-23 19:45:57 +02:00
|
|
|
|
2015-11-10 16:29:12 +01:00
|
|
|
#define BGP_ROUTE_ADV_HOLD(bgp) (bgp->main_peers_update_hold)
|
2015-05-20 02:58:12 +02:00
|
|
|
|
2016-02-12 21:18:28 +01:00
|
|
|
#define IS_BGP_INST_KNOWN_TO_ZEBRA(bgp) \
|
|
|
|
(bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT \
|
2016-04-14 00:43:15 +02:00
|
|
|
|| (bgp->inst_type == BGP_INSTANCE_TYPE_VRF \
|
|
|
|
&& bgp->vrf_id != VRF_UNKNOWN))
|
2016-02-12 21:18:28 +01:00
|
|
|
|
2020-01-31 19:04:00 +01:00
|
|
|
#define BGP_SELECT_DEFER_DISABLE(bgp) \
|
2020-02-06 15:37:20 +01:00
|
|
|
(CHECK_FLAG(bgp->flags, BGP_FLAG_SELECT_DEFER_DISABLE))
|
2019-10-23 19:45:57 +02:00
|
|
|
|
2020-12-03 21:48:59 +01:00
|
|
|
#define BGP_SUPPRESS_FIB_ENABLED(bgp) \
|
|
|
|
(CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING) \
|
|
|
|
|| bm->wait_for_fib)
|
2020-11-06 04:16:04 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP peer-group support. */
|
|
|
|
struct peer_group {
|
|
|
|
/* Name of the peer-group. */
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
/* Pointer to BGP. */
|
|
|
|
struct bgp *bgp;
|
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/* Peer-group client list. */
|
|
|
|
struct list *peer;
|
|
|
|
|
|
|
|
/** Dynamic neighbor listening ranges */
|
2002-12-13 21:15:29 +01:00
|
|
|
struct list *listen_range[AFI_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Peer-group config */
|
|
|
|
struct peer *conf;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* BGP Notify message format. */
|
|
|
|
struct bgp_notify {
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t code;
|
|
|
|
uint8_t subcode;
|
2002-12-13 21:15:29 +01:00
|
|
|
char *data;
|
|
|
|
bgp_size_t length;
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t *raw_data;
|
2022-04-30 22:04:58 +02:00
|
|
|
bool hard_reset;
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Next hop self address. */
|
|
|
|
struct bgp_nexthop {
|
|
|
|
struct interface *ifp;
|
|
|
|
struct in_addr v4;
|
|
|
|
struct in6_addr v6_global;
|
|
|
|
struct in6_addr v6_local;
|
|
|
|
};
|
|
|
|
|
2015-05-20 03:03:45 +02:00
|
|
|
/* BGP addpath values */
|
|
|
|
#define BGP_ADDPATH_RX 1
|
|
|
|
#define BGP_ADDPATH_TX 2
|
|
|
|
#define BGP_ADDPATH_ID_LEN 4
|
|
|
|
|
BGP: support for addpath TX
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com
Ticket: CM-8014
This implements addpath TX with the first feature to use it
being "neighbor x.x.x.x addpath-tx-all-paths".
One change to show output is 'show ip bgp x.x.x.x'. If no addpath-tx
features are configured for any peers then everything looks the same
as it is today in that "Advertised to" is at the top and refers to
which peers the bestpath was advertise to.
root@superm-redxp-05[quagga-stash5]# vtysh -c 'show ip bgp 1.1.1.1'
BGP routing table entry for 1.1.1.1/32
Paths: (6 available, best #6, table Default-IP-Routing-Table)
Advertised to non peer-group peers:
r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8)
Local, (Received from a RR-client)
12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 8
Last update: Fri Oct 30 18:26:44 2015
[snip]
but once you enable an addpath feature we must display "Advertised to" on a path-by-path basis:
superm-redxp-05# show ip bgp 1.1.1.1/32
BGP routing table entry for 1.1.1.1/32
Paths: (6 available, best #6, table Default-IP-Routing-Table)
Local, (Received from a RR-client)
12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 8
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:44 2015
Local, (Received from a RR-client)
34.34.34.34 (metric 20) from r3(10.0.0.3) (10.0.0.3)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 7
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:39 2015
Local, (Received from a RR-client)
56.56.56.56 (metric 20) from r6(10.0.0.6) (10.0.0.6)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 6
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:39 2015
Local, (Received from a RR-client)
56.56.56.56 (metric 20) from r5(10.0.0.5) (10.0.0.5)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 5
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:39 2015
Local, (Received from a RR-client)
34.34.34.34 (metric 20) from r4(10.0.0.4) (10.0.0.4)
Origin IGP, metric 0, localpref 100, valid, internal
AddPath ID: RX 0, TX 4
Advertised to: r8(10.0.0.8)
Last update: Fri Oct 30 18:26:39 2015
Local, (Received from a RR-client)
12.12.12.12 (metric 20) from r1(10.0.0.1) (10.0.0.1)
Origin IGP, metric 0, localpref 100, valid, internal, best
AddPath ID: RX 0, TX 3
Advertised to: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8)
Last update: Fri Oct 30 18:26:34 2015
superm-redxp-05#
2015-11-05 18:29:43 +01:00
|
|
|
#define BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE 1
|
|
|
|
|
2018-07-07 22:34:25 +02:00
|
|
|
/* Route map direction */
|
2015-11-10 16:29:12 +01:00
|
|
|
#define RMAP_IN 0
|
|
|
|
#define RMAP_OUT 1
|
|
|
|
#define RMAP_MAX 2
|
2004-09-13 Jose Luis Rubio <jrubio@dit.upm.es>
(at Technical University of Madrid as part of Euro6ix Project)
Enhanced Route Server functionality and Route-Maps:
* bgpd/bgpd.h: Modified 'struct peer' and 'struct bgp_filter' to
support rs-clients. A 'struct bgp_table *rib' has been added to the
first (to mantain a separated RIB for each rs-client) and two new
route-maps have been added to the last (for import/export policies).
Added the following #defines: RMAP_{IN|OUT|IMPORT|EXPORT|MAX},
PEER_RMAP_TYPE_{IMPORT|EXPORT} and BGP_CLEAR_SOFT_RSCLIENT.
* bgpd/bgpd.c: Modified the functions that create/delete/etc peers in
order to consider the new fields included in 'struct peer' for
supporting rs-clients, i.e. the import/export route-maps and the
'struct bgp_table'.
* bgpd/bgp_route.{ch}: Modified several functions related with
receiving/sending announces in order to support the new Route Server
capabilities.
Function 'bgp_process' has been reorganized, creating an auxiliar
function for best path selection ('bgp_best_selection').
Modified 'bgp_show' and 'bgp_show_route' for displaying information
about any RIB (and not only the main bgp RIB).
Added commands for displaying information about RS-clients RIBs:
'show bgp rsclient (A.B.C.D|X:X::X:X)', 'show bgp rsclient
(A.B.C.D|X:X::X:X) X:X::X:X/M', etc
* bgpd/bgp_table.{ch}: The structure 'struct bgp_table' now has two
new fields: type (which can take the values BGP_TABLE_{MAIN|RSCLIENT})
and 'void *owner' which points to 'struct bgp' or 'struct peer' which
owns the table.
When creating a new bgp_table by default 'type=BGP_TABLE_MAIN' is set.
* bgpd/bgp_vty.c: The commands 'neighbor ... route-server-client' and
'no neighbor ... route-server-client' now not only set/unset the flag
PEER_FLAG_RSERVER_CLIENT, but they create/destroy the 'struct
bgp_table' of the peer. Special actions are taken for peer_groups.
Command 'neighbor ... route-map WORD (in|out)' now also supports two
new kinds of route-map: 'import' and 'export'.
Added commands 'clear bgp * rsclient', etc. These commands allow a new
kind of soft_reconfig which affects only the RIB of the specified
RS-client.
Added commands 'show bgp rsclient summary', etc which display a
summary of the rs-clients configured for the corresponding address
family.
* bgpd/bgp_routemap.c: A new match statement is available,
'match peer (A.B.C.D|X:X::X:X)'. This statement can only be used in
import/export route-maps, and it matches when the peer who announces
(when used in an import route-map) or is going to receive (when used
in an export route-map) the route is the same than the one specified
in the statement.
For peer-groups the statement matches if the specified peer is member
of the peer-group.
A special version of the command, 'match peer local', matches with
routes originated by the Route Server (defined with 'network ...',
redistributed routes and default-originate).
* lib/routemap.{ch}: Added a new clause 'call NAME' for use in
route-maps. It jumps into the specified route-map and when it returns
the first route-map ends if the called RM returns DENY_MATCH, or
continues in other case.
2004-09-13 07:12:46 +02:00
|
|
|
|
2020-02-10 15:17:40 +01:00
|
|
|
#define BGP_DEFAULT_TTL 1
|
|
|
|
#define BGP_GTSM_HOPS_DISABLED 0
|
|
|
|
#define BGP_GTSM_HOPS_CONNECTED 1
|
2019-10-23 16:56:23 +02:00
|
|
|
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
/* Advertise map */
|
2020-10-07 14:10:00 +02:00
|
|
|
#define CONDITION_NON_EXIST false
|
|
|
|
#define CONDITION_EXIST true
|
bgpd: conditional advertisement - other match rules support
Sample Configuration with prefix-list and community match rules
---------------------------------------------------------------
R1 ------- R2(DUT) ------- R3
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 20.20.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/32
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.20.3 soft-reconfiguration inbound
neighbor 10.10.20.3 advertise-map ADV-MAP non-exist-map EXIST-MAP
exit-address-family
!
ip prefix-list DEFAULT seq 5 permit 1.1.1.5/32
ip prefix-list DEFAULT seq 10 permit 1.1.1.1/32
ip prefix-list EXIST seq 5 permit 10.10.10.10/32
ip prefix-list DEFAULT-ROUTE seq 5 permit 0.0.0.0/0
ip prefix-list IP1 seq 5 permit 10.139.224.0/20
ip prefix-list T2 seq 5 permit 1.1.1.5/32
!
bgp community-list standard DC-ROUTES seq 5 permit 64952:3008
bgp community-list standard DC-ROUTES seq 10 permit 64671:501
bgp community-list standard DC-ROUTES seq 15 permit 64950:3009
bgp community-list standard DEFAULT-ROUTE seq 5 permit 65013:200
!
route-map ADV-MAP permit 10
match ip address prefix-list IP1
!
route-map ADV-MAP permit 20
match community DC-ROUTES
!
route-map EXIST-MAP permit 10
match community DEFAULT-ROUTE
match ip address prefix-list DEFAULT-ROUTE
!
line vty
!
end
Router2#
Router2# show ip bgp 0.0.0.0
BGP routing table entry for 0.0.0.0/0
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
10.10.10.1 10.10.20.3
1
10.10.10.1 from 10.10.10.1 (10.139.224.1)
Origin IGP, metric 0, valid, external, best (First path received)
Community: 64848:3011 65011:200 65013:200
Last update: Tue Oct 6 02:39:42 2020
Router2#
Sample output with non-exist-map when default route present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 10.10.10.1 0 0 1 i
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 4 routes and 4 total paths
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 0.0.0.0 0 1 i
*> 1.1.1.5/32 0.0.0.0 0 1 i <<<<<<<<< non-exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 not advertised
Total number of prefixes 2
Sample output with non-exist-map when default route not present in table
------------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 3 routes and 3 total paths
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 1 i
*> 1.1.1.5/32 0.0.0.0 0 1 i
*> 10.139.224.0/20 0.0.0.0 0 1 ? <<<<<<<<< non-exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 advertised
Total number of prefixes 3
Router2#
Sample output with exist-map when default route present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 10.10.10.1 0 0 1 i
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 4 routes and 4 total paths
Router2#
Router2#
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 0.0.0.0 0 1 i
*> 1.1.1.1/32 0.0.0.0 0 1 i
*> 1.1.1.5/32 0.0.0.0 0 1 i
*> 10.139.224.0/20 0.0.0.0 0 1 ? <<<<<<<<< exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 advertised
Total number of prefixes 4
Router2#
Sample output with exist-map when default route not present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 3 routes and 3 total paths
Router2#
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.5/32 0.0.0.0 0 1 i <<<<<<<<< exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 not advertised
Total number of prefixes 1
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-10-05 19:40:56 +02:00
|
|
|
|
2021-06-12 01:00:15 +02:00
|
|
|
enum update_type { UPDATE_TYPE_WITHDRAW, UPDATE_TYPE_ADVERTISE };
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
#include "filter.h"
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP filter structure. */
|
|
|
|
struct bgp_filter {
|
|
|
|
/* Distribute-list. */
|
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
struct access_list *alist;
|
|
|
|
} dlist[FILTER_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Prefix-list. */
|
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
struct prefix_list *plist;
|
|
|
|
} plist[FILTER_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Filter-list. */
|
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
struct as_list *aslist;
|
|
|
|
} aslist[FILTER_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Route-map. */
|
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
struct route_map *map;
|
2004-09-13 Jose Luis Rubio <jrubio@dit.upm.es>
(at Technical University of Madrid as part of Euro6ix Project)
Enhanced Route Server functionality and Route-Maps:
* bgpd/bgpd.h: Modified 'struct peer' and 'struct bgp_filter' to
support rs-clients. A 'struct bgp_table *rib' has been added to the
first (to mantain a separated RIB for each rs-client) and two new
route-maps have been added to the last (for import/export policies).
Added the following #defines: RMAP_{IN|OUT|IMPORT|EXPORT|MAX},
PEER_RMAP_TYPE_{IMPORT|EXPORT} and BGP_CLEAR_SOFT_RSCLIENT.
* bgpd/bgpd.c: Modified the functions that create/delete/etc peers in
order to consider the new fields included in 'struct peer' for
supporting rs-clients, i.e. the import/export route-maps and the
'struct bgp_table'.
* bgpd/bgp_route.{ch}: Modified several functions related with
receiving/sending announces in order to support the new Route Server
capabilities.
Function 'bgp_process' has been reorganized, creating an auxiliar
function for best path selection ('bgp_best_selection').
Modified 'bgp_show' and 'bgp_show_route' for displaying information
about any RIB (and not only the main bgp RIB).
Added commands for displaying information about RS-clients RIBs:
'show bgp rsclient (A.B.C.D|X:X::X:X)', 'show bgp rsclient
(A.B.C.D|X:X::X:X) X:X::X:X/M', etc
* bgpd/bgp_table.{ch}: The structure 'struct bgp_table' now has two
new fields: type (which can take the values BGP_TABLE_{MAIN|RSCLIENT})
and 'void *owner' which points to 'struct bgp' or 'struct peer' which
owns the table.
When creating a new bgp_table by default 'type=BGP_TABLE_MAIN' is set.
* bgpd/bgp_vty.c: The commands 'neighbor ... route-server-client' and
'no neighbor ... route-server-client' now not only set/unset the flag
PEER_FLAG_RSERVER_CLIENT, but they create/destroy the 'struct
bgp_table' of the peer. Special actions are taken for peer_groups.
Command 'neighbor ... route-map WORD (in|out)' now also supports two
new kinds of route-map: 'import' and 'export'.
Added commands 'clear bgp * rsclient', etc. These commands allow a new
kind of soft_reconfig which affects only the RIB of the specified
RS-client.
Added commands 'show bgp rsclient summary', etc which display a
summary of the rs-clients configured for the corresponding address
family.
* bgpd/bgp_routemap.c: A new match statement is available,
'match peer (A.B.C.D|X:X::X:X)'. This statement can only be used in
import/export route-maps, and it matches when the peer who announces
(when used in an import route-map) or is going to receive (when used
in an export route-map) the route is the same than the one specified
in the statement.
For peer-groups the statement matches if the specified peer is member
of the peer-group.
A special version of the command, 'match peer local', matches with
routes originated by the Route Server (defined with 'network ...',
redistributed routes and default-originate).
* lib/routemap.{ch}: Added a new clause 'call NAME' for use in
route-maps. It jumps into the specified route-map and when it returns
the first route-map ends if the called RM returns DENY_MATCH, or
continues in other case.
2004-09-13 07:12:46 +02:00
|
|
|
} map[RMAP_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Unsuppress-map. */
|
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
struct route_map *map;
|
|
|
|
} usmap;
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
|
|
|
|
/* Advertise-map */
|
|
|
|
struct {
|
|
|
|
char *aname;
|
|
|
|
struct route_map *amap;
|
|
|
|
|
|
|
|
bool condition;
|
|
|
|
|
|
|
|
char *cname;
|
|
|
|
struct route_map *cmap;
|
|
|
|
|
bgpd: conditional advertisement - topotests
Router2# show ip bgp neighbors 10.10.20.3 json
!--- Output suppressed.
"addressFamilyInfo":{
"ipv4Unicast":{
"updateGroupId":2,
"subGroupId":2,
"packetQueueLength":0,
"inboundSoftConfigPermit":true,
"commAttriSentToNbr":"extendedAndStandard",
"advertiseMap":{
"condition":"NON_EXIST",
"conditionMap":"EXIST-MAP",
"advertiseMap":"ADV-MAP",
"advertiseStatus":"Withdraw"
},
"acceptedPrefixCounter":0,
"sentPrefixCounter":2
},
"ipv6Unicast":{
"inboundSoftConfigPermit":true,
"commAttriSentToNbr":"extendedAndStandard",
"advertiseMap":{
"condition":"EXIST",
"conditionMap":"ALLOW_ALL",
"advertiseMap":"ALLOW_ALL",
"advertiseStatus":"Advertise"
},
"acceptedPrefixCounter":0
}
},
!--- Output suppressed.
router@router:~/frr/tests/topotests/bgp_conditional_advertisement$ sudo pytest -s test_bgp_conditional_advertisement.py
[sudo] password for router:
mkdir: cannot create directory ‘/tmp/topotests’: File exists
2020-10-14 17:00:46,649 INFO: Running environment diagnostics
=========================================================================================== test session starts ============================================================================================
platform linux2 -- Python 2.7.17, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
rootdir: /home/router/frr/tests/topotests, inifile: pytest.ini
collected 2 items
test_bgp_conditional_advertisement.py 2020-10-14 17:00:47,137 INFO: Testsuite start time: Wed Oct 14 17:00:47 2020
2020-10-14 17:00:47,137 INFO: ========================================
2020-10-14 17:00:47,138 INFO: Running setup_module to create topology
2020-10-14 17:00:48,711 INFO: loading topology: bgp_conditional_advertisement.test_bgp_conditional_advertisement
2020-10-14 17:00:48,712 INFO: starting topology: bgp_conditional_advertisement.test_bgp_conditional_advertisement
2020-10-14 17:00:49,042 INFO: r1: running version: 7.6-dev-MyOwnFRRVersion-gd77fe2dd0
2020-10-14 17:00:51,284 INFO: r2: running version: 7.6-dev-MyOwnFRRVersion-gd77fe2dd0
2020-10-14 17:00:53,582 INFO: r3: running version: 7.6-dev-MyOwnFRRVersion-gd77fe2dd0
2020-10-14 17:00:55,826 INFO: Running setup_module() done
2020-10-14 17:00:57,747 INFO: '_all_routes_advertised' polling started (interval 1 secs, maximum wait 130 secs)
2020-10-14 17:00:58,262 INFO: '_all_routes_advertised' succeeded after 0.52 seconds
2020-10-14 17:00:58,262 INFO: TC11: "router3" BGP convergence - PASSED!!!
2020-10-14 17:00:58,863 INFO: '_exist_map_routes_present' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:00:59,419 INFO: '_exist_map_routes_present' succeeded after 0.56 seconds
2020-10-14 17:00:59,419 INFO: TC21: exist-map routes present in "router2" BGP table - PASSED!!!
2020-10-14 17:01:00,017 INFO: '_exist_map_routes_not_present' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:02:00,192 INFO: '_exist_map_routes_not_present' succeeded after 60.18 seconds
2020-10-14 17:02:00,192 INFO: TC22: exist-map routes not present in "router2" BGP table - PASSED!!!
2020-10-14 17:02:00,736 INFO: '_non_exist_map_routes_not_present' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:02:59,215 INFO: '_non_exist_map_routes_not_present' succeeded after 58.48 seconds
2020-10-14 17:02:59,215 INFO: TC31: non-exist-map routes not present in "router2" BGP table - PASSED!!!
2020-10-14 17:02:59,968 INFO: '_non_exist_map_routes_present' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:03:59,300 INFO: '_non_exist_map_routes_present' succeeded after 59.33 seconds
2020-10-14 17:03:59,300 INFO: TC32: non-exist-map routes present in "router2" BGP table - PASSED!!!
2020-10-14 17:03:59,919 INFO: '_non_exist_map_no_condition_route_map' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:05:00,306 INFO: '_non_exist_map_no_condition_route_map' succeeded after 60.39 seconds
2020-10-14 17:05:00,306 INFO: TC41: non-exist-map route-map removed in "router2" - PASSED!!!
2020-10-14 17:05:01,024 INFO: '_exist_map_no_condition_route_map' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:05:59,405 INFO: '_exist_map_no_condition_route_map' succeeded after 58.38 seconds
2020-10-14 17:05:59,406 INFO: TC42: exist-map route-map removed in "router2" - PASSED!!!
2020-10-14 17:05:59,941 INFO: '_exist_map_routes_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:06:59,622 INFO: '_exist_map_routes_present_rmap_filter' succeeded after 59.68 seconds
2020-10-14 17:06:59,622 INFO: TC51: exist-map routes present with route-map filter - PASSED!!!
2020-10-14 17:07:00,150 INFO: '_exist_map_routes_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:07:00,688 INFO: '_exist_map_routes_present_no_rmap_filter' succeeded after 0.54 seconds
2020-10-14 17:07:00,688 INFO: TC52: exist-map routes present, no route-map filter - PASSED!!!
2020-10-14 17:07:01,229 INFO: '_non_exist_map_routes_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:07:01,767 INFO: '_non_exist_map_routes_present_rmap_filter' succeeded after 0.54 seconds
2020-10-14 17:07:01,767 INFO: TC53: non-exist-map routes present, with route-map filter - PASSED!!!
2020-10-14 17:07:02,321 INFO: '_non_exist_map_routes_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:08:00,419 INFO: '_non_exist_map_routes_present_no_rmap_filter' succeeded after 58.10 seconds
2020-10-14 17:08:00,419 INFO: TC54: non-exist-map routes present, no route-map filter - PASSED!!!
2020-10-14 17:08:01,485 INFO: '_exist_map_routes_not_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:08:02,039 INFO: '_exist_map_routes_not_present_rmap_filter' succeeded after 0.55 seconds
2020-10-14 17:08:02,039 INFO: TC61: exist-map routes not present, route-map filter - PASSED!!!
2020-10-14 17:08:02,568 INFO: '_exist_map_routes_not_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:08:59,147 INFO: '_exist_map_routes_not_present_no_rmap_filter' succeeded after 56.58 seconds
2020-10-14 17:08:59,147 INFO: TC62: exist-map routes not present, no route-map filter - PASSED!!!
2020-10-14 17:08:59,686 INFO: '_non_exist_map_routes_not_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:09:59,354 INFO: '_non_exist_map_routes_not_present_rmap_filter' succeeded after 59.67 seconds
2020-10-14 17:09:59,354 INFO: TC63: non-exist-map routes not present, route-map filter - PASSED!!!
2020-10-14 17:09:59,886 INFO: '_non_exist_map_routes_not_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:10:00,424 INFO: '_non_exist_map_routes_not_present_no_rmap_filter' succeeded after 0.54 seconds
2020-10-14 17:10:00,424 INFO: TC64: non-exist-map routes not present, no route-map filter - PASSED!!!
.2020-10-14 17:10:01,989 INFO: assert skipped at "bgp_conditional_advertisement.test_bgp_conditional_advertisement/test_memory_leak": Memory leak test/report is disabled
s2020-10-14 17:10:01,989 INFO: Running teardown_module to delete topology
2020-10-14 17:10:01,990 INFO: stopping topology: bgp_conditional_advertisement.test_bgp_conditional_advertisement
2020-10-14 17:10:01,990 INFO: stopping "s2"
2020-10-14 17:10:01,990 INFO: stopping "s1"
2020-10-14 17:10:01,993 INFO: r1: stopping bgpd
2020-10-14 17:10:01,995 INFO: r1: stopping staticd
2020-10-14 17:10:02,010 INFO: r1: stopping zebra
2020-10-14 17:10:02,013 INFO: r1: stopping bgpd
2020-10-14 17:10:02,015 INFO: r1: stopping zebra
2020-10-14 17:10:02,025 INFO: r1: waiting for daemons stopping: bgpd, zebra (0.1 seconds)
2020-10-14 17:10:02,143 INFO: r2: stopping bgpd
2020-10-14 17:10:02,147 INFO: r2: stopping staticd
2020-10-14 17:10:02,152 INFO: r2: stopping zebra
2020-10-14 17:10:02,156 INFO: r2: stopping bgpd
2020-10-14 17:10:02,164 INFO: r2: stopping zebra
2020-10-14 17:10:02,175 INFO: r2: waiting for daemons stopping: zebra (0.1 seconds)
2020-10-14 17:10:02,291 INFO: r3: stopping bgpd
2020-10-14 17:10:02,302 INFO: r3: stopping staticd
2020-10-14 17:10:02,309 INFO: r3: stopping zebra
2020-10-14 17:10:02,313 INFO: r3: stopping bgpd
2020-10-14 17:10:02,316 INFO: r3: stopping zebra
2020-10-14 17:10:02,323 INFO: r3: waiting for daemons stopping: zebra (0.1 seconds)
2020-10-14 17:10:03,615 INFO: Testsuite end time: Wed Oct 14 17:10:03 2020
2020-10-14 17:10:03,615 INFO: ========================================
================================================================================== 1 passed, 1 skipped in 556.55 seconds ===================================================================================
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
temp
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-10-13 22:14:27 +02:00
|
|
|
enum update_type update_type;
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
} advmap;
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
2012-05-07 18:52:54 +02:00
|
|
|
/* IBGP/EBGP identifier. We also have a CONFED peer, which is to say,
|
|
|
|
a peer who's AS is part of our Confederation. */
|
2022-04-12 10:29:40 +02:00
|
|
|
enum bgp_peer_sort {
|
2018-12-27 17:03:38 +01:00
|
|
|
BGP_PEER_UNSPECIFIED,
|
|
|
|
BGP_PEER_IBGP,
|
2012-05-07 18:52:54 +02:00
|
|
|
BGP_PEER_EBGP,
|
|
|
|
BGP_PEER_INTERNAL,
|
|
|
|
BGP_PEER_CONFED,
|
2022-04-12 10:29:40 +02:00
|
|
|
};
|
2012-05-07 18:52:54 +02:00
|
|
|
|
2015-05-20 02:40:39 +02:00
|
|
|
/* BGP message header and packet size. */
|
|
|
|
#define BGP_MARKER_SIZE 16
|
|
|
|
#define BGP_HEADER_SIZE 19
|
2021-04-27 22:20:27 +02:00
|
|
|
#define BGP_STANDARD_MESSAGE_MAX_PACKET_SIZE 4096
|
|
|
|
#define BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE 65535
|
|
|
|
#define BGP_MAX_PACKET_SIZE BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE
|
2015-05-20 02:58:10 +02:00
|
|
|
#define BGP_MAX_PACKET_SIZE_OVERFLOW 1024
|
2015-05-20 02:40:39 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/*
|
|
|
|
* Trigger delay for bgp_announce_route().
|
|
|
|
*/
|
|
|
|
#define BGP_ANNOUNCE_ROUTE_SHORT_DELAY_MS 100
|
|
|
|
#define BGP_ANNOUNCE_ROUTE_DELAY_MS 500
|
|
|
|
|
|
|
|
struct peer_af {
|
|
|
|
/* back pointer to the peer */
|
|
|
|
struct peer *peer;
|
|
|
|
|
|
|
|
/* which subgroup the peer_af belongs to */
|
|
|
|
struct update_subgroup *subgroup;
|
|
|
|
|
|
|
|
/* for being part of an update subgroup's peer list */
|
|
|
|
LIST_ENTRY(peer_af) subgrp_train;
|
|
|
|
|
|
|
|
/* for being part of a packet's peer list */
|
|
|
|
LIST_ENTRY(peer_af) pkt_train;
|
|
|
|
|
|
|
|
struct bpacket *next_pkt_to_send;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Trigger timer for bgp_announce_route().
|
|
|
|
*/
|
|
|
|
struct thread *t_announce_route;
|
|
|
|
|
|
|
|
afi_t afi;
|
|
|
|
safi_t safi;
|
|
|
|
int afid;
|
|
|
|
};
|
2019-10-23 07:32:45 +02:00
|
|
|
/* BGP GR per peer ds */
|
|
|
|
|
2019-11-25 16:18:15 +01:00
|
|
|
#define BGP_PEER_GR_MODE 5
|
|
|
|
#define BGP_PEER_GR_EVENT_CMD 6
|
2019-10-23 07:32:45 +02:00
|
|
|
|
|
|
|
enum peer_mode {
|
|
|
|
PEER_HELPER = 0,
|
|
|
|
PEER_GR,
|
|
|
|
PEER_DISABLE,
|
|
|
|
PEER_INVALID,
|
|
|
|
PEER_GLOBAL_INHERIT /* This is the default mode */
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
enum peer_gr_command {
|
|
|
|
PEER_GR_CMD = 0,
|
|
|
|
NO_PEER_GR_CMD,
|
2019-11-25 16:18:15 +01:00
|
|
|
PEER_DISABLE_CMD,
|
2019-10-23 07:32:45 +02:00
|
|
|
NO_PEER_DISABLE_CMD,
|
|
|
|
PEER_HELPER_CMD,
|
|
|
|
NO_PEER_HELPER_CMD
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef unsigned int (*bgp_peer_gr_action_ptr)(struct peer *, int, int);
|
|
|
|
|
|
|
|
struct bgp_peer_gr {
|
|
|
|
enum peer_mode next_state;
|
|
|
|
bgp_peer_gr_action_ptr action_fun;
|
|
|
|
};
|
|
|
|
|
2021-02-12 00:54:27 +01:00
|
|
|
/*
|
|
|
|
* BGP FSM event codes, per RFC 4271 ss. 8.1
|
|
|
|
*/
|
|
|
|
enum bgp_fsm_rfc_codes {
|
|
|
|
BGP_FSM_ManualStart = 1,
|
|
|
|
BGP_FSM_ManualStop = 2,
|
|
|
|
BGP_FSM_AutomaticStart = 3,
|
|
|
|
BGP_FSM_ManualStart_with_PassiveTcpEstablishment = 4,
|
|
|
|
BGP_FSM_AutomaticStart_with_PassiveTcpEstablishment = 5,
|
|
|
|
BGP_FSM_AutomaticStart_with_DampPeerOscillations = 6,
|
|
|
|
BGP_FSM_AutomaticStart_with_DampPeerOscillations_and_PassiveTcpEstablishment =
|
|
|
|
7,
|
|
|
|
BGP_FSM_AutomaticStop = 8,
|
|
|
|
BGP_FSM_ConnectRetryTimer_Expires = 9,
|
|
|
|
BGP_FSM_HoldTimer_Expires = 10,
|
|
|
|
BGP_FSM_KeepaliveTimer_Expires = 11,
|
|
|
|
BGP_FSM_DelayOpenTimer_Expires = 12,
|
|
|
|
BGP_FSM_IdleHoldTimer_Expires = 13,
|
|
|
|
BGP_FSM_TcpConnection_Valid = 14,
|
|
|
|
BGP_FSM_Tcp_CR_Invalid = 15,
|
|
|
|
BGP_FSM_Tcp_CR_Acked = 16,
|
|
|
|
BGP_FSM_TcpConnectionConfirmed = 17,
|
|
|
|
BGP_FSM_TcpConnectionFails = 18,
|
|
|
|
BGP_FSM_BGPOpen = 19,
|
|
|
|
BGP_FSM_BGPOpen_with_DelayOpenTimer_running = 20,
|
|
|
|
BGP_FSM_BGPHeaderErr = 21,
|
|
|
|
BGP_FSM_BGPOpenMsgErr = 22,
|
|
|
|
BGP_FSM_OpenCollisionDump = 23,
|
|
|
|
BGP_FSM_NotifMsgVerErr = 24,
|
|
|
|
BGP_FSM_NotifMsg = 25,
|
|
|
|
BGP_FSM_KeepAliveMsg = 26,
|
|
|
|
BGP_FSM_UpdateMsg = 27,
|
|
|
|
BGP_FSM_UpdateMsgErr = 28
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BGP finite state machine events
|
|
|
|
*
|
|
|
|
* Note: these do not correspond to RFC-defined event codes. Those are
|
|
|
|
* defined elsewhere.
|
|
|
|
*/
|
2020-03-20 01:19:50 +01:00
|
|
|
enum bgp_fsm_events {
|
|
|
|
BGP_Start = 1,
|
|
|
|
BGP_Stop,
|
|
|
|
TCP_connection_open,
|
2020-10-20 16:49:58 +02:00
|
|
|
TCP_connection_open_w_delay,
|
2020-03-20 01:19:50 +01:00
|
|
|
TCP_connection_closed,
|
|
|
|
TCP_connection_open_failed,
|
|
|
|
TCP_fatal_error,
|
|
|
|
ConnectRetry_timer_expired,
|
|
|
|
Hold_Timer_expired,
|
|
|
|
KeepAlive_timer_expired,
|
2020-10-20 16:49:58 +02:00
|
|
|
DelayOpen_timer_expired,
|
2020-03-20 01:19:50 +01:00
|
|
|
Receive_OPEN_message,
|
|
|
|
Receive_KEEPALIVE_message,
|
|
|
|
Receive_UPDATE_message,
|
|
|
|
Receive_NOTIFICATION_message,
|
|
|
|
Clearing_Completed,
|
|
|
|
BGP_EVENTS_MAX,
|
|
|
|
};
|
2015-05-20 03:03:47 +02:00
|
|
|
|
2020-03-20 14:03:08 +01:00
|
|
|
/* BGP finite state machine status. */
|
|
|
|
enum bgp_fsm_status {
|
|
|
|
Idle = 1,
|
|
|
|
Connect,
|
|
|
|
Active,
|
|
|
|
OpenSent,
|
|
|
|
OpenConfirm,
|
|
|
|
Established,
|
|
|
|
Clearing,
|
|
|
|
Deleted,
|
|
|
|
BGP_STATUS_MAX,
|
|
|
|
};
|
|
|
|
|
2021-02-12 01:21:08 +01:00
|
|
|
#define PEER_HOSTNAME(peer) ((peer)->host ? (peer)->host : "(unknown peer)")
|
|
|
|
|
bgpd: Add Long-lived Graceful Restart capability (restarter)
Restart Router mode.
FRRouting (Restarter):
```
bgp long-lived-graceful-restart stale-time 10
bgp graceful-restart restart-time 1
```
Tested with GoBGP (Helper):
```
long-lived-graceful-restart: advertised and received
Local:
ipv4-unicast, restart time 100000 sec
Remote:
ipv4-unicast, restart time 10 sec, forward flag set
```
Logs:
```
{"Key":"192.168.10.123","Reason":"graceful-restart","State":"BGP_FSM_ESTABLISHED","Topic":"Peer","level":"info","msg":"Peer Down","time":"2021-10-25T17:48:36+03:00"}
{"Key":"192.168.10.123","State":"BGP_FSM_IDLE","Topic":"Peer","level":"warning","msg":"graceful restart timer expired","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"start LLGR restart timer (10 sec) for ipv4-unicast","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"LLGR restart timer (10 sec) for ipv4-unicast expired","time":"2021-10-25T17:48:47+03:00"}
% ./gobgp global rib
Network Next Hop AS_PATH Age Attrs
S*>10.0.2.0/24 192.168.10.123 174 00:12:08 [{Origin: ?} {Med: 0} {Communities: llgr-stale} {Extcomms: [174:1282304808]}]
```
Helper mode will be added with upcoming PRs.
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-25 16:23:02 +02:00
|
|
|
struct llgr_info {
|
|
|
|
uint32_t stale_time;
|
|
|
|
uint8_t flags;
|
|
|
|
};
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP neighbor structure. */
|
|
|
|
struct peer {
|
|
|
|
/* BGP structure. */
|
|
|
|
struct bgp *bgp;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-06-01 Paul Jakma <paul.jakma@sun.com>
* bgpd/(general) refcount struct peer and bgp_info, hence allowing us
add work_queues for bgp_process.
* bgpd/bgp_route.h: (struct bgp_info) Add 'lock' field for refcount.
Add bgp_info_{lock,unlock} helper functions.
Add bgp_info_{add,delete} helpers, to remove need for
users managing locking/freeing of bgp_info and bgp_node's.
* bgpd/bgp_table.h: (struct bgp_node) Add a flags field, and
BGP_NODE_PROCESS_SCHEDULED to merge redundant processing of
nodes.
* bgpd/bgp_fsm.h: Make the ON/OFF/ADD/REMOVE macros lock and unlock
peer reference as appropriate.
* bgpd/bgp_damp.c: Remove its internal prototypes for
bgp_info_delete/free. Just use bgp_info_delete.
* bgpd/bgpd.h: (struct bgp_master) Add work_queue pointers.
(struct peer) Add reference count 'lock'
(peer_lock,peer_unlock) New helpers to take/release reference
on struct peer.
* bgpd/bgp_advertise.c: (general) Add peer and bgp_info refcounting
and balance how references are taken and released.
(bgp_advertise_free) release bgp_info reference, if appropriate
(bgp_adj_out_free) unlock peer
(bgp_advertise_clean) leave the adv references alone, or else
call bgp_advertise_free cant unlock them.
(bgp_adj_out_set) lock the peer on new adj's, leave the reference
alone otherwise. lock the new bgp_info reference.
(bgp_adj_in_set) lock the peer reference
(bgp_adj_in_remove) and unlock it here
(bgp_sync_delete) make hash_free on peer conditional, just in
case.
* bgpd/bgp_fsm.c: (general) document that the timers depend on
bgp_event to release a peer reference.
(bgp_fsm_change_status) moved up the file, unchanged.
(bgp_stop) Decrement peer lock as many times as cancel_event
canceled - shouldnt be needed but just in case.
stream_fifo_clean of obuf made conditional, just in case.
(bgp_event) always unlock the peer, regardless of return value
of bgp_fsm_change_status.
* bgpd/bgp_packet.c: (general) change several bgp_stop's to BGP_EVENT's.
(bgp_read) Add a mysterious extra peer_unlock for ACCEPT_PEERs
along with a comment on it.
* bgpd/bgp_route.c: (general) Add refcounting of bgp_info, cleanup
some of the resource management around bgp_info. Refcount peer.
Add workqueues for bgp_process and clear_table.
(bgp_info_new) make static
(bgp_info_free) Ditto, and unlock the peer reference.
(bgp_info_lock,bgp_info_unlock) new exported functions
(bgp_info_add) Add a bgp_info to a bgp_node in correct fashion,
taking care of reference counts.
(bgp_info_delete) do the opposite of bgp_info_add.
(bgp_process_rsclient) Converted into a work_queue work function.
(bgp_process_main) ditto.
(bgp_processq_del) process work queue item deconstructor
(bgp_process_queue_init) process work queue init
(bgp_process) call init function if required, set up queue item
and add to queue, rather than calling process functions directly.
(bgp_rib_remove) let bgp_info_delete manage bgp_info refcounts
(bgp_rib_withdraw) ditto
(bgp_update_rsclient) let bgp_info_add manage refcounts
(bgp_update_main) ditto
(bgp_clear_route_node) clear_node_queue work function, does
per-node aspects of what bgp_clear_route_table did previously
(bgp_clear_node_queue_del) clear_node_queue item delete function
(bgp_clear_node_complete) clear_node_queue completion function,
it unplugs the process queues, which have to be blocked while
clear_node_queue is being processed to prevent a race.
(bgp_clear_node_queue_init) init function for clear_node_queue
work queues
(bgp_clear_route_table) Sets up items onto a workqueue now, rather
than clearing each node directly. Plugs both process queues to
avoid potential race.
(bgp_static_withdraw_rsclient) let bgp_info_{add,delete} manage
bgp_info refcounts.
(bgp_static_update_rsclient) ditto
(bgp_static_update_main) ditto
(bgp_static_update_vpnv4) ditto, remove unneeded cast.
(bgp_static_withdraw) see bgp_static_withdraw_rsclient
(bgp_static_withdraw_vpnv4) ditto
(bgp_aggregate_{route,add,delete}) ditto
(bgp_redistribute_{add,delete,withdraw}) ditto
* bgpd/bgp_vty.c: (peer_rsclient_set_vty) lock rsclient list peer
reference
(peer_rsclient_unset_vty) ditto, but unlock same reference
* bgpd/bgpd.c: (peer_free) handle frees of info to be kept for lifetime
of struct peer.
(peer_lock,peer_unlock) peer refcount helpers
(peer_new) add initial refcounts
(peer_create,peer_create_accept) lock peer as appropriate
(peer_delete) unlock as appropriate, move out some free's to
peer_free.
(peer_group_bind,peer_group_unbind) peer refcounting as
appropriate.
(bgp_create) check CALLOC return value.
(bgp_terminate) free workqueues too.
* lib/memtypes.c: Add MTYPE_BGP_PROCESS_QUEUE and
MTYPE_BGP_CLEAR_NODE_QUEUE
2005-06-01 13:17:05 +02:00
|
|
|
/* reference count, primarily to allow bgp_process'ing of route_node's
|
|
|
|
* to be done after a struct peer is deleted.
|
|
|
|
*
|
|
|
|
* named 'lock' for hysterical reasons within Quagga.
|
|
|
|
*/
|
|
|
|
int lock;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP peer group. */
|
|
|
|
struct peer_group *group;
|
2016-08-24 17:11:00 +02:00
|
|
|
uint64_t version[AFI_MAX][SAFI_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/* BGP peer_af structures, per configured AF on this peer */
|
|
|
|
struct peer_af *peer_af_array[BGP_AF_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Peer's remote AS number. */
|
2015-05-20 03:04:25 +02:00
|
|
|
int as_type;
|
|
|
|
as_t as;
|
2022-11-18 16:02:55 +01:00
|
|
|
/* for vty as format */
|
|
|
|
char *as_pretty;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Peer's local AS number. */
|
|
|
|
as_t local_as;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-04-12 10:29:40 +02:00
|
|
|
enum bgp_peer_sort sort;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Peer's Change local AS number. */
|
|
|
|
as_t change_local_as;
|
2022-11-18 16:02:55 +01:00
|
|
|
/* for vty as format */
|
|
|
|
char *change_local_as_pretty;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Remote router ID. */
|
|
|
|
struct in_addr remote_id;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Local router ID. */
|
|
|
|
struct in_addr local_id;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Packet receive and send buffer. */
|
2017-05-02 02:37:45 +02:00
|
|
|
pthread_mutex_t io_mtx; // guards ibuf, obuf
|
|
|
|
struct stream_fifo *ibuf; // packets waiting to be processed
|
|
|
|
struct stream_fifo *obuf; // packets waiting to be written
|
|
|
|
|
2021-04-27 00:59:48 +02:00
|
|
|
/* used as a block to deposit raw wire data to */
|
2021-04-27 22:20:27 +02:00
|
|
|
uint8_t ibuf_scratch[BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE
|
2021-04-27 00:59:48 +02:00
|
|
|
* BGP_READ_PACKET_MAX];
|
2018-01-02 19:20:00 +01:00
|
|
|
struct ringbuf *ibuf_work; // WiP buffer used by bgp_read() only
|
|
|
|
struct stream *obuf_work; // WiP buffer used to construct packets
|
2017-05-02 02:37:45 +02:00
|
|
|
|
|
|
|
struct stream *curr; // the current packet being parsed
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2014-01-15 07:57:57 +01:00
|
|
|
/* We use a separate stream to encode MP_REACH_NLRI for efficient
|
2017-05-02 02:37:45 +02:00
|
|
|
* NLRI packing. peer->obuf_work stores all the other attributes. The
|
2014-01-15 07:57:57 +01:00
|
|
|
* actual packet is then constructed by concatenating the two.
|
|
|
|
*/
|
|
|
|
struct stream *scratch;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 02:40:37 +02:00
|
|
|
/* the doppelganger peer structure, due to dual TCP conn setup */
|
|
|
|
struct peer *doppelganger;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Status of the peer. */
|
2020-03-20 14:03:08 +01:00
|
|
|
enum bgp_fsm_status status;
|
|
|
|
enum bgp_fsm_status ostatus;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:04:12 +02:00
|
|
|
/* FSM events, stored for debug purposes.
|
|
|
|
* Note: uchar used for reduced memory usage.
|
|
|
|
*/
|
2020-03-20 01:19:50 +01:00
|
|
|
enum bgp_fsm_events cur_event;
|
|
|
|
enum bgp_fsm_events last_event;
|
|
|
|
enum bgp_fsm_events last_major_event;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
[bgpd] Merge AS4 support
2007-10-14 Paul Jakma <paul.jakma@sun.com>
* NEWS: Note that MRT dumps are now version 2
* (general) Merge in Juergen Kammer's AS4 patch.
2007-09-27 Paul Jakma <paul.jakma@sun.com>
* bgp_aspath.c: (assegment_normalise) remove duplicates from
from sets.
(aspath_reconcile_as4) disregard a broken part of the RFC around
error handling in path reconciliation.
* aspath_test.c: Test dupe-weeding from sets.
Test that reconciliation merges AS_PATH and AS4_PATH where
former is shorter than latter.
2007-09-26 Paul Jakma <paul.jakma@sun.com>
* aspath_test.c: Test AS4_PATH reconcilation where length
of AS_PATH and AS4_PATH is same.
2007-09-25 Paul Jakma <paul.jakma@sun.com>
* bgp_open.c: (peek_for_as4_capability) Fix to work.
* bgp_packet.c: (bgp_open_receive) Fix sanity check of as4.
* tests/bgp_capability_test.c: (general) Extend tests to validate
peek_for_as4_capability.
Add test of full OPEN Option block, with multiple capabilities,
both as a series of Option, and a single option.
Add some crap to beginning of stream, to prevent code depending
on getp == 0.
2007-09-18 Paul Jakma <paul.jakma@sun.com>
* bgp_open.c: (bgp_capability_as4) debug printf inline with others.
(peek_for_as4_capability) There's no need to signal failure, as
failure is better dealt with through full capability parser -
just return the AS4, simpler.
* bgp_packet.c: (bgp_open_receive) Update to match
peek_for_as4_capability change.
Allow use of BGP_AS_TRANS by 2b speakers.
Use NOTIFY_OPEN_ERR rather than CEASE for OPEN parsing errors.
(bgp_capability_msg_parse) missing argument to debug print
(bgp_capability_receive) missing return values.
* tests/bgp_capability_test.c: (parse_test) update for changes to
peek_for_as4_capability
2007-07-25 Paul Jakma <paul.jakma@sun.com>
* Remove 2-byte size macros, just make existing macros take
argument to indicate which size to use.
Adjust all users - typically they want '1'.
* bgp_aspath.c: (aspath_has_as4) New, return 1 if there are any
as4's in a path.
(aspath_put) Return the number of bytes actually written, to
fix the bug Juergen noted: Splitting of segments will change
the number of bytes written from that already written to the
AS_PATH header.
(aspath_snmp_pathseg) Pass 2-byte flag to aspath_put. SNMP
is still defined as 2b.
(aspath_aggregate) fix latent bug.
(aspath_reconcile_as4) AS_PATH+NEW_AS_PATH reconciliation
function.
(aspath_key_make) Hash the AS_PATH string, rather than
just taking the addition of assegment ASes as the hash value,
hopefully sligthly more collision resistant.
(bgp_attr_munge_as4_attrs) Collide the NEW_ attributes
together with the OLD 2-byte forms, code Juergen
had in bgp_attr_parse but re-organised a bit.
(bgp_attr_parse) Bunch of code from Juergen moves
to previous function.
(bgp_packet_attribute) Compact significantly by
just /always/ using extended-length attr header.
Fix bug Juergen noted, by using aspath_put's
(new) returned size value for the attr header rather
than the (guesstimate) of aspath_size() - the two could
differ when aspath_put had to split large segments, unlikely
this bug was ever hit in the 'wild'.
(bgp_dump_routes_attr) Always use extended-len and
use aspath_put return for header length. Output 4b ASN
for AS_PATH and AGGREGATOR.
* bgp_ecommunity.c: (ecommunity_{hash_make,cmp}) fix
hash callback declarations to match prototypes.
(ecommunity_gettoken) Updated for ECOMMUNITY_ENCODE_AS4,
complete rewrite of Juergen's changes (no asdot support)
* bgp_open.c: (bgp_capability_as4) New, does what it says
on the tin.
(peek_for_as4_capability) Rewritten to use streams and
bgp_capability_as4.
* bgp_packet.c: (bgp_open_send) minor edit
checked (in the abstract at least) with Juergen.
Changes are to be more accepting, e.g, allow AS_TRANS on
a 2-byte session.
* (general) Update all commands to use CMD_AS_RANGE.
* bgp_vty.c: (bgp_clear) Fix return vals to use CMD_..
Remove stuff replicated by VTY_GET_LONG
(bgp_clear_vty) Return bgp_clear directly to vty.
* tests/aspath_test.c: Exercise 32bit parsing. Test reconcile
function.
* tests/ecommunity_test.c: New, test AS4 ecommunity changes,
positive test only at this time, error cases not tested yet.
2007-07-25 Juergen Kammer <j.kammer@eurodata.de>
* (general) AS4 support.
* bgpd.h: as_t changes to 4-bytes.
* bgp_aspath.h: Add BGP_AS4_MAX and BGP_AS_TRANS defines.
* bgp_aspath.c: AS_VALUE_SIZE becomes 4-byte, AS16_VALUE_SIZE
added for 2-byte.
Add AS16 versions of length calc macros.
(aspath_count_numas) New, count number of ASes.
(aspath_has_as4) New, return 1 if there are any as4's in a
path.
(assegments_parse) Interpret assegment as 4 or 2 byte,
according to how the caller instructs us, with a new
argument.
(aspath_parse) Add use32bit argument to pass to
assegments_parse. Adjust all its callers to pass 1, unless
otherwise noted.
(assegment_data_put) Adjust to be able to write 2 or 4 byte
AS, according to new use32bit argument.
(aspath_put) Adjust to write 2 or 4.
(aspath_gettoken) Use a long for passed in asno.
* bgp_attr.c: (attr_str) Add BGP_ATTR_AS4_PATH and
BGP_ATTR_AS4_AGGREGATOR.
(bgp_attr_aspath) Call aspath_parse with right 2/4 arg, as
determined by received-capability flag.
(bgp_attr_aspath_check) New, code previously in attr_aspath
but moved to new func so it can be run after NEW_AS_PATH
reconciliation.
(bgp_attr_as4_path) New, handle NEW_AS_PATH.
(bgp_attr_aggregator) Adjust to cope with 2/4 byte ASes.
(bgp_attr_as4_aggregator) New, read NEW_AGGREGATOR.
(bgp_attr_parse) Add handoffs to previous parsers for the two
new AS4 NEW_ attributes.
Various checks added for NEW/OLD reconciliation.
(bgp_packet_attribute) Support 2/4 for AS_PATH and
AGGREGATOR, detect when NEW_ attrs need to be sent.
* bgp_debug.{c,h}: Add 'debug bgp as4'.
* bgp_dump.c: MRTv2 support, unconditionally enabled, which
supports AS4. Based on patches from Erik (RIPE?).
* bgp_ecommunity.c: (ecommunity_ecom2str) ECOMMUNITY_ENCODE_AS4
support.
* bgp_open.c: (peek_for_as4_capability) New, peek for AS4
capability prior to full capability parsing, so we know which
ASN to use for struct peer lookup.
(bgp_open_capability) Always send AS4 capability.
* bgp_packet.c: (bgp_open_send) AS4 handling for AS field
(bgp_open_receive) Peek for AS4 capability first, and figure
out which AS to believe.
* bgp_vty.c: (bgp_show_peer) Print AS4 cap
* tests/aspath_test.c: Support asn32 changes, call aspath_parse
with 16 bit.
* vtysh/extract.pl: AS4 compatibility for router bgp ASNUMBER
* vtysh/extract.pl.in: AS4 compatibility for router bgp ASNUMBER
* vtysh/vtysh.c: AS4 compatibility for router bgp ASNUMBER
2007-10-15 00:32:21 +02:00
|
|
|
/* Peer index, used for dumping TABLE_DUMP_V2 format */
|
|
|
|
uint16_t table_dump_index;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Peer information */
|
2004-05-01 10:44:08 +02:00
|
|
|
int fd; /* File descriptor */
|
|
|
|
int ttl; /* TTL of TCP connection to the peer. */
|
2015-04-29 08:43:04 +02:00
|
|
|
int rtt; /* Estimated round-trip-time from TCP_INFO */
|
2020-07-25 08:10:56 +02:00
|
|
|
int rtt_expected; /* Expected round-trip-time for a peer */
|
|
|
|
uint8_t rtt_keepalive_rcv; /* Received count for RTT shutdown */
|
|
|
|
uint8_t rtt_keepalive_conf; /* Configured count for RTT shutdown */
|
bgpd: RFC 5082 Generalized TTL Security Mechanism support
* bgpd: Add support for RFC 5082 GTSM, which allows the TTL field to be used
to verify that incoming packets have been sent from neighbours no more
than X IP hops away. In other words, this allows packets that were sent from
further away (i.e. not by the neighbour with known distance, and so possibly
a miscreant) to be filtered out.
* lib/sockunion.{c,h}: (sockopt_minttl) new function, to set a minimum TTL
using the IP_MINTTL socket opt.
* bgpd.h: (BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK) define for command
error for minttl.
(struct peer) add a config variable, to store the configured minttl.
(peer_ttl_security_hops_{set,unset}) configuration handlers
* bgpd.c: (peer_group_get) init gtsm_hops
(peer_ebgp_multihop_{un,}set) check for conflicts with GTSM. Multihop and
GTSM can't both be active for a peer at the same time.
(peer_ttl_security_hops_set) set minttl, taking care to avoid conflicts with
ebgp_multihop.
(bgp_config_write_peer) write out minttl as "neighbor .. ttl-security hops X".
* bgp_vty.c: (bgp_vty_return) message for
BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK
(peer_ebgp_multihop_{un,}set_vty)
* bgp_network.c: (bgp_accept) set minttl on accepted sockets if appropriate.
(bgp_connect) ditto for outbound.
2011-03-23 16:33:17 +01:00
|
|
|
int gtsm_hops; /* minimum hopcount to peer */
|
2004-05-01 10:44:08 +02:00
|
|
|
char *desc; /* Description of the peer. */
|
|
|
|
unsigned short port; /* Destination port for peer */
|
|
|
|
char *host; /* Printable address of the peer. */
|
|
|
|
union sockunion su; /* Sockunion address of the peer. */
|
2015-05-20 02:40:40 +02:00
|
|
|
#define BGP_PEER_SU_UNSPEC(peer) (peer->su.sa.sa_family == AF_UNSPEC)
|
2004-05-01 10:44:08 +02:00
|
|
|
time_t uptime; /* Last Up/Down time */
|
|
|
|
time_t readtime; /* Last read time */
|
|
|
|
time_t resettime; /* Last reset time */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 02:40:40 +02:00
|
|
|
char *conf_if; /* neighbor interface config name. */
|
BGP: Trigger IPv6 router advertisements upon config of unnumbered neighbor
Instead of turning on IPv6 RA on every interface as soon as it has an IPv6
address, only enable it upon configuration of BGP neighbor. When the BGP
neighbor is deleted, signal that RAs can be turned off.
To support this, introduce new message interaction between BGP and Zebra.
Also, take appropriate actions in BGP upon interface add/del since the
unnumbered neighbor could exist prior to interface creation etc.
Only unnumbered IPv6 neighbors require RA, the /30 or /31 based neighbors
don't. However, to keep the interaction simple and not have to deal with
too many dynamic conditions (e.g., address deletes or neighbor change to/from
'v6only'), RAs on the interface are triggered upon any unnumbered neighbor
configuration.
BGP-triggered RAs will cause RAs to be initiated on the interface; however,
if BGP asks that RAs be stopped (upon delete of unnumbered neighbor), RAs
will continue to be exchanged if the operator has explicitly enabled.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-10640
Reviewed By: CCR-4589
Testing Done: Various manual and automated (refer to defect)
2016-05-02 22:53:38 +02:00
|
|
|
struct interface *ifp; /* corresponding interface */
|
2004-05-01 10:44:08 +02:00
|
|
|
char *ifname; /* bind interface name. */
|
|
|
|
char *update_if;
|
|
|
|
union sockunion *update_source;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2004-05-01 10:44:08 +02:00
|
|
|
union sockunion *su_local; /* Sockunion of local address. */
|
|
|
|
union sockunion *su_remote; /* Sockunion of remote address. */
|
|
|
|
int shared_network; /* Is this peer shared same network. */
|
|
|
|
struct bgp_nexthop nexthop; /* Nexthop */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-06-17 12:14:46 +02:00
|
|
|
/* Roles in bgp session */
|
|
|
|
uint8_t local_role;
|
2022-06-20 14:39:03 +02:00
|
|
|
uint8_t remote_role;
|
2022-06-17 12:14:46 +02:00
|
|
|
#define ROLE_PROVIDER 0
|
|
|
|
#define ROLE_RS_SERVER 1
|
|
|
|
#define ROLE_RS_CLIENT 2
|
|
|
|
#define ROLE_CUSTOMER 3
|
|
|
|
#define ROLE_PEER 4
|
2022-06-20 14:39:03 +02:00
|
|
|
#define ROLE_UNDEFINED 255
|
2022-06-17 12:14:46 +02:00
|
|
|
|
|
|
|
#define ROLE_NAME_MAX_LEN 20
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Peer address family configuration. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t afc[AFI_MAX][SAFI_MAX];
|
|
|
|
uint8_t afc_nego[AFI_MAX][SAFI_MAX];
|
|
|
|
uint8_t afc_adv[AFI_MAX][SAFI_MAX];
|
|
|
|
uint8_t afc_recv[AFI_MAX][SAFI_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-02-01 21:57:17 +01:00
|
|
|
/* Capability flags (reset in bgp_stop) */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t cap;
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_CAP_REFRESH_ADV (1U << 0) /* refresh advertised */
|
|
|
|
#define PEER_CAP_REFRESH_OLD_RCV (1U << 1) /* refresh old received */
|
|
|
|
#define PEER_CAP_REFRESH_NEW_RCV (1U << 2) /* refresh rfc received */
|
|
|
|
#define PEER_CAP_DYNAMIC_ADV (1U << 3) /* dynamic advertised */
|
|
|
|
#define PEER_CAP_DYNAMIC_RCV (1U << 4) /* dynamic received */
|
|
|
|
#define PEER_CAP_RESTART_ADV (1U << 5) /* restart advertised */
|
|
|
|
#define PEER_CAP_RESTART_RCV (1U << 6) /* restart received */
|
|
|
|
#define PEER_CAP_AS4_ADV (1U << 7) /* as4 advertised */
|
|
|
|
#define PEER_CAP_AS4_RCV (1U << 8) /* as4 received */
|
2022-04-27 21:30:29 +02:00
|
|
|
/* sent graceful-restart restart (R) bit */
|
|
|
|
#define PEER_CAP_GRACEFUL_RESTART_R_BIT_ADV (1U << 9)
|
|
|
|
/* received graceful-restart restart (R) bit */
|
|
|
|
#define PEER_CAP_GRACEFUL_RESTART_R_BIT_RCV (1U << 10)
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_CAP_ADDPATH_ADV (1U << 11) /* addpath advertised */
|
|
|
|
#define PEER_CAP_ADDPATH_RCV (1U << 12) /* addpath received */
|
|
|
|
#define PEER_CAP_ENHE_ADV (1U << 13) /* Extended nexthop advertised */
|
|
|
|
#define PEER_CAP_ENHE_RCV (1U << 14) /* Extended nexthop received */
|
|
|
|
#define PEER_CAP_HOSTNAME_ADV (1U << 15) /* hostname advertised */
|
|
|
|
#define PEER_CAP_HOSTNAME_RCV (1U << 16) /* hostname received */
|
2020-10-01 22:08:06 +02:00
|
|
|
#define PEER_CAP_ENHANCED_RR_ADV (1U << 17) /* enhanced rr advertised */
|
|
|
|
#define PEER_CAP_ENHANCED_RR_RCV (1U << 18) /* enhanced rr received */
|
2021-02-25 18:46:49 +01:00
|
|
|
#define PEER_CAP_EXTENDED_MESSAGE_ADV (1U << 19)
|
|
|
|
#define PEER_CAP_EXTENDED_MESSAGE_RCV (1U << 20)
|
bgpd: Add Long-lived Graceful Restart capability (restarter)
Restart Router mode.
FRRouting (Restarter):
```
bgp long-lived-graceful-restart stale-time 10
bgp graceful-restart restart-time 1
```
Tested with GoBGP (Helper):
```
long-lived-graceful-restart: advertised and received
Local:
ipv4-unicast, restart time 100000 sec
Remote:
ipv4-unicast, restart time 10 sec, forward flag set
```
Logs:
```
{"Key":"192.168.10.123","Reason":"graceful-restart","State":"BGP_FSM_ESTABLISHED","Topic":"Peer","level":"info","msg":"Peer Down","time":"2021-10-25T17:48:36+03:00"}
{"Key":"192.168.10.123","State":"BGP_FSM_IDLE","Topic":"Peer","level":"warning","msg":"graceful restart timer expired","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"start LLGR restart timer (10 sec) for ipv4-unicast","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"LLGR restart timer (10 sec) for ipv4-unicast expired","time":"2021-10-25T17:48:47+03:00"}
% ./gobgp global rib
Network Next Hop AS_PATH Age Attrs
S*>10.0.2.0/24 192.168.10.123 174 00:12:08 [{Origin: ?} {Med: 0} {Communities: llgr-stale} {Extcomms: [174:1282304808]}]
```
Helper mode will be added with upcoming PRs.
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-25 16:23:02 +02:00
|
|
|
#define PEER_CAP_LLGR_ADV (1U << 21)
|
|
|
|
#define PEER_CAP_LLGR_RCV (1U << 22)
|
2022-04-30 22:04:58 +02:00
|
|
|
/* sent graceful-restart notification (N) bit */
|
|
|
|
#define PEER_CAP_GRACEFUL_RESTART_N_BIT_ADV (1U << 23)
|
|
|
|
/* received graceful-restart notification (N) bit */
|
|
|
|
#define PEER_CAP_GRACEFUL_RESTART_N_BIT_RCV (1U << 24)
|
2022-06-17 12:14:46 +02:00
|
|
|
#define PEER_CAP_ROLE_ADV (1U << 25) /* role advertised */
|
|
|
|
#define PEER_CAP_ROLE_RCV (1U << 26) /* role received */
|
bgpd: Add BGP Software Version Capability
Implement: https://datatracker.ietf.org/doc/html/draft-abraitis-bgp-version-capability
Tested with GoBGP:
```
% ./gobgp neighbor 192.168.10.124
BGP neighbor is 192.168.10.124, remote AS 65001
BGP version 4, remote router ID 200.200.200.202
BGP state = ESTABLISHED, up for 00:01:49
BGP OutQ = 0, Flops = 0
Hold time is 3, keepalive interval is 1 seconds
Configured hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
multiprotocol:
ipv4-unicast: advertised and received
ipv6-unicast: advertised
route-refresh: advertised and received
extended-nexthop: advertised
Local: nlri: ipv4-unicast, nexthop: ipv6
UnknownCapability(6): received
UnknownCapability(9): received
graceful-restart: advertised and received
Local: restart time 10 sec
ipv6-unicast
ipv4-unicast
Remote: restart time 120 sec, notification flag set
ipv4-unicast, forward flag set
4-octet-as: advertised and received
add-path: received
Remote:
ipv4-unicast: receive
enhanced-route-refresh: received
long-lived-graceful-restart: advertised and received
Local:
ipv6-unicast, restart time 10 sec
ipv4-unicast, restart time 20 sec
Remote:
ipv4-unicast, restart time 0 sec, forward flag set
fqdn: advertised and received
Local:
name: donatas-pc, domain:
Remote:
name: spine1-debian-11, domain:
software-version: advertised and received
Local:
GoBGP/3.10.0
Remote:
FRRouting/8.5-dev-MyOwnFRRVersion-gdc92f44a45-dirt
cisco-route-refresh: received
Message statistics:
```
FRR side:
```
root@spine1-debian-11:~# vtysh -c 'show bgp neighbor 192.168.10.17 json' | \
> jq '."192.168.10.17".neighborCapabilities.softwareVersion.receivedSoftwareVersion'
"GoBGP/3.10.0"
root@spine1-debian-11:~#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-25 08:00:23 +01:00
|
|
|
#define PEER_CAP_SOFT_VERSION_ADV (1U << 27)
|
|
|
|
#define PEER_CAP_SOFT_VERSION_RCV (1U << 28)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-02-01 21:57:17 +01:00
|
|
|
/* Capability flags (reset in bgp_stop) */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t af_cap[AFI_MAX][SAFI_MAX];
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_CAP_ORF_PREFIX_SM_ADV (1U << 0) /* send-mode advertised */
|
|
|
|
#define PEER_CAP_ORF_PREFIX_RM_ADV (1U << 1) /* receive-mode advertised */
|
|
|
|
#define PEER_CAP_ORF_PREFIX_SM_RCV (1U << 2) /* send-mode received */
|
|
|
|
#define PEER_CAP_ORF_PREFIX_RM_RCV (1U << 3) /* receive-mode received */
|
|
|
|
#define PEER_CAP_ORF_PREFIX_SM_OLD_RCV (1U << 4) /* send-mode received */
|
|
|
|
#define PEER_CAP_ORF_PREFIX_RM_OLD_RCV (1U << 5) /* receive-mode received */
|
|
|
|
#define PEER_CAP_RESTART_AF_RCV (1U << 6) /* graceful restart afi/safi received */
|
|
|
|
#define PEER_CAP_RESTART_AF_PRESERVE_RCV (1U << 7) /* graceful restart afi/safi F-bit received */
|
|
|
|
#define PEER_CAP_ADDPATH_AF_TX_ADV (1U << 8) /* addpath tx advertised */
|
|
|
|
#define PEER_CAP_ADDPATH_AF_TX_RCV (1U << 9) /* addpath tx received */
|
|
|
|
#define PEER_CAP_ADDPATH_AF_RX_ADV (1U << 10) /* addpath rx advertised */
|
|
|
|
#define PEER_CAP_ADDPATH_AF_RX_RCV (1U << 11) /* addpath rx received */
|
|
|
|
#define PEER_CAP_ENHE_AF_ADV (1U << 12) /* Extended nexthopi afi/safi advertised */
|
|
|
|
#define PEER_CAP_ENHE_AF_RCV (1U << 13) /* Extended nexthop afi/safi received */
|
|
|
|
#define PEER_CAP_ENHE_AF_NEGO (1U << 14) /* Extended nexthop afi/safi negotiated */
|
bgpd: Add Long-lived Graceful Restart capability (restarter)
Restart Router mode.
FRRouting (Restarter):
```
bgp long-lived-graceful-restart stale-time 10
bgp graceful-restart restart-time 1
```
Tested with GoBGP (Helper):
```
long-lived-graceful-restart: advertised and received
Local:
ipv4-unicast, restart time 100000 sec
Remote:
ipv4-unicast, restart time 10 sec, forward flag set
```
Logs:
```
{"Key":"192.168.10.123","Reason":"graceful-restart","State":"BGP_FSM_ESTABLISHED","Topic":"Peer","level":"info","msg":"Peer Down","time":"2021-10-25T17:48:36+03:00"}
{"Key":"192.168.10.123","State":"BGP_FSM_IDLE","Topic":"Peer","level":"warning","msg":"graceful restart timer expired","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"start LLGR restart timer (10 sec) for ipv4-unicast","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"LLGR restart timer (10 sec) for ipv4-unicast expired","time":"2021-10-25T17:48:47+03:00"}
% ./gobgp global rib
Network Next Hop AS_PATH Age Attrs
S*>10.0.2.0/24 192.168.10.123 174 00:12:08 [{Origin: ?} {Med: 0} {Communities: llgr-stale} {Extcomms: [174:1282304808]}]
```
Helper mode will be added with upcoming PRs.
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-25 16:23:02 +02:00
|
|
|
#define PEER_CAP_LLGR_AF_ADV (1U << 15)
|
|
|
|
#define PEER_CAP_LLGR_AF_RCV (1U << 16)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Global configuration flags. */
|
bgpd: Implement group-overrides for peer flags
The current implementation of peer flags (e.g. shutdown, passive, ...)
only has partial support for overriding flags of a peer-group when the
peer is a member. Often settings might get lost if the user toys around
with the peer-group configuration, which can lead to disaster.
This commit introduces the same override implementation which was
previously integrated to support proper peer flag/attribute override on
the address-family level. The code is very similar and the global
attributes now use their separate state-arrays *flags_invert* and
*flags_override*.
The test suite for BGP peer attributes was extended to also check peer
global attributes, so that the newly introduced changes are covered. An
additional feature was added which allows to test an attribute with an
*interface-peer*, which can be configured by running `neighbor IF-TEST
interface`. This was introduced so that the dynamic runtime inversion of
the `extended-nexthop` flag, which is only enabled by default for
interface peers, can also be tested.
Last but not least, two small changes have been made to the current bgpd
implementation:
- The command `strict-capability-match` can now also be set on a
peer-group, it seems like this command slipped through while
implementing peer-groups in the very past.
- The macro `COND_FLAG` was introduced inside lib/zebra.h, which now
allows to either set or unset a flag based on a condition. The syntax
for using this macro is: `COND_FLAG(flag_variable, flag, condition)`
Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-11 19:49:20 +02:00
|
|
|
/*
|
|
|
|
* Parallel array to flags that indicates whether each flag originates
|
|
|
|
* from a peer-group or if it is config that is specific to this
|
|
|
|
* individual peer. If a flag is set independent of the peer-group, the
|
|
|
|
* same bit should be set here. If this peer is a peer-group, this
|
|
|
|
* memory region should be all zeros.
|
|
|
|
*
|
|
|
|
* The assumption is that the default state for all flags is unset,
|
|
|
|
* so if a flag is unset, the corresponding override flag is unset too.
|
|
|
|
* However if a flag is set, the corresponding override flag is set.
|
|
|
|
*/
|
2023-02-18 08:58:37 +01:00
|
|
|
uint64_t flags_override;
|
bgpd: Implement group-overrides for peer flags
The current implementation of peer flags (e.g. shutdown, passive, ...)
only has partial support for overriding flags of a peer-group when the
peer is a member. Often settings might get lost if the user toys around
with the peer-group configuration, which can lead to disaster.
This commit introduces the same override implementation which was
previously integrated to support proper peer flag/attribute override on
the address-family level. The code is very similar and the global
attributes now use their separate state-arrays *flags_invert* and
*flags_override*.
The test suite for BGP peer attributes was extended to also check peer
global attributes, so that the newly introduced changes are covered. An
additional feature was added which allows to test an attribute with an
*interface-peer*, which can be configured by running `neighbor IF-TEST
interface`. This was introduced so that the dynamic runtime inversion of
the `extended-nexthop` flag, which is only enabled by default for
interface peers, can also be tested.
Last but not least, two small changes have been made to the current bgpd
implementation:
- The command `strict-capability-match` can now also be set on a
peer-group, it seems like this command slipped through while
implementing peer-groups in the very past.
- The macro `COND_FLAG` was introduced inside lib/zebra.h, which now
allows to either set or unset a flag based on a condition. The syntax
for using this macro is: `COND_FLAG(flag_variable, flag, condition)`
Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-11 19:49:20 +02:00
|
|
|
/*
|
|
|
|
* Parallel array to flags that indicates whether the default behavior
|
|
|
|
* of *flags_override* should be inverted. If a flag is unset and the
|
|
|
|
* corresponding invert flag is set, the corresponding override flag
|
|
|
|
* would be set. However if a flag is set and the corresponding invert
|
|
|
|
* flag is unset, the corresponding override flag would be unset.
|
|
|
|
*
|
|
|
|
* This can be used for attributes like *send-community*, which are
|
|
|
|
* implicitely enabled and have to be disabled explicitely, compared to
|
|
|
|
* 'normal' attributes like *next-hop-self* which are implicitely set.
|
|
|
|
*
|
|
|
|
* All operations dealing with flags should apply the following boolean
|
|
|
|
* logic to keep the internal flag system in a sane state:
|
|
|
|
*
|
|
|
|
* value=0 invert=0 Inherit flag if member, otherwise unset flag
|
|
|
|
* value=0 invert=1 Unset flag unconditionally
|
|
|
|
* value=1 invert=0 Set flag unconditionally
|
|
|
|
* value=1 invert=1 Inherit flag if member, otherwise set flag
|
|
|
|
*
|
|
|
|
* Contrary to the implementation of *flags_override*, the flag
|
|
|
|
* inversion state can be set either on the peer OR the peer *and* the
|
|
|
|
* peer-group. This was done on purpose, as the inversion state of a
|
|
|
|
* flag can be determined on either the peer or the peer-group.
|
|
|
|
*
|
|
|
|
* Example: Enabling the cisco configuration mode inverts all flags
|
|
|
|
* related to *send-community* unconditionally for both peer-groups and
|
|
|
|
* peers.
|
|
|
|
*
|
|
|
|
* This behavior is different for interface peers though, which enable
|
|
|
|
* the *extended-nexthop* flag by default, which regular peers do not.
|
|
|
|
* As the peer-group can contain both regular and interface peers, the
|
|
|
|
* flag inversion state must be set on the peer only.
|
|
|
|
*
|
|
|
|
* When a peer inherits the configuration from a peer-group and the
|
|
|
|
* inversion state of the flag differs between peer and peer-group, the
|
|
|
|
* newly set value must equal to the inverted state of the peer-group.
|
|
|
|
*/
|
2023-02-18 08:58:37 +01:00
|
|
|
uint64_t flags_invert;
|
bgpd: Implement group-overrides for peer flags
The current implementation of peer flags (e.g. shutdown, passive, ...)
only has partial support for overriding flags of a peer-group when the
peer is a member. Often settings might get lost if the user toys around
with the peer-group configuration, which can lead to disaster.
This commit introduces the same override implementation which was
previously integrated to support proper peer flag/attribute override on
the address-family level. The code is very similar and the global
attributes now use their separate state-arrays *flags_invert* and
*flags_override*.
The test suite for BGP peer attributes was extended to also check peer
global attributes, so that the newly introduced changes are covered. An
additional feature was added which allows to test an attribute with an
*interface-peer*, which can be configured by running `neighbor IF-TEST
interface`. This was introduced so that the dynamic runtime inversion of
the `extended-nexthop` flag, which is only enabled by default for
interface peers, can also be tested.
Last but not least, two small changes have been made to the current bgpd
implementation:
- The command `strict-capability-match` can now also be set on a
peer-group, it seems like this command slipped through while
implementing peer-groups in the very past.
- The macro `COND_FLAG` was introduced inside lib/zebra.h, which now
allows to either set or unset a flag based on a condition. The syntax
for using this macro is: `COND_FLAG(flag_variable, flag, condition)`
Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-11 19:49:20 +02:00
|
|
|
/*
|
|
|
|
* Effective array for storing the peer/peer-group flags. In case of a
|
|
|
|
* peer-group, the peer-specific overrides (see flags_override and
|
|
|
|
* flags_invert) must be respected.
|
2023-02-18 08:58:37 +01:00
|
|
|
* When changing the structure of flags/af_flags, do not forget to
|
|
|
|
* change flags_invert/flags_override too.
|
bgpd: Implement group-overrides for peer flags
The current implementation of peer flags (e.g. shutdown, passive, ...)
only has partial support for overriding flags of a peer-group when the
peer is a member. Often settings might get lost if the user toys around
with the peer-group configuration, which can lead to disaster.
This commit introduces the same override implementation which was
previously integrated to support proper peer flag/attribute override on
the address-family level. The code is very similar and the global
attributes now use their separate state-arrays *flags_invert* and
*flags_override*.
The test suite for BGP peer attributes was extended to also check peer
global attributes, so that the newly introduced changes are covered. An
additional feature was added which allows to test an attribute with an
*interface-peer*, which can be configured by running `neighbor IF-TEST
interface`. This was introduced so that the dynamic runtime inversion of
the `extended-nexthop` flag, which is only enabled by default for
interface peers, can also be tested.
Last but not least, two small changes have been made to the current bgpd
implementation:
- The command `strict-capability-match` can now also be set on a
peer-group, it seems like this command slipped through while
implementing peer-groups in the very past.
- The macro `COND_FLAG` was introduced inside lib/zebra.h, which now
allows to either set or unset a flag based on a condition. The syntax
for using this macro is: `COND_FLAG(flag_variable, flag, condition)`
Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-11 19:49:20 +02:00
|
|
|
*/
|
2022-06-20 10:46:15 +02:00
|
|
|
uint64_t flags;
|
2022-06-27 15:36:56 +02:00
|
|
|
#define PEER_FLAG_PASSIVE (1ULL << 0) /* passive mode */
|
|
|
|
#define PEER_FLAG_SHUTDOWN (1ULL << 1) /* shutdown */
|
|
|
|
#define PEER_FLAG_DONT_CAPABILITY (1ULL << 2) /* dont-capability */
|
|
|
|
#define PEER_FLAG_OVERRIDE_CAPABILITY (1ULL << 3) /* override-capability */
|
|
|
|
#define PEER_FLAG_STRICT_CAP_MATCH (1ULL << 4) /* strict-match */
|
|
|
|
#define PEER_FLAG_DYNAMIC_CAPABILITY (1ULL << 5) /* dynamic capability */
|
|
|
|
#define PEER_FLAG_DISABLE_CONNECTED_CHECK (1ULL << 6) /* disable-connected-check */
|
|
|
|
#define PEER_FLAG_LOCAL_AS_NO_PREPEND (1ULL << 7) /* local-as no-prepend */
|
|
|
|
#define PEER_FLAG_LOCAL_AS_REPLACE_AS (1ULL << 8) /* local-as no-prepend replace-as */
|
|
|
|
#define PEER_FLAG_DELETE (1ULL << 9) /* mark the peer for deleting */
|
|
|
|
#define PEER_FLAG_CONFIG_NODE (1ULL << 10) /* the node to update configs on */
|
|
|
|
#define PEER_FLAG_LONESOUL (1ULL << 11)
|
|
|
|
#define PEER_FLAG_DYNAMIC_NEIGHBOR (1ULL << 12) /* dynamic neighbor */
|
|
|
|
#define PEER_FLAG_CAPABILITY_ENHE (1ULL << 13) /* Extended next-hop (rfc 5549)*/
|
|
|
|
#define PEER_FLAG_IFPEER_V6ONLY (1ULL << 14) /* if-based peer is v6 only */
|
|
|
|
#define PEER_FLAG_IS_RFAPI_HD (1ULL << 15) /* attached to rfapi HD */
|
|
|
|
#define PEER_FLAG_ENFORCE_FIRST_AS (1ULL << 16) /* enforce-first-as */
|
|
|
|
#define PEER_FLAG_ROUTEADV (1ULL << 17) /* route advertise */
|
|
|
|
#define PEER_FLAG_TIMER (1ULL << 18) /* keepalive & holdtime */
|
|
|
|
#define PEER_FLAG_TIMER_CONNECT (1ULL << 19) /* connect timer */
|
|
|
|
#define PEER_FLAG_PASSWORD (1ULL << 20) /* password */
|
|
|
|
#define PEER_FLAG_LOCAL_AS (1ULL << 21) /* local-as */
|
|
|
|
#define PEER_FLAG_UPDATE_SOURCE (1ULL << 22) /* update-source */
|
2017-10-10 16:00:10 +02:00
|
|
|
|
2019-10-23 07:32:45 +02:00
|
|
|
/* BGP-GR Peer related flags */
|
2022-06-27 15:36:56 +02:00
|
|
|
#define PEER_FLAG_GRACEFUL_RESTART_HELPER (1ULL << 23) /* Helper */
|
|
|
|
#define PEER_FLAG_GRACEFUL_RESTART (1ULL << 24) /* Graceful Restart */
|
|
|
|
#define PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT (1ULL << 25) /* Global-Inherit */
|
|
|
|
#define PEER_FLAG_RTT_SHUTDOWN (1ULL << 26) /* shutdown rtt */
|
|
|
|
#define PEER_FLAG_TIMER_DELAYOPEN (1ULL << 27) /* delayopen timer */
|
|
|
|
#define PEER_FLAG_TCP_MSS (1ULL << 28) /* tcp-mss */
|
2021-08-29 20:54:13 +02:00
|
|
|
/* Disable IEEE floating-point link bandwidth encoding in
|
|
|
|
* extended communities.
|
|
|
|
*/
|
2022-06-27 15:36:56 +02:00
|
|
|
#define PEER_FLAG_DISABLE_LINK_BW_ENCODING_IEEE (1ULL << 29)
|
2021-11-20 21:00:23 +01:00
|
|
|
/* force the extended format for Optional Parameters in OPEN message */
|
2022-06-27 15:36:56 +02:00
|
|
|
#define PEER_FLAG_EXTENDED_OPT_PARAMS (1ULL << 30)
|
2019-10-23 07:32:45 +02:00
|
|
|
|
2022-06-17 12:14:46 +02:00
|
|
|
/* BGP Open Policy flags.
|
2022-06-27 16:21:42 +02:00
|
|
|
* Enforce using roles on both sides:
|
|
|
|
* `local-role ROLE strict-mode` configured.
|
2022-06-17 12:14:46 +02:00
|
|
|
*/
|
2022-06-27 16:21:42 +02:00
|
|
|
#define PEER_FLAG_ROLE_STRICT_MODE (1ULL << 31)
|
|
|
|
/* `local-role` configured */
|
|
|
|
#define PEER_FLAG_ROLE (1ULL << 32)
|
2022-07-27 10:44:07 +02:00
|
|
|
#define PEER_FLAG_PORT (1ULL << 33)
|
2022-10-12 20:06:47 +02:00
|
|
|
#define PEER_FLAG_AIGP (1ULL << 34)
|
2022-11-15 14:04:23 +01:00
|
|
|
#define PEER_FLAG_GRACEFUL_SHUTDOWN (1ULL << 35)
|
bgpd: Add BGP Software Version Capability
Implement: https://datatracker.ietf.org/doc/html/draft-abraitis-bgp-version-capability
Tested with GoBGP:
```
% ./gobgp neighbor 192.168.10.124
BGP neighbor is 192.168.10.124, remote AS 65001
BGP version 4, remote router ID 200.200.200.202
BGP state = ESTABLISHED, up for 00:01:49
BGP OutQ = 0, Flops = 0
Hold time is 3, keepalive interval is 1 seconds
Configured hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
multiprotocol:
ipv4-unicast: advertised and received
ipv6-unicast: advertised
route-refresh: advertised and received
extended-nexthop: advertised
Local: nlri: ipv4-unicast, nexthop: ipv6
UnknownCapability(6): received
UnknownCapability(9): received
graceful-restart: advertised and received
Local: restart time 10 sec
ipv6-unicast
ipv4-unicast
Remote: restart time 120 sec, notification flag set
ipv4-unicast, forward flag set
4-octet-as: advertised and received
add-path: received
Remote:
ipv4-unicast: receive
enhanced-route-refresh: received
long-lived-graceful-restart: advertised and received
Local:
ipv6-unicast, restart time 10 sec
ipv4-unicast, restart time 20 sec
Remote:
ipv4-unicast, restart time 0 sec, forward flag set
fqdn: advertised and received
Local:
name: donatas-pc, domain:
Remote:
name: spine1-debian-11, domain:
software-version: advertised and received
Local:
GoBGP/3.10.0
Remote:
FRRouting/8.5-dev-MyOwnFRRVersion-gdc92f44a45-dirt
cisco-route-refresh: received
Message statistics:
```
FRR side:
```
root@spine1-debian-11:~# vtysh -c 'show bgp neighbor 192.168.10.17 json' | \
> jq '."192.168.10.17".neighborCapabilities.softwareVersion.receivedSoftwareVersion'
"GoBGP/3.10.0"
root@spine1-debian-11:~#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-25 08:00:23 +01:00
|
|
|
#define PEER_FLAG_CAPABILITY_SOFT_VERSION (1ULL << 36)
|
2022-06-17 12:14:46 +02:00
|
|
|
|
2019-10-23 07:32:45 +02:00
|
|
|
/*
|
|
|
|
*GR-Disabled mode means unset PEER_FLAG_GRACEFUL_RESTART
|
|
|
|
*& PEER_FLAG_GRACEFUL_RESTART_HELPER
|
|
|
|
*and PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT
|
|
|
|
*/
|
|
|
|
|
2019-11-25 16:18:15 +01:00
|
|
|
struct bgp_peer_gr PEER_GR_FSM[BGP_PEER_GR_MODE][BGP_PEER_GR_EVENT_CMD];
|
2019-10-23 07:32:45 +02:00
|
|
|
enum peer_mode peer_gr_present_state;
|
|
|
|
/* Non stop forwarding afi-safi count for BGP gr feature*/
|
|
|
|
uint8_t nsf_af_count;
|
|
|
|
|
|
|
|
uint8_t peer_gr_new_status_flag;
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_GRACEFUL_RESTART_NEW_STATE_HELPER (1U << 0)
|
|
|
|
#define PEER_GRACEFUL_RESTART_NEW_STATE_RESTART (1U << 1)
|
|
|
|
#define PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT (1U << 2)
|
2019-10-23 07:32:45 +02:00
|
|
|
|
2017-01-25 03:30:52 +01:00
|
|
|
/* outgoing message sent in CEASE_ADMIN_SHUTDOWN notify */
|
|
|
|
char *tx_shutdown_message;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-02-02 15:40:33 +01:00
|
|
|
/* NSF mode (graceful restart) */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t nsf[AFI_MAX][SAFI_MAX];
|
2019-10-24 16:59:43 +02:00
|
|
|
/* EOR Send time */
|
|
|
|
time_t eor_stime[AFI_MAX][SAFI_MAX];
|
|
|
|
/* Last update packet sent time */
|
|
|
|
time_t pkt_stime[AFI_MAX][SAFI_MAX];
|
2005-02-02 15:40:33 +01:00
|
|
|
|
2018-05-07 19:25:10 +02:00
|
|
|
/* Peer Per AF flags */
|
|
|
|
/*
|
bgpd: Implement group-overrides for peer flags
The current implementation of peer flags (e.g. shutdown, passive, ...)
only has partial support for overriding flags of a peer-group when the
peer is a member. Often settings might get lost if the user toys around
with the peer-group configuration, which can lead to disaster.
This commit introduces the same override implementation which was
previously integrated to support proper peer flag/attribute override on
the address-family level. The code is very similar and the global
attributes now use their separate state-arrays *flags_invert* and
*flags_override*.
The test suite for BGP peer attributes was extended to also check peer
global attributes, so that the newly introduced changes are covered. An
additional feature was added which allows to test an attribute with an
*interface-peer*, which can be configured by running `neighbor IF-TEST
interface`. This was introduced so that the dynamic runtime inversion of
the `extended-nexthop` flag, which is only enabled by default for
interface peers, can also be tested.
Last but not least, two small changes have been made to the current bgpd
implementation:
- The command `strict-capability-match` can now also be set on a
peer-group, it seems like this command slipped through while
implementing peer-groups in the very past.
- The macro `COND_FLAG` was introduced inside lib/zebra.h, which now
allows to either set or unset a flag based on a condition. The syntax
for using this macro is: `COND_FLAG(flag_variable, flag, condition)`
Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-11 19:49:20 +02:00
|
|
|
* Please consult the comments for *flags_override*, *flags_invert* and
|
|
|
|
* *flags* to understand what these three arrays do. The address-family
|
|
|
|
* specific attributes are being treated the exact same way as global
|
|
|
|
* peer attributes.
|
2018-05-07 19:25:10 +02:00
|
|
|
*/
|
2022-08-31 13:23:23 +02:00
|
|
|
uint64_t af_flags_override[AFI_MAX][SAFI_MAX];
|
|
|
|
uint64_t af_flags_invert[AFI_MAX][SAFI_MAX];
|
|
|
|
uint64_t af_flags[AFI_MAX][SAFI_MAX];
|
2022-08-31 13:39:38 +02:00
|
|
|
#define PEER_FLAG_SEND_COMMUNITY (1ULL << 0)
|
|
|
|
#define PEER_FLAG_SEND_EXT_COMMUNITY (1ULL << 1)
|
|
|
|
#define PEER_FLAG_NEXTHOP_SELF (1ULL << 2)
|
|
|
|
#define PEER_FLAG_REFLECTOR_CLIENT (1ULL << 3)
|
|
|
|
#define PEER_FLAG_RSERVER_CLIENT (1ULL << 4)
|
|
|
|
#define PEER_FLAG_SOFT_RECONFIG (1ULL << 5)
|
|
|
|
#define PEER_FLAG_AS_PATH_UNCHANGED (1ULL << 6)
|
|
|
|
#define PEER_FLAG_NEXTHOP_UNCHANGED (1ULL << 7)
|
|
|
|
#define PEER_FLAG_MED_UNCHANGED (1ULL << 8)
|
|
|
|
#define PEER_FLAG_DEFAULT_ORIGINATE (1ULL << 9)
|
|
|
|
#define PEER_FLAG_REMOVE_PRIVATE_AS (1ULL << 10)
|
|
|
|
#define PEER_FLAG_ALLOWAS_IN (1ULL << 11)
|
|
|
|
#define PEER_FLAG_ORF_PREFIX_SM (1ULL << 12)
|
|
|
|
#define PEER_FLAG_ORF_PREFIX_RM (1ULL << 13)
|
|
|
|
#define PEER_FLAG_MAX_PREFIX (1ULL << 14)
|
|
|
|
#define PEER_FLAG_MAX_PREFIX_WARNING (1ULL << 15)
|
|
|
|
#define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1ULL << 16)
|
|
|
|
#define PEER_FLAG_FORCE_NEXTHOP_SELF (1ULL << 17)
|
|
|
|
#define PEER_FLAG_REMOVE_PRIVATE_AS_ALL (1ULL << 18)
|
|
|
|
#define PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE (1ULL << 19)
|
|
|
|
#define PEER_FLAG_AS_OVERRIDE (1ULL << 20)
|
|
|
|
#define PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE (1ULL << 21)
|
|
|
|
#define PEER_FLAG_WEIGHT (1ULL << 24)
|
|
|
|
#define PEER_FLAG_ALLOWAS_IN_ORIGIN (1ULL << 25)
|
|
|
|
#define PEER_FLAG_SEND_LARGE_COMMUNITY (1ULL << 26)
|
|
|
|
#define PEER_FLAG_MAX_PREFIX_OUT (1ULL << 27)
|
|
|
|
#define PEER_FLAG_MAX_PREFIX_FORCE (1ULL << 28)
|
|
|
|
#define PEER_FLAG_DISABLE_ADDPATH_RX (1ULL << 29)
|
|
|
|
#define PEER_FLAG_SOO (1ULL << 30)
|
2023-01-17 17:14:27 +01:00
|
|
|
#define PEER_FLAG_ACCEPT_OWN (1ULL << 31)
|
[bgpd] TCP-MD5: password vty configuration and initial Linux support
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* bgp_packet.c: (bgp_open_receive) fix warning in a zlog call
* bgp_vty.c: (bgp_vty_return) add return code
* bgpd.c: (bgp_master_init) setup the socket list.
* bgp_network.c: Remove the dual IPv4/6 socket thing for now, which
was implemented by Michael, until such time as its clear its
required for Linux (see sockopt comments). IPv6 support, including
IPv4 sessions on AF_INET6 sockets, therefore is broken, and the
'-l 0.0.0.0' arguments would need to be given to bgpd to make
things work here.
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Tomohiko Kusuda <kusuda@inetcore.com>
Leigh Brown <leigh@solinno.co.uk>
* bgp_network.c: (bgp_md5_set_one) shim between libzebra tcp-md5
sockopt and bgpd.
(bgp_md5_set_socket) Helper for bgp_connect
(bgp_md5_set) setup TCP-MD5SIG for the given peer.
(bgp_connect) call out to bgp_md5_set_socket for the outgoing
connect socket.
(bgp_socket) save references to the listen sockets, needed if
TCP-MD5SIG is applied later or changed.
* bgp_vty.c: (*neighbor_password_cmd) New 'neighbor ... password'
commands.
* bgpd.c: (peer_{new,delete) manage TCP-MD5 password
(peer_group2peer_config_copy) inherit TCP-MD5 password
(peer_password_{un,}set) orchestrate the whole add/remove of TCP-MD5
passwords: applying checks, stopping peers, and trying to return
errors to UI, etc.
(bgp_config_write_peer) save password.
Fix missing newline in writeout of neighbor ... port.
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* sockunion.c: ifdef out various places that converted
v4mapped sockets to pure v4. Doesn't seem necessary at all,
presumably a workaround for now historical inet_ntop bugs (?)
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
* sockopt.{c,h}: (sockopt_tcp_signature) Add TCP-MD5SIG support.
2008-07-21 23:02:49 +02:00
|
|
|
|
bgpd: Re-use TX Addpath IDs where possible
The motivation for this patch is to address a concerning behavior of
tx-addpath-bestpath-per-AS. Prior to this patch, all paths' TX ID was
pre-determined as the path was received from a peer. However, this meant
that any time the path selected as best from an AS changed, bgpd had no
choice but to withdraw the previous best path, and advertise the new
best-path under a new TX ID. This could cause significant network
disruption, especially for the subset of prefixes coming from only one
AS that were also communicated over a bestpath-per-AS session.
The patch's general approach is best illustrated by
txaddpath_update_ids. After a bestpath run (required for best-per-AS to
know what will and will not be sent as addpaths) ID numbers will be
stripped from paths that no longer need to be sent, and held in a pool.
Then, paths that will be sent as addpaths and do not already have ID
numbers will allocate new ID numbers, pulling first from that pool.
Finally, anything left in the pool will be returned to the allocator.
In order for this to work, ID numbers had to be split by strategy. The
tx-addpath-All strategy would keep every ID number "in use" constantly,
preventing IDs from being transferred to different paths. Rather than
create two variables for ID, this patch create a more generic array that
will easily enable more addpath strategies to be implemented. The
previously described ID manipulations will happen per addpath strategy,
and will only be run for strategies that are enabled on at least one
peer.
Finally, the ID numbers are allocated from an allocator that tracks per
AFI/SAFI/Addpath Strategy which IDs are in use. Though it would be very
improbable, there was the possibility with the free-running counter
approach for rollover to cause two paths on the same prefix to get
assigned the same TX ID. As remote as the possibility is, we prefer to
not leave it to chance.
This ID re-use method is not perfect. In some cases you could still get
withdraw-then-add behaviors where not strictly necessary. In the case of
bestpath-per-AS this requires one AS to advertise a prefix for the first
time, then a second AS withdraws that prefix, all within the space of an
already pending MRAI timer. In those situations a withdraw-then-add is
more forgivable, and fixing it would probably require a much more
significant effort, as IDs would need to be moved to ADVs instead of
paths.
Signed-off-by Mitchell Skiba <mskiba@amazon.com>
2018-05-10 01:10:02 +02:00
|
|
|
enum bgp_addpath_strat addpath_type[AFI_MAX][SAFI_MAX];
|
|
|
|
|
[bgpd] TCP-MD5: password vty configuration and initial Linux support
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* bgp_packet.c: (bgp_open_receive) fix warning in a zlog call
* bgp_vty.c: (bgp_vty_return) add return code
* bgpd.c: (bgp_master_init) setup the socket list.
* bgp_network.c: Remove the dual IPv4/6 socket thing for now, which
was implemented by Michael, until such time as its clear its
required for Linux (see sockopt comments). IPv6 support, including
IPv4 sessions on AF_INET6 sockets, therefore is broken, and the
'-l 0.0.0.0' arguments would need to be given to bgpd to make
things work here.
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Tomohiko Kusuda <kusuda@inetcore.com>
Leigh Brown <leigh@solinno.co.uk>
* bgp_network.c: (bgp_md5_set_one) shim between libzebra tcp-md5
sockopt and bgpd.
(bgp_md5_set_socket) Helper for bgp_connect
(bgp_md5_set) setup TCP-MD5SIG for the given peer.
(bgp_connect) call out to bgp_md5_set_socket for the outgoing
connect socket.
(bgp_socket) save references to the listen sockets, needed if
TCP-MD5SIG is applied later or changed.
* bgp_vty.c: (*neighbor_password_cmd) New 'neighbor ... password'
commands.
* bgpd.c: (peer_{new,delete) manage TCP-MD5 password
(peer_group2peer_config_copy) inherit TCP-MD5 password
(peer_password_{un,}set) orchestrate the whole add/remove of TCP-MD5
passwords: applying checks, stopping peers, and trying to return
errors to UI, etc.
(bgp_config_write_peer) save password.
Fix missing newline in writeout of neighbor ... port.
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* sockunion.c: ifdef out various places that converted
v4mapped sockets to pure v4. Doesn't seem necessary at all,
presumably a workaround for now historical inet_ntop bugs (?)
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
* sockopt.{c,h}: (sockopt_tcp_signature) Add TCP-MD5SIG support.
2008-07-21 23:02:49 +02:00
|
|
|
/* MD5 password */
|
|
|
|
char *password;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* default-originate route-map. */
|
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
struct route_map *map;
|
|
|
|
} default_rmap[AFI_MAX][SAFI_MAX];
|
|
|
|
|
|
|
|
/* Peer status flags. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint16_t sflags;
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_STATUS_ACCEPT_PEER (1U << 0) /* accept peer */
|
|
|
|
#define PEER_STATUS_PREFIX_OVERFLOW (1U << 1) /* prefix-overflow */
|
|
|
|
#define PEER_STATUS_CAPABILITY_OPEN (1U << 2) /* capability open send */
|
|
|
|
#define PEER_STATUS_HAVE_ACCEPT (1U << 3) /* accept peer's parent */
|
|
|
|
#define PEER_STATUS_GROUP (1U << 4) /* peer-group conf */
|
|
|
|
#define PEER_STATUS_NSF_MODE (1U << 5) /* NSF aware peer */
|
|
|
|
#define PEER_STATUS_NSF_WAIT (1U << 6) /* wait comeback peer */
|
2021-11-20 21:00:23 +01:00
|
|
|
/* received extended format encoding for OPEN message */
|
|
|
|
#define PEER_STATUS_EXT_OPT_PARAMS_LENGTH (1U << 7)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-02-01 21:57:17 +01:00
|
|
|
/* Peer status af flags (reset in bgp_stop) */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint16_t af_sflags[AFI_MAX][SAFI_MAX];
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_STATUS_ORF_PREFIX_SEND (1U << 0) /* prefix-list send peer */
|
|
|
|
#define PEER_STATUS_ORF_WAIT_REFRESH (1U << 1) /* wait refresh received peer */
|
|
|
|
#define PEER_STATUS_PREFIX_THRESHOLD (1U << 2) /* exceed prefix-threshold */
|
|
|
|
#define PEER_STATUS_PREFIX_LIMIT (1U << 3) /* exceed prefix-limit */
|
|
|
|
#define PEER_STATUS_EOR_SEND (1U << 4) /* end-of-rib send to peer */
|
|
|
|
#define PEER_STATUS_EOR_RECEIVED (1U << 5) /* end-of-rib received from peer */
|
2020-10-01 22:08:06 +02:00
|
|
|
#define PEER_STATUS_ENHANCED_REFRESH (1U << 6) /* Enhanced Route Refresh */
|
|
|
|
#define PEER_STATUS_BORR_SEND (1U << 7) /* BoRR send to peer */
|
|
|
|
#define PEER_STATUS_BORR_RECEIVED (1U << 8) /* BoRR received from peer */
|
|
|
|
#define PEER_STATUS_EORR_SEND (1U << 9) /* EoRR send to peer */
|
|
|
|
#define PEER_STATUS_EORR_RECEIVED (1U << 10) /* EoRR received from peer */
|
2021-12-20 22:03:09 +01:00
|
|
|
/* LLGR aware peer */
|
|
|
|
#define PEER_STATUS_LLGR_WAIT (1U << 11)
|
2022-09-14 05:13:41 +02:00
|
|
|
#define PEER_STATUS_REFRESH_PENDING (1U << 12) /* refresh request from peer */
|
2022-11-04 14:40:52 +01:00
|
|
|
#define PEER_STATUS_RTT_SHUTDOWN (1U << 13) /* In shutdown state due to RTT */
|
2004-05-20 11:19:34 +02:00
|
|
|
|
2018-06-13 02:34:43 +02:00
|
|
|
/* Configured timer values. */
|
2017-07-05 17:38:57 +02:00
|
|
|
_Atomic uint32_t holdtime;
|
|
|
|
_Atomic uint32_t keepalive;
|
|
|
|
_Atomic uint32_t connect;
|
|
|
|
_Atomic uint32_t routeadv;
|
2020-10-20 16:49:58 +02:00
|
|
|
_Atomic uint32_t delayopen;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Timer values. */
|
2017-07-05 17:38:57 +02:00
|
|
|
_Atomic uint32_t v_start;
|
|
|
|
_Atomic uint32_t v_connect;
|
|
|
|
_Atomic uint32_t v_holdtime;
|
|
|
|
_Atomic uint32_t v_keepalive;
|
|
|
|
_Atomic uint32_t v_routeadv;
|
2020-10-20 16:49:58 +02:00
|
|
|
_Atomic uint32_t v_delayopen;
|
2017-07-05 17:38:57 +02:00
|
|
|
_Atomic uint32_t v_pmax_restart;
|
|
|
|
_Atomic uint32_t v_gr_restart;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Threads. */
|
|
|
|
struct thread *t_read;
|
2017-05-02 02:37:45 +02:00
|
|
|
struct thread *t_write;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct thread *t_start;
|
2017-09-25 04:18:15 +02:00
|
|
|
struct thread *t_connect_check_r;
|
|
|
|
struct thread *t_connect_check_w;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct thread *t_connect;
|
|
|
|
struct thread *t_holdtime;
|
|
|
|
struct thread *t_routeadv;
|
2020-10-20 16:49:58 +02:00
|
|
|
struct thread *t_delayopen;
|
2005-02-01 21:57:17 +01:00
|
|
|
struct thread *t_pmax_restart;
|
2005-02-02 15:40:33 +01:00
|
|
|
struct thread *t_gr_restart;
|
|
|
|
struct thread *t_gr_stale;
|
2021-12-20 22:03:09 +01:00
|
|
|
struct thread *t_llgr_stale[AFI_MAX][SAFI_MAX];
|
2022-11-08 13:36:56 +01:00
|
|
|
struct thread *t_revalidate_all[AFI_MAX][SAFI_MAX];
|
2017-04-18 20:11:43 +02:00
|
|
|
struct thread *t_generate_updgrp_packets;
|
2017-05-02 02:37:45 +02:00
|
|
|
struct thread *t_process_packet;
|
2021-08-08 14:23:24 +02:00
|
|
|
struct thread *t_process_packet_error;
|
2020-10-01 22:08:06 +02:00
|
|
|
struct thread *t_refresh_stalepath;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-03-27 21:47:23 +02:00
|
|
|
/* Thread flags. */
|
2018-11-19 19:44:35 +01:00
|
|
|
_Atomic uint32_t thread_flags;
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_THREAD_WRITES_ON (1U << 0)
|
|
|
|
#define PEER_THREAD_READS_ON (1U << 1)
|
|
|
|
#define PEER_THREAD_KEEPALIVES_ON (1U << 2)
|
2020-11-06 04:25:56 +01:00
|
|
|
#define PEER_THREAD_SUBGRP_ADV_DELAY (1U << 3)
|
|
|
|
|
2006-02-21 02:09:01 +01:00
|
|
|
/* workqueues */
|
|
|
|
struct work_queue *clear_node_queue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-02-09 19:22:50 +01:00
|
|
|
#define PEER_TOTAL_RX(peer) \
|
|
|
|
atomic_load_explicit(&peer->open_in, memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->update_in, memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->notify_in, memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->refresh_in, \
|
|
|
|
memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->keepalive_in, \
|
|
|
|
memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->dynamic_cap_in, \
|
|
|
|
memory_order_relaxed)
|
|
|
|
|
|
|
|
#define PEER_TOTAL_TX(peer) \
|
|
|
|
atomic_load_explicit(&peer->open_out, memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->update_out, \
|
|
|
|
memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->notify_out, \
|
|
|
|
memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->refresh_out, \
|
|
|
|
memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->keepalive_out, \
|
|
|
|
memory_order_relaxed) \
|
|
|
|
+ atomic_load_explicit(&peer->dynamic_cap_out, \
|
|
|
|
memory_order_relaxed)
|
2018-01-09 21:38:17 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Statistics field */
|
2018-02-09 22:14:22 +01:00
|
|
|
_Atomic uint32_t open_in; /* Open message input count */
|
|
|
|
_Atomic uint32_t open_out; /* Open message output count */
|
2017-07-05 17:38:57 +02:00
|
|
|
_Atomic uint32_t update_in; /* Update message input count */
|
|
|
|
_Atomic uint32_t update_out; /* Update message ouput count */
|
|
|
|
_Atomic time_t update_time; /* Update message received time. */
|
|
|
|
_Atomic uint32_t keepalive_in; /* Keepalive input count */
|
|
|
|
_Atomic uint32_t keepalive_out; /* Keepalive output count */
|
|
|
|
_Atomic uint32_t notify_in; /* Notify input count */
|
|
|
|
_Atomic uint32_t notify_out; /* Notify output count */
|
|
|
|
_Atomic uint32_t refresh_in; /* Route Refresh input count */
|
|
|
|
_Atomic uint32_t refresh_out; /* Route Refresh output count */
|
|
|
|
_Atomic uint32_t dynamic_cap_in; /* Dynamic Capability input count. */
|
2018-02-09 19:22:50 +01:00
|
|
|
_Atomic uint32_t dynamic_cap_out; /* Dynamic Capability output count. */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-04-24 21:40:50 +02:00
|
|
|
uint32_t stat_pfx_filter;
|
|
|
|
uint32_t stat_pfx_aspath_loop;
|
|
|
|
uint32_t stat_pfx_originator_loop;
|
|
|
|
uint32_t stat_pfx_cluster_loop;
|
|
|
|
uint32_t stat_pfx_nh_invalid;
|
|
|
|
uint32_t stat_pfx_dup_withdraw;
|
|
|
|
uint32_t stat_upd_7606; /* RFC7606: treat-as-withdraw */
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP state count */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t established; /* Established */
|
|
|
|
uint32_t dropped; /* Dropped */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
bgpd: bgpd-update-delay.patch
COMMAND:
'update-delay <max-delay in seconds> [<establish-wait in seconds>]'
DESCRIPTION:
This feature is used to enable read-only mode on BGP process restart or when
BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode
would begin as soon as the first peer reaches Established state and a timer
for <max-delay> seconds is started.
During this mode BGP doesn't run any best-path or generate any updates to its
peers. This mode continues until:
1. All the configured peers, except the shutdown peers, have sent explicit EOR
(End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
Established is considered an implicit-EOR.
If the <establish-wait> optional value is given, then BGP will wait for
peers to reach establish from the begining of the update-delay till the
establish-wait period is over, i.e. the minimum set of established peers for
which EOR is expected would be peers established during the establish-wait
window, not necessarily all the configured neighbors.
2. max-delay period is over.
On hitting any of the above two conditions, BGP resumes the decision process
and generates updates to its peers.
Default <max-delay> is 0, i.e. the feature is off by default.
This feature can be useful in reducing CPU/network used as BGP restarts/clears.
Particularly useful in the topologies where BGP learns a prefix from many peers.
Intermediate bestpaths are possible for the same prefix as peers get established
and start receiving updates at different times. This feature should offer a
value-add if the network has a high number of such prefixes.
IMPLEMENTATION OBJECTIVES:
Given this is an optional feature, minimized the code-churn. Used existing
constructs wherever possible (existing queue-plug/unplug were used to achieve
delay and resume of best-paths/update-generation). As a result, no new
data-structure(s) had to be defined and allocated. When the feature is disabled,
the new node is not exercised for the most part.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-20 02:40:33 +02:00
|
|
|
/* Update delay related fields */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t update_delay_over; /* When this is set, BGP is no more waiting
|
bgpd: bgpd-update-delay.patch
COMMAND:
'update-delay <max-delay in seconds> [<establish-wait in seconds>]'
DESCRIPTION:
This feature is used to enable read-only mode on BGP process restart or when
BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode
would begin as soon as the first peer reaches Established state and a timer
for <max-delay> seconds is started.
During this mode BGP doesn't run any best-path or generate any updates to its
peers. This mode continues until:
1. All the configured peers, except the shutdown peers, have sent explicit EOR
(End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
Established is considered an implicit-EOR.
If the <establish-wait> optional value is given, then BGP will wait for
peers to reach establish from the begining of the update-delay till the
establish-wait period is over, i.e. the minimum set of established peers for
which EOR is expected would be peers established during the establish-wait
window, not necessarily all the configured neighbors.
2. max-delay period is over.
On hitting any of the above two conditions, BGP resumes the decision process
and generates updates to its peers.
Default <max-delay> is 0, i.e. the feature is off by default.
This feature can be useful in reducing CPU/network used as BGP restarts/clears.
Particularly useful in the topologies where BGP learns a prefix from many peers.
Intermediate bestpaths are possible for the same prefix as peers get established
and start receiving updates at different times. This feature should offer a
value-add if the network has a high number of such prefixes.
IMPLEMENTATION OBJECTIVES:
Given this is an optional feature, minimized the code-churn. Used existing
constructs wherever possible (existing queue-plug/unplug were used to achieve
delay and resume of best-paths/update-generation). As a result, no new
data-structure(s) had to be defined and allocated. When the feature is disabled,
the new node is not exercised for the most part.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-20 02:40:33 +02:00
|
|
|
for EOR */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Syncronization list and time. */
|
|
|
|
struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX];
|
|
|
|
time_t synctime;
|
2017-07-05 17:38:57 +02:00
|
|
|
/* timestamp when the last UPDATE msg was written */
|
|
|
|
_Atomic time_t last_write;
|
|
|
|
/* timestamp when the last msg was written */
|
|
|
|
_Atomic time_t last_update;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-04-22 11:04:52 +02:00
|
|
|
/* only updated under io_mtx.
|
|
|
|
* last_sendq_warn is only for ratelimiting log warning messages.
|
|
|
|
*/
|
|
|
|
time_t last_sendq_ok, last_sendq_warn;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Notify data. */
|
|
|
|
struct bgp_notify notify;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Filter structure. */
|
|
|
|
struct bgp_filter filter[AFI_MAX][SAFI_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-05-21 12:09:25 +02:00
|
|
|
/*
|
|
|
|
* Parallel array to filter that indicates whether each filter
|
|
|
|
* originates from a peer-group or if it is config that is specific to
|
|
|
|
* this individual peer. If a filter is set independent of the
|
|
|
|
* peer-group the appropriate bit should be set here. If this peer is a
|
|
|
|
* peer-group, this memory region should be all zeros. The assumption
|
|
|
|
* is that the default state for all flags is unset. Due to filters
|
|
|
|
* having a direction (e.g. in/out/...), this array has a third
|
|
|
|
* dimension for storing the overrides independently per direction.
|
|
|
|
*
|
|
|
|
* Notes:
|
|
|
|
* - if a filter for an individual peer is unset, the corresponding
|
|
|
|
* override flag is unset and the peer is considered to be back in
|
|
|
|
* sync with the peer-group.
|
|
|
|
* - This does *not* contain the filter values, rather it contains
|
|
|
|
* whether the filter in filter (struct bgp_filter) is peer-specific.
|
|
|
|
*/
|
2020-03-10 10:29:48 +01:00
|
|
|
uint8_t filter_override[AFI_MAX][SAFI_MAX][FILTER_MAX];
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_FT_DISTRIBUTE_LIST (1U << 0) /* distribute-list */
|
|
|
|
#define PEER_FT_FILTER_LIST (1U << 1) /* filter-list */
|
|
|
|
#define PEER_FT_PREFIX_LIST (1U << 2) /* prefix-list */
|
|
|
|
#define PEER_FT_ROUTE_MAP (1U << 3) /* route-map */
|
|
|
|
#define PEER_FT_UNSUPPRESS_MAP (1U << 4) /* unsuppress-map */
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
#define PEER_FT_ADVERTISE_MAP (1U << 5) /* advertise-map */
|
2018-05-21 12:09:25 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* ORF Prefix-list */
|
|
|
|
struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 02:58:12 +02:00
|
|
|
/* Text description of last attribute rcvd */
|
|
|
|
char rcvd_attr_str[BUFSIZ];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 02:58:12 +02:00
|
|
|
/* Track if we printed the attribute in debugs */
|
|
|
|
int rcvd_attr_printed;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-07-24 10:08:05 +02:00
|
|
|
/* Accepted prefix count */
|
2019-10-03 23:30:28 +02:00
|
|
|
uint32_t pcount[AFI_MAX][SAFI_MAX];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Max prefix count. */
|
2019-10-03 23:30:28 +02:00
|
|
|
uint32_t pmax[AFI_MAX][SAFI_MAX];
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t pmax_threshold[AFI_MAX][SAFI_MAX];
|
|
|
|
uint16_t pmax_restart[AFI_MAX][SAFI_MAX];
|
2004-05-20 11:19:34 +02:00
|
|
|
#define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-01-17 15:04:18 +01:00
|
|
|
/* Send prefix count. */
|
|
|
|
uint32_t pmax_out[AFI_MAX][SAFI_MAX];
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* allowas-in. */
|
|
|
|
char allowas_in[AFI_MAX][SAFI_MAX];
|
2003-08-12 07:32:27 +02:00
|
|
|
|
2022-08-19 12:15:15 +02:00
|
|
|
/* soo */
|
|
|
|
struct ecommunity *soo[AFI_MAX][SAFI_MAX];
|
|
|
|
|
2016-10-10 16:53:34 +02:00
|
|
|
/* weight */
|
|
|
|
unsigned long weight[AFI_MAX][SAFI_MAX];
|
|
|
|
|
2004-05-20 11:19:34 +02:00
|
|
|
/* peer reset cause */
|
2019-04-24 20:14:19 +02:00
|
|
|
uint8_t last_reset;
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_DOWN_RID_CHANGE 1U /* bgp router-id command */
|
|
|
|
#define PEER_DOWN_REMOTE_AS_CHANGE 2U /* neighbor remote-as command */
|
|
|
|
#define PEER_DOWN_LOCAL_AS_CHANGE 3U /* neighbor local-as command */
|
|
|
|
#define PEER_DOWN_CLID_CHANGE 4U /* bgp cluster-id command */
|
|
|
|
#define PEER_DOWN_CONFED_ID_CHANGE 5U /* bgp confederation id command */
|
|
|
|
#define PEER_DOWN_CONFED_PEER_CHANGE 6U /* bgp confederation peer command */
|
|
|
|
#define PEER_DOWN_RR_CLIENT_CHANGE 7U /* neighbor rr-client command */
|
|
|
|
#define PEER_DOWN_RS_CLIENT_CHANGE 8U /* neighbor rs-client command */
|
|
|
|
#define PEER_DOWN_UPDATE_SOURCE_CHANGE 9U /* neighbor update-source command */
|
|
|
|
#define PEER_DOWN_AF_ACTIVATE 10U /* neighbor activate command */
|
|
|
|
#define PEER_DOWN_USER_SHUTDOWN 11U /* neighbor shutdown command */
|
|
|
|
#define PEER_DOWN_USER_RESET 12U /* clear ip bgp command */
|
|
|
|
#define PEER_DOWN_NOTIFY_RECEIVED 13U /* notification received */
|
|
|
|
#define PEER_DOWN_NOTIFY_SEND 14U /* notification send */
|
|
|
|
#define PEER_DOWN_CLOSE_SESSION 15U /* tcp session close */
|
|
|
|
#define PEER_DOWN_NEIGHBOR_DELETE 16U /* neghbor delete */
|
|
|
|
#define PEER_DOWN_RMAP_BIND 17U /* neghbor peer-group command */
|
|
|
|
#define PEER_DOWN_RMAP_UNBIND 18U /* no neighbor peer-group command */
|
|
|
|
#define PEER_DOWN_CAPABILITY_CHANGE 19U /* neighbor capability command */
|
|
|
|
#define PEER_DOWN_PASSIVE_CHANGE 20U /* neighbor passive command */
|
|
|
|
#define PEER_DOWN_MULTIHOP_CHANGE 21U /* neighbor multihop command */
|
|
|
|
#define PEER_DOWN_NSF_CLOSE_SESSION 22U /* NSF tcp session close */
|
|
|
|
#define PEER_DOWN_V6ONLY_CHANGE 23U /* if-based peering v6only toggled */
|
|
|
|
#define PEER_DOWN_BFD_DOWN 24U /* BFD down */
|
|
|
|
#define PEER_DOWN_IF_DOWN 25U /* Interface down */
|
|
|
|
#define PEER_DOWN_NBR_ADDR_DEL 26U /* Peer address lost */
|
|
|
|
#define PEER_DOWN_WAITING_NHT 27U /* Waiting for NHT to resolve */
|
|
|
|
#define PEER_DOWN_NBR_ADDR 28U /* Waiting for peer IPv6 IP Addr */
|
|
|
|
#define PEER_DOWN_VRF_UNINIT 29U /* Associated VRF is not init yet */
|
|
|
|
#define PEER_DOWN_NOAFI_ACTIVATED 30U /* No AFI/SAFI activated for peer */
|
|
|
|
#define PEER_DOWN_AS_SETS_REJECT 31U /* Reject routes with AS_SET */
|
|
|
|
#define PEER_DOWN_WAITING_OPEN 32U /* Waiting for open to succeed */
|
|
|
|
#define PEER_DOWN_PFX_COUNT 33U /* Reached received prefix count */
|
2021-09-03 13:56:35 +02:00
|
|
|
#define PEER_DOWN_SOCKET_ERROR 34U /* Some socket error happened */
|
2022-11-04 14:40:52 +01:00
|
|
|
#define PEER_DOWN_RTT_SHUTDOWN 35U /* Automatically shutdown due to RTT */
|
2020-02-11 01:25:52 +01:00
|
|
|
/*
|
|
|
|
* Remember to update peer_down_str in bgp_fsm.c when you add
|
|
|
|
* a new value to the last_reset reason
|
|
|
|
*/
|
|
|
|
|
2022-06-10 11:35:00 +02:00
|
|
|
uint16_t last_reset_cause_size;
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t last_reset_cause[BGP_MAX_PACKET_SIZE];
|
2004-05-20 11:19:34 +02:00
|
|
|
|
2003-08-12 07:32:27 +02:00
|
|
|
/* The kind of route-map Flags.*/
|
2019-09-24 14:24:10 +02:00
|
|
|
uint16_t rmap_type;
|
2020-09-02 21:11:26 +02:00
|
|
|
#define PEER_RMAP_TYPE_IN (1U << 0) /* neighbor route-map in */
|
|
|
|
#define PEER_RMAP_TYPE_OUT (1U << 1) /* neighbor route-map out */
|
|
|
|
#define PEER_RMAP_TYPE_NETWORK (1U << 2) /* network route-map */
|
|
|
|
#define PEER_RMAP_TYPE_REDISTRIBUTE (1U << 3) /* redistribute route-map */
|
|
|
|
#define PEER_RMAP_TYPE_DEFAULT (1U << 4) /* default-originate route-map */
|
|
|
|
#define PEER_RMAP_TYPE_NOSET (1U << 5) /* not allow to set commands */
|
|
|
|
#define PEER_RMAP_TYPE_IMPORT (1U << 6) /* neighbor route-map import */
|
|
|
|
#define PEER_RMAP_TYPE_EXPORT (1U << 7) /* neighbor route-map export */
|
|
|
|
#define PEER_RMAP_TYPE_AGGREGATE (1U << 8) /* aggregate-address route-map */
|
2015-05-20 03:29:16 +02:00
|
|
|
|
2021-02-26 20:50:51 +01:00
|
|
|
/** Peer overwrite configuration. */
|
|
|
|
struct bfd_session_config {
|
|
|
|
/**
|
|
|
|
* Manual configuration bit.
|
|
|
|
*
|
|
|
|
* This flag only makes sense for real peers (and not groups),
|
|
|
|
* it keeps track if the user explicitly configured BFD for a
|
|
|
|
* peer.
|
|
|
|
*/
|
|
|
|
bool manual;
|
|
|
|
/** Control Plane Independent. */
|
|
|
|
bool cbit;
|
|
|
|
/** Detection multiplier. */
|
|
|
|
uint8_t detection_multiplier;
|
|
|
|
/** Minimum required RX interval. */
|
|
|
|
uint32_t min_rx;
|
|
|
|
/** Minimum required TX interval. */
|
|
|
|
uint32_t min_tx;
|
|
|
|
/** Profile name. */
|
|
|
|
char profile[BFD_PROFILE_NAME_LEN];
|
|
|
|
/** Peer BFD session */
|
|
|
|
struct bfd_session_params *session;
|
|
|
|
} * bfd_config;
|
2015-09-11 05:10:16 +02:00
|
|
|
|
|
|
|
/* hostname and domainname advertised by host */
|
|
|
|
char *hostname;
|
|
|
|
char *domainname;
|
2016-12-07 12:25:24 +01:00
|
|
|
|
2019-10-29 20:29:09 +01:00
|
|
|
/* Sender side AS path loop detection. */
|
|
|
|
bool as_path_loop_detection;
|
|
|
|
|
2021-02-25 18:46:49 +01:00
|
|
|
/* Extended Message Support */
|
|
|
|
uint16_t max_packet_size;
|
|
|
|
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
/* Conditional advertisement */
|
bgpd: conditional advertisement - other match rules support
Sample Configuration with prefix-list and community match rules
---------------------------------------------------------------
R1 ------- R2(DUT) ------- R3
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 20.20.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/32
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.20.3 soft-reconfiguration inbound
neighbor 10.10.20.3 advertise-map ADV-MAP non-exist-map EXIST-MAP
exit-address-family
!
ip prefix-list DEFAULT seq 5 permit 1.1.1.5/32
ip prefix-list DEFAULT seq 10 permit 1.1.1.1/32
ip prefix-list EXIST seq 5 permit 10.10.10.10/32
ip prefix-list DEFAULT-ROUTE seq 5 permit 0.0.0.0/0
ip prefix-list IP1 seq 5 permit 10.139.224.0/20
ip prefix-list T2 seq 5 permit 1.1.1.5/32
!
bgp community-list standard DC-ROUTES seq 5 permit 64952:3008
bgp community-list standard DC-ROUTES seq 10 permit 64671:501
bgp community-list standard DC-ROUTES seq 15 permit 64950:3009
bgp community-list standard DEFAULT-ROUTE seq 5 permit 65013:200
!
route-map ADV-MAP permit 10
match ip address prefix-list IP1
!
route-map ADV-MAP permit 20
match community DC-ROUTES
!
route-map EXIST-MAP permit 10
match community DEFAULT-ROUTE
match ip address prefix-list DEFAULT-ROUTE
!
line vty
!
end
Router2#
Router2# show ip bgp 0.0.0.0
BGP routing table entry for 0.0.0.0/0
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
10.10.10.1 10.10.20.3
1
10.10.10.1 from 10.10.10.1 (10.139.224.1)
Origin IGP, metric 0, valid, external, best (First path received)
Community: 64848:3011 65011:200 65013:200
Last update: Tue Oct 6 02:39:42 2020
Router2#
Sample output with non-exist-map when default route present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 10.10.10.1 0 0 1 i
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 4 routes and 4 total paths
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 0.0.0.0 0 1 i
*> 1.1.1.5/32 0.0.0.0 0 1 i <<<<<<<<< non-exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 not advertised
Total number of prefixes 2
Sample output with non-exist-map when default route not present in table
------------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 3 routes and 3 total paths
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 1 i
*> 1.1.1.5/32 0.0.0.0 0 1 i
*> 10.139.224.0/20 0.0.0.0 0 1 ? <<<<<<<<< non-exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 advertised
Total number of prefixes 3
Router2#
Sample output with exist-map when default route present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 10.10.10.1 0 0 1 i
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 4 routes and 4 total paths
Router2#
Router2#
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 0.0.0.0 0 1 i
*> 1.1.1.1/32 0.0.0.0 0 1 i
*> 1.1.1.5/32 0.0.0.0 0 1 i
*> 10.139.224.0/20 0.0.0.0 0 1 ? <<<<<<<<< exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 advertised
Total number of prefixes 4
Router2#
Sample output with exist-map when default route not present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 10.10.10.1 0 0 1 i
*> 1.1.1.5/32 10.10.10.1 0 0 1 i
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
Displayed 3 routes and 3 total paths
Router2#
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.5/32 0.0.0.0 0 1 i <<<<<<<<< exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 not advertised
Total number of prefixes 1
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-10-05 19:40:56 +02:00
|
|
|
bool advmap_config_change[AFI_MAX][SAFI_MAX];
|
|
|
|
bool advmap_table_change;
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
|
bgpd: Support tcp-mss for bgp neighbors
Problem Statement:
=================
In scale setup BGP sessions start flapping.
RCA:
====
In virtualized environment there are multiple places where
MTU need to be set. If there are some places were MTU is not set
properly then there is chances that BGP packets get fragmented,
in scale setup this will lead to BGP session flap.
Fix:
====
A new tcp option is provided as part of this implementation,
which can be configured per neighbor and helps to set the TCP
max segment size. User need to derive the path MTU between the BGP
neighbors and set that value as part of tcp-mss setting.
1. CLI Configuration:
[no] neighbor <A.B.C.D|X:X::X:X|WORD> tcp-mss (1-65535)
2. Running config
frr# show running-config
router bgp 100
neighbor 198.51.100.2 tcp-mss 150 => new entry
neighbor 2001:DB8::2 tcp-mss 400 => new entry
3. Show command
frr# show bgp neighbors 198.51.100.2
BGP neighbor is 198.51.100.2, remote AS 100, local AS 100, internal link
Hostname: frr
Configured tcp-mss is 150, synced tcp-mss is 138 => new display
4. Show command json output
frr# show bgp neighbors 2001:DB8::2 json
{
"2001:DB8::2":{
"remoteAs":100,
"bgpTimerKeepAliveIntervalMsecs":60000,
"bgpTcpMssConfigured":400, => new entry
"bgpTcpMssSynced":388, => new entry
Risk:
=====
Low - This is a config driven feature and it sets the max segment
size for the TCP session between BGP peers.
Tests Executed:
===============
Have done manual testing with three router topology.
1. Executed basic config and un config scenarios
2. Verified if the config is updated in running config
during config and no config operation
3. Verified the show command output in both CLI format and
JSON format.
4. Verified if TCP SYN messages carry the max segment size
in their initial packets.
5. Verified the behaviour during clear bgp session.
6. done packet capture to see if the new segment size
takes effect.
Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
2021-04-08 12:28:35 +02:00
|
|
|
/* set TCP max segment size */
|
|
|
|
uint32_t tcp_mss;
|
|
|
|
|
bgpd: Add Long-lived Graceful Restart capability (restarter)
Restart Router mode.
FRRouting (Restarter):
```
bgp long-lived-graceful-restart stale-time 10
bgp graceful-restart restart-time 1
```
Tested with GoBGP (Helper):
```
long-lived-graceful-restart: advertised and received
Local:
ipv4-unicast, restart time 100000 sec
Remote:
ipv4-unicast, restart time 10 sec, forward flag set
```
Logs:
```
{"Key":"192.168.10.123","Reason":"graceful-restart","State":"BGP_FSM_ESTABLISHED","Topic":"Peer","level":"info","msg":"Peer Down","time":"2021-10-25T17:48:36+03:00"}
{"Key":"192.168.10.123","State":"BGP_FSM_IDLE","Topic":"Peer","level":"warning","msg":"graceful restart timer expired","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"start LLGR restart timer (10 sec) for ipv4-unicast","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"LLGR restart timer (10 sec) for ipv4-unicast expired","time":"2021-10-25T17:48:47+03:00"}
% ./gobgp global rib
Network Next Hop AS_PATH Age Attrs
S*>10.0.2.0/24 192.168.10.123 174 00:12:08 [{Origin: ?} {Med: 0} {Communities: llgr-stale} {Extcomms: [174:1282304808]}]
```
Helper mode will be added with upcoming PRs.
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-25 16:23:02 +02:00
|
|
|
/* Long-lived Graceful Restart */
|
|
|
|
struct llgr_info llgr[AFI_MAX][SAFI_MAX];
|
|
|
|
|
2022-03-09 14:28:38 +01:00
|
|
|
bool shut_during_cfg;
|
|
|
|
|
2023-01-06 13:33:03 +01:00
|
|
|
#define BGP_ATTR_MAX 255
|
|
|
|
/* Path attributes discard */
|
|
|
|
bool discard_attrs[BGP_ATTR_MAX];
|
|
|
|
|
2023-01-24 10:02:24 +01:00
|
|
|
/* Path attributes treat-as-withdraw */
|
|
|
|
bool withdraw_attrs[BGP_ATTR_MAX];
|
|
|
|
|
bgpd: Add BGP Software Version Capability
Implement: https://datatracker.ietf.org/doc/html/draft-abraitis-bgp-version-capability
Tested with GoBGP:
```
% ./gobgp neighbor 192.168.10.124
BGP neighbor is 192.168.10.124, remote AS 65001
BGP version 4, remote router ID 200.200.200.202
BGP state = ESTABLISHED, up for 00:01:49
BGP OutQ = 0, Flops = 0
Hold time is 3, keepalive interval is 1 seconds
Configured hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
multiprotocol:
ipv4-unicast: advertised and received
ipv6-unicast: advertised
route-refresh: advertised and received
extended-nexthop: advertised
Local: nlri: ipv4-unicast, nexthop: ipv6
UnknownCapability(6): received
UnknownCapability(9): received
graceful-restart: advertised and received
Local: restart time 10 sec
ipv6-unicast
ipv4-unicast
Remote: restart time 120 sec, notification flag set
ipv4-unicast, forward flag set
4-octet-as: advertised and received
add-path: received
Remote:
ipv4-unicast: receive
enhanced-route-refresh: received
long-lived-graceful-restart: advertised and received
Local:
ipv6-unicast, restart time 10 sec
ipv4-unicast, restart time 20 sec
Remote:
ipv4-unicast, restart time 0 sec, forward flag set
fqdn: advertised and received
Local:
name: donatas-pc, domain:
Remote:
name: spine1-debian-11, domain:
software-version: advertised and received
Local:
GoBGP/3.10.0
Remote:
FRRouting/8.5-dev-MyOwnFRRVersion-gdc92f44a45-dirt
cisco-route-refresh: received
Message statistics:
```
FRR side:
```
root@spine1-debian-11:~# vtysh -c 'show bgp neighbor 192.168.10.17 json' | \
> jq '."192.168.10.17".neighborCapabilities.softwareVersion.receivedSoftwareVersion'
"GoBGP/3.10.0"
root@spine1-debian-11:~#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-25 08:00:23 +01:00
|
|
|
/* BGP Software Version Capability */
|
|
|
|
#define BGP_MAX_SOFT_VERSION 64
|
|
|
|
char *soft_version;
|
|
|
|
|
2016-12-07 12:25:24 +01:00
|
|
|
QOBJ_FIELDS;
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
2016-12-07 12:25:24 +01:00
|
|
|
DECLARE_QOBJ_TYPE(peer);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
bgpd: Improve group overrides for AF flags
The current implementation for overriding peer-group configuration on a
peer member consists of several bandaids, which introduce more issues
than they fix. A generic approach for implementing peer-group overrides
for address-family flags is clearly missing.
This commit implements a generic and sane approach to overriding
peer-group configuration on a peer-member. A separate peer attribute
called 'af_flags_override' which was introduced in 04e1c5b is being used
to keep track of all address-family flags, storing whether the
configuration is being inherited from the parent-group or overridden.
All address-family flags are being supported by this implementation
(note: flags, not filters/maps) except 'send-community', which currently
breaks due to having the three flags enabled by default, which is not
being properly handled within this commit; all flags are supposed to
have an 'off'/'false' state by default.
In the interest of readability and comprehensibility, the flag
'send-community' is being fixed in a separate commit.
The following rules apply when looking at the new peer-group override
implementation this commit provides:
- Each peer-group can enable every flag (except the limitations noted
above), which gets automatically inherited to all members.
- Each peer can enable each flag independently and/or modify their
value, if available. (e.g.: weight <value>)
- Each command executed on a neighbor/peer gets explicitely set as an
override, so even when the peer-group has the same kind of
configuration, both will show up in 'show running-configuration'.
- Executing 'no <command>' on a peer will remove the peer-specific
configuration and make the peer inherit the configuration from the
peer-group again.
- Executing 'no <command>' on a peer-group will only remove the flag
from the peer-group, however not from peers explicitely setting that
flag.
This guarantees a clean implementation which does not break, even when
constantly messing with the flags of a peer-group. The same behavior is
present in Cisco devices, so people familiar with those should feel safe
when dealing with FRRs peer-groups.
The only restriction that now applies is that single peer cannot
disable a flag which was set by a peer-group, because 'no <command>' is
already being used for disabling a peer-specific override. This is not
supported by any known vendor though, would require many specific
edge-cases and magic comparisons and will most likely only end up
confusing the user. Additionally, peer-groups should only contain flags
which are being used by all peer members.
Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-19 22:10:48 +02:00
|
|
|
/* Inherit peer attribute from peer-group. */
|
2018-06-12 17:09:49 +02:00
|
|
|
#define PEER_ATTR_INHERIT(peer, group, attr) \
|
|
|
|
((peer)->attr = (group)->conf->attr)
|
|
|
|
#define PEER_STR_ATTR_INHERIT(peer, group, attr, mt) \
|
bgpd: Improve group overrides for AF flags
The current implementation for overriding peer-group configuration on a
peer member consists of several bandaids, which introduce more issues
than they fix. A generic approach for implementing peer-group overrides
for address-family flags is clearly missing.
This commit implements a generic and sane approach to overriding
peer-group configuration on a peer-member. A separate peer attribute
called 'af_flags_override' which was introduced in 04e1c5b is being used
to keep track of all address-family flags, storing whether the
configuration is being inherited from the parent-group or overridden.
All address-family flags are being supported by this implementation
(note: flags, not filters/maps) except 'send-community', which currently
breaks due to having the three flags enabled by default, which is not
being properly handled within this commit; all flags are supposed to
have an 'off'/'false' state by default.
In the interest of readability and comprehensibility, the flag
'send-community' is being fixed in a separate commit.
The following rules apply when looking at the new peer-group override
implementation this commit provides:
- Each peer-group can enable every flag (except the limitations noted
above), which gets automatically inherited to all members.
- Each peer can enable each flag independently and/or modify their
value, if available. (e.g.: weight <value>)
- Each command executed on a neighbor/peer gets explicitely set as an
override, so even when the peer-group has the same kind of
configuration, both will show up in 'show running-configuration'.
- Executing 'no <command>' on a peer will remove the peer-specific
configuration and make the peer inherit the configuration from the
peer-group again.
- Executing 'no <command>' on a peer-group will only remove the flag
from the peer-group, however not from peers explicitely setting that
flag.
This guarantees a clean implementation which does not break, even when
constantly messing with the flags of a peer-group. The same behavior is
present in Cisco devices, so people familiar with those should feel safe
when dealing with FRRs peer-groups.
The only restriction that now applies is that single peer cannot
disable a flag which was set by a peer-group, because 'no <command>' is
already being used for disabling a peer-specific override. This is not
supported by any known vendor though, would require many specific
edge-cases and magic comparisons and will most likely only end up
confusing the user. Additionally, peer-groups should only contain flags
which are being used by all peer members.
Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-19 22:10:48 +02:00
|
|
|
do { \
|
2020-02-04 19:19:37 +01:00
|
|
|
XFREE(mt, (peer)->attr); \
|
2018-06-12 17:09:49 +02:00
|
|
|
if ((group)->conf->attr) \
|
|
|
|
(peer)->attr = XSTRDUP(mt, (group)->conf->attr); \
|
bgpd: Improve group overrides for AF flags
The current implementation for overriding peer-group configuration on a
peer member consists of several bandaids, which introduce more issues
than they fix. A generic approach for implementing peer-group overrides
for address-family flags is clearly missing.
This commit implements a generic and sane approach to overriding
peer-group configuration on a peer-member. A separate peer attribute
called 'af_flags_override' which was introduced in 04e1c5b is being used
to keep track of all address-family flags, storing whether the
configuration is being inherited from the parent-group or overridden.
All address-family flags are being supported by this implementation
(note: flags, not filters/maps) except 'send-community', which currently
breaks due to having the three flags enabled by default, which is not
being properly handled within this commit; all flags are supposed to
have an 'off'/'false' state by default.
In the interest of readability and comprehensibility, the flag
'send-community' is being fixed in a separate commit.
The following rules apply when looking at the new peer-group override
implementation this commit provides:
- Each peer-group can enable every flag (except the limitations noted
above), which gets automatically inherited to all members.
- Each peer can enable each flag independently and/or modify their
value, if available. (e.g.: weight <value>)
- Each command executed on a neighbor/peer gets explicitely set as an
override, so even when the peer-group has the same kind of
configuration, both will show up in 'show running-configuration'.
- Executing 'no <command>' on a peer will remove the peer-specific
configuration and make the peer inherit the configuration from the
peer-group again.
- Executing 'no <command>' on a peer-group will only remove the flag
from the peer-group, however not from peers explicitely setting that
flag.
This guarantees a clean implementation which does not break, even when
constantly messing with the flags of a peer-group. The same behavior is
present in Cisco devices, so people familiar with those should feel safe
when dealing with FRRs peer-groups.
The only restriction that now applies is that single peer cannot
disable a flag which was set by a peer-group, because 'no <command>' is
already being used for disabling a peer-specific override. This is not
supported by any known vendor though, would require many specific
edge-cases and magic comparisons and will most likely only end up
confusing the user. Additionally, peer-groups should only contain flags
which are being used by all peer members.
Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-19 22:10:48 +02:00
|
|
|
else \
|
|
|
|
(peer)->attr = NULL; \
|
|
|
|
} while (0)
|
2018-06-13 19:34:17 +02:00
|
|
|
#define PEER_SU_ATTR_INHERIT(peer, group, attr) \
|
|
|
|
do { \
|
|
|
|
if ((peer)->attr) \
|
|
|
|
sockunion_free((peer)->attr); \
|
|
|
|
if ((group)->conf->attr) \
|
|
|
|
(peer)->attr = sockunion_dup((group)->conf->attr); \
|
|
|
|
else \
|
|
|
|
(peer)->attr = NULL; \
|
|
|
|
} while (0)
|
bgpd: Improve group overrides for AF flags
The current implementation for overriding peer-group configuration on a
peer member consists of several bandaids, which introduce more issues
than they fix. A generic approach for implementing peer-group overrides
for address-family flags is clearly missing.
This commit implements a generic and sane approach to overriding
peer-group configuration on a peer-member. A separate peer attribute
called 'af_flags_override' which was introduced in 04e1c5b is being used
to keep track of all address-family flags, storing whether the
configuration is being inherited from the parent-group or overridden.
All address-family flags are being supported by this implementation
(note: flags, not filters/maps) except 'send-community', which currently
breaks due to having the three flags enabled by default, which is not
being properly handled within this commit; all flags are supposed to
have an 'off'/'false' state by default.
In the interest of readability and comprehensibility, the flag
'send-community' is being fixed in a separate commit.
The following rules apply when looking at the new peer-group override
implementation this commit provides:
- Each peer-group can enable every flag (except the limitations noted
above), which gets automatically inherited to all members.
- Each peer can enable each flag independently and/or modify their
value, if available. (e.g.: weight <value>)
- Each command executed on a neighbor/peer gets explicitely set as an
override, so even when the peer-group has the same kind of
configuration, both will show up in 'show running-configuration'.
- Executing 'no <command>' on a peer will remove the peer-specific
configuration and make the peer inherit the configuration from the
peer-group again.
- Executing 'no <command>' on a peer-group will only remove the flag
from the peer-group, however not from peers explicitely setting that
flag.
This guarantees a clean implementation which does not break, even when
constantly messing with the flags of a peer-group. The same behavior is
present in Cisco devices, so people familiar with those should feel safe
when dealing with FRRs peer-groups.
The only restriction that now applies is that single peer cannot
disable a flag which was set by a peer-group, because 'no <command>' is
already being used for disabling a peer-specific override. This is not
supported by any known vendor though, would require many specific
edge-cases and magic comparisons and will most likely only end up
confusing the user. Additionally, peer-groups should only contain flags
which are being used by all peer members.
Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-19 22:10:48 +02:00
|
|
|
|
2016-02-12 21:18:28 +01:00
|
|
|
/* Check if suppress start/restart of sessions to peer. */
|
|
|
|
#define BGP_PEER_START_SUPPRESSED(P) \
|
2022-03-09 14:28:38 +01:00
|
|
|
(CHECK_FLAG((P)->flags, PEER_FLAG_SHUTDOWN) || \
|
|
|
|
CHECK_FLAG((P)->sflags, PEER_STATUS_PREFIX_OVERFLOW) || \
|
|
|
|
CHECK_FLAG((P)->bgp->flags, BGP_FLAG_SHUTDOWN) || \
|
|
|
|
(P)->shut_during_cfg)
|
2016-02-12 21:18:28 +01:00
|
|
|
|
2020-11-06 04:25:56 +01:00
|
|
|
#define PEER_ROUTE_ADV_DELAY(peer) \
|
|
|
|
(CHECK_FLAG(peer->thread_flags, PEER_THREAD_SUBGRP_ADV_DELAY))
|
2020-11-06 04:16:04 +01:00
|
|
|
|
[bgpd] TCP-MD5: password vty configuration and initial Linux support
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* bgp_packet.c: (bgp_open_receive) fix warning in a zlog call
* bgp_vty.c: (bgp_vty_return) add return code
* bgpd.c: (bgp_master_init) setup the socket list.
* bgp_network.c: Remove the dual IPv4/6 socket thing for now, which
was implemented by Michael, until such time as its clear its
required for Linux (see sockopt comments). IPv6 support, including
IPv4 sessions on AF_INET6 sockets, therefore is broken, and the
'-l 0.0.0.0' arguments would need to be given to bgpd to make
things work here.
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Tomohiko Kusuda <kusuda@inetcore.com>
Leigh Brown <leigh@solinno.co.uk>
* bgp_network.c: (bgp_md5_set_one) shim between libzebra tcp-md5
sockopt and bgpd.
(bgp_md5_set_socket) Helper for bgp_connect
(bgp_md5_set) setup TCP-MD5SIG for the given peer.
(bgp_connect) call out to bgp_md5_set_socket for the outgoing
connect socket.
(bgp_socket) save references to the listen sockets, needed if
TCP-MD5SIG is applied later or changed.
* bgp_vty.c: (*neighbor_password_cmd) New 'neighbor ... password'
commands.
* bgpd.c: (peer_{new,delete) manage TCP-MD5 password
(peer_group2peer_config_copy) inherit TCP-MD5 password
(peer_password_{un,}set) orchestrate the whole add/remove of TCP-MD5
passwords: applying checks, stopping peers, and trying to return
errors to UI, etc.
(bgp_config_write_peer) save password.
Fix missing newline in writeout of neighbor ... port.
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* sockunion.c: ifdef out various places that converted
v4mapped sockets to pure v4. Doesn't seem necessary at all,
presumably a workaround for now historical inet_ntop bugs (?)
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
* sockopt.{c,h}: (sockopt_tcp_signature) Add TCP-MD5SIG support.
2008-07-21 23:02:49 +02:00
|
|
|
#define PEER_PASSWORD_MINLEN (1)
|
|
|
|
#define PEER_PASSWORD_MAXLEN (80)
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* This structure's member directly points incoming packet data
|
|
|
|
stream. */
|
|
|
|
struct bgp_nlri {
|
|
|
|
/* AFI. */
|
2017-08-01 02:37:46 +02:00
|
|
|
uint16_t afi; /* iana_afi_t */
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* SAFI. */
|
2017-08-01 02:37:46 +02:00
|
|
|
uint8_t safi; /* iana_safi_t */
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Pointer to NLRI byte stream. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t *nlri;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Length of whole NLRI. */
|
|
|
|
bgp_size_t length;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* BGP versions. */
|
|
|
|
#define BGP_VERSION_4 4
|
|
|
|
|
|
|
|
/* Default BGP port number. */
|
|
|
|
#define BGP_PORT_DEFAULT 179
|
|
|
|
|
2022-01-05 11:11:27 +01:00
|
|
|
/* Extended BGP Administrative Shutdown Communication */
|
|
|
|
#define BGP_ADMIN_SHUTDOWN_MSG_LEN 255
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP minimum message size. */
|
|
|
|
#define BGP_MSG_OPEN_MIN_SIZE (BGP_HEADER_SIZE + 10)
|
|
|
|
#define BGP_MSG_UPDATE_MIN_SIZE (BGP_HEADER_SIZE + 4)
|
|
|
|
#define BGP_MSG_NOTIFY_MIN_SIZE (BGP_HEADER_SIZE + 2)
|
|
|
|
#define BGP_MSG_KEEPALIVE_MIN_SIZE (BGP_HEADER_SIZE + 0)
|
|
|
|
#define BGP_MSG_ROUTE_REFRESH_MIN_SIZE (BGP_HEADER_SIZE + 4)
|
|
|
|
#define BGP_MSG_CAPABILITY_MIN_SIZE (BGP_HEADER_SIZE + 3)
|
|
|
|
|
|
|
|
/* BGP message types. */
|
|
|
|
#define BGP_MSG_OPEN 1
|
|
|
|
#define BGP_MSG_UPDATE 2
|
|
|
|
#define BGP_MSG_NOTIFY 3
|
|
|
|
#define BGP_MSG_KEEPALIVE 4
|
|
|
|
#define BGP_MSG_ROUTE_REFRESH_NEW 5
|
|
|
|
#define BGP_MSG_CAPABILITY 6
|
|
|
|
#define BGP_MSG_ROUTE_REFRESH_OLD 128
|
|
|
|
|
|
|
|
/* BGP open optional parameter. */
|
|
|
|
#define BGP_OPEN_OPT_CAP 2
|
|
|
|
|
|
|
|
/* BGP4 attribute type codes. */
|
|
|
|
#define BGP_ATTR_ORIGIN 1
|
|
|
|
#define BGP_ATTR_AS_PATH 2
|
|
|
|
#define BGP_ATTR_NEXT_HOP 3
|
|
|
|
#define BGP_ATTR_MULTI_EXIT_DISC 4
|
|
|
|
#define BGP_ATTR_LOCAL_PREF 5
|
|
|
|
#define BGP_ATTR_ATOMIC_AGGREGATE 6
|
|
|
|
#define BGP_ATTR_AGGREGATOR 7
|
|
|
|
#define BGP_ATTR_COMMUNITIES 8
|
|
|
|
#define BGP_ATTR_ORIGINATOR_ID 9
|
|
|
|
#define BGP_ATTR_CLUSTER_LIST 10
|
|
|
|
#define BGP_ATTR_MP_REACH_NLRI 14
|
|
|
|
#define BGP_ATTR_MP_UNREACH_NLRI 15
|
|
|
|
#define BGP_ATTR_EXT_COMMUNITIES 16
|
[bgpd] Merge AS4 support
2007-10-14 Paul Jakma <paul.jakma@sun.com>
* NEWS: Note that MRT dumps are now version 2
* (general) Merge in Juergen Kammer's AS4 patch.
2007-09-27 Paul Jakma <paul.jakma@sun.com>
* bgp_aspath.c: (assegment_normalise) remove duplicates from
from sets.
(aspath_reconcile_as4) disregard a broken part of the RFC around
error handling in path reconciliation.
* aspath_test.c: Test dupe-weeding from sets.
Test that reconciliation merges AS_PATH and AS4_PATH where
former is shorter than latter.
2007-09-26 Paul Jakma <paul.jakma@sun.com>
* aspath_test.c: Test AS4_PATH reconcilation where length
of AS_PATH and AS4_PATH is same.
2007-09-25 Paul Jakma <paul.jakma@sun.com>
* bgp_open.c: (peek_for_as4_capability) Fix to work.
* bgp_packet.c: (bgp_open_receive) Fix sanity check of as4.
* tests/bgp_capability_test.c: (general) Extend tests to validate
peek_for_as4_capability.
Add test of full OPEN Option block, with multiple capabilities,
both as a series of Option, and a single option.
Add some crap to beginning of stream, to prevent code depending
on getp == 0.
2007-09-18 Paul Jakma <paul.jakma@sun.com>
* bgp_open.c: (bgp_capability_as4) debug printf inline with others.
(peek_for_as4_capability) There's no need to signal failure, as
failure is better dealt with through full capability parser -
just return the AS4, simpler.
* bgp_packet.c: (bgp_open_receive) Update to match
peek_for_as4_capability change.
Allow use of BGP_AS_TRANS by 2b speakers.
Use NOTIFY_OPEN_ERR rather than CEASE for OPEN parsing errors.
(bgp_capability_msg_parse) missing argument to debug print
(bgp_capability_receive) missing return values.
* tests/bgp_capability_test.c: (parse_test) update for changes to
peek_for_as4_capability
2007-07-25 Paul Jakma <paul.jakma@sun.com>
* Remove 2-byte size macros, just make existing macros take
argument to indicate which size to use.
Adjust all users - typically they want '1'.
* bgp_aspath.c: (aspath_has_as4) New, return 1 if there are any
as4's in a path.
(aspath_put) Return the number of bytes actually written, to
fix the bug Juergen noted: Splitting of segments will change
the number of bytes written from that already written to the
AS_PATH header.
(aspath_snmp_pathseg) Pass 2-byte flag to aspath_put. SNMP
is still defined as 2b.
(aspath_aggregate) fix latent bug.
(aspath_reconcile_as4) AS_PATH+NEW_AS_PATH reconciliation
function.
(aspath_key_make) Hash the AS_PATH string, rather than
just taking the addition of assegment ASes as the hash value,
hopefully sligthly more collision resistant.
(bgp_attr_munge_as4_attrs) Collide the NEW_ attributes
together with the OLD 2-byte forms, code Juergen
had in bgp_attr_parse but re-organised a bit.
(bgp_attr_parse) Bunch of code from Juergen moves
to previous function.
(bgp_packet_attribute) Compact significantly by
just /always/ using extended-length attr header.
Fix bug Juergen noted, by using aspath_put's
(new) returned size value for the attr header rather
than the (guesstimate) of aspath_size() - the two could
differ when aspath_put had to split large segments, unlikely
this bug was ever hit in the 'wild'.
(bgp_dump_routes_attr) Always use extended-len and
use aspath_put return for header length. Output 4b ASN
for AS_PATH and AGGREGATOR.
* bgp_ecommunity.c: (ecommunity_{hash_make,cmp}) fix
hash callback declarations to match prototypes.
(ecommunity_gettoken) Updated for ECOMMUNITY_ENCODE_AS4,
complete rewrite of Juergen's changes (no asdot support)
* bgp_open.c: (bgp_capability_as4) New, does what it says
on the tin.
(peek_for_as4_capability) Rewritten to use streams and
bgp_capability_as4.
* bgp_packet.c: (bgp_open_send) minor edit
checked (in the abstract at least) with Juergen.
Changes are to be more accepting, e.g, allow AS_TRANS on
a 2-byte session.
* (general) Update all commands to use CMD_AS_RANGE.
* bgp_vty.c: (bgp_clear) Fix return vals to use CMD_..
Remove stuff replicated by VTY_GET_LONG
(bgp_clear_vty) Return bgp_clear directly to vty.
* tests/aspath_test.c: Exercise 32bit parsing. Test reconcile
function.
* tests/ecommunity_test.c: New, test AS4 ecommunity changes,
positive test only at this time, error cases not tested yet.
2007-07-25 Juergen Kammer <j.kammer@eurodata.de>
* (general) AS4 support.
* bgpd.h: as_t changes to 4-bytes.
* bgp_aspath.h: Add BGP_AS4_MAX and BGP_AS_TRANS defines.
* bgp_aspath.c: AS_VALUE_SIZE becomes 4-byte, AS16_VALUE_SIZE
added for 2-byte.
Add AS16 versions of length calc macros.
(aspath_count_numas) New, count number of ASes.
(aspath_has_as4) New, return 1 if there are any as4's in a
path.
(assegments_parse) Interpret assegment as 4 or 2 byte,
according to how the caller instructs us, with a new
argument.
(aspath_parse) Add use32bit argument to pass to
assegments_parse. Adjust all its callers to pass 1, unless
otherwise noted.
(assegment_data_put) Adjust to be able to write 2 or 4 byte
AS, according to new use32bit argument.
(aspath_put) Adjust to write 2 or 4.
(aspath_gettoken) Use a long for passed in asno.
* bgp_attr.c: (attr_str) Add BGP_ATTR_AS4_PATH and
BGP_ATTR_AS4_AGGREGATOR.
(bgp_attr_aspath) Call aspath_parse with right 2/4 arg, as
determined by received-capability flag.
(bgp_attr_aspath_check) New, code previously in attr_aspath
but moved to new func so it can be run after NEW_AS_PATH
reconciliation.
(bgp_attr_as4_path) New, handle NEW_AS_PATH.
(bgp_attr_aggregator) Adjust to cope with 2/4 byte ASes.
(bgp_attr_as4_aggregator) New, read NEW_AGGREGATOR.
(bgp_attr_parse) Add handoffs to previous parsers for the two
new AS4 NEW_ attributes.
Various checks added for NEW/OLD reconciliation.
(bgp_packet_attribute) Support 2/4 for AS_PATH and
AGGREGATOR, detect when NEW_ attrs need to be sent.
* bgp_debug.{c,h}: Add 'debug bgp as4'.
* bgp_dump.c: MRTv2 support, unconditionally enabled, which
supports AS4. Based on patches from Erik (RIPE?).
* bgp_ecommunity.c: (ecommunity_ecom2str) ECOMMUNITY_ENCODE_AS4
support.
* bgp_open.c: (peek_for_as4_capability) New, peek for AS4
capability prior to full capability parsing, so we know which
ASN to use for struct peer lookup.
(bgp_open_capability) Always send AS4 capability.
* bgp_packet.c: (bgp_open_send) AS4 handling for AS field
(bgp_open_receive) Peek for AS4 capability first, and figure
out which AS to believe.
* bgp_vty.c: (bgp_show_peer) Print AS4 cap
* tests/aspath_test.c: Support asn32 changes, call aspath_parse
with 16 bit.
* vtysh/extract.pl: AS4 compatibility for router bgp ASNUMBER
* vtysh/extract.pl.in: AS4 compatibility for router bgp ASNUMBER
* vtysh/vtysh.c: AS4 compatibility for router bgp ASNUMBER
2007-10-15 00:32:21 +02:00
|
|
|
#define BGP_ATTR_AS4_PATH 17
|
|
|
|
#define BGP_ATTR_AS4_AGGREGATOR 18
|
2018-01-04 12:34:24 +01:00
|
|
|
#define BGP_ATTR_PMSI_TUNNEL 22
|
2016-01-12 19:42:01 +01:00
|
|
|
#define BGP_ATTR_ENCAP 23
|
2019-10-17 16:08:16 +02:00
|
|
|
#define BGP_ATTR_IPV6_EXT_COMMUNITIES 25
|
2022-10-12 20:06:47 +02:00
|
|
|
#define BGP_ATTR_AIGP 26
|
2016-11-15 11:00:39 +01:00
|
|
|
#define BGP_ATTR_LARGE_COMMUNITIES 32
|
2022-06-17 12:14:46 +02:00
|
|
|
#define BGP_ATTR_OTC 35
|
2017-04-26 23:45:32 +02:00
|
|
|
#define BGP_ATTR_PREFIX_SID 40
|
2020-01-28 12:59:57 +01:00
|
|
|
#define BGP_ATTR_SRTE_COLOR 51
|
2020-03-10 16:50:03 +01:00
|
|
|
#ifdef ENABLE_BGP_VNC_ATTR
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
#define BGP_ATTR_VNC 255
|
|
|
|
#endif
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* BGP update origin. */
|
|
|
|
#define BGP_ORIGIN_IGP 0
|
|
|
|
#define BGP_ORIGIN_EGP 1
|
|
|
|
#define BGP_ORIGIN_INCOMPLETE 2
|
2020-02-12 20:19:02 +01:00
|
|
|
#define BGP_ORIGIN_UNSPECIFIED 255
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* BGP notify message codes. */
|
|
|
|
#define BGP_NOTIFY_HEADER_ERR 1
|
|
|
|
#define BGP_NOTIFY_OPEN_ERR 2
|
|
|
|
#define BGP_NOTIFY_UPDATE_ERR 3
|
|
|
|
#define BGP_NOTIFY_HOLD_ERR 4
|
|
|
|
#define BGP_NOTIFY_FSM_ERR 5
|
|
|
|
#define BGP_NOTIFY_CEASE 6
|
2020-10-01 22:08:06 +02:00
|
|
|
#define BGP_NOTIFY_ROUTE_REFRESH_ERR 7
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-03-15 13:19:11 +01:00
|
|
|
/* Subcodes for BGP Finite State Machine Error */
|
|
|
|
#define BGP_NOTIFY_FSM_ERR_SUBCODE_UNSPECIFIC 0
|
|
|
|
#define BGP_NOTIFY_FSM_ERR_SUBCODE_OPENSENT 1
|
|
|
|
#define BGP_NOTIFY_FSM_ERR_SUBCODE_OPENCONFIRM 2
|
|
|
|
#define BGP_NOTIFY_FSM_ERR_SUBCODE_ESTABLISHED 3
|
|
|
|
|
2011-09-21 21:13:22 +02:00
|
|
|
#define BGP_NOTIFY_SUBCODE_UNSPECIFIC 0
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP_NOTIFY_HEADER_ERR sub codes. */
|
|
|
|
#define BGP_NOTIFY_HEADER_NOT_SYNC 1
|
|
|
|
#define BGP_NOTIFY_HEADER_BAD_MESLEN 2
|
|
|
|
#define BGP_NOTIFY_HEADER_BAD_MESTYPE 3
|
|
|
|
|
|
|
|
/* BGP_NOTIFY_OPEN_ERR sub codes. */
|
2015-07-22 21:35:38 +02:00
|
|
|
#define BGP_NOTIFY_OPEN_MALFORMED_ATTR 0
|
2002-12-13 21:15:29 +01:00
|
|
|
#define BGP_NOTIFY_OPEN_UNSUP_VERSION 1
|
|
|
|
#define BGP_NOTIFY_OPEN_BAD_PEER_AS 2
|
|
|
|
#define BGP_NOTIFY_OPEN_BAD_BGP_IDENT 3
|
|
|
|
#define BGP_NOTIFY_OPEN_UNSUP_PARAM 4
|
|
|
|
#define BGP_NOTIFY_OPEN_UNACEP_HOLDTIME 6
|
|
|
|
#define BGP_NOTIFY_OPEN_UNSUP_CAPBL 7
|
2022-06-17 12:14:46 +02:00
|
|
|
#define BGP_NOTIFY_OPEN_ROLE_MISMATCH 11
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* BGP_NOTIFY_UPDATE_ERR sub codes. */
|
|
|
|
#define BGP_NOTIFY_UPDATE_MAL_ATTR 1
|
|
|
|
#define BGP_NOTIFY_UPDATE_UNREC_ATTR 2
|
|
|
|
#define BGP_NOTIFY_UPDATE_MISS_ATTR 3
|
|
|
|
#define BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR 4
|
|
|
|
#define BGP_NOTIFY_UPDATE_ATTR_LENG_ERR 5
|
|
|
|
#define BGP_NOTIFY_UPDATE_INVAL_ORIGIN 6
|
|
|
|
#define BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP 8
|
|
|
|
#define BGP_NOTIFY_UPDATE_OPT_ATTR_ERR 9
|
|
|
|
#define BGP_NOTIFY_UPDATE_INVAL_NETWORK 10
|
|
|
|
#define BGP_NOTIFY_UPDATE_MAL_AS_PATH 11
|
|
|
|
|
2011-09-21 21:13:22 +02:00
|
|
|
/* BGP_NOTIFY_CEASE sub codes (RFC 4486). */
|
2002-12-13 21:15:29 +01:00
|
|
|
#define BGP_NOTIFY_CEASE_MAX_PREFIX 1
|
|
|
|
#define BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN 2
|
|
|
|
#define BGP_NOTIFY_CEASE_PEER_UNCONFIG 3
|
|
|
|
#define BGP_NOTIFY_CEASE_ADMIN_RESET 4
|
|
|
|
#define BGP_NOTIFY_CEASE_CONNECT_REJECT 5
|
|
|
|
#define BGP_NOTIFY_CEASE_CONFIG_CHANGE 6
|
2004-04-20 17:13:15 +02:00
|
|
|
#define BGP_NOTIFY_CEASE_COLLISION_RESOLUTION 7
|
|
|
|
#define BGP_NOTIFY_CEASE_OUT_OF_RESOURCE 8
|
2022-04-30 22:04:58 +02:00
|
|
|
#define BGP_NOTIFY_CEASE_HARD_RESET 9
|
2022-05-30 16:40:15 +02:00
|
|
|
#define BGP_NOTIFY_CEASE_BFD_DOWN 10
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-10-01 22:08:06 +02:00
|
|
|
/* BGP_NOTIFY_ROUTE_REFRESH_ERR sub codes (RFC 7313). */
|
|
|
|
#define BGP_NOTIFY_ROUTE_REFRESH_INVALID_MSG_LEN 1
|
|
|
|
|
|
|
|
/* BGP route refresh optional subtypes. */
|
|
|
|
#define BGP_ROUTE_REFRESH_NORMAL 0
|
|
|
|
#define BGP_ROUTE_REFRESH_BORR 1
|
|
|
|
#define BGP_ROUTE_REFRESH_EORR 2
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* BGP timers default value. */
|
2015-05-20 02:40:42 +02:00
|
|
|
#define BGP_INIT_START_TIMER 1
|
2019-08-01 18:50:56 +02:00
|
|
|
/* The following 3 are RFC defaults that are overridden in bgp_vty.c with
|
|
|
|
* version-/profile-specific values. The values here do not matter, they only
|
|
|
|
* exist to provide a clear layering separation between core and CLI.
|
|
|
|
*/
|
|
|
|
#define BGP_DEFAULT_HOLDTIME 180
|
|
|
|
#define BGP_DEFAULT_KEEPALIVE 60
|
|
|
|
#define BGP_DEFAULT_CONNECT_RETRY 120
|
|
|
|
|
2015-10-20 23:51:00 +02:00
|
|
|
#define BGP_DEFAULT_EBGP_ROUTEADV 0
|
2015-10-20 23:50:03 +02:00
|
|
|
#define BGP_DEFAULT_IBGP_ROUTEADV 0
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-10-20 16:49:58 +02:00
|
|
|
/* BGP RFC 4271 DelayOpenTime default value */
|
|
|
|
#define BGP_DEFAULT_DELAYOPEN 120
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP default local preference. */
|
|
|
|
#define BGP_DEFAULT_LOCAL_PREF 100
|
|
|
|
|
2017-08-25 20:27:49 +02:00
|
|
|
/* BGP local-preference to send when 'bgp graceful-shutdown'
|
|
|
|
* is configured */
|
|
|
|
#define BGP_GSHUT_LOCAL_PREF 0
|
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/* BGP default subgroup packet queue max . */
|
|
|
|
#define BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX 40
|
|
|
|
|
2004-05-21 11:31:30 +02:00
|
|
|
/* BGP graceful restart */
|
|
|
|
#define BGP_DEFAULT_RESTART_TIME 120
|
|
|
|
#define BGP_DEFAULT_STALEPATH_TIME 360
|
2019-10-23 19:45:57 +02:00
|
|
|
#define BGP_DEFAULT_SELECT_DEFERRAL_TIME 360
|
2019-10-25 17:42:39 +02:00
|
|
|
#define BGP_DEFAULT_RIB_STALE_TIME 500
|
2020-11-06 04:16:04 +01:00
|
|
|
#define BGP_DEFAULT_UPDATE_ADVERTISEMENT_TIME 1
|
2004-05-21 11:31:30 +02:00
|
|
|
|
bgpd: Add Long-lived Graceful Restart capability (restarter)
Restart Router mode.
FRRouting (Restarter):
```
bgp long-lived-graceful-restart stale-time 10
bgp graceful-restart restart-time 1
```
Tested with GoBGP (Helper):
```
long-lived-graceful-restart: advertised and received
Local:
ipv4-unicast, restart time 100000 sec
Remote:
ipv4-unicast, restart time 10 sec, forward flag set
```
Logs:
```
{"Key":"192.168.10.123","Reason":"graceful-restart","State":"BGP_FSM_ESTABLISHED","Topic":"Peer","level":"info","msg":"Peer Down","time":"2021-10-25T17:48:36+03:00"}
{"Key":"192.168.10.123","State":"BGP_FSM_IDLE","Topic":"Peer","level":"warning","msg":"graceful restart timer expired","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"start LLGR restart timer (10 sec) for ipv4-unicast","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"LLGR restart timer (10 sec) for ipv4-unicast expired","time":"2021-10-25T17:48:47+03:00"}
% ./gobgp global rib
Network Next Hop AS_PATH Age Attrs
S*>10.0.2.0/24 192.168.10.123 174 00:12:08 [{Origin: ?} {Med: 0} {Communities: llgr-stale} {Extcomms: [174:1282304808]}]
```
Helper mode will be added with upcoming PRs.
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-25 16:23:02 +02:00
|
|
|
/* BGP Long-lived Graceful Restart */
|
2021-12-23 13:23:48 +01:00
|
|
|
#define BGP_DEFAULT_LLGR_STALE_TIME 0
|
bgpd: Add Long-lived Graceful Restart capability (restarter)
Restart Router mode.
FRRouting (Restarter):
```
bgp long-lived-graceful-restart stale-time 10
bgp graceful-restart restart-time 1
```
Tested with GoBGP (Helper):
```
long-lived-graceful-restart: advertised and received
Local:
ipv4-unicast, restart time 100000 sec
Remote:
ipv4-unicast, restart time 10 sec, forward flag set
```
Logs:
```
{"Key":"192.168.10.123","Reason":"graceful-restart","State":"BGP_FSM_ESTABLISHED","Topic":"Peer","level":"info","msg":"Peer Down","time":"2021-10-25T17:48:36+03:00"}
{"Key":"192.168.10.123","State":"BGP_FSM_IDLE","Topic":"Peer","level":"warning","msg":"graceful restart timer expired","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"start LLGR restart timer (10 sec) for ipv4-unicast","time":"2021-10-25T17:48:37+03:00"}
{"Family":65537,"Key":"192.168.10.123","Topic":"Peer","level":"info","msg":"LLGR restart timer (10 sec) for ipv4-unicast expired","time":"2021-10-25T17:48:47+03:00"}
% ./gobgp global rib
Network Next Hop AS_PATH Age Attrs
S*>10.0.2.0/24 192.168.10.123 174 00:12:08 [{Origin: ?} {Med: 0} {Communities: llgr-stale} {Extcomms: [174:1282304808]}]
```
Helper mode will be added with upcoming PRs.
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-25 16:23:02 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* BGP uptime string length. */
|
|
|
|
#define BGP_UPTIME_LEN 25
|
|
|
|
|
|
|
|
/* Default configuration settings for bgpd. */
|
|
|
|
#define BGP_VTY_PORT 2605
|
|
|
|
#define BGP_DEFAULT_CONFIG "bgpd.conf"
|
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/* BGP Dynamic Neighbors feature */
|
|
|
|
#define BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT 100
|
|
|
|
#define BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN 1
|
2021-03-31 17:51:34 +02:00
|
|
|
#define BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX 65535
|
2015-05-20 03:03:47 +02:00
|
|
|
|
2022-10-12 20:06:47 +02:00
|
|
|
/* BGP AIGP */
|
|
|
|
#define BGP_AIGP_TLV_RESERVED 0 /* AIGP Reserved */
|
|
|
|
#define BGP_AIGP_TLV_METRIC 1 /* AIGP Metric */
|
|
|
|
#define BGP_AIGP_TLV_METRIC_LEN 11
|
|
|
|
#define BGP_AIGP_TLV_METRIC_MAX 0xffffffffffffffffULL
|
|
|
|
#define BGP_AIGP_TLV_METRIC_DESC "Accumulated IGP Metric"
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Flag for peer_clear_soft(). */
|
|
|
|
enum bgp_clear_type {
|
|
|
|
BGP_CLEAR_SOFT_NONE,
|
|
|
|
BGP_CLEAR_SOFT_OUT,
|
|
|
|
BGP_CLEAR_SOFT_IN,
|
|
|
|
BGP_CLEAR_SOFT_BOTH,
|
2022-01-19 14:24:18 +01:00
|
|
|
BGP_CLEAR_SOFT_IN_ORF_PREFIX,
|
|
|
|
BGP_CLEAR_MESSAGE_STATS
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Macros. */
|
2017-05-02 02:37:45 +02:00
|
|
|
#define BGP_INPUT(P) ((P)->curr)
|
2017-11-08 18:51:16 +01:00
|
|
|
#define BGP_INPUT_PNT(P) (stream_pnt(BGP_INPUT(P)))
|
2013-10-02 12:40:20 +02:00
|
|
|
#define BGP_IS_VALID_STATE_FOR_NOTIF(S) \
|
|
|
|
(((S) == OpenSent) || ((S) == OpenConfirm) || ((S) == Established))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* BGP error codes. */
|
2022-02-15 21:53:30 +01:00
|
|
|
enum bgp_create_error_code {
|
|
|
|
BGP_SUCCESS = 0,
|
|
|
|
BGP_CREATED = 1,
|
|
|
|
BGP_ERR_INVALID_VALUE = -1,
|
|
|
|
BGP_ERR_INVALID_FLAG = -2,
|
|
|
|
BGP_ERR_INVALID_AS = -3,
|
2022-02-15 22:36:30 +01:00
|
|
|
BGP_ERR_PEER_GROUP_MEMBER = -4,
|
|
|
|
BGP_ERR_PEER_GROUP_NO_REMOTE_AS = -5,
|
|
|
|
BGP_ERR_PEER_GROUP_CANT_CHANGE = -6,
|
|
|
|
BGP_ERR_PEER_GROUP_MISMATCH = -7,
|
|
|
|
BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT = -8,
|
|
|
|
BGP_ERR_AS_MISMATCH = -9,
|
|
|
|
BGP_ERR_PEER_FLAG_CONFLICT = -10,
|
|
|
|
BGP_ERR_PEER_GROUP_SHUTDOWN = -11,
|
|
|
|
BGP_ERR_PEER_FILTER_CONFLICT = -12,
|
|
|
|
BGP_ERR_NOT_INTERNAL_PEER = -13,
|
|
|
|
BGP_ERR_REMOVE_PRIVATE_AS = -14,
|
|
|
|
BGP_ERR_AF_UNCONFIGURED = -15,
|
|
|
|
BGP_ERR_SOFT_RECONFIG_UNCONFIGURED = -16,
|
|
|
|
BGP_ERR_INSTANCE_MISMATCH = -17,
|
|
|
|
BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS = -19,
|
|
|
|
BGP_ERR_TCPSIG_FAILED = -20,
|
|
|
|
BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK = -21,
|
|
|
|
BGP_ERR_NO_IBGP_WITH_TTLHACK = -22,
|
|
|
|
BGP_ERR_NO_INTERFACE_CONFIG = -23,
|
|
|
|
BGP_ERR_AS_OVERRIDE = -25,
|
|
|
|
BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT = -26,
|
|
|
|
BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS = -27,
|
|
|
|
BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_NOT_FOUND = -28,
|
|
|
|
BGP_ERR_INVALID_FOR_DYNAMIC_PEER = -29,
|
|
|
|
BGP_ERR_INVALID_FOR_DIRECT_PEER = -30,
|
|
|
|
BGP_ERR_PEER_SAFI_CONFLICT = -31,
|
2022-02-15 21:53:30 +01:00
|
|
|
|
|
|
|
/* BGP GR ERRORS */
|
2022-02-15 22:36:30 +01:00
|
|
|
BGP_ERR_GR_INVALID_CMD = -32,
|
|
|
|
BGP_ERR_GR_OPERATION_FAILED = -33,
|
|
|
|
BGP_GR_NO_OPERATION = -34,
|
2022-06-17 12:14:46 +02:00
|
|
|
|
|
|
|
/*BGP Open Policy ERRORS */
|
|
|
|
BGP_ERR_INVALID_ROLE_NAME = -35,
|
2023-01-17 17:14:27 +01:00
|
|
|
BGP_ERR_INVALID_INTERNAL_ROLE = -36
|
2022-02-15 21:53:30 +01:00
|
|
|
};
|
2019-10-23 07:32:45 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/*
|
|
|
|
* Enumeration of different policy kinds a peer can be configured with.
|
|
|
|
*/
|
2022-04-12 10:32:23 +02:00
|
|
|
enum bgp_policy_type {
|
2015-05-20 03:03:47 +02:00
|
|
|
BGP_POLICY_ROUTE_MAP,
|
|
|
|
BGP_POLICY_FILTER_LIST,
|
|
|
|
BGP_POLICY_PREFIX_LIST,
|
|
|
|
BGP_POLICY_DISTRIBUTE_LIST,
|
2022-04-12 10:32:23 +02:00
|
|
|
};
|
2015-05-20 03:03:47 +02:00
|
|
|
|
bgpd: Re-use TX Addpath IDs where possible
The motivation for this patch is to address a concerning behavior of
tx-addpath-bestpath-per-AS. Prior to this patch, all paths' TX ID was
pre-determined as the path was received from a peer. However, this meant
that any time the path selected as best from an AS changed, bgpd had no
choice but to withdraw the previous best path, and advertise the new
best-path under a new TX ID. This could cause significant network
disruption, especially for the subset of prefixes coming from only one
AS that were also communicated over a bestpath-per-AS session.
The patch's general approach is best illustrated by
txaddpath_update_ids. After a bestpath run (required for best-per-AS to
know what will and will not be sent as addpaths) ID numbers will be
stripped from paths that no longer need to be sent, and held in a pool.
Then, paths that will be sent as addpaths and do not already have ID
numbers will allocate new ID numbers, pulling first from that pool.
Finally, anything left in the pool will be returned to the allocator.
In order for this to work, ID numbers had to be split by strategy. The
tx-addpath-All strategy would keep every ID number "in use" constantly,
preventing IDs from being transferred to different paths. Rather than
create two variables for ID, this patch create a more generic array that
will easily enable more addpath strategies to be implemented. The
previously described ID manipulations will happen per addpath strategy,
and will only be run for strategies that are enabled on at least one
peer.
Finally, the ID numbers are allocated from an allocator that tracks per
AFI/SAFI/Addpath Strategy which IDs are in use. Though it would be very
improbable, there was the possibility with the free-running counter
approach for rollover to cause two paths on the same prefix to get
assigned the same TX ID. As remote as the possibility is, we prefer to
not leave it to chance.
This ID re-use method is not perfect. In some cases you could still get
withdraw-then-add behaviors where not strictly necessary. In the case of
bestpath-per-AS this requires one AS to advertise a prefix for the first
time, then a second AS withdraws that prefix, all within the space of an
already pending MRAI timer. In those situations a withdraw-then-add is
more forgivable, and fixing it would probably require a much more
significant effort, as IDs would need to be moved to ADVs instead of
paths.
Signed-off-by Mitchell Skiba <mskiba@amazon.com>
2018-05-10 01:10:02 +02:00
|
|
|
/* peer_flag_change_type. */
|
|
|
|
enum peer_change_type {
|
|
|
|
peer_change_none,
|
|
|
|
peer_change_reset,
|
|
|
|
peer_change_reset_in,
|
|
|
|
peer_change_reset_out,
|
|
|
|
};
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
extern struct bgp_master *bm;
|
2016-11-04 00:59:19 +01:00
|
|
|
extern unsigned int multipath_num;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Prototypes. */
|
2005-06-28 14:44:16 +02:00
|
|
|
extern void bgp_terminate(void);
|
|
|
|
extern void bgp_reset(void);
|
|
|
|
extern void bgp_zclient_reset(void);
|
|
|
|
extern struct bgp *bgp_get_default(void);
|
|
|
|
extern struct bgp *bgp_lookup(as_t, const char *);
|
|
|
|
extern struct bgp *bgp_lookup_by_name(const char *);
|
2016-02-02 13:36:20 +01:00
|
|
|
extern struct bgp *bgp_lookup_by_vrf_id(vrf_id_t);
|
2019-03-06 19:09:25 +01:00
|
|
|
extern struct bgp *bgp_get_evpn(void);
|
|
|
|
extern void bgp_set_evpn(struct bgp *bgp);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern struct peer *peer_lookup(struct bgp *, union sockunion *);
|
2015-05-20 02:40:40 +02:00
|
|
|
extern struct peer *peer_lookup_by_conf_if(struct bgp *, const char *);
|
2015-09-11 05:10:16 +02:00
|
|
|
extern struct peer *peer_lookup_by_hostname(struct bgp *, const char *);
|
2015-05-20 02:40:40 +02:00
|
|
|
extern void bgp_peer_conf_if_to_su_update(struct peer *);
|
2015-05-20 03:12:17 +02:00
|
|
|
extern int peer_group_listen_range_del(struct peer_group *, struct prefix *);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern struct peer_group *peer_group_lookup(struct bgp *, const char *);
|
|
|
|
extern struct peer_group *peer_group_get(struct bgp *, const char *);
|
2015-05-20 03:03:47 +02:00
|
|
|
extern struct peer *peer_create_bind_dynamic_neighbor(struct bgp *,
|
|
|
|
union sockunion *,
|
|
|
|
struct peer_group *);
|
|
|
|
extern struct prefix *
|
|
|
|
peer_group_lookup_dynamic_neighbor_range(struct peer_group *, struct prefix *);
|
|
|
|
extern struct peer_group *peer_group_lookup_dynamic_neighbor(struct bgp *,
|
|
|
|
struct prefix *,
|
|
|
|
struct prefix **);
|
|
|
|
extern struct peer *peer_lookup_dynamic_neighbor(struct bgp *,
|
|
|
|
union sockunion *);
|
2015-07-22 21:35:38 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Peers are incredibly easy to memory leak
|
|
|
|
* due to the various ways that they are actually used
|
|
|
|
* Provide some functionality to debug locks and unlocks
|
|
|
|
*/
|
|
|
|
extern struct peer *peer_lock_with_caller(const char *, struct peer *);
|
|
|
|
extern struct peer *peer_unlock_with_caller(const char *, struct peer *);
|
|
|
|
#define peer_unlock(A) peer_unlock_with_caller(__FUNCTION__, (A))
|
|
|
|
#define peer_lock(B) peer_lock_with_caller(__FUNCTION__, (B))
|
|
|
|
|
2022-04-12 10:29:40 +02:00
|
|
|
extern enum bgp_peer_sort peer_sort(struct peer *peer);
|
|
|
|
extern enum bgp_peer_sort peer_sort_lookup(struct peer *peer);
|
2020-02-12 19:26:19 +01:00
|
|
|
|
2020-03-20 10:57:54 +01:00
|
|
|
extern bool peer_active(struct peer *);
|
|
|
|
extern bool peer_active_nego(struct peer *);
|
2022-01-13 09:15:03 +01:00
|
|
|
extern bool peer_afc_received(struct peer *peer);
|
|
|
|
extern bool peer_afc_advertised(struct peer *peer);
|
2015-11-06 17:34:41 +01:00
|
|
|
extern void bgp_recalculate_all_bestpaths(struct bgp *bgp);
|
2022-12-02 18:59:30 +01:00
|
|
|
extern struct peer *peer_create(union sockunion *su, const char *conf_if,
|
|
|
|
struct bgp *bgp, as_t local_as, as_t remote_as,
|
|
|
|
int as_type, struct peer_group *group,
|
2022-11-18 16:02:55 +01:00
|
|
|
bool config_node, const char *as_str);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern struct peer *peer_create_accept(struct bgp *);
|
2015-05-20 02:40:37 +02:00
|
|
|
extern void peer_xfer_config(struct peer *dst, struct peer *src);
|
2018-08-30 17:54:46 +02:00
|
|
|
extern char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json,
|
|
|
|
json_object *json);
|
2015-08-12 15:59:18 +02:00
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int bgp_config_write(struct vty *);
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2021-01-03 05:56:48 +01:00
|
|
|
extern void bgp_master_init(struct thread_master *master, const int buffer_size,
|
|
|
|
struct list *addresses);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-06-07 15:28:12 +02:00
|
|
|
extern void bgp_init(unsigned short instance);
|
2017-03-29 21:16:28 +02:00
|
|
|
extern void bgp_pthreads_run(void);
|
2017-03-09 00:16:15 +01:00
|
|
|
extern void bgp_pthreads_finish(void);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern void bgp_route_map_init(void);
|
2015-11-30 22:19:39 +01:00
|
|
|
extern void bgp_session_reset(struct peer *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int bgp_option_set(int);
|
|
|
|
extern int bgp_option_unset(int);
|
|
|
|
extern int bgp_option_check(int);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-09-02 18:20:08 +02:00
|
|
|
/* set the bgp no-rib option during runtime and remove installed routes */
|
|
|
|
extern void bgp_option_norib_set_runtime(void);
|
|
|
|
|
|
|
|
/* unset the bgp no-rib option during runtime and reset all peers */
|
|
|
|
extern void bgp_option_norib_unset_runtime(void);
|
|
|
|
|
2022-11-15 16:42:40 +01:00
|
|
|
extern int bgp_get(struct bgp **bgp, as_t *as, const char *name,
|
bgpd: add as-notation keyword to 'router bgp' vty command
A new keyword permits changing the BGP as-notation output:
- [no] router bgp <> [vrf BLABLA] [as-notation [<dot|plain|dot+>]]
At the BGP instance creation, the output will inherit the way the
BGP instance is declared. For instance, the 'router bgp 1.1'
command will configure the output in the dot format. However, if
the client wants to choose an alternate output, he will have to
add the extra command: 'router bgp 1.1 as-notation dot+'.
Also, if the user wants to have plain format, even if the BGP
instance is declared in dot format, the keyword can also be used
for that.
The as-notation output is only taken into account at the BGP
instance creation. In the case where VPN instances are used,
a separate instance may be dynamically created. In that case,
the real as-notation format will be taken into acccount at the
first configuration.
Linking the as-notation format with the BGP instance makes sense,
as the operators want to keep consistency of what they configure.
One technical reason why to link the as-notation output with the
BGP instance creation is that the as-path segment lists stored
in the BGP updates use a string representation to handle aspath
operations (by using regexp for instance). Changing on the fly
the output needs to regenerate this string representation to the
correct format. Linking the configuration to the BGP instance
creation avoids refreshing the BGP updates. A similar mechanism
is put in place in junos too.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-11-03 21:17:57 +01:00
|
|
|
enum bgp_instance_type kind, const char *as_pretty,
|
|
|
|
enum asnotation_mode asnotation);
|
2016-02-02 13:36:20 +01:00
|
|
|
extern void bgp_instance_up(struct bgp *);
|
|
|
|
extern void bgp_instance_down(struct bgp *);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int bgp_delete(struct bgp *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-01-26 12:25:34 +01:00
|
|
|
extern int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf,
|
|
|
|
vrf_id_t old_vrf_id, bool create);
|
|
|
|
|
2016-07-28 17:23:34 +02:00
|
|
|
extern void bgp_router_id_zebra_bump(vrf_id_t, const struct prefix *);
|
2020-03-20 10:57:54 +01:00
|
|
|
extern void bgp_router_id_static_set(struct bgp *, struct in_addr);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-12-03 21:48:59 +01:00
|
|
|
extern void bm_wait_for_fib_set(bool set);
|
2020-11-06 04:16:04 +01:00
|
|
|
extern void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set);
|
2022-08-12 12:20:32 +02:00
|
|
|
extern void bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id);
|
|
|
|
extern void bgp_cluster_id_unset(struct bgp *bgp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-11-18 16:56:09 +01:00
|
|
|
extern void bgp_confederation_id_set(struct bgp *bgp, as_t as,
|
|
|
|
const char *as_str);
|
2022-08-12 12:20:32 +02:00
|
|
|
extern void bgp_confederation_id_unset(struct bgp *bgp);
|
2020-03-20 10:57:54 +01:00
|
|
|
extern bool bgp_confederation_peers_check(struct bgp *, as_t);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-11-18 16:56:09 +01:00
|
|
|
extern void bgp_confederation_peers_add(struct bgp *bgp, as_t as,
|
|
|
|
const char *as_str);
|
2022-08-12 12:20:32 +02:00
|
|
|
extern void bgp_confederation_peers_remove(struct bgp *bgp, as_t as);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-03-20 10:57:54 +01:00
|
|
|
extern void bgp_timers_set(struct bgp *, uint32_t keepalive, uint32_t holdtime,
|
2020-10-20 16:49:58 +02:00
|
|
|
uint32_t connect_retry, uint32_t delayopen);
|
2020-03-20 10:57:54 +01:00
|
|
|
extern void bgp_timers_unset(struct bgp *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-08-12 12:20:32 +02:00
|
|
|
extern void bgp_default_local_preference_set(struct bgp *bgp,
|
|
|
|
uint32_t local_pref);
|
|
|
|
extern void bgp_default_local_preference_unset(struct bgp *bgp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-08-12 12:20:32 +02:00
|
|
|
extern void bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp,
|
|
|
|
uint32_t queue_size);
|
|
|
|
extern void bgp_default_subgroup_pkt_queue_max_unset(struct bgp *bgp);
|
2015-05-20 03:03:47 +02:00
|
|
|
|
2022-08-12 12:20:32 +02:00
|
|
|
extern void bgp_listen_limit_set(struct bgp *bgp, int listen_limit);
|
|
|
|
extern void bgp_listen_limit_unset(struct bgp *bgp);
|
2015-05-20 03:03:47 +02:00
|
|
|
|
2020-03-20 10:57:54 +01:00
|
|
|
extern bool bgp_update_delay_active(struct bgp *);
|
|
|
|
extern bool bgp_update_delay_configured(struct bgp *);
|
2022-08-12 12:20:32 +02:00
|
|
|
extern bool bgp_afi_safi_peer_exists(struct bgp *bgp, afi_t afi, safi_t safi);
|
2022-11-18 16:02:55 +01:00
|
|
|
extern void peer_as_change(struct peer *peer, as_t as, int as_type,
|
|
|
|
const char *as_str);
|
|
|
|
extern int peer_remote_as(struct bgp *bgp, union sockunion *su,
|
|
|
|
const char *conf_if, as_t *as, int as_type,
|
|
|
|
const char *as_str);
|
|
|
|
extern int peer_group_remote_as(struct bgp *bgp, const char *peer_str, as_t *as,
|
|
|
|
int as_type, const char *as_str);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_delete(struct peer *peer);
|
2020-03-20 10:57:54 +01:00
|
|
|
extern void peer_notify_unconfig(struct peer *peer);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_group_delete(struct peer_group *);
|
|
|
|
extern int peer_group_remote_as_delete(struct peer_group *);
|
2015-05-20 03:03:47 +02:00
|
|
|
extern int peer_group_listen_range_add(struct peer_group *, struct prefix *);
|
2020-03-20 10:57:54 +01:00
|
|
|
extern void peer_group_notify_unconfig(struct peer_group *group);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_activate(struct peer *, afi_t, safi_t);
|
|
|
|
extern int peer_deactivate(struct peer *, afi_t, safi_t);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2015-05-20 02:40:40 +02:00
|
|
|
extern int peer_group_bind(struct bgp *, union sockunion *, struct peer *,
|
BGP: Remove the requirement to rebind a peer to its peer-group under the address-family.
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-3868
NOTE: Many of the ibgp peers are not up in the 'show ip bgp summ' output below. This
is because ospf was disabled at the time. The main thing to look for is whether or
not all of the correct peers are listed based on their 'activate' status.
Basic Example
=============
router bgp 10
bgp router-id 10.0.0.1
no bgp default ipv4-unicast
no bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid
bgp route-map delay-timer 1
neighbor EBGP peer-group
neighbor EBGP advertisement-interval 1
neighbor IBGP peer-group
neighbor IBGP remote-as 10
neighbor IBGP update-source 10.0.0.1
neighbor IBGP advertisement-interval 1
neighbor 10.0.0.2 peer-group IBGP
neighbor 10.0.0.3 peer-group IBGP
neighbor 10.0.0.4 peer-group IBGP
neighbor 20.1.1.6 remote-as 20
neighbor 20.1.1.6 peer-group EBGP
neighbor 20.1.1.7 remote-as 20
neighbor 20.1.1.7 peer-group EBGP
neighbor 40.1.1.2 remote-as 40
neighbor 40.1.1.2 peer-group EBGP
neighbor 40.1.1.6 remote-as 40
neighbor 40.1.1.6 peer-group EBGP
neighbor 40.1.1.10 remote-as 40
neighbor 40.1.1.10 peer-group EBGP
!
address-family ipv4 unicast
neighbor EBGP activate
neighbor IBGP activate
neighbor IBGP next-hop-self
exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r2(10.0.0.2) 4 10 107 211 0 0 0 00:23:01 Connect
r3(10.0.0.3) 4 10 107 211 0 0 0 00:23:01 Connect
r4(10.0.0.4) 4 10 207 211 0 0 0 00:23:01 Active
r6(20.1.1.6) 4 20 873 975 0 0 0 00:23:29 600
r7(20.1.1.7) 4 20 873 976 0 0 0 00:23:29 600
r8(40.1.1.2) 4 40 874 975 0 0 0 00:23:30 600
r9(40.1.1.6) 4 40 874 975 0 0 0 00:23:30 600
r10(40.1.1.10) 4 40 874 975 0 0 0 00:23:30 600
Total number of neighbors 8
superm-redxp-05#
Example where one member of the peer-group is inactive...we can do this now that
peer-group members can have different outbound policies from the peer-group.
================================================================================
superm-redxp-05# conf t
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# no neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# do show run
router bgp 10
bgp router-id 10.0.0.1
no bgp default ipv4-unicast
no bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid
bgp route-map delay-timer 1
neighbor EBGP peer-group
neighbor EBGP advertisement-interval 1
neighbor IBGP peer-group
neighbor IBGP remote-as 10
neighbor IBGP update-source 10.0.0.1
neighbor IBGP advertisement-interval 1
neighbor 10.0.0.2 peer-group IBGP
neighbor 10.0.0.3 peer-group IBGP
neighbor 10.0.0.4 peer-group IBGP
neighbor 20.1.1.6 remote-as 20
neighbor 20.1.1.6 peer-group EBGP
neighbor 20.1.1.7 remote-as 20
neighbor 20.1.1.7 peer-group EBGP
neighbor 40.1.1.2 remote-as 40
neighbor 40.1.1.2 peer-group EBGP
neighbor 40.1.1.6 remote-as 40
neighbor 40.1.1.6 peer-group EBGP
neighbor 40.1.1.10 remote-as 40
neighbor 40.1.1.10 peer-group EBGP
!
address-family ipv4 unicast
neighbor EBGP activate
neighbor IBGP activate
neighbor IBGP next-hop-self
no neighbor 10.0.0.3 activate
exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r2(10.0.0.2) 4 10 107 211 0 0 0 00:23:24 Connect
r4(10.0.0.4) 4 10 207 211 0 0 0 00:23:24 Active
r6(20.1.1.6) 4 20 881 983 0 0 0 00:23:52 600
r7(20.1.1.7) 4 20 881 984 0 0 0 00:23:52 600
r8(40.1.1.2) 4 40 881 982 0 0 0 00:23:53 600
r9(40.1.1.6) 4 40 881 982 0 0 0 00:23:53 600
r10(40.1.1.10) 4 40 881 982 0 0 0 00:23:53 600
Total number of neighbors 7
superm-redxp-05#
Example where the peer-group is inactive but a member of the peer-group is active:
==================================================================================
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# no neighbor IBGP activate
superm-redxp-05(config-router-af)#
superm-redxp-05(config-router-af)# neighbor 10.0.0.4 activate
superm-redxp-05(config-router-af)# end
superm-redxp-05# show run
router bgp 10
bgp router-id 10.0.0.1
no bgp default ipv4-unicast
no bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid
bgp route-map delay-timer 1
neighbor EBGP peer-group
neighbor EBGP advertisement-interval 1
neighbor IBGP peer-group
neighbor IBGP remote-as 10
neighbor IBGP update-source 10.0.0.1
neighbor IBGP advertisement-interval 1
neighbor 10.0.0.2 peer-group IBGP
neighbor 10.0.0.3 peer-group IBGP
neighbor 10.0.0.4 peer-group IBGP
neighbor 20.1.1.6 remote-as 20
neighbor 20.1.1.6 peer-group EBGP
neighbor 20.1.1.7 remote-as 20
neighbor 20.1.1.7 peer-group EBGP
neighbor 40.1.1.2 remote-as 40
neighbor 40.1.1.2 peer-group EBGP
neighbor 40.1.1.6 remote-as 40
neighbor 40.1.1.6 peer-group EBGP
neighbor 40.1.1.10 remote-as 40
neighbor 40.1.1.10 peer-group EBGP
!
address-family ipv4 unicast
neighbor EBGP activate
neighbor IBGP next-hop-self
neighbor 10.0.0.4 activate
exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r4(10.0.0.4) 4 10 207 211 0 0 0 00:24:56 Active
r6(20.1.1.6) 4 20 911 1013 0 0 0 00:25:24 600
r7(20.1.1.7) 4 20 911 1014 0 0 0 00:25:24 600
r8(40.1.1.2) 4 40 912 1013 0 0 0 00:25:25 600
r9(40.1.1.6) 4 40 912 1013 0 0 0 00:25:25 600
r10(40.1.1.10) 4 40 912 1013 0 0 0 00:25:25 600
Total number of neighbors 6
superm-redxp-05#
2015-11-20 19:53:50 +01:00
|
|
|
struct peer_group *, as_t *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-06-27 15:36:56 +02:00
|
|
|
extern int peer_flag_set(struct peer *peer, uint64_t flag);
|
|
|
|
extern int peer_flag_unset(struct peer *peer, uint64_t flag);
|
|
|
|
extern void peer_flag_inherit(struct peer *peer, uint64_t flag);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-08-31 13:23:23 +02:00
|
|
|
extern int peer_af_flag_set(struct peer *peer, afi_t afi, safi_t safi,
|
|
|
|
uint64_t flag);
|
|
|
|
extern int peer_af_flag_unset(struct peer *peer, afi_t afi, safi_t safi,
|
|
|
|
uint64_t flag);
|
2018-03-27 21:13:34 +02:00
|
|
|
extern int peer_af_flag_check(struct peer *, afi_t, safi_t, uint32_t);
|
2018-05-27 19:36:48 +02:00
|
|
|
extern void peer_af_flag_inherit(struct peer *peer, afi_t afi, safi_t safi,
|
2022-08-31 13:23:23 +02:00
|
|
|
uint64_t flag);
|
bgpd: Re-use TX Addpath IDs where possible
The motivation for this patch is to address a concerning behavior of
tx-addpath-bestpath-per-AS. Prior to this patch, all paths' TX ID was
pre-determined as the path was received from a peer. However, this meant
that any time the path selected as best from an AS changed, bgpd had no
choice but to withdraw the previous best path, and advertise the new
best-path under a new TX ID. This could cause significant network
disruption, especially for the subset of prefixes coming from only one
AS that were also communicated over a bestpath-per-AS session.
The patch's general approach is best illustrated by
txaddpath_update_ids. After a bestpath run (required for best-per-AS to
know what will and will not be sent as addpaths) ID numbers will be
stripped from paths that no longer need to be sent, and held in a pool.
Then, paths that will be sent as addpaths and do not already have ID
numbers will allocate new ID numbers, pulling first from that pool.
Finally, anything left in the pool will be returned to the allocator.
In order for this to work, ID numbers had to be split by strategy. The
tx-addpath-All strategy would keep every ID number "in use" constantly,
preventing IDs from being transferred to different paths. Rather than
create two variables for ID, this patch create a more generic array that
will easily enable more addpath strategies to be implemented. The
previously described ID manipulations will happen per addpath strategy,
and will only be run for strategies that are enabled on at least one
peer.
Finally, the ID numbers are allocated from an allocator that tracks per
AFI/SAFI/Addpath Strategy which IDs are in use. Though it would be very
improbable, there was the possibility with the free-running counter
approach for rollover to cause two paths on the same prefix to get
assigned the same TX ID. As remote as the possibility is, we prefer to
not leave it to chance.
This ID re-use method is not perfect. In some cases you could still get
withdraw-then-add behaviors where not strictly necessary. In the case of
bestpath-per-AS this requires one AS to advertise a prefix for the first
time, then a second AS withdraws that prefix, all within the space of an
already pending MRAI timer. In those situations a withdraw-then-add is
more forgivable, and fixing it would probably require a much more
significant effort, as IDs would need to be moved to ADVs instead of
paths.
Signed-off-by Mitchell Skiba <mskiba@amazon.com>
2018-05-10 01:10:02 +02:00
|
|
|
extern void peer_change_action(struct peer *peer, afi_t afi, safi_t safi,
|
|
|
|
enum peer_change_type type);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_ebgp_multihop_set(struct peer *, int);
|
|
|
|
extern int peer_ebgp_multihop_unset(struct peer *);
|
2015-06-12 16:59:11 +02:00
|
|
|
extern int is_ebgp_multihop_configured(struct peer *peer);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-06-20 14:39:03 +02:00
|
|
|
extern int peer_role_set(struct peer *peer, uint8_t role, bool strict_mode);
|
2022-06-17 12:14:46 +02:00
|
|
|
extern int peer_role_unset(struct peer *peer);
|
|
|
|
|
2020-03-20 10:57:54 +01:00
|
|
|
extern void peer_description_set(struct peer *, const char *);
|
|
|
|
extern void peer_description_unset(struct peer *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_update_source_if_set(struct peer *, const char *);
|
2022-08-12 12:20:32 +02:00
|
|
|
extern void peer_update_source_addr_set(struct peer *peer,
|
|
|
|
const union sockunion *su);
|
|
|
|
extern void peer_update_source_unset(struct peer *peer);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-09-14 10:56:46 +02:00
|
|
|
extern int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi,
|
|
|
|
const char *rmap,
|
|
|
|
struct route_map *route_map);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_default_originate_unset(struct peer *, afi_t, safi_t);
|
2021-11-08 09:48:24 +01:00
|
|
|
extern void bgp_tcp_keepalive_set(struct bgp *bgp, uint16_t idle,
|
|
|
|
uint16_t interval, uint16_t probes);
|
|
|
|
extern void bgp_tcp_keepalive_unset(struct bgp *bgp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-03-20 10:57:54 +01:00
|
|
|
extern void peer_port_set(struct peer *, uint16_t);
|
|
|
|
extern void peer_port_unset(struct peer *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
extern int peer_weight_set(struct peer *, afi_t, safi_t, uint16_t);
|
2016-10-10 16:53:34 +02:00
|
|
|
extern int peer_weight_unset(struct peer *, afi_t, safi_t);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
extern int peer_timers_set(struct peer *, uint32_t keepalive,
|
|
|
|
uint32_t holdtime);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_timers_unset(struct peer *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
extern int peer_timers_connect_set(struct peer *, uint32_t);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_timers_connect_unset(struct peer *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
extern int peer_advertise_interval_set(struct peer *, uint32_t);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_advertise_interval_unset(struct peer *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-10-20 16:49:58 +02:00
|
|
|
extern int peer_timers_delayopen_set(struct peer *peer, uint32_t delayopen);
|
|
|
|
extern int peer_timers_delayopen_unset(struct peer *peer);
|
|
|
|
|
2015-05-20 03:12:17 +02:00
|
|
|
extern void peer_interface_set(struct peer *, const char *);
|
|
|
|
extern void peer_interface_unset(struct peer *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_distribute_set(struct peer *, afi_t, safi_t, int, const char *);
|
|
|
|
extern int peer_distribute_unset(struct peer *, afi_t, safi_t, int);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
bgpd: add 'neighbor x.x.x.x allowas-in origin' knob
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Ticket: CM-13207
normal table on spine-1....we do not see 6.0.0.10 (spine-2's loopback)
spine-1 and spine-2 are in AS 65200
superm-redxp-05# show ip bgp
BGP table version is 13, local router ID is 6.0.0.9
Status codes: s suppressed, d damped, h history, * valid, > best, =
multipath,
i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 6.0.0.5/32 swp1 0 0 65101 ?
*> 6.0.0.6/32 swp2 0 0 65101 ?
*> 6.0.0.7/32 swp3 0 0 65104 ?
*> 6.0.0.8/32 swp4 0 0 65104 ?
*> 6.0.0.9/32 0.0.0.0 0 32768 ?
*= 6.0.0.11/32 swp2 0 65101 65001 ?
*> swp1 0 65101 65001 ?
*= 6.0.0.12/32 swp2 0 65101 65002 ?
*> swp1 0 65101 65002 ?
*= 6.0.0.13/32 swp4 0 65104 65001 ?
*> swp3 0 65104 65001 ?
*= 6.0.0.14/32 swp4 0 65104 65002 ?
*> swp3 0 65104 65002 ?
Displayed 9 out of 13 total prefixes
superm-redxp-05#
spine-1 with "neighbor x.x.x.x allowas-in origin", we now see 6.0.0.10
superm-redxp-05# show ip bgp
BGP table version is 14, local router ID is 6.0.0.9
Status codes: s suppressed, d damped, h history, * valid, > best, =
multipath,
i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 6.0.0.5/32 swp1 0 0 65101 ?
*> 6.0.0.6/32 swp2 0 0 65101 ?
*> 6.0.0.7/32 swp3 0 0 65104 ?
*> 6.0.0.8/32 swp4 0 0 65104 ?
* 6.0.0.9/32 swp2 0 65101 65200 ?
* swp1 0 65101 65200 ?
* swp3 0 65104 65200 ?
* swp4 0 65104 65200 ?
*> 0.0.0.0 0 32768 ?
*= 6.0.0.10/32 swp2 0 65101 65200 ?
*> swp1 0 65101 65200 ?
*= swp3 0 65104 65200 ?
*= swp4 0 65104 65200 ?
*= 6.0.0.11/32 swp2 0 65101 65001 ?
*> swp1 0 65101 65001 ?
*= 6.0.0.12/32 swp2 0 65101 65002 ?
*> swp1 0 65101 65002 ?
*= 6.0.0.13/32 swp4 0 65104 65001 ?
*> swp3 0 65104 65001 ?
*= 6.0.0.14/32 swp4 0 65104 65002 ?
*> swp3 0 65104 65002 ?
Displayed 10 out of 21 total prefixes
superm-redxp-05#
The only as-paths with 65200 that made it through were the ones that
originated from 65200
superm-redxp-05# show ip bgp regexp _65200_
BGP table version is 14, local router ID is 6.0.0.9
Status codes: s suppressed, d damped, h history, * valid, > best, =
multipath,
i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 6.0.0.9/32 swp2 0 65101 65200 ?
* swp1 0 65101 65200 ?
* swp3 0 65104 65200 ?
* swp4 0 65104 65200 ?
*= 6.0.0.10/32 swp2 0 65101 65200 ?
*> swp1 0 65101 65200 ?
*= swp3 0 65104 65200 ?
*= swp4 0 65104 65200 ?
Displayed 2 out of 21 total prefixes
superm-redxp-05#
2016-10-21 19:51:05 +02:00
|
|
|
extern int peer_allowas_in_set(struct peer *, afi_t, safi_t, int, int);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_allowas_in_unset(struct peer *, afi_t, safi_t);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-11-18 16:02:55 +01:00
|
|
|
extern int peer_local_as_set(struct peer *peer, as_t as, bool no_prepend,
|
|
|
|
bool replace_as, const char *as_str);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_local_as_unset(struct peer *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_prefix_list_set(struct peer *, afi_t, safi_t, int,
|
|
|
|
const char *);
|
|
|
|
extern int peer_prefix_list_unset(struct peer *, afi_t, safi_t, int);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_aslist_set(struct peer *, afi_t, safi_t, int, const char *);
|
|
|
|
extern int peer_aslist_unset(struct peer *, afi_t, safi_t, int);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-09-14 10:56:46 +02:00
|
|
|
extern int peer_route_map_set(struct peer *peer, afi_t afi, safi_t safi, int,
|
|
|
|
const char *name, struct route_map *route_map);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_route_map_unset(struct peer *, afi_t, safi_t, int);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-09-14 10:56:46 +02:00
|
|
|
extern int peer_unsuppress_map_set(struct peer *peer, afi_t afi, safi_t safi,
|
|
|
|
const char *name,
|
|
|
|
struct route_map *route_map);
|
[bgpd] TCP-MD5: password vty configuration and initial Linux support
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* bgp_packet.c: (bgp_open_receive) fix warning in a zlog call
* bgp_vty.c: (bgp_vty_return) add return code
* bgpd.c: (bgp_master_init) setup the socket list.
* bgp_network.c: Remove the dual IPv4/6 socket thing for now, which
was implemented by Michael, until such time as its clear its
required for Linux (see sockopt comments). IPv6 support, including
IPv4 sessions on AF_INET6 sockets, therefore is broken, and the
'-l 0.0.0.0' arguments would need to be given to bgpd to make
things work here.
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Tomohiko Kusuda <kusuda@inetcore.com>
Leigh Brown <leigh@solinno.co.uk>
* bgp_network.c: (bgp_md5_set_one) shim between libzebra tcp-md5
sockopt and bgpd.
(bgp_md5_set_socket) Helper for bgp_connect
(bgp_md5_set) setup TCP-MD5SIG for the given peer.
(bgp_connect) call out to bgp_md5_set_socket for the outgoing
connect socket.
(bgp_socket) save references to the listen sockets, needed if
TCP-MD5SIG is applied later or changed.
* bgp_vty.c: (*neighbor_password_cmd) New 'neighbor ... password'
commands.
* bgpd.c: (peer_{new,delete) manage TCP-MD5 password
(peer_group2peer_config_copy) inherit TCP-MD5 password
(peer_password_{un,}set) orchestrate the whole add/remove of TCP-MD5
passwords: applying checks, stopping peers, and trying to return
errors to UI, etc.
(bgp_config_write_peer) save password.
Fix missing newline in writeout of neighbor ... port.
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* sockunion.c: ifdef out various places that converted
v4mapped sockets to pure v4. Doesn't seem necessary at all,
presumably a workaround for now historical inet_ntop bugs (?)
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
* sockopt.{c,h}: (sockopt_tcp_signature) Add TCP-MD5SIG support.
2008-07-21 23:02:49 +02:00
|
|
|
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
extern int peer_advertise_map_set(struct peer *peer, afi_t afi, safi_t safi,
|
|
|
|
const char *advertise_name,
|
|
|
|
struct route_map *advertise_map,
|
2020-10-07 14:10:00 +02:00
|
|
|
const char *condition_name,
|
|
|
|
struct route_map *condition_map,
|
|
|
|
bool condition);
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
|
[bgpd] TCP-MD5: password vty configuration and initial Linux support
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* bgp_packet.c: (bgp_open_receive) fix warning in a zlog call
* bgp_vty.c: (bgp_vty_return) add return code
* bgpd.c: (bgp_master_init) setup the socket list.
* bgp_network.c: Remove the dual IPv4/6 socket thing for now, which
was implemented by Michael, until such time as its clear its
required for Linux (see sockopt comments). IPv6 support, including
IPv4 sessions on AF_INET6 sockets, therefore is broken, and the
'-l 0.0.0.0' arguments would need to be given to bgpd to make
things work here.
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Tomohiko Kusuda <kusuda@inetcore.com>
Leigh Brown <leigh@solinno.co.uk>
* bgp_network.c: (bgp_md5_set_one) shim between libzebra tcp-md5
sockopt and bgpd.
(bgp_md5_set_socket) Helper for bgp_connect
(bgp_md5_set) setup TCP-MD5SIG for the given peer.
(bgp_connect) call out to bgp_md5_set_socket for the outgoing
connect socket.
(bgp_socket) save references to the listen sockets, needed if
TCP-MD5SIG is applied later or changed.
* bgp_vty.c: (*neighbor_password_cmd) New 'neighbor ... password'
commands.
* bgpd.c: (peer_{new,delete) manage TCP-MD5 password
(peer_group2peer_config_copy) inherit TCP-MD5 password
(peer_password_{un,}set) orchestrate the whole add/remove of TCP-MD5
passwords: applying checks, stopping peers, and trying to return
errors to UI, etc.
(bgp_config_write_peer) save password.
Fix missing newline in writeout of neighbor ... port.
2008-07-21 Paul Jakma <paul.jakma@sun.com>
* sockunion.c: ifdef out various places that converted
v4mapped sockets to pure v4. Doesn't seem necessary at all,
presumably a workaround for now historical inet_ntop bugs (?)
2008-07-21 Michael H. Warfield <mhw@wittsend.com>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
* sockopt.{c,h}: (sockopt_tcp_signature) Add TCP-MD5SIG support.
2008-07-21 23:02:49 +02:00
|
|
|
extern int peer_password_set(struct peer *, const char *);
|
|
|
|
extern int peer_password_unset(struct peer *);
|
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_unsuppress_map_unset(struct peer *, afi_t, safi_t);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
extern int peer_advertise_map_unset(struct peer *peer, afi_t afi, safi_t safi,
|
|
|
|
const char *advertise_name,
|
|
|
|
struct route_map *advertise_map,
|
2020-10-07 14:10:00 +02:00
|
|
|
const char *condition_name,
|
|
|
|
struct route_map *condition_map,
|
|
|
|
bool condition);
|
bgpd: conditional advertisement
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 2.2.2.2/24
ipv6 address 2001:db8::2/128
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 2.2.2.0/24
network 200.200.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
address-family ipv6 unicast
network 2001:db8::2/128
network 2001:db8::200/128
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
neighbor 10.10.20.3 activate
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
match ipv6 address CONDITION_6
!
line vty
!
end
Router2#
Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 3.3.3.0/24 10.10.20.3 0 0 3 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 4 total paths
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 4 routes and 4 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
1 accepted prefixes
!--- Output suppressed.
Router2#
Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 3.3.3.0/24 0.0.0.0 0 3 i
Total number of prefixes 2
For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::3/128 :: 0 3 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised
Router2# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.10.10.1 0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Displayed 3 routes and 3 total paths
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Displayed 3 routes and 3 total paths
Router2#
Router2# show ip bgp neighbors 10.10.10.1
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 9, subgroup 5
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
1 accepted prefixes
For address family: IPv6 Unicast
Update group 10, subgroup 6
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
1 accepted prefixes
!--- Output suppressed.
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide
For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 1 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
*> 200.200.0.0/16 0.0.0.0 0 32768 i
Total number of prefixes 3
For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2001:db8::1/128 :: 0 1 i
*> 2001:db8::2/128 :: 0 32768 i
*> 2001:db8::200/128 :: 0 32768 i
Total number of prefixes 3
Router2#
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-09-29 11:46:04 +02:00
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
extern int peer_maximum_prefix_set(struct peer *, afi_t, safi_t, uint32_t,
|
2020-07-24 10:08:05 +02:00
|
|
|
uint8_t, int, uint16_t, bool force);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_maximum_prefix_unset(struct peer *, afi_t, safi_t);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-10-20 16:26:30 +02:00
|
|
|
extern void peer_maximum_prefix_out_refresh_routes(struct peer *peer, afi_t afi,
|
|
|
|
safi_t safi);
|
2021-10-25 13:25:19 +02:00
|
|
|
extern int peer_maximum_prefix_out_set(struct peer *peer, afi_t afi,
|
|
|
|
safi_t safi, uint32_t max);
|
|
|
|
extern int peer_maximum_prefix_out_unset(struct peer *peer, afi_t afi,
|
|
|
|
safi_t safi);
|
2021-10-20 16:26:30 +02:00
|
|
|
|
2015-05-20 02:40:37 +02:00
|
|
|
extern int peer_clear(struct peer *, struct listnode **);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int peer_clear_soft(struct peer *, afi_t, safi_t, enum bgp_clear_type);
|
2005-02-02 15:40:33 +01:00
|
|
|
|
bgpd: RFC 5082 Generalized TTL Security Mechanism support
* bgpd: Add support for RFC 5082 GTSM, which allows the TTL field to be used
to verify that incoming packets have been sent from neighbours no more
than X IP hops away. In other words, this allows packets that were sent from
further away (i.e. not by the neighbour with known distance, and so possibly
a miscreant) to be filtered out.
* lib/sockunion.{c,h}: (sockopt_minttl) new function, to set a minimum TTL
using the IP_MINTTL socket opt.
* bgpd.h: (BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK) define for command
error for minttl.
(struct peer) add a config variable, to store the configured minttl.
(peer_ttl_security_hops_{set,unset}) configuration handlers
* bgpd.c: (peer_group_get) init gtsm_hops
(peer_ebgp_multihop_{un,}set) check for conflicts with GTSM. Multihop and
GTSM can't both be active for a peer at the same time.
(peer_ttl_security_hops_set) set minttl, taking care to avoid conflicts with
ebgp_multihop.
(bgp_config_write_peer) write out minttl as "neighbor .. ttl-security hops X".
* bgp_vty.c: (bgp_vty_return) message for
BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK
(peer_ebgp_multihop_{un,}set_vty)
* bgp_network.c: (bgp_accept) set minttl on accepted sockets if appropriate.
(bgp_connect) ditto for outbound.
2011-03-23 16:33:17 +01:00
|
|
|
extern int peer_ttl_security_hops_set(struct peer *, int);
|
|
|
|
extern int peer_ttl_security_hops_unset(struct peer *);
|
|
|
|
|
2020-03-20 10:57:54 +01:00
|
|
|
extern void peer_tx_shutdown_message_set(struct peer *, const char *msg);
|
|
|
|
extern void peer_tx_shutdown_message_unset(struct peer *);
|
2017-01-25 03:30:52 +01:00
|
|
|
|
2022-02-23 01:04:25 +01:00
|
|
|
extern void bgp_route_map_update_timer(struct thread *thread);
|
2022-06-20 14:39:03 +02:00
|
|
|
extern const char *bgp_get_name_by_role(uint8_t role);
|
bgpd: aspath list format binds on as-notation format
Each BGP prefix may have an as-path list attached. A forged
string is stored in the BGP attribute and shows the as-path
list output.
Before this commit, the as-path list output was expressed as
a list of AS values in plain format. Now, if a given BGP instance
uses a specific asnotation, then the output is changed:
new output:
router bgp 1.1 asnotation dot
!
address-family ipv4 unicast
network 10.200.0.0/24 route-map rmap
network 10.201.0.0/24 route-map rmap
redistribute connected route-map rmap
exit-address-family
exit
!
route-map rmap permit 1
set as-path prepend 1.1 5433.55 264564564
exit
ubuntu2004# do show bgp ipv4
BGP table version is 2, local router ID is 10.0.2.15, vrf id 0
Default local pref 100, local AS 1.1
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 4.4.4.4/32 0.0.0.0 0 32768 1.1 5433.55 4036.61268 ?
*> 10.0.2.0/24 0.0.0.0 0 32768 1.1 5433.55 4036.61268 ?
10.200.0.0/24 0.0.0.0 0 32768 1.1 5433.55 4036.61268 i
10.201.0.0/24 0.0.0.0 0 32768 1.1 5433.55 4036.61268 i
The changes include:
- the aspath structure has a new field: asnotation type
The ashash list will differentiate 2 aspaths using a different
asnotation.
- 3 new printf extensions display the as number in the wished
format: pASP, pASD, pASE for plain, dot, or dot+ format (extended).
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-11-14 15:56:40 +01:00
|
|
|
extern enum asnotation_mode bgp_get_asnotation(struct bgp *bgp);
|
2022-06-17 12:14:46 +02:00
|
|
|
|
2015-05-20 02:40:45 +02:00
|
|
|
extern void bgp_route_map_terminate(void);
|
2015-05-20 02:58:12 +02:00
|
|
|
|
|
|
|
extern int peer_cmp(struct peer *p1, struct peer *p2);
|
2015-05-20 03:03:47 +02:00
|
|
|
|
2017-08-01 02:06:40 +02:00
|
|
|
extern int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, iana_safi_t pkt_safi,
|
2016-06-15 19:25:35 +02:00
|
|
|
afi_t *afi, safi_t *safi);
|
|
|
|
extern int bgp_map_afi_safi_int2iana(afi_t afi, safi_t safi,
|
2018-02-09 19:22:50 +01:00
|
|
|
iana_afi_t *pkt_afi,
|
|
|
|
iana_safi_t *pkt_safi);
|
2016-06-15 19:25:35 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
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);
|
|
|
|
|
2020-08-20 16:50:21 +02:00
|
|
|
extern void bgp_shutdown_enable(struct bgp *bgp, const char *msg);
|
2020-08-13 17:52:49 +02:00
|
|
|
extern void bgp_shutdown_disable(struct bgp *bgp);
|
|
|
|
|
2015-05-20 03:12:17 +02:00
|
|
|
extern void bgp_close(void);
|
2017-08-07 13:40:10 +02:00
|
|
|
extern void bgp_free(struct bgp *);
|
2019-10-23 07:32:45 +02:00
|
|
|
void bgp_gr_apply_running_config(void);
|
|
|
|
|
|
|
|
/* BGP GR */
|
|
|
|
int bgp_global_gr_init(struct bgp *bgp);
|
|
|
|
int bgp_peer_gr_init(struct peer *peer);
|
2017-08-07 13:40:10 +02:00
|
|
|
|
2019-10-25 17:42:39 +02:00
|
|
|
|
2020-01-31 19:04:00 +01:00
|
|
|
#define BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(_bgp, _peer_list) \
|
|
|
|
do { \
|
|
|
|
struct peer *peer_loop; \
|
|
|
|
bool gr_router_detected = false; \
|
|
|
|
struct listnode *node = {0}; \
|
|
|
|
for (ALL_LIST_ELEMENTS_RO(_peer_list, node, peer_loop)) { \
|
|
|
|
if (CHECK_FLAG(peer_loop->flags, \
|
|
|
|
PEER_FLAG_GRACEFUL_RESTART)) \
|
|
|
|
gr_router_detected = true; \
|
|
|
|
} \
|
|
|
|
if (gr_router_detected \
|
|
|
|
&& _bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) { \
|
|
|
|
bgp_zebra_send_capabilities(_bgp, false); \
|
|
|
|
} else if (!gr_router_detected \
|
|
|
|
&& _bgp->present_zebra_gr_state \
|
|
|
|
== ZEBRA_GR_ENABLE) { \
|
|
|
|
bgp_zebra_send_capabilities(_bgp, true); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2019-10-25 17:42:39 +02:00
|
|
|
|
2017-08-07 13:40:10 +02:00
|
|
|
static inline struct bgp *bgp_lock(struct bgp *bgp)
|
|
|
|
{
|
|
|
|
bgp->lock++;
|
|
|
|
return bgp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void bgp_unlock(struct bgp *bgp)
|
|
|
|
{
|
|
|
|
assert(bgp->lock > 0);
|
|
|
|
if (--bgp->lock == 0)
|
|
|
|
bgp_free(bgp);
|
|
|
|
}
|
2015-05-20 03:12:17 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
static inline int afindex(afi_t afi, safi_t safi)
|
|
|
|
{
|
|
|
|
switch (afi) {
|
|
|
|
case AFI_IP:
|
|
|
|
switch (safi) {
|
|
|
|
case SAFI_UNICAST:
|
|
|
|
return BGP_AF_IPV4_UNICAST;
|
|
|
|
case SAFI_MULTICAST:
|
|
|
|
return BGP_AF_IPV4_MULTICAST;
|
2017-03-09 15:54:20 +01:00
|
|
|
case SAFI_LABELED_UNICAST:
|
|
|
|
return BGP_AF_IPV4_LBL_UNICAST;
|
2015-05-20 03:03:47 +02:00
|
|
|
case SAFI_MPLS_VPN:
|
|
|
|
return BGP_AF_IPV4_VPN;
|
2016-01-12 19:42:02 +01:00
|
|
|
case SAFI_ENCAP:
|
|
|
|
return BGP_AF_IPV4_ENCAP;
|
2017-01-23 03:45:30 +01:00
|
|
|
case SAFI_FLOWSPEC:
|
|
|
|
return BGP_AF_IPV4_FLOWSPEC;
|
2023-01-30 16:05:41 +01:00
|
|
|
case SAFI_EVPN:
|
|
|
|
case SAFI_UNSPEC:
|
|
|
|
case SAFI_MAX:
|
2015-05-20 03:03:47 +02:00
|
|
|
return BGP_AF_MAX;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
break;
|
2015-05-20 03:03:47 +02:00
|
|
|
case AFI_IP6:
|
|
|
|
switch (safi) {
|
|
|
|
case SAFI_UNICAST:
|
|
|
|
return BGP_AF_IPV6_UNICAST;
|
|
|
|
case SAFI_MULTICAST:
|
|
|
|
return BGP_AF_IPV6_MULTICAST;
|
2017-03-09 15:54:20 +01:00
|
|
|
case SAFI_LABELED_UNICAST:
|
|
|
|
return BGP_AF_IPV6_LBL_UNICAST;
|
|
|
|
case SAFI_MPLS_VPN:
|
2016-06-11 20:36:42 +02:00
|
|
|
return BGP_AF_IPV6_VPN;
|
2016-01-12 19:42:02 +01:00
|
|
|
case SAFI_ENCAP:
|
|
|
|
return BGP_AF_IPV6_ENCAP;
|
2017-01-23 03:45:30 +01:00
|
|
|
case SAFI_FLOWSPEC:
|
|
|
|
return BGP_AF_IPV6_FLOWSPEC;
|
2023-01-30 16:05:41 +01:00
|
|
|
case SAFI_EVPN:
|
|
|
|
case SAFI_UNSPEC:
|
|
|
|
case SAFI_MAX:
|
2015-05-20 03:03:47 +02:00
|
|
|
return BGP_AF_MAX;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
break;
|
2017-01-20 17:13:24 +01:00
|
|
|
case AFI_L2VPN:
|
|
|
|
switch (safi) {
|
|
|
|
case SAFI_EVPN:
|
|
|
|
return BGP_AF_L2VPN_EVPN;
|
2023-01-30 16:05:41 +01:00
|
|
|
case SAFI_UNICAST:
|
|
|
|
case SAFI_MULTICAST:
|
|
|
|
case SAFI_LABELED_UNICAST:
|
|
|
|
case SAFI_MPLS_VPN:
|
|
|
|
case SAFI_ENCAP:
|
|
|
|
case SAFI_FLOWSPEC:
|
|
|
|
case SAFI_UNSPEC:
|
|
|
|
case SAFI_MAX:
|
2015-05-20 03:03:47 +02:00
|
|
|
return BGP_AF_MAX;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2023-01-30 16:05:41 +01:00
|
|
|
break;
|
|
|
|
case AFI_UNSPEC:
|
|
|
|
case AFI_MAX:
|
2015-05-20 03:03:47 +02:00
|
|
|
return BGP_AF_MAX;
|
|
|
|
}
|
2023-01-30 16:05:41 +01:00
|
|
|
|
|
|
|
assert(!"Reached end of function we should never hit");
|
2015-05-20 03:03:47 +02:00
|
|
|
}
|
|
|
|
|
BGP: Remove the requirement to rebind a peer to its peer-group under the address-family.
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-3868
NOTE: Many of the ibgp peers are not up in the 'show ip bgp summ' output below. This
is because ospf was disabled at the time. The main thing to look for is whether or
not all of the correct peers are listed based on their 'activate' status.
Basic Example
=============
router bgp 10
bgp router-id 10.0.0.1
no bgp default ipv4-unicast
no bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid
bgp route-map delay-timer 1
neighbor EBGP peer-group
neighbor EBGP advertisement-interval 1
neighbor IBGP peer-group
neighbor IBGP remote-as 10
neighbor IBGP update-source 10.0.0.1
neighbor IBGP advertisement-interval 1
neighbor 10.0.0.2 peer-group IBGP
neighbor 10.0.0.3 peer-group IBGP
neighbor 10.0.0.4 peer-group IBGP
neighbor 20.1.1.6 remote-as 20
neighbor 20.1.1.6 peer-group EBGP
neighbor 20.1.1.7 remote-as 20
neighbor 20.1.1.7 peer-group EBGP
neighbor 40.1.1.2 remote-as 40
neighbor 40.1.1.2 peer-group EBGP
neighbor 40.1.1.6 remote-as 40
neighbor 40.1.1.6 peer-group EBGP
neighbor 40.1.1.10 remote-as 40
neighbor 40.1.1.10 peer-group EBGP
!
address-family ipv4 unicast
neighbor EBGP activate
neighbor IBGP activate
neighbor IBGP next-hop-self
exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r2(10.0.0.2) 4 10 107 211 0 0 0 00:23:01 Connect
r3(10.0.0.3) 4 10 107 211 0 0 0 00:23:01 Connect
r4(10.0.0.4) 4 10 207 211 0 0 0 00:23:01 Active
r6(20.1.1.6) 4 20 873 975 0 0 0 00:23:29 600
r7(20.1.1.7) 4 20 873 976 0 0 0 00:23:29 600
r8(40.1.1.2) 4 40 874 975 0 0 0 00:23:30 600
r9(40.1.1.6) 4 40 874 975 0 0 0 00:23:30 600
r10(40.1.1.10) 4 40 874 975 0 0 0 00:23:30 600
Total number of neighbors 8
superm-redxp-05#
Example where one member of the peer-group is inactive...we can do this now that
peer-group members can have different outbound policies from the peer-group.
================================================================================
superm-redxp-05# conf t
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# no neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# do show run
router bgp 10
bgp router-id 10.0.0.1
no bgp default ipv4-unicast
no bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid
bgp route-map delay-timer 1
neighbor EBGP peer-group
neighbor EBGP advertisement-interval 1
neighbor IBGP peer-group
neighbor IBGP remote-as 10
neighbor IBGP update-source 10.0.0.1
neighbor IBGP advertisement-interval 1
neighbor 10.0.0.2 peer-group IBGP
neighbor 10.0.0.3 peer-group IBGP
neighbor 10.0.0.4 peer-group IBGP
neighbor 20.1.1.6 remote-as 20
neighbor 20.1.1.6 peer-group EBGP
neighbor 20.1.1.7 remote-as 20
neighbor 20.1.1.7 peer-group EBGP
neighbor 40.1.1.2 remote-as 40
neighbor 40.1.1.2 peer-group EBGP
neighbor 40.1.1.6 remote-as 40
neighbor 40.1.1.6 peer-group EBGP
neighbor 40.1.1.10 remote-as 40
neighbor 40.1.1.10 peer-group EBGP
!
address-family ipv4 unicast
neighbor EBGP activate
neighbor IBGP activate
neighbor IBGP next-hop-self
no neighbor 10.0.0.3 activate
exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r2(10.0.0.2) 4 10 107 211 0 0 0 00:23:24 Connect
r4(10.0.0.4) 4 10 207 211 0 0 0 00:23:24 Active
r6(20.1.1.6) 4 20 881 983 0 0 0 00:23:52 600
r7(20.1.1.7) 4 20 881 984 0 0 0 00:23:52 600
r8(40.1.1.2) 4 40 881 982 0 0 0 00:23:53 600
r9(40.1.1.6) 4 40 881 982 0 0 0 00:23:53 600
r10(40.1.1.10) 4 40 881 982 0 0 0 00:23:53 600
Total number of neighbors 7
superm-redxp-05#
Example where the peer-group is inactive but a member of the peer-group is active:
==================================================================================
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# no neighbor IBGP activate
superm-redxp-05(config-router-af)#
superm-redxp-05(config-router-af)# neighbor 10.0.0.4 activate
superm-redxp-05(config-router-af)# end
superm-redxp-05# show run
router bgp 10
bgp router-id 10.0.0.1
no bgp default ipv4-unicast
no bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid
bgp route-map delay-timer 1
neighbor EBGP peer-group
neighbor EBGP advertisement-interval 1
neighbor IBGP peer-group
neighbor IBGP remote-as 10
neighbor IBGP update-source 10.0.0.1
neighbor IBGP advertisement-interval 1
neighbor 10.0.0.2 peer-group IBGP
neighbor 10.0.0.3 peer-group IBGP
neighbor 10.0.0.4 peer-group IBGP
neighbor 20.1.1.6 remote-as 20
neighbor 20.1.1.6 peer-group EBGP
neighbor 20.1.1.7 remote-as 20
neighbor 20.1.1.7 peer-group EBGP
neighbor 40.1.1.2 remote-as 40
neighbor 40.1.1.2 peer-group EBGP
neighbor 40.1.1.6 remote-as 40
neighbor 40.1.1.6 peer-group EBGP
neighbor 40.1.1.10 remote-as 40
neighbor 40.1.1.10 peer-group EBGP
!
address-family ipv4 unicast
neighbor EBGP activate
neighbor IBGP next-hop-self
neighbor 10.0.0.4 activate
exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r4(10.0.0.4) 4 10 207 211 0 0 0 00:24:56 Active
r6(20.1.1.6) 4 20 911 1013 0 0 0 00:25:24 600
r7(20.1.1.7) 4 20 911 1014 0 0 0 00:25:24 600
r8(40.1.1.2) 4 40 912 1013 0 0 0 00:25:25 600
r9(40.1.1.6) 4 40 912 1013 0 0 0 00:25:25 600
r10(40.1.1.10) 4 40 912 1013 0 0 0 00:25:25 600
Total number of neighbors 6
superm-redxp-05#
2015-11-20 19:53:50 +01:00
|
|
|
/* If the peer is not a peer-group but is bound to a peer-group return 1 */
|
2015-05-20 03:03:47 +02:00
|
|
|
static inline int peer_group_active(struct peer *peer)
|
|
|
|
{
|
BGP: Remove the requirement to rebind a peer to its peer-group under the address-family.
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-3868
NOTE: Many of the ibgp peers are not up in the 'show ip bgp summ' output below. This
is because ospf was disabled at the time. The main thing to look for is whether or
not all of the correct peers are listed based on their 'activate' status.
Basic Example
=============
router bgp 10
bgp router-id 10.0.0.1
no bgp default ipv4-unicast
no bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid
bgp route-map delay-timer 1
neighbor EBGP peer-group
neighbor EBGP advertisement-interval 1
neighbor IBGP peer-group
neighbor IBGP remote-as 10
neighbor IBGP update-source 10.0.0.1
neighbor IBGP advertisement-interval 1
neighbor 10.0.0.2 peer-group IBGP
neighbor 10.0.0.3 peer-group IBGP
neighbor 10.0.0.4 peer-group IBGP
neighbor 20.1.1.6 remote-as 20
neighbor 20.1.1.6 peer-group EBGP
neighbor 20.1.1.7 remote-as 20
neighbor 20.1.1.7 peer-group EBGP
neighbor 40.1.1.2 remote-as 40
neighbor 40.1.1.2 peer-group EBGP
neighbor 40.1.1.6 remote-as 40
neighbor 40.1.1.6 peer-group EBGP
neighbor 40.1.1.10 remote-as 40
neighbor 40.1.1.10 peer-group EBGP
!
address-family ipv4 unicast
neighbor EBGP activate
neighbor IBGP activate
neighbor IBGP next-hop-self
exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r2(10.0.0.2) 4 10 107 211 0 0 0 00:23:01 Connect
r3(10.0.0.3) 4 10 107 211 0 0 0 00:23:01 Connect
r4(10.0.0.4) 4 10 207 211 0 0 0 00:23:01 Active
r6(20.1.1.6) 4 20 873 975 0 0 0 00:23:29 600
r7(20.1.1.7) 4 20 873 976 0 0 0 00:23:29 600
r8(40.1.1.2) 4 40 874 975 0 0 0 00:23:30 600
r9(40.1.1.6) 4 40 874 975 0 0 0 00:23:30 600
r10(40.1.1.10) 4 40 874 975 0 0 0 00:23:30 600
Total number of neighbors 8
superm-redxp-05#
Example where one member of the peer-group is inactive...we can do this now that
peer-group members can have different outbound policies from the peer-group.
================================================================================
superm-redxp-05# conf t
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# no neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# do show run
router bgp 10
bgp router-id 10.0.0.1
no bgp default ipv4-unicast
no bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid
bgp route-map delay-timer 1
neighbor EBGP peer-group
neighbor EBGP advertisement-interval 1
neighbor IBGP peer-group
neighbor IBGP remote-as 10
neighbor IBGP update-source 10.0.0.1
neighbor IBGP advertisement-interval 1
neighbor 10.0.0.2 peer-group IBGP
neighbor 10.0.0.3 peer-group IBGP
neighbor 10.0.0.4 peer-group IBGP
neighbor 20.1.1.6 remote-as 20
neighbor 20.1.1.6 peer-group EBGP
neighbor 20.1.1.7 remote-as 20
neighbor 20.1.1.7 peer-group EBGP
neighbor 40.1.1.2 remote-as 40
neighbor 40.1.1.2 peer-group EBGP
neighbor 40.1.1.6 remote-as 40
neighbor 40.1.1.6 peer-group EBGP
neighbor 40.1.1.10 remote-as 40
neighbor 40.1.1.10 peer-group EBGP
!
address-family ipv4 unicast
neighbor EBGP activate
neighbor IBGP activate
neighbor IBGP next-hop-self
no neighbor 10.0.0.3 activate
exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r2(10.0.0.2) 4 10 107 211 0 0 0 00:23:24 Connect
r4(10.0.0.4) 4 10 207 211 0 0 0 00:23:24 Active
r6(20.1.1.6) 4 20 881 983 0 0 0 00:23:52 600
r7(20.1.1.7) 4 20 881 984 0 0 0 00:23:52 600
r8(40.1.1.2) 4 40 881 982 0 0 0 00:23:53 600
r9(40.1.1.6) 4 40 881 982 0 0 0 00:23:53 600
r10(40.1.1.10) 4 40 881 982 0 0 0 00:23:53 600
Total number of neighbors 7
superm-redxp-05#
Example where the peer-group is inactive but a member of the peer-group is active:
==================================================================================
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# no neighbor IBGP activate
superm-redxp-05(config-router-af)#
superm-redxp-05(config-router-af)# neighbor 10.0.0.4 activate
superm-redxp-05(config-router-af)# end
superm-redxp-05# show run
router bgp 10
bgp router-id 10.0.0.1
no bgp default ipv4-unicast
no bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid
bgp route-map delay-timer 1
neighbor EBGP peer-group
neighbor EBGP advertisement-interval 1
neighbor IBGP peer-group
neighbor IBGP remote-as 10
neighbor IBGP update-source 10.0.0.1
neighbor IBGP advertisement-interval 1
neighbor 10.0.0.2 peer-group IBGP
neighbor 10.0.0.3 peer-group IBGP
neighbor 10.0.0.4 peer-group IBGP
neighbor 20.1.1.6 remote-as 20
neighbor 20.1.1.6 peer-group EBGP
neighbor 20.1.1.7 remote-as 20
neighbor 20.1.1.7 peer-group EBGP
neighbor 40.1.1.2 remote-as 40
neighbor 40.1.1.2 peer-group EBGP
neighbor 40.1.1.6 remote-as 40
neighbor 40.1.1.6 peer-group EBGP
neighbor 40.1.1.10 remote-as 40
neighbor 40.1.1.10 peer-group EBGP
!
address-family ipv4 unicast
neighbor EBGP activate
neighbor IBGP next-hop-self
neighbor 10.0.0.4 activate
exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r4(10.0.0.4) 4 10 207 211 0 0 0 00:24:56 Active
r6(20.1.1.6) 4 20 911 1013 0 0 0 00:25:24 600
r7(20.1.1.7) 4 20 911 1014 0 0 0 00:25:24 600
r8(40.1.1.2) 4 40 912 1013 0 0 0 00:25:25 600
r9(40.1.1.6) 4 40 912 1013 0 0 0 00:25:25 600
r10(40.1.1.10) 4 40 912 1013 0 0 0 00:25:25 600
Total number of neighbors 6
superm-redxp-05#
2015-11-20 19:53:50 +01:00
|
|
|
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP) && peer->group)
|
2015-05-20 03:03:47 +02:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If peer is negotiated at least one address family return 1. */
|
|
|
|
static inline int peer_afi_active_nego(const struct peer *peer, afi_t afi)
|
|
|
|
{
|
|
|
|
if (peer->afc_nego[afi][SAFI_UNICAST]
|
|
|
|
|| peer->afc_nego[afi][SAFI_MULTICAST]
|
2017-03-09 15:54:20 +01:00
|
|
|
|| peer->afc_nego[afi][SAFI_LABELED_UNICAST]
|
2016-01-12 19:42:02 +01:00
|
|
|
|| peer->afc_nego[afi][SAFI_MPLS_VPN]
|
2017-05-15 23:28:38 +02:00
|
|
|
|| peer->afc_nego[afi][SAFI_ENCAP]
|
2017-01-23 03:45:30 +01:00
|
|
|
|| peer->afc_nego[afi][SAFI_FLOWSPEC]
|
2017-05-15 23:28:38 +02:00
|
|
|
|| peer->afc_nego[afi][SAFI_EVPN])
|
2015-05-20 03:03:47 +02:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
/* If at least one address family activated for group, return 1. */
|
|
|
|
static inline int peer_group_af_configured(struct peer_group *group)
|
|
|
|
{
|
|
|
|
struct peer *peer = group->conf;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
if (peer->afc[AFI_IP][SAFI_UNICAST] || peer->afc[AFI_IP][SAFI_MULTICAST]
|
2017-03-09 15:54:20 +01:00
|
|
|
|| peer->afc[AFI_IP][SAFI_LABELED_UNICAST]
|
2017-01-23 03:45:30 +01:00
|
|
|
|| peer->afc[AFI_IP][SAFI_FLOWSPEC]
|
2015-05-20 03:03:47 +02:00
|
|
|
|| peer->afc[AFI_IP][SAFI_MPLS_VPN] || peer->afc[AFI_IP][SAFI_ENCAP]
|
|
|
|
|| peer->afc[AFI_IP6][SAFI_UNICAST]
|
2016-06-11 20:36:42 +02:00
|
|
|
|| peer->afc[AFI_IP6][SAFI_MULTICAST]
|
2017-03-09 15:54:20 +01:00
|
|
|
|| peer->afc[AFI_IP6][SAFI_LABELED_UNICAST]
|
2016-01-12 19:42:02 +01:00
|
|
|
|| peer->afc[AFI_IP6][SAFI_MPLS_VPN]
|
2017-06-14 04:12:10 +02:00
|
|
|
|| peer->afc[AFI_IP6][SAFI_ENCAP]
|
2017-01-23 03:45:30 +01:00
|
|
|
|| peer->afc[AFI_IP6][SAFI_FLOWSPEC]
|
2017-06-14 04:12:10 +02:00
|
|
|
|| peer->afc[AFI_L2VPN][SAFI_EVPN])
|
2015-05-20 03:03:47 +02:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-20 03:03:47 +02:00
|
|
|
static inline char *timestamp_string(time_t ts)
|
|
|
|
{
|
|
|
|
time_t tbuf;
|
2022-08-18 00:27:54 +02:00
|
|
|
tbuf = time(NULL) - (monotime(NULL) - ts);
|
2015-05-20 03:03:47 +02:00
|
|
|
return ctime(&tbuf);
|
|
|
|
}
|
|
|
|
|
2021-06-07 15:39:10 +02:00
|
|
|
static inline bool peer_established(struct peer *peer)
|
2015-05-20 03:03:47 +02:00
|
|
|
{
|
2021-06-07 15:39:10 +02:00
|
|
|
return peer->status == Established;
|
2015-05-20 03:03:47 +02:00
|
|
|
}
|
|
|
|
|
bgpd: Do not delete BGP dynamic peers if graceful restart kicks in
```
~# vtysh -c 'show bgp ipv4 unicast summary' | grep 192.168.10.17
*donatas-pc(192.168.10.17) 4 65002 8 12 0 0 0 00:01:35 2 14 N/A
```
Before shutting down 192.168.10.17:
```
~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32'
BGP routing table entry for 100.100.100.100/32, version 7
Paths: (2 available, best #2, table default)
Advertised to non peer-group peers:
home-spine1.donatas.net(192.168.0.2)
65002, (stale)
192.168.10.17 from donatas-pc(192.168.10.17) (0.0.0.0)
Origin incomplete, valid, external
Last update: Sat Jan 15 21:45:47 2022
65001
192.168.0.2 from home-spine1.donatas.net(192.168.0.2) (2.2.2.2)
Origin incomplete, metric 0, valid, external, best (Older Path)
Last update: Sat Jan 15 21:25:19 2022
```
After 192.168.10.17 is down:
```
~# vtysh -c 'show bgp ipv4 unicast summary' | grep 192.168.10.17
donatas-pc(192.168.10.17) 4 65002 5 9 0 0 0 00:00:12 Active 0 N/A
~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32'
BGP routing table entry for 100.100.100.100/32, version 7
Paths: (2 available, best #2, table default)
Advertised to non peer-group peers:
home-spine1.donatas.net(192.168.0.2)
65002, (stale)
192.168.10.17 from donatas-pc(192.168.10.17) (0.0.0.0)
Origin incomplete, valid, external
Community: llgr-stale
Last update: Sat Jan 15 21:49:01 2022
Time until Long-lived stale route deleted: 16
65001
192.168.0.2 from home-spine1.donatas.net(192.168.0.2) (2.2.2.2)
Origin incomplete, metric 0, valid, external, best (First path received)
Last update: Sat Jan 15 21:25:19 2022
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-15 22:16:15 +01:00
|
|
|
static inline bool peer_dynamic_neighbor(struct peer *peer)
|
2015-05-20 03:03:47 +02:00
|
|
|
{
|
bgpd: Do not delete BGP dynamic peers if graceful restart kicks in
```
~# vtysh -c 'show bgp ipv4 unicast summary' | grep 192.168.10.17
*donatas-pc(192.168.10.17) 4 65002 8 12 0 0 0 00:01:35 2 14 N/A
```
Before shutting down 192.168.10.17:
```
~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32'
BGP routing table entry for 100.100.100.100/32, version 7
Paths: (2 available, best #2, table default)
Advertised to non peer-group peers:
home-spine1.donatas.net(192.168.0.2)
65002, (stale)
192.168.10.17 from donatas-pc(192.168.10.17) (0.0.0.0)
Origin incomplete, valid, external
Last update: Sat Jan 15 21:45:47 2022
65001
192.168.0.2 from home-spine1.donatas.net(192.168.0.2) (2.2.2.2)
Origin incomplete, metric 0, valid, external, best (Older Path)
Last update: Sat Jan 15 21:25:19 2022
```
After 192.168.10.17 is down:
```
~# vtysh -c 'show bgp ipv4 unicast summary' | grep 192.168.10.17
donatas-pc(192.168.10.17) 4 65002 5 9 0 0 0 00:00:12 Active 0 N/A
~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32'
BGP routing table entry for 100.100.100.100/32, version 7
Paths: (2 available, best #2, table default)
Advertised to non peer-group peers:
home-spine1.donatas.net(192.168.0.2)
65002, (stale)
192.168.10.17 from donatas-pc(192.168.10.17) (0.0.0.0)
Origin incomplete, valid, external
Community: llgr-stale
Last update: Sat Jan 15 21:49:01 2022
Time until Long-lived stale route deleted: 16
65001
192.168.0.2 from home-spine1.donatas.net(192.168.0.2) (2.2.2.2)
Origin incomplete, metric 0, valid, external, best (First path received)
Last update: Sat Jan 15 21:25:19 2022
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-15 22:16:15 +01:00
|
|
|
return CHECK_FLAG(peer->flags, PEER_FLAG_DYNAMIC_NEIGHBOR);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool peer_dynamic_neighbor_no_nsf(struct peer *peer)
|
|
|
|
{
|
|
|
|
return (peer_dynamic_neighbor(peer) &&
|
|
|
|
!CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT));
|
2015-05-20 03:03:47 +02:00
|
|
|
}
|
|
|
|
|
2017-05-10 15:40:29 +02:00
|
|
|
static inline int peer_cap_enhe(struct peer *peer, afi_t afi, safi_t safi)
|
2015-06-11 18:19:12 +02:00
|
|
|
{
|
2017-05-10 15:40:29 +02:00
|
|
|
return (CHECK_FLAG(peer->af_cap[afi][safi], PEER_CAP_ENHE_AF_NEGO));
|
2015-06-11 18:19:12 +02:00
|
|
|
}
|
|
|
|
|
2016-02-20 03:43:30 +01:00
|
|
|
/* Lookup VRF for BGP instance based on its type. */
|
|
|
|
static inline struct vrf *bgp_vrf_lookup_by_instance_type(struct bgp *bgp)
|
|
|
|
{
|
|
|
|
struct vrf *vrf;
|
|
|
|
|
|
|
|
if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
|
2016-11-02 15:16:58 +01:00
|
|
|
vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
2016-02-20 03:43:30 +01:00
|
|
|
else if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
|
|
|
|
vrf = vrf_lookup_by_name(bgp->name);
|
|
|
|
else
|
|
|
|
vrf = NULL;
|
|
|
|
|
|
|
|
return vrf;
|
|
|
|
}
|
|
|
|
|
2020-09-28 17:35:35 +02:00
|
|
|
static inline uint32_t bgp_vrf_interfaces(struct bgp *bgp, bool active)
|
|
|
|
{
|
|
|
|
struct vrf *vrf;
|
|
|
|
struct interface *ifp;
|
|
|
|
uint32_t count = 0;
|
|
|
|
|
|
|
|
/* if there is one interface in the vrf which is up then it is deemed
|
|
|
|
* active
|
|
|
|
*/
|
|
|
|
vrf = bgp_vrf_lookup_by_instance_type(bgp);
|
|
|
|
if (vrf == NULL)
|
|
|
|
return 0;
|
|
|
|
RB_FOREACH (ifp, if_name_head, &vrf->ifaces_by_name) {
|
2022-04-29 18:49:08 +02:00
|
|
|
if (strcmp(ifp->name, bgp->name) == 0)
|
2020-09-28 17:35:35 +02:00
|
|
|
continue;
|
|
|
|
if (!active || if_is_up(ifp))
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2016-02-20 03:43:30 +01:00
|
|
|
/* Link BGP instance to VRF. */
|
|
|
|
static inline void bgp_vrf_link(struct bgp *bgp, struct vrf *vrf)
|
|
|
|
{
|
|
|
|
bgp->vrf_id = vrf->vrf_id;
|
2017-08-07 13:40:10 +02:00
|
|
|
if (vrf->info != (void *)bgp)
|
|
|
|
vrf->info = (void *)bgp_lock(bgp);
|
2016-02-20 03:43:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Unlink BGP instance from VRF. */
|
|
|
|
static inline void bgp_vrf_unlink(struct bgp *bgp, struct vrf *vrf)
|
|
|
|
{
|
2016-03-16 21:38:31 +01:00
|
|
|
if (vrf->info == (void *)bgp) {
|
|
|
|
vrf->info = NULL;
|
|
|
|
bgp_unlock(bgp);
|
|
|
|
}
|
2016-04-14 00:43:15 +02:00
|
|
|
bgp->vrf_id = VRF_UNKNOWN;
|
2016-02-20 03:43:30 +01:00
|
|
|
}
|
|
|
|
|
2020-09-19 21:50:46 +02:00
|
|
|
static inline bool bgp_in_graceful_shutdown(struct bgp *bgp)
|
|
|
|
{
|
2020-09-19 23:22:17 +02:00
|
|
|
/* True if either set for this instance or globally */
|
|
|
|
return (!!CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN) ||
|
|
|
|
!!CHECK_FLAG(bm->flags, BM_FLAG_GRACEFUL_SHUTDOWN));
|
2020-09-19 21:50:46 +02:00
|
|
|
}
|
|
|
|
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
/* For benefit of rfapi */
|
|
|
|
extern struct peer *peer_new(struct bgp *bgp);
|
2019-08-08 04:58:18 +02:00
|
|
|
|
|
|
|
extern struct peer *peer_lookup_in_view(struct vty *vty, struct bgp *bgp,
|
|
|
|
const char *ip_str, bool use_json);
|
2020-10-13 01:11:58 +02:00
|
|
|
extern int bgp_lookup_by_as_name_type(struct bgp **bgp_val, as_t *as,
|
|
|
|
const char *name,
|
|
|
|
enum bgp_instance_type inst_type);
|
2019-08-08 04:58:18 +02:00
|
|
|
|
2019-08-09 19:53:01 +02:00
|
|
|
/* Hooks */
|
2020-09-28 17:35:35 +02:00
|
|
|
DECLARE_HOOK(bgp_vrf_status_changed, (struct bgp *bgp, struct interface *ifp),
|
|
|
|
(bgp, ifp));
|
|
|
|
DECLARE_HOOK(peer_status_changed, (struct peer *peer), (peer));
|
|
|
|
DECLARE_HOOK(bgp_snmp_init_stats, (struct bgp *bgp), (bgp));
|
|
|
|
DECLARE_HOOK(bgp_snmp_update_last_changed, (struct bgp *bgp), (bgp));
|
2020-10-02 13:45:08 +02:00
|
|
|
DECLARE_HOOK(bgp_snmp_update_stats,
|
|
|
|
(struct bgp_node *rn, struct bgp_path_info *pi, bool added),
|
|
|
|
(rn, pi, added));
|
bgpd: Display RPKI validation state if we have it
When dumping data about prefixes in bgp. Let's dump the
rpki validation state as well:
Output if rpki is turned on:
janelle# show rpki prefix 2003::/19
Prefix Prefix Length Origin-AS
2003:: 19 - 19 3320
janelle# show bgp ipv6 uni 2003::/19
BGP routing table entry for 2003::/19
Paths: (1 available, best #1, table default)
Not advertised to any peer
15096 6939 3320
::ffff:4113:867a from 65.19.134.122 (193.72.216.231)
(fe80::e063:daff:fe79:1dab) (used)
Origin IGP, valid, external, best (First path received), validation-state: valid
Last update: Sat Mar 6 09:20:51 2021
janelle# show rpki prefix 8.8.8.0/24
Prefix Prefix Length Origin-AS
janelle# show bgp ipv4 uni 8.8.8.0/24
BGP routing table entry for 8.8.8.0/24
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
100.99.229.142
15096 6939 15169
65.19.134.122 from 65.19.134.122 (193.72.216.231)
Origin IGP, valid, external, best (First path received), validation-state: not found
Last update: Sat Mar 6 09:21:25 2021
Example output when rpki is not configured:
eva# show bgp ipv4 uni 8.8.8.0/24
BGP routing table entry for 8.8.8.0/24
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
janelle(192.168.161.137)
64539 15096 6939 15169
192.168.161.137(janelle) from janelle(192.168.161.137) (192.168.44.1)
Origin IGP, valid, external, bestpath-from-AS 64539, best (First path received)
Last update: Sat Mar 6 09:33:51 2021
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-06 15:31:45 +01:00
|
|
|
DECLARE_HOOK(bgp_rpki_prefix_status,
|
|
|
|
(struct peer * peer, struct attr *attr,
|
|
|
|
const struct prefix *prefix),
|
|
|
|
(peer, attr, prefix));
|
|
|
|
|
2019-10-24 06:40:53 +02:00
|
|
|
void peer_nsf_stop(struct peer *peer);
|
2019-08-09 19:53:01 +02:00
|
|
|
|
bgpd: Support tcp-mss for bgp neighbors
Problem Statement:
=================
In scale setup BGP sessions start flapping.
RCA:
====
In virtualized environment there are multiple places where
MTU need to be set. If there are some places were MTU is not set
properly then there is chances that BGP packets get fragmented,
in scale setup this will lead to BGP session flap.
Fix:
====
A new tcp option is provided as part of this implementation,
which can be configured per neighbor and helps to set the TCP
max segment size. User need to derive the path MTU between the BGP
neighbors and set that value as part of tcp-mss setting.
1. CLI Configuration:
[no] neighbor <A.B.C.D|X:X::X:X|WORD> tcp-mss (1-65535)
2. Running config
frr# show running-config
router bgp 100
neighbor 198.51.100.2 tcp-mss 150 => new entry
neighbor 2001:DB8::2 tcp-mss 400 => new entry
3. Show command
frr# show bgp neighbors 198.51.100.2
BGP neighbor is 198.51.100.2, remote AS 100, local AS 100, internal link
Hostname: frr
Configured tcp-mss is 150, synced tcp-mss is 138 => new display
4. Show command json output
frr# show bgp neighbors 2001:DB8::2 json
{
"2001:DB8::2":{
"remoteAs":100,
"bgpTimerKeepAliveIntervalMsecs":60000,
"bgpTcpMssConfigured":400, => new entry
"bgpTcpMssSynced":388, => new entry
Risk:
=====
Low - This is a config driven feature and it sets the max segment
size for the TCP session between BGP peers.
Tests Executed:
===============
Have done manual testing with three router topology.
1. Executed basic config and un config scenarios
2. Verified if the config is updated in running config
during config and no config operation
3. Verified the show command output in both CLI format and
JSON format.
4. Verified if TCP SYN messages carry the max segment size
in their initial packets.
5. Verified the behaviour during clear bgp session.
6. done packet capture to see if the new segment size
takes effect.
Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
2021-04-08 12:28:35 +02:00
|
|
|
void peer_tcp_mss_set(struct peer *peer, uint32_t tcp_mss);
|
|
|
|
void peer_tcp_mss_unset(struct peer *peer);
|
2021-12-20 22:03:09 +01:00
|
|
|
|
|
|
|
extern void bgp_recalculate_afi_safi_bestpaths(struct bgp *bgp, afi_t afi,
|
|
|
|
safi_t safi);
|
2022-10-06 09:13:05 +02:00
|
|
|
extern void peer_on_policy_change(struct peer *peer, afi_t afi, safi_t safi,
|
|
|
|
int outbound);
|
2023-01-06 13:33:03 +01:00
|
|
|
extern bool bgp_path_attribute_discard(struct peer *peer, char *buf,
|
|
|
|
size_t size);
|
2023-01-24 10:02:24 +01:00
|
|
|
extern bool bgp_path_attribute_treat_as_withdraw(struct peer *peer, char *buf,
|
|
|
|
size_t size);
|
2022-03-31 14:59:06 +02:00
|
|
|
#ifdef _FRR_ATTRIBUTE_PRINTFRR
|
|
|
|
/* clang-format off */
|
|
|
|
#pragma FRR printfrr_ext "%pBP" (struct peer *)
|
|
|
|
/* clang-format on */
|
|
|
|
#endif
|
|
|
|
|
2005-05-23 16:19:54 +02:00
|
|
|
#endif /* _QUAGGA_BGPD_H */
|