Commit Graph

415 Commits

Author SHA1 Message Date
vivek
92708db6c3 bgpd: Auto RD definitions and encoding
Setup a per-VRF identifier to use along with the Router Id to build the
RD. Define a function to encode the RD. Code is brought over from EVPN
and EVPN code has been modified to use the generic function.

Ticket: CM-20256
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-04-25 12:39:16 -04:00
Mitesh Kanjariya
f4882003c6 bgpd: resolve flag definition confict for af_flags under bgp vrf
afi/safi flags defined under bgp vrf needs to be unique across afi/safi.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-04-25 12:39:16 -04:00
Donald Sharp
12a844a506 bgpd: Implement vrf - vrf route leaking cli
add the `import vrf XXXX` command

router bgp 4 vrf DONNA
  <config>
!

router bgp 4 vrf EVA
  <config>
  address-family ipv4 uni
    import vrf DONNA
  !
!

This command will allow for vrf EVA to specify that it would like
to receive the routes from vrf DONNA into it's table.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:16 -04:00
Vincent Bernat
bf1061d876 bgpd: add an option for RT auto-derivation to use RFC 8635.
RFC 8635 explains how RT auto-derivation should be done in section
5.1.2.1 [1]. In addition to encoding the VNI in the lowest bytes, a
3-bit field is used to encode a namespace. For VXLAN, we have to put 1
in this field. This is needed for proper interoperability with RT
auto-derivation in JunOS. Since this would break existing setup, an
additional option, "autort rfc8365-compatible" is used.

[1]: https://tools.ietf.org/html/rfc8365#section-5.1.2.1

Signed-off-by: Vincent Bernat <vincent@bernat.im>
2018-04-23 17:05:23 +02:00
G. Paul Ziemba
e70e9f8e24 bgpd: vpn-vrf leaking: use dynamic label pool for "auto" labels
Add support for CLI "auto" keyword in vrf->vpn export label:

    router bgp NNN vrf FOO
	address-family ipv4 unicast
	    label vpn export auto
	exit-address-family

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-11 23:18:35 -07:00
G. Paul Ziemba
955bfd984f bgpd: dynamic mpls label pool
MPLS label pool backed by allocations from the zebra label manager.

A caller requests a label (e.g., in support of an "auto" label
specification in the CLI) via lp_get(), supplying a unique ID and
a callback function. The callback function is invoked at a later
time with the unique ID and a label value to inform the requestor
of the assigned label.

Requestors may release their labels back to the pool via lp_release().

The label pool is stocked with labels allocated by the zebra label
manager. The interaction with zebra is asynchronous so that bgpd
is not blocked while awaiting a label allocation from zebra.

The label pool implementation allows for bgpd operation before (or
without) zebra, and gracefully handles loss and reconnection of
zebra. Of course, before initial connection with zebra, no labels
are assigned to requestors. If the zebra connection is lost and
regained, callbacks to requestors will invalidate old assignments
and then assign new labels.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-11 23:18:28 -07:00
G. Paul Ziemba
3572fb26ca bgpd: simplify bgp instance name printing
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-04 09:24:17 -07:00
jaydom
7c40bf391c bgpd: add flowspec feature
This work is derived from a work done by China-Telecom.
That initial work can be found in [0].
As the gap between frr and quagga is important, a reworks has been
done in the meantime.
The initial work consists of bringing the following:
- Bringing the client side of flowspec.
- the enhancement of address-family ipv4/ipv6 flowspec
- partial data path handling at reception has been prepared
- the support for ipv4 flowspec or ipv6 flowspec in BGP open messages,
  and the internals of BGP has been done.
- the memory contexts necessary for flowspec has been provisioned

In addition to this work, the following has been done:
- the complement of adaptation for FS safi in bgp code
- the code checkstyle has been reworked so as to match frr checkstyle
- the processing of IPv6 FS NLRI is prevented
- the processing of FS NLRI is stopped ( temporary)

[0] https://github.com/chinatelecom-sdn-group/quagga_flowspec/

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: jaydom <chinatelecom-sdn-group@github.com>
2018-03-30 14:00:47 +02:00
Lou Berger
615e608d76
Merge pull request #1854 from qlyoung/integer-standards-compliance
*: use C99 standard fixed-width integer types
2018-03-28 10:30:54 -04:00
Quentin Young
d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
Philippe Guibert
301ad80a99 bgpd: add an API to get incoming VRF from a RT
This commit is relying on bgp vpn-policy. It is needed to configure
several bgp vrf instances, and in each of the bgp instance, configure
the following command under address-family ipv4 unicast node:
[no] rt redirect import RTLIST

Then, a function is provided, that will parse the BGP instances.
The incoming ecommunity will be compared with the configured rt redirect
import ecommunity list, and return the VRF first instance of the matching
route target.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-27 15:21:51 +02:00
G. Paul Ziemba
b9c7bc5ab0 bgpd: new vpn-policy CLI
PR #1739 added code to leak routes between (default VRF) VPN safi and unicast RIBs in any VRF. That set of changes included temporary CLI including vpn-policy blocks to specify RD/RT/label/&c. After considerable discussion, we arrived at a consensus CLI shown below.

The code of this PR implements the vpn-specific parts of this syntax:

router bgp <as> [vrf <FOO>]
    address-family <afi> unicast
        rd (vpn|evpn) export (AS:NN | IP:nn)
        label (vpn|evpn) export (0..1048575)
        rt (vpn|evpn) (import|export|both) RTLIST...
        nexthop vpn (import|export) (A.B.C.D | X:X::X:X)
        route-map (vpn|evpn|vrf NAME) (import|export) MAP

        [no] import|export [vpn|evpn|evpn8]
        [no] import|export vrf NAME

User documentation of the vpn-specific parts of the above syntax is in PR #1937

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-19 22:13:43 -07:00
paulzlabn
3f1224cd1a
Merge branch 'master' into working/master/bgp-vpn-vrf-leaking 2018-03-14 13:31:58 -07:00
Mitesh Kanjariya
9bb3ca515b
Merge branch 'master' into type5-default-originate 2018-03-12 14:47:28 -07:00
G. Paul Ziemba
ddb5b4880b bgpd: vpn-vrf route leaking
- add "debug bgp vpn label" CLI
    - improved debug messages for "debug bgp bestpath"
    - send vrf label to zebra after zebra informs bgpd of vrf_id
    - withdraw vrf_label from zebra if zebra informs bgpd that vrf_id is disabled
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09 16:42:40 -05:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Mitesh Kanjariya
58f9e4d3f2
Merge branch 'master' into type5-default-originate 2018-02-27 12:52:24 -08:00
Russ White
7a684566d4
Merge pull request #1802 from dwalton76/bgpd-multipath-same-link-local
bgpd: use peer->ifp->ifindex instead of peer->ifindex
2018-02-27 08:31:06 -05:00
mitesh
2c29b18a1b bgpd: reassign the flags in struct bgp af_flags to avoid conflict
We have af_flags in struct bgp which holds address family related flags.
Seems like we had a conflict between two flags.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-27 02:19:57 -08:00
Philippe Guibert
e5619c289a bgpd: server socket is created for all enabled VRF
Upon creation of BGP instances, server socket may or may not be created.
In the case of VRF instances, if the VRF backend relies on NETNS, then
a new server socket will be created for each BGP VRF instance. If the
VRF backend relies on VRF LITE, then only one server socket will be
enough. Moreover, At startup, with BGP VRF configuration, a server
socket may not be created if VRF is not the default one or VRF is not
recognized yet.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-27 11:11:24 +01:00
Mitesh Kanjariya
23e386ac71
Merge branch 'master' into type5-default-originate 2018-02-27 01:46:26 -08:00
Philippe Guibert
ac3133a35d
Merge pull request #1736 from mkanjari/type5-with-asymm
zebra, bgp: Support type-5 routes with asymmetric routing
2018-02-27 10:36:57 +01:00
Daniel Walton
194a4f2c5c bgpd: use peer->ifp->ifindex instead of peer->ifindex
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

peer->ifindex was only used in two places but it was never populated so
neither of them worked as they should.  'struct peer' also has a 'struct
interface' pointer which we can use to get the ifindex.
2018-02-26 22:13:22 +00:00
Mitesh Kanjariya
486456ca92 bgpd: support for default-originate type-5 route
Implement support for 'default-originate' for L2VPN/EVPN address family.
This is needed for the case where external routing within a POD,
will follow the default route to the border/exit leaf.
The border leaf has more than one next hop to forward the packet on to,
depending on the destination IP.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-22 17:31:58 -08:00
Mitesh Kanjariya
154faa5007 bgpd: move l2vpn evpn related flags in struct bgp to af_flags
We have af_flags in struct bgp to hold address family related flags,
l2vpn evpn flags to indicate advertise ipvX unicast should be moved there.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-22 17:24:36 -08:00
Mitesh Kanjariya
53c84f7800 bgpd: Policy to control which RIB routes are injected into EVPN
FRR/CL provides the means for injecting regular (IPv4) routes
from the BGP RIB into EVPN as type-5 routes.
This needs to be enhanced to allow selective injection.
This can be achieved by adding a route-map option
for the "advertise ipv4/ipv6 unicast" command.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-12 16:02:15 -08:00
Mitesh Kanjariya
efc812a379
Merge branch 'master' into type5-with-asymm 2018-02-12 02:05:00 -08:00
Mitesh Kanjariya
c48d9f5f85 zebra, bgp: Support type-5 routes with asymmetric routing
Asymmetric routing is an ideal choice when all VLANs are cfged on all leafs.
It simplifies the routing configuration and
eliminates potential need for advertising subnet routes.
However, we need to reach the Internet or global destinations
or to do subnet-based routing between PODs or DCs.
This requires EVPN type-5 routes but those routes require L3 VNI configuration.

This task is to support EVPN type-5 routes for prefix-based routing in
conjunction with asymmetric routing within the POD/DC.
It is done by providing an option to use the L3 VNI only for prefix routes,
so that type-2 routes (host routes) will only use the L2 VNI.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-10 00:41:28 -08:00
G. Paul Ziemba
d316210b65 whitespace/comment fixes per qlyoung
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-02-09 13:14:22 -08:00
G. Paul Ziemba
a4d82a8adc bgpd: ran indent.py on some files prior to bgp vpn-vrf leaking changes
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-02-09 10:22:50 -08:00
Donald Sharp
48a67e2c0a bgpd: Remove peer->hash as that it is unused
The peer->hash pointer is allocating a bunch of memory
but is never used.  Remove.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-17 14:17:15 -05:00
Russ White
7256280c1b
Merge pull request #1627 from qlyoung/bgp-autoshutdown
BGP auto-shutdown
2018-01-16 15:29:17 -05:00
Quentin Young
f26845f9a6
bgpd: add neighbor autoshutdown
Adds ability to specify that peers should be administratively shutdown
when first configured.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-12 15:03:24 -05:00
Mitesh Kanjariya
9bb77a5b3d
Merge branch 'master' into evpn-symmetric-routing 2018-01-11 09:00:23 -08:00
Russ White
2ed7e4c3c3
Merge pull request #1591 from qlyoung/bgpd-ringbuf
bgpd: use ring buffer for network input
2018-01-10 19:59:24 -05:00
Quentin Young
0112e9e0b9
bgpd: use atomic_* ops on _Atomic variables
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-09 15:40:48 -05:00
Dario Wiesner
a21bd7a3b9 bgpd: add PMSI_TUNNEL_ATTRIBUTE to EVPN IMET routes
Signed-off-by: Dario Wiesner <dario.wiesner@gmail.com>
2018-01-04 13:51:15 +01:00
Quentin Young
74ffbfe6fe
bgpd: use ring buffer for network input
The multithreading code has a comment that reads:
"XXX: Heavy abuse of stream API. This needs a ring buffer."

This patch makes the relevant code use a ring buffer.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-03 14:35:11 -05:00
Quentin Young
37a333fef1
bgpd: fix configuration of 0 for coalesce-time
Was using 0 as a sentinel value, so user couldn't configure 0 as the
value of the coalesce timer.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-14 16:43:31 -05:00
mitesh
342dd0c623 bgpd: advertise/withdraw type-5 routes upon user config
CLI config for enabling/disabling type-5 routes

router bgp <as> vrf <vrf>
  address-family l2vpn evpn
    [no] advertise <ipv4|ipv6|both>

loop through all the routes in VRF instance and advertise/withdraw
all ip routes as type-5 routes in default instance.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14 10:57:07 -08:00
mitesh
b67a60d2cf bgpd: set vrf originator ip to kernels local-ip
For EVPN type-5 route the NH in the NLRI is set to the local tunnel ip.
This information has to be obtained from kernel notification.
We need to pass this info from zebra to bgp in l3vni call flow.
This patch doesn't handle the tunnel-ip change.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14 10:57:07 -08:00
mitesh
676f83b991 bgpd: RD derivation for VRF
1. VRF RD can be auto-derived (simillar to RD for a VNI)
2. VRF RD can be configured manually through a config

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14 10:57:07 -08:00
mitesh
e9eb5f63ed bgpd: move rd id bitfield to bgp_master
currently, we have a rd_id bitfield
to assign an unique index for auto RD.
This bitfield currently resides under struct bgp which seems wrong.
We need to shift this to a global space
as this ID space is really global per box.
One more reason to keep it at a global data structure is,
the ID space could be used by both VNIs and VRFs.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14 10:57:07 -08:00
Mitesh Kanjariya
10ebe1ab54 bgpd: import rt to vrf mapping
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14 10:57:05 -08:00
Mitesh Kanjariya
6a8657d0f0 bgpd: link l2vnis(bgpevpn) to l3vni(vrf)
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14 10:57:05 -08:00
Mitesh Kanjariya
c581d8b0f4 bgpd: import/export rt for BGP vrf
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14 10:57:05 -08:00
Mitesh Kanjariya
fe1dc5a374 bgpd: l3vni/rmac association with bgp vrf
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14 10:57:05 -08:00
Quentin Young
14b8641a5e
bgpd: fix config display of coalesce-time
Since coalesce time is now heuristically adjusted based on peer count,
we need to separate out specific configuration by the user from the
current value. Behavior established is to not adjust if the user has a
value set.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-06 17:38:24 -05:00
Quentin Young
2d34fb80b8
*: don't use deprecated stream.h macros
Some of the deprecated stream.h macros see such little use that we may
as well just remove them and use the non-deprecated macros.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-01 13:51:06 -05:00
Quentin Young
387f984e58
bgpd: fix bgp active open
At some point when rearranging FSM code, bgpd lost the ability to
perform active opens because it was only paying attention to POLLIN and
not POLLOUT, when the latter is used to signify a successful connection
in the active case.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:18:05 -05:00
Quentin Young
1588f6f441
bgpd: update atomic memory orders
Use best-performing memory orders where appropriate.
Also update some style and add missing comments.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:18:04 -05:00
Quentin Young
b750b0ba76
bgpd: small i/o threading improvements
* Start bit flags at 1, not 2
* Make run-flags atomic for i/o thread
* Remove work_cond mutex, it should no longer be necessary
* Add asserts to ensure proper ordering in bgp_connect()
* Use true/false with booleans, not 1/0

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:18:01 -05:00
Quentin Young
555e09d4a2
bgpd: atomize write-quanta, add read-quanta
bgpd supports setting a write-quanta that serves as a hint on how many
packets to write per I/O cycle. Now that input is buffered, it makes
sense to add the equivalent parameter for how many packets are processed
per cycle. This is *not* how many packets are read off the wire per I/O
cycle; rather it is how many packets are processed from the input buffer
in a given cycle after having been read off the wire and sanitized.

Since these values must be used from multiple threads, they have also
been made atomic.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:18:00 -05:00
Quentin Young
424ab01d0f
bgpd: implement buffered reads
* Move and modify all network input related code to bgp_io.c
* Add a real input buffer to `struct peer`
* Move connection initialization to its own thread.c task instead of
  piggybacking off of bgp_read()
* Tons of little fixups

Primary changes are in bgp_packet.[ch], bgp_io.[ch], bgp_fsm.[ch].
Changes made elsewhere are almost exclusively refactoring peer->ibuf to
peer->curr since peer->ibuf is now the true FIFO packet input buffer
while peer->curr represents the packet currently being processed by the
main pthread.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:59 -05:00
Quentin Young
56257a44e4
bgpd: move bgp i/o to a separate source file
After implement threading, bgp_packet.c was serving the double purpose
of consolidating packet parsing functionality and handling actual I/O
operations. This is somewhat messy and difficult to understand. I've
thus moved all code and data structures for handling threaded packet
writes to bgp_io.[ch].

Although bgp_io.[ch] only handles writes at the moment to keep the noise
on this commit series down, for organization purposes, it's probably
best to move bgp_read() and its trappings into here as well and
restructure that code so that read()'s happen in the pthread and packet
processing happens on the main thread.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:59 -05:00
Quentin Young
0ca8b79f38
bgpd: use new threading infra
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:59 -05:00
Quentin Young
419dfe6a70
bgpd: dynamically allocate synchronization primitives
Changes all synchronization primitives to be dynamically allocated. This
should help catch any subtle errors in pthread lifecycles.

This change also pre-initializes synchronization primitives before
threads begin to run, eliminating a potential race condition that
probably would have caused a segfault on startup on a very fast box.

Also changes mutex and condition variable allocations to use
MTYPE_PTHREAD and updates tests to do the proper initializations.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:58 -05:00
Quentin Young
49507a6f6a
bgpd: remove unused struct thread from peer
* Remove t_write
* Remove t_keepalive

These have been replaced by pthreads and are no longer needed. Since
some code looks at these values to determine if the threads are
scheduled, also add a new bitfield to store the same information.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:58 -05:00
Quentin Young
2d4ee77490
lib, bgpd: implement pthread lifecycle management
Removes the WiP shim and implements proper thread lifecycle management.

* Declare necessary pthread_t's in bgp_master
* Define new MTYPE in lib/thread.c for pthreads
* Allocate and free BGP's pthreads appropriately
* Terminate and join threads appropriately

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:57 -05:00
Quentin Young
d3ecc69e5f
bgpd: move packet writes into dedicated pthread
* BGP_WRITE_ON() removed
* BGP_WRITE_OFF() removed
* peer_writes_on() added
* peer_writes_off() added
* bgp_write_proceed_actions() removed

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:57 -05:00
Donald Sharp
ccd2b0e6ce
Merge pull request #1391 from LabNConsulting/working/master/patch-set/vnc-vrf-export
Support vrf export/import based on vrf-policy
2017-11-09 08:53:24 -05:00
Lou Berger
02a82b47b3 bgpd: allow for vpn->vrf imports
ignore nexthop checks for RFAPI imported routes (as is self)
      note: NHT is still updated

Signed-off-by: Lou Berger <lberger@labn.net>
2017-10-31 11:06:17 -04:00
Don Slice
d25e4efc52 bgpd: fix various problems with hold/keepalive timers
Problem reported that we weren't adjusting the keepalive timer
correctly when we negotiated a lower hold time learned from a
peer.  While working on this, found we didn't do inheritance
correctly at all.  This fix solves the first problem and also
ensures that the timers are configured correctly based on this
priority order - peer defined > peer-group defined > global config.
This fix also displays the timers as "configured" regardless of
which of the three locations above is used.

Ticket: CM-18408
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: CCR-6807
Testing-performed:  Manual testing successful, fix tested by
submitter, bgp-smoke completed successfully
2017-10-26 11:55:31 -04:00
Renato Westphal
5ba345ccb2 Merge pull request #1047 from dwalton76/bgpd-draft-ietf-grow-bgp-gshut-10
bgpd: implement draft-ietf-grow-bgp-gshut-10
2017-09-05 10:20:49 -03:00
Donald Sharp
32592ffb4f Merge pull request #1056 from opensourcerouting/oldbits-0
"pathspace" options, vtysh-suid-cleanups, "vty_frame()"
2017-08-29 17:48:36 -04:00
David Lamparter
2b79110731 bgpd: get rid of afi_header_vty_out() & co.
afi_header_vty_out() is easily replaced with vty_frame(), which means we
can drop a whole batch of "int *write" args as well as the entirety of
bgp_config_write_family_header().

=> AFI/SAFI config writing is now a lot simpler.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-29 08:36:03 +02:00
Mitesh Kanjariya
09fdc88c8c Merge branch 'master' into dev-master 2017-08-28 18:19:03 -07:00
Daniel Walton
31d5efe2ea Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-draft-ietf-grow-bgp-gshut-10
Conflicts:
	bgpd/bgp_route.c
2017-08-28 06:59:38 -07:00
Daniel Walton
7f32323620 bgpd: implement draft-ietf-grow-bgp-gshut-10
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-08-25 18:27:49 +00:00
Daniel Walton
318cac96ef bgpd: Memory wasting in zebra by non used MPLS FECs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-08-22 18:14:50 +00:00
Jorge Boncompte
92375c917e bgpd: inline bgp_lock()/bgp_unlock()
Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
2017-08-17 17:47:07 +02:00
Mitesh Kanjariya
db0e1937ca bgpd: Ignore EVPN routes from CLAG peer when VNI comes up
There are two parts to this commit:
1. create a database of self tunnel-ip for used in martian nexthop check
In a CLAG setup, the tunnel-ip (VNI UP) notification comes before the clag-anycast-ip comes up in the system.
This was causing our self next hop check to fail and we were instaling routes with martian nexthop in zebra.
We need to keep this info in a seperate database for all local tunnel-ip.
This database will be used in parallel with the self next hop database to martian nexthop checks.
2. When a local VNI comes up, update the tunnel-ip database and filter routes in the RD table if necessary
In case of EVPN we might receive routes from clag peer before the clag-anycast ip and VNI is up on the system.
We will store the routes in the RD table for later processing.
When VNI comes UP, we loop thorugh all the routes and install them in zebra if required.
However, we were missing the martian nexthop check in this code path.
From now onwards, when a VNI comes UP,
we will first update the tunnel-ip database
We then loop through all the routes in RD table and apply martian next hop filter if required.

Things not covered in this commit but are required:

This processing is needed in general when an address becomes a connected address.
We need to loop through all the routes in BGP and apply martian nexthop filter if necessary.
This will be taken care in a seperate bug

Ticket:CM-17271/CM-16911
Reviewed By: ccr-6542
Testing Done: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-16 23:19:58 -07:00
Mitesh Kanjariya
1a98c08704 bgpd/zebra/lib: EVPN support for asymmetric VxLan routing
1. Advertise gateway mac-ip in EVPN
2. Advertise VRR mac-ip in EVPN
3. Ignore gateway mac-ip advertisements in case of distributed gateway
4. Config knob to enable/disable gateway mac-ip advertisements

Ticket: CM-16456, CM-16543, CM-16555, CM-16778
Review: CCR-6283
Unit-test: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:28:46 -04:00
vivek
ba0fcaf6df bgpd: Fix incorrect AFI reference
Fixes: "bgpd: Fixes related to use of L2VPN/EVPN"
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-08-08 10:09:37 -04:00
Donald Sharp
ab665082fe Merge pull request #882 from opensourcerouting/safi-cleanup
lib/bgpd: cleanup SAFI values
2017-08-01 14:21:26 -04:00
Renato Westphal
a46a2e9b4e bgpd: don't make any assumptions about the size of an enum
The size of an enum is compiler dependent and thus we shouldn't use
enums inside structures that represent fields of a packet.

Problem detected by the 'test_capability' unit test.

The problem was not apparent before because the 'iana_safi_t' enum didn't
exist and 'safi_t' was a typedef to uint8_t. Now we have two different
enums, 'iana_afi_t' and 'iana_safi_t', and both need to be encoded in
different ways on the wire (2 bytes vs 1 byte).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-31 23:45:03 -03:00
Renato Westphal
5c5255381e lib/bgpd: introduce the iana_safi_t enum
We had afi_t/iana_afi_t for AFIs but only safi_t for SAFIs. Fix this
inconsistency.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-31 23:44:42 -03:00
Daniel Walton
40520c3649 bgpd: peer hash expands until we are out of memory
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

swpX peers all start out with the same sockunion so initially they all
go into the same hash bucket. Once IPv6 ND has worked its magic they
will have different sockunions and will go in different buckets...life
is good.

Until then though, we are in a phase where all swpX peers have the same
socknunion. Once we have HASH_THRESHOLD (10) swpX peers and call
hash_get for a new swpX peer the hash code calls hash_expand(). This
happens because there are more than HASH_THRESHOLD entries in a single
bucket so the logic is "expand the hash to spread things out"...in our
case expanding doesn't spread out the swpX peers because all of their
sockunions are the same.

I looked at having peer_hash_make and peer_hash_same consider the ifname
of the swpX peer but that is a large change that we don't want to make
at the moment. So the fix is to put a cap on how large we are
willing to let the hash table get. By default there is no limit but if
max_size is set we will not allow the hash to expand above that.
2017-07-31 21:22:23 +00:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22 14:52:33 +02:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
vivek
14c1a7bf91 bgpd: EVPN initialization and cleanup
Define the EVPN (EVI) hash table and related structures and initialize
and cleanup.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:36:34 -04:00
David Lamparter
21bb7c8774 Merge commit '3d22338f04d9554fa' into evpn-prep
Conflicts:
	lib/Makefile.am

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-10 22:15:19 +02:00
Daniel Walton
4fbf55e986 Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-ipv4-plus-label-misc3 2017-06-26 17:24:44 +00:00
Quentin Young
56b4067930 *: simplify log message lookup
log.c provides functionality for associating a constant (typically a
protocol constant) with a string and finding the string given the
constant. However this is highly delicate code that is extremely prone
to stack overflows and off-by-one's due to requiring the developer to
always remember to update the array size constant and to do so correctly
which, as shown by example, is never a good idea.b

The original goal of this code was to try to implement lookups in O(1)
time without a linear search through the message array. Since this code
is used 99% of the time for debugs, it's worth the 5-6 additional cmp's
worst case if it means we avoid explitable bugs due to oversights...

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-21 15:22:21 +00:00
Daniel Walton
9bedbb1e52 bgpd: Install SAFI_LABELED_UNICAST routes in SAFI_UNICAST table
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

- All ipv4 labeled-unicast routes are now installed in the ipv4 unicast
  table. This allows us to do things like take routes from an ipv4
  unicast peer, allocate a label for them and TX them to a ipv4
  labeled-unicast peer. We can do the opposite where we take routes from
  a labeled-unicast peer, remove the label and advertise them to an ipv4
  unicast peer.

- Multipath over a labeled route and non-labeled route is not allowed.

- You cannot activate a peer for both 'ipv4 unicast' and 'ipv4
  labeled-unicast'

- The 'tag' variable was overloaded for zebra's route tag feature as
  well as the mpls label. I added a 'mpls_label_t mpls' variable to
  avoid this.  This is much cleaner but resulted in touching a lot of
  code.
2017-06-16 19:12:57 +00:00
vivek
3d22338f04 bgpd: Fixes related to use of L2VPN/EVPN
Add checks related to AFI_L2VPN/SAFI_EVPN that were missing in some parts
of the code. Fix incorrect check skipping EVPN when sending End of RIB.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-05-25 10:20:04 -07:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Daniel Walton
343e90c328 bgpd: add ENHE support for "address-family ipv4 labeled-unicast"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-05-10 10:06:47 -04:00
Daniel Walton
c5a543b433 Update to draft-ietf-idr-bgp-prefix-sid-05
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

The initial implementation was against draft-keyupate-idr-bgp-prefix-sid-02
This updates our label-index implementation up to draft-ietf-idr-bgp-prefix-sid-05
- changed BGP_ATTR_LABEL_INDEX to BGP_ATTR_PREFIX_SID
- since there are multiple TLVs in BGP_ATTR_PREFIX_SID you can no longer
  rely on that flag to know if there is a label-index for the path. I
changed bgp_attr_extra_new() to init the label_index to
BGP_INVALID_LABEL_INDEX
- put some placeholder code in for the other two TLVs (IPv6 and
  Originator SRGB)
2017-04-26 21:45:32 +00:00
Donald Sharp
64d222e2c3 bgpd: Use appropriate Attribute number for labels
The draft-ietf-idr-bgp-prefix-sid-04 specifies the label attribute
should be 40 not 30.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-06 10:32:08 -04:00
Vivek Venkatraman
6cf48acc1c bgpd: This patch implements the exchange of the BGP-Prefix-SID label index attr
Implement BGP Prefix-SID IETF draft to be able to signal a labeled-unicast
prefix with a label index (segment ID). This makes it easier to deploy
global MPLS labels with BGP, even without other aspects of Segment Routing
implemented.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-04-06 10:32:07 -04:00
Don Slice
cd1964ff38 bgpd: labeled unicast processing
Implement support for negotiating IPv4 or IPv6 labeled-unicast address
family, exchanging prefixes and installing them in the routing table, as
well as interactions with Zebra for FEC registration. This is the
implementation of RFC 3107.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-06 10:32:07 -04:00
David Lamparter
3e7c8d040c Merge branch 'stable/2.0'
Fixed minor conflicts from "defaults" change on stable.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 19:01:47 +02:00
David Lamparter
8efe88eacf *: track version & "defaults" in configs
[CF]: Move default name to autoconf and update tests

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-28 19:18:42 +02:00
David Lamparter
4f04a76b71 *: add frr_init() infrastructure
Start centralising startup & option parsing into the library.

FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g.
for killing the ZLOG_* enum, and having the daemon name available)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 23:07:20 +01:00
Donald Sharp
1a664f5e36 Merge pull request #254 from donaldsharp/shutdown3
Shutdown take 3
2017-03-07 11:29:44 -05:00
David Lamparter
f6e250f850 Merge branch 'frr/pull/240' ("lib, bgpd: clean up headers")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 16:03:36 +01:00
David Lamparter
73d70fa68a bgpd: TX shutdown message
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-06 19:40:26 -05:00
David Lamparter
38de8d0229 bgpd: RX shutdown message in "show bgp neighbor"
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-06 19:40:26 -05:00
Quentin Young
94c6042452 bgpd: add vty.h to bgpd.h
`struct vty` referenced in body of bgpd.h, so it should be #include'd.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-03-02 02:09:00 +00:00
Donald Sharp
37fe77317c bgpd, zebra: Allow setting ecmp from daemon cli
When starting up bgp and zebra now, you can specify
-e <number> or --ecmp <number>
and that number will be used as the maximum ecmp
that can be used.

The <number specified must be >= 1 and <= MULTIPATH_NUM
that Quagga is compiled with.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-01 07:58:32 -05:00
Philippe Guibert
2c9ba7c7cd bgpd: add support for epvn into afindex
afindex needs knowledge of l2vpn afi parameter, as well as evpn safi
parameter.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-02-14 13:58:57 +01:00
David Lamparter
dcb817fd27 Merge branch 'frr/pull/92' (BGP Large Community support)
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-25 23:04:29 +01:00
Job Snijders
57d187bc77 Support for BGP Large Communities
BGP Large Communities are a novel way to signal information between
networks. An example of a Large Community is: "2914:65400:38016". Large
BGP Communities are composed of three 4-byte integers, separated by a
colon. This is easy to remember and accommodates advanced routing
policies in relation to 4-Byte ASNs.

This feature was developed by:
Keyur Patel <keyur@arrcus.com> (Arrcus, Inc.),
Job Snijders <job@ntt.net> (NTT Communications),
David Lamparter <equinox@opensourcerouting.org>
and Donald Sharp <sharpd@cumulusnetworks.com>

Signed-off-by: Job Snijders <job@ntt.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-18 18:38:53 -05:00
Donald Sharp
b58ed1f8a8 Merge remote-tracking branch 'origin/master' into pim_lib_work2 2017-01-17 21:01:56 -05:00
Donald Sharp
9aa7f43f7e Merge branch 'master' into cleanup 2017-01-13 14:48:16 -05:00
Donald Sharp
56c1f7d852 frr: Remove HAVE_IPV6 from code base
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-13 08:05:50 -05:00
vivek
9cabb64b32 Quagga: AFI/SAFI mappings IANA to/from internal values
Introduce internal and IANA defintions for AFI/SAFI and mapping
functions and modify code to use these. This refactoring will
facilitate adding support for other AFI/SAFI whose IANA values
won't be suitable for internal data structure definitions (e.g.,
they are not contiguous).
The commit adds some fixes related to afi/safi testing with 'make check
' command.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>

Ticket: CM-11416
Reviewed By: CCR-3594 (mpls branch)
Testing Done: Not tested now, tested earlier on mpls branch
2017-01-12 09:28:43 +01:00
Olivier Dugeon
b98f56422e Merge pull request #55 from donaldsharp/monotonic
Monotonic
2017-01-09 15:26:16 +01:00
Donald Sharp
3814903108 bgpd: Remove knowledge of HAVE_CLOCK_MONTONIC
thread.c fails to build properly on systems that do
not have a CLOCK_MONOTONIC.  Therefore there is
no need for bgp to have knowledge of it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-07 19:23:50 -05:00
Julien Courtat
6a9a3cde58 bgpd: enable send of Graceful Restart Preserve State F bit
Enhance struct bgp to add a new flag BGP_FLAG_GR_PRESERVE_FWD, which
allow to set the Preserve State F bit of Graceful Restart capability in
OPEN messages.

Signed-off-by: Julien Courtat <julien.courtat@6wind.com>
2017-01-06 15:08:45 +01:00
David Lamparter
19df7279f7 bgpd: add qobj registrations
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:36:25 +01:00
Renato Westphal
5f3d1bdf3c *: rename two vrf functions
Since VRFs can be searched by vrf_id or name, make this explicit in the
helper functions.

s/vrf_lookup/vrf_lookup_by_id/
s/zebra_vrf_lookup/zebra_vrf_lookup_by_id/

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28 16:18:35 -02:00
Daniel Walton
aac9ef6cb0 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 17:51:05 +00:00
Maitane Zotes
734b349e15 bgpd: implement admin distance
Until today the admin distance cannot be configured for any IPv6
routing protocol. This patch implements it for bgp.

Signed-off-by: Maitane Zotes <maz@open.ch>
Signed-off-by: Roman Hoog Antink <rha@open.ch>
2016-10-19 22:28:45 -04:00
Daniel Walton
d93f7ffcb1 bgpd: 'neighbor x.x.x.x weight' should be per address-family
Ticket: CM-13053
Reviewed By: dslice@cumulusnetworks.com

'neighbor x.x.x.x weight' was implemented as a per-peer knob instead of
a per-peer per-afi-safi option. This makes it configurable per-peer
per-afi-safi so that we can do things like soft clear that afi/safi when
weight is modified.
2016-10-10 07:53:34 -07:00
Daniel Walton
1ba2a97af9 bgpd: 'Last write' does not update when we TX a keepalive
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-5518
2016-10-06 13:20:02 +00:00
Lou Berger
65efcfce42 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-10-03 08:17:02 -04:00
David Lamparter
4a1ab8e405 *: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs
This is a rather large mechanical commit that splits up the memory types
defined in lib/memtypes.c and distributes them into *_memory.[ch] files
in the individual daemons.

The zebra change is slightly annoying because there is no nice place to
put the #include "zebra_memory.h" statement.

bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the
library for its own use.  This is bad practice and would break when the
memtype are made static.

Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[CF: rebased for cmaster-next]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-19 16:31:04 -04:00
Renato Westphal
f43e655ed8 bgpd: fix build on Solaris
* Solaris doesn't have u_int64_t, so use uint64_t instead. C99-style
  fixed-width integers should always be preferred to improve portability;

* 's_addr' is a macro on Solaris, so we can't use it as a variable name.
  Rename the 's_addr' variable to 'addr' in the
  bgp_peer_conf_if_to_su_update_v4() function.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-08-24 11:17:55 -04:00
Paul Jakma
b892f1ddfe *: use an ifindex_t type, defined in lib/if.h, for ifindex values
(cherry picked from commit 9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744)
2016-08-18 07:35:38 -04:00
Sid Khot
eb117f29e1 bgpd: Fix for CM-11982 bgp failed to redistribute connected in vrf table
Made fix to update the redistribute vrf bitmap when vrf goes down and comes up.

Ticket: CM-11982
Reviewed By: CCR-5032
Testing Done: bgp-min passed, manual
2016-08-05 16:49:39 -07:00
David Lamparter
0e6cb7434f bgpd: divorce router-id logic from CLI & zebra
Logic for determining the router-id was spread out over bgp_zebra.c and
bgp_vty.c.  Move to bgpd/bgpd.c and have these two call more properly
encapsulated functions.

Significant work by Christian Franke <chris@opensourcerouting.org>.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28 07:27:47 -04:00
David Lamparter
4760600f78 bgpd: minor header/API clean up
Adds "const" on:
- peer_update_source_addr_set()
- peer_description_set()
Adds parameter names on:
- bgp_timers_set()
  (really confusing, this one, with 2 unexplained args of same type)
Adds new setter:
- peer_afc_set(), calling peer_activate/peer_deactivate.
  (intended for API consumers, matches peer->afc)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28 07:27:47 -04:00
Quentin Young
63fa10b595 bgpd: Disallow ebgp-multihop on swpX peers
Disallow setting ebgp-multihop on peers directly
connected via an interface.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-07-12 21:13:24 +00:00
Lou Berger
587ff0fd88 bgpd: encap: add encap SAFI (RFC5512)
Adds RFC5512 and Encapsulation Attribute.

Signed-off-by: Lou Berger <lberger@labn.net>
(cherry picked from commit 298cc2f688dbadf0a447fcd06ae8e20fa5006ce4)

Conflicts:
	bgpd/Makefile.am
	bgpd/bgp_attr.c
	bgpd/bgp_open.c
	bgpd/bgp_packet.c
	bgpd/bgp_route.c
	bgpd/bgp_vty.c
	bgpd/bgpd.c
2016-06-11 15:36:42 -07:00
vivek
6407da5a24 bgpd: Fixes and updates for VPNv6
VPNv6 changes picked from upstream needed fixes and updates due to some
fundamental changes implemented by Cumulus (BGP update-groups, RFC 5549
and nexthop setting etc.) which aren't present upstream.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Updates: 945c8fe, 8ecd326, bb86c60, 93b73df, f4c8985
2016-06-11 11:36:42 -07:00
Lou Berger
f4c89855b5 bgpd: encap: add attribute handling
Signed-off-by: Lou Berger <lberger@labn.net>
Reviewed-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit c3741789530ee824693fd606356acac2ad695f83)

Conflicts:
	bgpd/Makefile.am
	bgpd/bgp_attr.c
	bgpd/bgp_attr.h
	lib/memtypes.c
2016-06-09 18:36:40 -07:00
Lou Berger
bb86c6017e bgpd: improve cleanup in bgp_delete()
Signed-off-by: Lou Berger <lberger@labn.net>
(cherry picked from commit 82dd707988b7481e203cab058c92f0b3041dd558)

Conflicts:
	bgpd/bgp_nexthop.h
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_zebra.h
	bgpd/bgpd.c
	bgpd/bgpd.h
2016-06-08 17:58:42 -07:00
Timo Teräs
baa376fc1c bgpd: allow using rtt in route-map's set metric
Useful when the BGP neighbors are over tunnels that have large
differences in geographic distances and RTTs. Especially useful
for DMVPN setups to allow preferring closes hub.

The parameter is added as new alias command as otherwise it seems
the command parser is not able to match it properly (it seems
merging is done for the various 'set metric' route-map objects in
different routing engines). For same reason also they are listed
as three separate options: optional +/- seems not possibly easily.

Related research papers:
http://www.pps.univ-paris-diderot.fr/~jch/research/delay-based.pdf
http://arxiv.org/pdf/1309.0632.pdf

Paper on similar extension to Babel:
http://www.pps.univ-paris-diderot.fr/~jch/research/rapport-jonglez-2013.pdf

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit ef757700d0fd51dc0b46df9d3631208919f9b779)
2016-06-06 08:25:42 -07:00
Paul Jakma
1f9a9fffc1 Fix most compiler warnings in default GCC build.
Fix lots of warnings. Some const and type-pun breaks strict-aliasing
warnings left but much reduced.

* bgp_advertise.h: (struct bgp_advertise_fifo) is functionally identical to
  (struct fifo), so just use that.  Makes it clearer the beginning of
  (struct bgp_advertise) is compatible with with (struct fifo), which seems
  to be enough for gcc.
  Add a BGP_ADV_FIFO_HEAD macro to contain the right cast to try shut up
  type-punning breaks strict aliasing warnings.
* bgp_packet.c: Use BGP_ADV_FIFO_HEAD.
  (bgp_route_refresh_receive) fix an interesting logic error in
  (!ok || (ret != BLAH)) where ret is only well-defined if ok.
* bgp_vty.c: Peer commands should use bgp_vty_return to set their return.
* jhash.{c,h}: Can take const on * args without adding issues & fix warnings.
* libospf.h: LSA sequence numbers use the unsigned range of values, and
  constants need to be set to unsigned, or it causes warnings in ospf6d.
* md5.h: signedness of caddr_t is implementation specific, change to an
  explicit (uint_8 *), fix sign/unsigned comparison warnings.
* vty.c: (vty_log_fixed) const on level is well-intentioned, but not going
  to fly given iov_base.
* workqueue.c: ALL_LIST_ELEMENTS_RO tests for null pointer, which is always
  true for address of static variable.  Correct but pointless warning in
  this case, but use a 2nd pointer to shut it up.
* ospf6_route.h: Add a comment about the use of (struct prefix) to stuff 2
  different 32 bit IDs into in (struct ospf6_route), and the resulting
  type-pun strict-alias breakage warnings this causes.  Need to use 2
  different fields to fix that warning?

general:

* remove unused variables, other than a few cases where they serve a
  sufficiently useful documentary purpose (e.g.  for code that needs
  fixing), or they're required dummies.  In those cases, try mark them as
  unused.
* Remove dead code that can't be reached.
* Quite a few 'no ...' forms of vty commands take arguments, but do not
  check the argument matches the command being negated.  E.g., should
  'distance X <prefix>' succeed if previously 'distance Y <prefix>' was set?
  Or should it be required that the distance match the previously configured
  distance for the prefix?
  Ultimately, probably better to be strict about this.  However, changing
  from slack to strict might expose problems in command aliases and tools.
* Fix uninitialised use of variables.
* Fix sign/unsigned comparison warnings by making signedness of types consistent.
* Mark functions as static where their use is restricted to the same compilation
  unit.
* Add required headers
* Move constants defined in headers into code.
* remove dead, unused functions that have no debug purpose.

(cherry picked from commit 7aa9dcef80b2ce50ecaa77653d87c8b84e009c49)

Conflicts:
	bgpd/bgp_advertise.h
	bgpd/bgp_mplsvpn.c
	bgpd/bgp_nexthop.c
	bgpd/bgp_packet.c
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	lib/command.c
	lib/if.c
	lib/jhash.c
	lib/workqueue.c
	ospf6d/ospf6_lsa.c
	ospf6d/ospf6_neighbor.h
	ospf6d/ospf6_spf.c
	ospf6d/ospf6_top.c
	ospfd/ospf_api.c
	zebra/router-id.c
	zebra/rt_netlink.c
	zebra/rt_netlink.h
2016-05-26 18:57:39 +00:00
vivek
5c81b96aca BGP: Set advertisement interval when triggering IPv6 RAs
This change extends the earlier change which added the ability in BGP to
trigger IPv6 Router Advertisements when an unnumbered neighbor is configured.
In addition to triggering the RAs, the advertisement interval is also set to
10 seconds. This is needed to handle the scenario where the peer may start
later.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-10896
Reviewed By: CCR-4693
Testing Done: Manual, bgp-min, bgp-smoke
2016-05-12 16:51:43 -07:00
vivek
4a04e5f796 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 13:53:38 -07:00
Dinesh G Dutt
e60480bd74 Update last reset reason on interface down or neighbor addr loss.
Ticket:
Reviewed By:
Testing Done:

For interface-based peering, we don't update the reset reason to be
interface down. Similarly, we don't update the reason to be loss of
neighbor address (maybe due to RA loss). This patch addresses these
limitations.
2016-04-25 08:54:44 -07:00
vivek
5c81a5f382 BGP: Use VRF_UNKNOWN for initialization
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-10423
Reviewed By: CCR-4474
Testing Done: Manual (basic checks)
2016-04-13 18:40:09 -07:00
Donald Sharp
f813b13b71 bgpd: Add group pointer to peer_create function.
When creating a 'struct peer' add in the ability to set the peer group
associated with that peer.

Ticket: CM-10184
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-03-31 14:01:12 -04:00
vivek
5fe9f9631d Quagga: Make routemap updates or deletes work for VRFs
Updates to routemaps and delete of the routemap were not working properly
for VRFs. This was because while routemaps are global, the routemap update
processing timer and the processing were at the per-instance level. This
approach was unable to handle processing for multiple instances as the
routemap has no tracking of which instances are still pending processing.
This lead to the processing happening correctly only for the first instance
- which could be the default instance or some other instance. It could also
result in reference to freed memory for an instance.

The fix done is to make the update/delete processing also global and not per
instance. This means that the route-map delay timer will be global and a global
thread will handle the change (or delete) for all instances instead of spawning
a separate thread for each instance. To support this, a global BGP command
"bgp route-map delay-timer <value>" has been implemented. The existing command
per-instance is not deleted but will update the global timer.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-6970, CM-9918
Reviewed By: CCR-4320
Testing Done: Manual, bgpsmoke
2016-03-22 17:46:30 +00:00
vivek
59ecefe2db BGP: Fix linkage between BGP instance and VRF structure
The issue here has to do with the fact that VRFs (like interfaces) are not
actually getting deleted when they are removed - they remain present. This
leads to situations in which BGP may try to unlink more than once, which
messes up the reference count (lock) in the BGP instance.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-9419
Reviewed By: CCR-4302
Testing Done: Manual, also verified by Atul

<DETAILED DESCRIPTION (REPLACE)>
2016-03-16 20:38:31 +00:00
vivek
b33adb7c40 BGP: Fix interface list upon instance creation/deletion
The BGP instance cleanup was deleting interfaces in that instance after
prior fixes, but this ended up deleting the interface list header which
was not being re-created. Added code to re-create this at the time an
instance is created.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>

Ticket: CM-9466
Reviewed By: CCR-4164
Testing Done: Manual and verified failed test
2016-02-24 04:09:21 +00:00
vivek
009b18fc80 BGP: Cleanup interfaces properly on instance delete or exit
Perform interface cleanup as an instance is deleted. This takes care of the
scenario when BGP exits (or is stopped/restarted) too as instances undergo
deletion and the interface cleanup is done as the last step in that.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Fixes: 46abd3e3e6

Ticket: CM-9410
Reviewed By: CCR-4143
Testing Done: Reran failed test
2016-02-22 06:36:37 +00:00
vivek
d1be1f083d BGP: Link BGP instance to corresponding VRF
Link BGP instance (Default or VRF) to the corresponding VRF structure and
modify lookup to use this. The logic is very similar to what is implemented
in zebra - the 'struct zebra_vrf' there is essentially 'struct bgp' in BGP.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-9122
Reviewed By: CCR-4102
Testing Done: Manual
2016-02-19 18:43:30 -08:00
vivek
ad4cbda1a3 BGP: VRF registration and cleanup
Various changes and fixes related to VRF registration, deletion,
BGP exit etc.

- Define instance type
- Ensure proper handling upon instance create, delete and
  VRF add/delete from zebra
- Cleanup upon bgp_exit()
- Ensure messages are not sent to zebra for unknown VRFs

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-9128, CM-7203
Reviewed By: CCR-4098
Testing Done: Manual
2016-02-12 13:50:22 -08:00
Donald Sharp
6aeb9e7846 bgpd: Add the ability to use a VRF to bgp
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
2016-02-02 04:36:20 -08:00
Donald Sharp
a0cee366e8 bgpd, ripngd, zebra: Remove duplicate PSIZE define
The PSIZE macro is defined the same in multiple places.  Remove
the duplicates.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-01-26 08:41:52 -08:00
vivek
96885f16b0 BGP: Rework iteration of peer_af_array
While processing references to the macro PEERAF_FOREACH(), aggressive loop
optimization by gcc 4.9.x (probably 4.8 and greater) was resulting in the
generated code not checking on the index as well as eliminating some code.
This was leading to a dereference of invalid memory when a BGP peer came up.

The fix is to scrap this convoluted macro. Two other changes done are to
eliminate overloading of "afindex" and make the loop iterator an integer.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Dave Olson <olson@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-8889
Reviewed By: CCR-4018
Testing Done: Verified failure scenario

Note: This code was added as part of update-groups implementation; when
upstreaming update-groups, this patch should also be included.
2016-01-22 10:56:48 -08:00
Daniel Walton
9b1be336fa BGP: ebgp-multihop should accept a value up to 255
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Don Slice <dslice@cumulusnetworks.com>

Ticket: CM-8788
2016-01-14 15:25:32 +00:00
Daniel Walton
4c48cf63ae BGP: 'neighbor swpX interface peer-group FOO' is needed to simplify swpX
configuration

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Dinesh Dutt <ddutt@cumulusnetworks.com>

Ticket: CM-8321

This allows the user to configure the peer-group as an option for the
"neighbor swpX interface" command.
{code}
!
router bgp 100
 neighbor FOO peer-group
 neighbor FOO remote-as external
 neighbor swp1 interface
 neighbor swp2 interface v6only
 neighbor swp3 interface peer-group FOO
 neighbor swp4 interface v6only peer-group FOO
!
 address-family ipv4 unicast
  neighbor FOO activate
  neighbor swp1 activate
  neighbor swp2 activate
 exit-address-family
!
{code}

Note that if the user configures
{code}
neighbor swp5 interface
neighbor swp5 peer-group FOO
{code}

We will display that as "neighbor swp5 interface peer-group FOO".  It
did not seem worth tracking that the peer-group was entered via two
lines instead of one.
2015-11-30 21:19:39 +00:00
Daniel Walton
c8560b44e0 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 18:53:50 +00:00
vivek
c2d58d6d0f BGP: Handle router-id correctly in config and display.
BGP is currently displaying the in-use router-id in the config. This is
conditional on a CONFIG flag, however, that flag is set even when there
is no configured router-id and the router-id learnt from Zebra is in-use.
The CONFIG flag for router-id is redundant since there is a separate
variable for the configured value, so use that and deprecate the CONFIG
flag. This also makes BGP behave like OSPF.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-8077, CM-8220
Reviewed By: CCR-3793
Testing Done: Manual verification (in 2.5-br)

Note: Imported from 2.5-br patch bgpd-fix-router-id-config-display.patch
2015-11-17 13:57:56 -08:00
Daniel Walton
219178b6ba Quagga default: BGP "no-as-set" should be the default for "bgp as-path multipath-relax"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7928
2015-11-10 15:33:24 +00:00
Daniel Walton
2a3d57318c BGP: route-server will now use addpath...chop the _rsclient code
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-8122

per draft-ietf-idr-ix-bgp-route-server-09:

2.3.2.2.2.  BGP ADD-PATH Approach

   The [I-D.ietf-idr-add-paths] Internet draft proposes a different
   approach to multiple path propagation, by allowing a BGP speaker to
   forward multiple paths for the same prefix on a single BGP session.

   As [RFC4271] specifies that a BGP listener must implement an implicit
   withdraw when it receives an UPDATE message for a prefix which
   already exists in its Adj-RIB-In, this approach requires explicit
   support for the feature both on the route server and on its clients.

   If the ADD-PATH capability is negotiated bidirectionally between the
   route server and a route server client, and the route server client
   propagates multiple paths for the same prefix to the route server,
   then this could potentially cause the propagation of inactive,
   invalid or suboptimal paths to the route server, thereby causing loss
   of reachability to other route server clients.  For this reason, ADD-
   PATH implementations on a route server should enforce send-only mode
   with the route server clients, which would result in negotiating
   receive-only mode from the client to the route server.

This allows us to delete all of the following code:

- All XXXX_rsclient() functions
- peer->rib
- BGP_TABLE_MAIN and BGP_TABLE_RSCLIENT
- RMAP_IMPORT and RMAP_EXPORT
2015-11-10 15:29:12 +00:00
Daniel Walton
06370dacc0 BGP: Implement "neighbor x.x.x.x addpath-tx-bestpath-per-AS"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-8114
2015-11-06 16:34:41 +00:00
Daniel Walton
adbac85e10 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 17:29:43 +00:00
Daniel Walton
400b1fad1d Deactivate BGP peer via "no neighbor x.x.x.x activate" removes other config
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-6281
2015-10-29 20:33:30 +00:00
Daniel Walton
88b8ed8dec BGP: peer-group restrictions should be relaxed, update-groups determine outbound policy anyway
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Vivek Venkataraman <vivek@cumulusnetworks.com>

Ticket: CM-7933
2015-10-28 01:54:48 +00:00
Daniel Walton
dd793e4a9c Use a hash to store BGP peer structures
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-5370
2015-10-23 17:34:50 +00:00
Daniel Walton
3fd8c52723 Lower BGP's default keepalive/holdtime to 3s/9s
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7900
2015-10-20 22:07:54 +00:00
Daniel Walton
ca5c79854c Remove BGP_ERROR_START_TIMER, it was no longer used
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7903
2015-10-20 22:06:52 +00:00
Daniel Walton
5623e905f2 Enable "bgp network import-check exact" by default. Without this it is
very easy to blackhole routes.

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-6649
2015-10-20 21:57:09 +00:00
Daniel Walton
bd4b893f77 Remove BGP's asorig timer, it is no longer used
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-20 21:54:07 +00:00
Daniel Walton
23a1f277a9 Lower the default 'timers connect' in BGP to 10 seconds
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-20 21:53:10 +00:00
Daniel Walton
12179ba3be Lower the default MRAI timer for EBGP peers to zero
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-20 21:51:00 +00:00
Daniel Walton
1670355a5a Lower the default MRAI timer for iBGP peers to 0 2015-10-20 21:50:03 +00:00
Donald Sharp
9229d914dd bgpd: fix using of two pointers for struct thread_master *
Ticket: CM-7861
Reviewed by: CCR-3651
Testing: See bug

bgp is using both bm->master and master pointers interchangebly
for thread manipulation.  Since they are the same thing consolidate
to one pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-14 06:16:10 -07:00
Donald Sharp
87d4a78163 bgpd: backout change of bm->master and master
Upstream does wanted the reverse of what was done
in this patch.  Back out the patch.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-13 13:00:55 -07:00
Donald Sharp
7dfe5b9499 bgpd: fix using of two pointers for struct thread_master
bgp is using both bm->master and master pointers interchangebly
for thread manipulation.  Since they are the same thing consolidate
to one pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-09-23 18:38:27 -07:00
Daniel Walton
04b6bdc0ee bgpd: Exchange hostname capability and display hostnames in output
This patch adds a hostname capability. The node's hostname and
domainname are exchanged in the new capability and used in show command
outputs based on a knob enabled by the user. The hostname and domainname
can be a maximum of 64 chars long, each.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Vivek Venkataraman <vivek@cumulusnetworks.com>

Ticket: CM-5660
Reviewed By: CCR-2563
Testing Done:
2015-09-10 20:10:16 -07:00
Morgan Stewart
856ca177c4 Added json formating support to show-...-neighbors-... bgp commands.
Ticket: CM-6789
Reviewed By: CCR-3263
Testing Done: Manual Testing and smoke tests

Whenever some sort of output is encountered, added a json version with
proper logic as well.
2015-08-12 13:24:02 -07:00
Donald Sharp
88177fe3ed Fixup of warnings in the code
Ticket: None
Reviewed by: Trivial
Testing:

A bunch of warnings have crept in to the code base.  This
fixes the issue
2015-07-25 15:55:47 -07:00
Donald Sharp
a538debe66 Cleanup of missing NEXTHOP_FORCE_SELF 2015-07-22 13:18:24 -07:00
Donald Sharp
28066f4bcc Fixup of peer memory leaks in bgp
When deleting a set of peers, the peer->group pointer was being set to NULL
and then passed into peer_delete.

peer_delete has functionality to safely remove the peer->group structure if it
non-null and to remove the peer->group if it's refcnt reaches zero.

This is a day one bug in the quagga source tree.
2015-07-22 12:35:38 -07:00
Donald Sharp
14051b3615 bgpd-capability-cleanup.patch
BGP: Make Capability handling a little more robust

This patch does two things:
- Returns the right sub error code when a malformed capability is rcvd
- Verifies that the capability length is a multiple of an individual unit

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Vivek Venkataraman <vivek@cumulusnetworks.com>
2015-07-22 12:35:38 -07:00
Donald Sharp
7f342629a9 This patch changes ospfd from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering neighbors discovered on BFD enabled interfaces with PTM/BFD through zebra. Neighbor is registered with BFD when 2-way adjacency is established and deregistered when adjacency goes down if the BFD is enabled on the interface through which the neighbor was discovered.
OSPF BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx).
interface <if-name>
  ip ospf bfd <detect mult> <min rx> <min tx>

This patch also adds BFD support for IPv6 OSPF. ospf6d  will dynamically register/deregister IPv6 neighbors with BFD for monitoring the connectivity of the neighbor. Neighbor is registered with BFD when 2-way adjacency is established and deregistered when adjacency goes down if the BFD is enabled on the interface through which the neighbor was discovered.

OSPF6 BFD command added to configure BFD and parameters (detect multiplier, min rx and min tx).
interface <if-name>
  ipv6 ospf6 bfd <detect mult> <min rx> <min tx>

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Kanna Rajagopal <kanna@cumulusnetworks.com>
2015-07-22 12:35:37 -07:00
Donald Sharp
7bbc6864de When IPv6 peer BFD down status is received by BGP, all the the peers for which the BFD is enabled are brought down. This happens due to reverse memcmp check of destination and source IPv6 addresses with the BFD enabled BGP peers. Fixed it by doing the memcmp correctly.
Also, there is no reason stored in the last_reset field when BGP peer goes down due BFD. Incorrect/no peer down reason can get logged when BGP peer goes down due to BFD. Fixed it by adding new BFD peer down reason code and storing it in the peer last_reset field when peer is broght down due to BFD.
2015-07-22 12:35:37 -07:00
Donald Sharp
8ffedceac3 bgpd-interface-ipv4-cmd.patch
BGP: Determine peer's IP address if interface has /30, /31

Allow interface-based session config for IPv4 numbered links
if the link address is either /30 or /31. This is not RFC5549,
but can be deployed now, and independent of whether the peer
supports RFC5549 or not.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-By:   Vivek Venkataram <vivek@cumulusnetworks.com>
2015-07-22 12:35:37 -07:00
Donald Sharp
c744aa9fc6 Remove draft-walton-bgp-hostname-capability-00 for now 2015-06-12 07:59:12 -07:00
Donald Sharp
c43ed2e48a This patch changes BGP from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering BFD enabled peers with PTM/BFD through zebra. Peer is registered with BFD when it goes into established state and de-registers when it goes out of establish state.
This patch also adds BFD multihop support for BGP. Whether a peer is multi-hop or single hop is determined internally. All IGP peers are considered as multi-hop peers. EBGP peers are considered as single hop unless configured as multi-hop.

BGP BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx).

router bgp <as-number>
  neighbor <name/ip-address> bfd <detect mult> <min rx> <min tx>

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by:   Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by:   Kanna Rajagopal <kanna@cumulusnetworks.com>
2015-06-12 07:59:11 -07:00
Donald Sharp
8a92a8a00c bgpd, zebra: rfc-5549-generic.patch
This adds support for BGP RFC 5549 (Extended Next Hop Encoding capability)

     * send and receive of the capability
     * processing of IPv4->IPv6 next-hops
     * for resolving these IPv6 next-hops, itsworks with the current
       next-hop-tracking support
     * added a new message type between BGP and Zebra for such route
       install/uninstall
     * zserv side of changes to process IPv4 prefix ->IPv6 next-hops
     * required show command changes for IPv4 prefix having IPv6 next-hops

Few points to note about the implementation:

     * It does an implicit next-hop-self when a [IPv4 prefix -> IPv6 LL next-hop]
       is to be considered for advertisement to IPv4 peering (or IPv6 peering
       without Extended next-hop capability negotiated)

     * Currently feature is off by default, enable it by configuring
       'neighbor <> capability extended-nexthop'

     * Current support is for IPv4 Unicast prefixes only.

IMPORTANT NOTE:

     This patch alone isn't enough to have IPv4->IPv6 routes installed into
     the kernel. A separate patch is needed for that to work for the netlink
     interface.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
             Vivek Venkatraman <vivek@cumulusnetworks.com>
             Donald Sharp <sharpd@cumulusnetworks.com>
2015-06-11 09:19:12 -07:00
Donald Sharp
840fced957 BGP 'show ip bgp nei x.x.x.x advertised-route' does not display 'Originating default network 0.0.0.0' 2015-05-19 18:29:19 -07:00
Donald Sharp
6410e93aa5 bgpd-hostname-cap.patch
bgpd: Exchange hostname capability and display hostnames in outputs

This patch adds a hostname capability. The node's hostname and
domainname are exchanged in the new capability and used in show command
outputs based on a knob enabled by the user. The hostname and domainname
can be a maximum of 64 chars long, each.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Vivek Venkataraman <vivek@cumulusnetworks.com>
2015-05-19 18:29:16 -07:00
Donald Sharp
ffd0c03744 bgpd: bgpd-warnings.patch
Remove compile warnings for the bgpd directory
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:
2015-05-19 18:12:17 -07:00
Donald Sharp
0299c00427 bgpd: bgpd-no-as.patch
bgp: Fixup of the remote-as command to allow user to not have to enter an actual as number
Signed-off-by: Donald Sharp<sharpd@cumulusnetworks.com>
Reviewed-by:
2015-05-19 18:04:25 -07:00
Donald Sharp
0de4848df6 If a route-map is used on a neighbor default-originate statement we need to dynamically add/del the default route if the permit/deny result of the route-map changes. 2015-05-19 18:04:20 -07:00
Donald Sharp
078430f609 bgpd-nht-import-check-fix.patch
BGP: Fix network import check use with NHT instead of scanner

When next hop tracking was implemented and the bgp scanner was eliminated,
the "network import-check" command got broken. This patch fixes that
issue. NHT is used to not just track nexthops, but also the static routes
that are announced as part of BGP's network command. The routes are
registered only when import-check is enabled. To optimize performance,
we register static routes only when import-check is enabled.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 18:04:20 -07:00
Donald Sharp
6403814caa When unexpected events are received, do not silently transition to Idle
state through bgp_ignore() as that may not do required cleanup. Instead,
define a new event handler to handle such cases, which will go through
bgp_stop(). A similar change is also done to handle the case where an
event handler fails.

Also add a couple of variables to keep track of events for a peer.
2015-05-19 18:04:12 -07:00
Donald Sharp
16fc1eec45 Add a no-as-set option to multipath-relax 2015-05-19 18:03:58 -07:00
Donald Sharp
907f92c8fc bgpd: Disable connected check for next hop on eBGP peers
In the data center, in conjunction with next hop propagation for features
such as announcing VIP routes to load balancers and such, it is desired to
disable the connected route check even on ebgp peers with TTL of 1. This
patch is used to disable the check for all peers instead of the peer by
peer check that is currently supported. Furthermore, the existing
disable-connected-check is different from how Cisco implements this feature.
So, we add this new flag to avoid reliance on the existing flag.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2015-05-19 18:03:49 -07:00
Donald Sharp
f14e6fdbe2 This patch adds support for allowing BGP to create and bring up neighbor
sessions dynamically. The operator configures a range of neighbor addresses
to which peering is allowed. The ranges are configured as subnets and
multiple ranges are allowed. Each range is associated with a peer-group
so that additional parameters can be configured.

BGP neighbor sessions are dynamically created when connections are initiated
by remote neighbors whose addresses fall within a configured range. The
sessions are deleted when the BGP connection terminates.

A limit on the number of neighbors allowed from each range of addresses
can be specified.

IPv4 and IPv6 peering is supported. Over the peering, any of the address
families configured for the peer-group can be negotiated.
2015-05-19 18:03:47 -07:00
Donald Sharp
3f9c7369f7 BGP: Add dynamic update group support
This patch implements the 'update-groups' functionality in BGP. This is a
function that can significantly improve BGP performance for Update generation
and resultant network convergence. BGP Updates are formed for "groups" of
peers and then replicated and sent out to each peer rather than being formed
for each peer. Thus major BGP operations related to outbound policy
application, adj-out maintenance and actual Update packet formation
are optimized.

BGP update-groups dynamically groups peers together based on configuration
as well as run-time criteria. Thus, it is more flexible than update-formation
based on peer-groups, which relies on operator configuration.

[Note that peer-group based update formation has been introduced into BGP by
Cumulus but is currently intended only for specific releases.]

From 11098af65b2b8f9535484703e7f40330a71cbae4 Mon Sep 17 00:00:00 2001
Subject: [PATCH] updgrp commits
2015-05-19 18:03:47 -07:00
Donald Sharp
a82478b985 BGP: add addpath RX support 2015-05-19 18:03:45 -07:00
Donald Sharp
7c8ff89e93 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-19 18:03:42 -07:00
Donald Sharp
c7122e1424 Implement BGP as-override feature 2015-05-19 18:03:14 -07:00
Donald Sharp
16286195e4 Overhual BGP debugs
Summary of changes
- added an option to enable keepalive debugs for a specific peer
- added an option to enable inbound and/or outbound updates debugs for a specific peer
- added an option to enable update debugs for a specific prefix
- added an option to enable zebra debugs for a specific prefix
- combined "deb bgp", "deb bgp events" and "deb bgp fsm" into "deb bgp neighbor-events". "deb bgp neighbor-events" can be enabled for a specific peer.
- merged "deb bgp filters" into "deb bgp update"
- moved the per-peer logging to one central log file. We now have the ability to filter all verbose debugs on a per-peer and per-prefix basis so we no longer need to keep log files per-peer. This simplifies troubleshooting by keeping all BGP logs in one location.  The use
r can then grep for the peer IP they are interested in if they wish to see the logs for a specific peer.
- Changed "show debugging" in isis to "show debugging isis" to be consistent with all other protocols.  This was very confusing for the user because they would type "show debug" and expect to see a list of debugs enabled across all protocols.
- Removed "undebug" from the parser for BGP.  Again this was to be consisten with all other protocols.
- Removed the "all" keyword from the BGP debug parser.  The user can now do "no debug bgp" to disable all BGP debugs, before you had to type "no deb all bgp" which was confusing.

The new parse tree for BGP debugging is:

deb bgp as4
deb bgp as4 segment
deb bgp keepalives [A.B.C.D|WORD|X:X::X:X]
deb bgp neighbor-events [A.B.C.D|WORD|X:X::X:X]
deb bgp nht
deb bgp updates [in|out] [A.B.C.D|WORD|X:X::X:X]
deb bgp updates prefix [A.B.C.D/M|X:X::X:X/M]
deb bgp zebra
deb bgp zebra prefix [A.B.C.D/M|X:X::X:X/M]
2015-05-19 17:58:12 -07:00
Donald Sharp
d889623f1a Changes to improve BGP convergence time:
- Schedule write thread for advertisements and withdraws only if corresponding
  FIFOs are growing and/or upon work_queue getting fully processed.
- Set non-default yield time for the main work_queue, as the default value
  of 10ms results in yielding after processing very few nodes.
- Remove unnecessary scheduling of write thread when update packet is formed.
- If MRAI is 0, don't start a timer unnecessarily, directly schedule write
  thread.
- Some debugs.
2015-05-19 17:58:12 -07:00
Donald Sharp
0a91ff55b8 BGP crashes if attributes alone consume > 4096 bytes 2015-05-19 17:58:10 -07:00
Donald Sharp
5000f21c25 Add replace-as option to remove-private-as 2015-05-19 17:57:34 -07:00
Donald Sharp
d5a5c8f05b This patch adds support for a new BFD session down message from zebra to
protocols. BGP and OSPF are integrated to respond this BFD session down message
originated in Zebra via ptmd.

BGP and OSPF now have a bfd command, which tells OSPF/BGP to respond to the
BFD session down message.

OSPF:

interface <>
 ip ospf bfd

BGP:

router bgp <>
  neighbor <> bfd

Please note that these commands don't enable BFD as a protocol. BFD configuration
and paramter tuning are via BFD applicable UI.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
2015-05-19 17:47:23 -07:00
Donald Sharp
518f0eb188 bgpd: bgpd-event-driven-route-map-updates.patch
BGP: Reprocess the trigger points when an attached route map changes

Currently, modifications to route maps do not affect already processed
routes; they only affect new route updates. This patch addresses this
limitation.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:45 -07:00
Donald Sharp
abc920f85e bgpd-maxmed-administrative-onstartup.patch
COMMAND:

Possible forms of the command configuration:

[no] bgp max-med administrative
[no] bgp max-med administrative <max-med-value>
[no] bgp max-med on-startup <period>
[no] bgp max-med on-startup <period> <max-med-value>

DESCRIPTION:

'administrative' takes effect from the time of the config until the config is
removed.

'on-startup' is effective only at the startup time for the given '<period>'
after the first peer is established.

'<max-med-value>' is used as the MED value to be sent out when the max-med
is effective. Default max-med value is 4294967294.

NOTE:
When max-med is active, MED is changed only in the outgoing attributes to the
peers, it doesn't modify any MED specific state of the attributes in BGP on
the local node.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:40:42 -07:00