Commit Graph

212 Commits

Author SHA1 Message Date
Donald Sharp
1defdda8e8 bgpd: Convert BGP_INFO_XXX to BGP_PATH_XXX
Search and replace all BGP_INFO_XXX to BGP_PATH_XXX

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09 14:14:25 -04:00
Quentin Young
1c50c1c0d6 *: style for EC replacements
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:38:57 +00:00
Quentin Young
e50f7cfdbd bgpd: BGP_[WARN|ERR] -> EC_BGP
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 18:51:04 +00:00
Don Slice
9f049418bc bgpd/ospfd: make bgp and ospf json response a bit more consistent
Problem reported that some bgp and ospf json commands did not return
any json output at all if the bgp/ospf instance did not exist.
Additionally, some bgp and ospf json commands did not return any json
output if the instance existed but no neighbors were defined.  This
fix makes these commands more consistent in returning empty braces for
json output and issue a message if not using json output.  Additionally,
made the flag "use_json" a bool to make it consistent since previously,
it had been defined as an int, char, u_char, and bool at various places.

Ticket: CM-21040
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-30 12:40:18 +00:00
Russ White
5719a7b88d
Merge pull request #2834 from dslicenc/import-vrf-fixes
bgpd: issues with vrf imports when switchd or networking restarted
2018-08-17 09:16:26 -04:00
Quentin Young
af4c27286d *: rename zlog_fer -> flog_err
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Don Slice
14454c9fdd bgpd: implement zlog_ferr facility for enhance error messages in bgp
Signed-off-by: Don Slice <dslice@cumulusnetworks.com<
2018-08-14 20:02:05 +00:00
Don Slice
e504cf3b9a bgpd: issues with vrf imports when switchd or networking restarted
Problem reported that when systemctl restart networking or switchd
performed, not all imported prefixes were successfully restored.

Ticket: CM-21684
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-14 14:33:56 +00:00
Russ White
96257ced27
Merge pull request #2591 from LabNConsulting/working/master/bgp-delayed-default-instance
bgpd: fix NULL dereference in vrf-vpn leak config if before default instance
2018-07-10 16:46:00 -04:00
F. Aragon
a85297a7c9
bgpd zebra: element overflow (PVS-Studio)
The warning given by PVS-Studio is related to per-element overflow (there is
no real overflow, because of how elements are mapped in the union). This
same warning is typically reported by Coverity, too.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-02 19:06:54 +02:00
G. Paul Ziemba
3bd70bf8f3 bgpd: fix NULL dereference in vrf-vpn leak config if before default instance
Issue 2473

VRF-VPN route-leaking configuration commands assumed existence of
default bgp instance. If a non-default vrf configuration occurred
before the default vrf configuration, it would result in a (NULL)
dereference to the non-existent default vrf.

This change 1) detects non-existence of default vrf and skips corresponding
RIB updating that normally occurs during configuration changes of the
route-leaking parameters; and 2) when the default bgp instance is defined,
runs the deferred RIB updating.

In vpn_leak_to_vrf_update_all(), replace early return if bgp_vpn is NULL
with assert, as the former would lead to subtly wrong RIB contents. The
underlying issue that led to commit 73aed5841a
should be fixed by the above changes.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-06-30 10:09:23 -07:00
G. Paul Ziemba
f46d45c17f bgpd: don't nexthop-track twice-leaked routes that came from zebra
Issue 2381: interface based routes not marked "up" when they originate
in zebra, redistributed to bgp vrf, then imported to vpn and then
imported by another vrf.

Routes that are redistributed into BGP from zebra should not get
nexthop tracking (the assumption is that the originating protocol
is responsible to export or withdraw the route according to its own
notion of nexthop status).

The vpn-vrf route-leaking code checks the source route sub_type to
decide whether to use nexthop tracking on the resulting leaked route.

A route that is redistributed from zebra into bgp will have
sub_type==BGP_ROUTE_REDISTRIBUTE. If it is leaked to the vpn RIB,
the resulting vpn RIB route will have sub_type==BGP_ROUTE_IMPORTED.
If THAT vpn route is leaked to another vrf, the original code will
examine only the leak-source route sub_type and, since it is
not BGP_ROUTE_REDISTRIBUTE, will wrongly try to use nexthop tracking
on the new route in the final vrf.

This change modifies the leak function to track back up the
parent links to the ultimate parent of the leak source route
and look at that route's sub_type instead.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-06-24 13:04:05 -07:00
paco
73aed5841a
bgpd: vpn null check
Can be reproduced with following vtysh sequence (an intentionaly wrong
sequence):

['configure terminal\n router bgp 255 vrf l3vrf-6\n',
 'configure terminal\n router bgp 255 vrf l3vrf-6\nbgp router-id 10.255.255.1\n',
 'configure terminal\n router bgp 255 vrf l3vrf-6\n address-family ipv4\nlabel vpn export 45000\n',
 'configure terminal\n router bgp 255 vrf l3vrf-6\n address-family ipv4\nrd vpn export 255:5\n',
 'configure terminal\n router bgp 255 vrf l3vrf-6\n address-family ipv4\nredistribute isis\n', 'configure terminal\n router bgp 255 vrf l3vrf-6\n address-family ipv4\nredistribute ospf\n', 'configure terminal\n router bgp 255 vrf l3vrf-6\n address-family ipv4\nredistribute connected\n', 'configure terminal\n router bgp 255 vrf l3vrf-6\n address-family ipv4\nimport vpn\n', 'configure terminal\n router bgp 255 vrf l3vrf-6\n address-family ipv4\nexport vpn\n', 'configure terminal\n router bgp 255 vrf l3vrf-6\n address-family ipv4\nrt vpn import 255:1\n', 'configure terminal\n router bgp 255 vrf l3vrf-6\n address-family ipv4\nrt vpn export 255:1\n'
]

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-18 15:52:57 +02:00
Donald Sharp
21d88ef761 bgpd: Lock originating bgp pointer for vrf route leaking
There exists cases where we will attempt to hard delete
the bgp instance( say a `no router bgp` is issued )
when we have vrf route leaking.  If we do have this
lock the bgp instance of the originator and do not
let it be deleted out from under us until we are
finished processing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-31 09:43:07 -04:00
Donald Sharp
7c82b3120e bgpd: Fix crash on shutdown
There exists code paths where the rn was being used after free.
This eliminates these code paths.

Fixes: CM-21019
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-18 20:40:24 -04:00
Donald Sharp
4b85140f5a bgpd: remove unnecessary test and allocate a bit earlier
The bgp_info_extra_get call gets the extra pointer, which
is also needed for the setlabels() call, so move the call
to above the setlabels.

Also remove an unnecessary test of a pointer since we
have already dereferenced it by the time we are testing
for it's existence.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-16 09:57:42 -04:00
vivek
528cd74fd3 bgpd: Update parent entry's refcount for imported routes
Imported routes in a VRF routing table have a reference to their parent
route entry which resides in the EVPN or IPVPN routing table. Ensure that
this reference uses appropriate locking so that the parent entry doesn't
get freed prematurely.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 13cb6b22ba9d558b1b4a1e8752f63f13242462a7)

Conflicts:
	bgpd/bgp_mplsvpn.c

Ticket: CM-20471
Testing Done:
a) Ran vrf_route_leak tests without fix and hit crash, ran twice with fix
and did not see the crash.
b) Ran evpn-smoke and ensured there were no new failures.
2018-05-11 08:02:05 -04:00
Donald Sharp
13b7e7f007 bgpd: Prevent vrf 2 vrf route leaking from going offbox.
The vrf 2 vrf route leaking auto-derives RD and RT and
installs the routes into the appropriate vpn table.
These routes when a operator configured ipv[4|6] vpn
neighbors were showing up off box.  The RD and RT
values choosen are localy significant but globaly
useless and may cause confusion.

Put a special bit of code in to notice that we
should not be advertising these routes off box.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:41:17 -04:00
Donald Sharp
321b4bc92e bgpd: Fix CI breakage
This commit reverts part of ceb800e0edb9f8979cebb1e6be9497d787bee39c
as it was found to be causing issues in upstream CI.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Don Slice
a8dadcf6cc bgpd: add ability to import default vrf routes
signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Donald Sharp
1d4e8b0d99 bgpd: Add some vrf <-> vrf code comments
Note that when we are importing vrf EVA into vrf DONNA
we must keep track of all the vrfs EVA is being
exported into and we must also keep track of all the vrf's
that DONNA is receiving data from as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Donald Sharp
89d5934783 bgpd: Fix SA warning found by clang.
Quiet the SA warning, with an assert.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Donald Sharp
020a3f60bd bgpd: Cleanup warnings found in CI
Cleanup some of the warnings found in the CI system.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
vivek
77e62f2b5a bgpd: Handle connected routes and IPv6 link-local nexthops for route leaking
Connected routes redistributed into BGP as well as IPv4 routes with IPv6
link-local next hops (RFC 5549) need information about the associated
interface in BGP if they are candidates to be leaked into another VRF. In
the absence of route leaking, this was not necessary. Introduce the
appropriate mechanism and ensure this is used during route install (in
the target VRF).

Ticket: CM-20343, CM-20382
Testing done:
1. Manually verified failed scenarios and some additional ones - logs
in the tickets.
2. Ran bgp-min and evpn-min - results are good.
3. Ran vrf smoke - has some failures, but none which look new

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-04-25 12:39:16 -04:00
vivek
82e7e75db1 bgpd: Fix route-leak/L3VPN delete of redistributed routes
Ensure that when a route redistributed into a VRF is subsequently
deleted, it is properly removed from the VPN table (if exported)
so that it can be removed from other VRFs and withdrawn from
L3VPN peers.

Ticket: CM-20345
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-04-25 12:39:16 -04:00
vivek
cc5a6ddd06 bgpd: Enhance loop checking for VRF to VPN route export
The VRF routes exported to the global VPN table must not be
imported routes. It is not necessary to check if they originate
in the global VPN instance as that doesn't hold good for VRF-to-
VRF route-leaking. Merely checking that they are not imported
should handle both L3VPN and VRF-to-VRF route-leaking use cases.

Ticket: CM-20283
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-04-25 12:39:16 -04:00
vivek
44338987be bgpd: Fixes for VRF route leaking
Implement fixes for route leaking between VRFs through BGP, especially for
the scenario where routes are leaked from a VRF X to multiple other VRFs.
This include making sure that import and export happen via the global VPN
table, setting RD correctly and proper handling for multiple import/export.

Ticket: CM-20256
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:16 -04:00
vivek
d793761d5a bgpd: Fix params/checks for route leaking and L3VPN
When routes are injected into the VPN table and then leaked into candidate
VRFs, the source should be the default instance. Also, the loop check when
withdrawing routes from a VRF should be that the route's origin isn't that
VRF; this handles VRF route leaking also and is consistent with checks in
other places.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
(cherry picked from commit 0149d2848c59bfb3277592caf0a5d5e07a2de872)

Ticket: CM-20256
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
G. Paul Ziemba
d6632478a4 bgpd: bugfix: vpn-vrf leak: set origin bgp to origin vrf for vrf-vpn-vrf
bgp route extra->bgp_orig for routes leaked vpn->vrf should be set
to original extra->bgp_orig if it is set, not vpn's bgp instance.

The initial leak is OK because it goes through a loopback path
in the vrf->vpn leaking code, but it is possible later re-leaks (e.g.,
if the destination vrf's leak configuration is changed) could
set the wrong extra->bgp_orig and break the route's nexthop.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-21 20:05:16 -07:00
G. Paul Ziemba
d92a55dfb6 bgpd: vpn-vrf routemaps: no leak if named route-map not defined
given a configuration such as this:

    router bgp 7777 vrf A
	address-family ipv4 unicast
	    route-map vpn import FOO
	    import vpn

or this:

    router bgp 7777 vrf A
	address-family ipv4 unicast
	    rd vpn export 1:3
	    rt vpn export 1:100
	    route-map vpn export FOO
	    export vpn

Previous code allowed leaking if the named FOO route-map was not defined.

Since the configuration is logically incomplete, if a route-map is named
for "vpn export" or "vpn import" but is not defined, leaking should not
occur until the route-map is defined.

This changeset implements the correct behavior.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-17 22:42:39 -07:00
Donald Sharp
ee11db2943
Merge pull request #2067 from LabNConsulting/working/master/bgp-vpn-leak-new-label-new-route
bgpd: bugfix vpn-vrf leak: consider route changed if labels change
2018-04-16 10:45:32 -04:00
Donald Sharp
bf2c7ef2a6
Merge pull request #2053 from LabNConsulting/working/master/bvl-bug-degenerate-no-label
bgpd: bugfix vpn->vrf leak: unicast-originated routes are local non-LSP
2018-04-16 08:00:23 -04:00
Renato Westphal
6b4fdc1cb1
Merge pull request #2036 from LabNConsulting/working/master/bgp-vpn-leak-labelmgr
bgpd: dynamic mpls label pool
2018-04-15 19:05:27 -03:00
G. Paul Ziemba
e37fb4bf7d bgpd: bugfix vpn-vrf leak: consider route changed if labels change
vpn-vrf leak code was not triggering a BGP update or an announce to zebra
if a route's labels changed. This changeset corrects that problem.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-14 12:00:25 -07: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
513bf8d6c9 bgpd: bugfix vpn->vrf leak: unicast-originated routes are local non-LSP
In general, routes leaked from the vpn rib to a vrf include any
labels that might have been attached to the vpn route. VRF routes
that have labels attached require a label-switched path and therefore
require nexthops with labels in order to be marked valid by the
nexthop-tracking logic.

However, some routes in the vpn RIB originated in vrfs local to this
router. Even though they may have labels, we must omit the labels
when leaking to a vrf because traffic using those resulting routes
will be carried by this router via IP routing and not label switching.
The nexthops of these routes do not need to indicate a label-switched
path, and thus the routes should be marked valid even when their nexthops
do not have labels.

This changeset omits labels from vpn->vrf leaked routes when the ultimate
source of the vpn route was a local vrf.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-11 12:14:27 -07:00
G. Paul Ziemba
291e32c391 bgpd: vrf-vpn leak: when no export label is set, encode implicit-null correctly
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-10 21:09:23 -07:00
G. Paul Ziemba
960035b2d9 bgpd: nexthop tracking with labels for vrf-vpn leaking
Routes that have labels must be sent via a nexthop that also has labels.
This change notes whether any path in a nexthop update from zebra contains
labels. If so, then the nexthop is valid for routes that have labels.

If a nexthop update has no labeled paths, then any labeled routes
referencing the nexthop are marked not valid.

Add a route flag BGP_INFO_ANNC_NH_SELF that means "advertise myself
as nexthop when announcing" so that we can track our notion of the
nexthop without revealing it to peers.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-04 10:00:23 -07: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
56c2c080f4 bgpd: qualify use of BGP_ROUTE_RFP with ENABLE_BGP_VNC
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-21 21:18:25 -07:00
G. Paul Ziemba
1b3510a060 bgpd: fix crash unleaking RFP routes
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-21 18:20:39 -07:00
Donald Sharp
c8f573499a bgpd: More ecommunity string leak cleanup
Do not leak the ecommunity string created.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-20 19:09:06 -04:00
Donald Sharp
18febdb05a
Merge pull request #1913 from LabNConsulting/working/master/bgp-vpn-leak-cli
bgpd: new vpn-policy CLI
2018-03-20 13:26:48 -04:00
G. Paul Ziemba
d555f3e904 bgpd: vpn-vrf-leaking new CLI: address Vivek's review comments + crash fix
- vpn_leak_to_vpn_active(): check instance type
    - vpn_leak_prechange(): qualify with test for active
    - vpn_leak_postchange(): remove duplicated call to
	vpn_leak_from_vrf_update_all()

    - bgp_vty.c: Avoid null-pointer dereference for command "no rt vpn import"

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-19 22:14:42 -07: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
Rafael Zalamena
5a52387a11
Merge pull request #1908 from donaldsharp/peer_established
bgpd: Clean up peer status checking for a received nlri
2018-03-19 11:35:37 -03:00
Donald Sharp
c3e345b1d5 bgpd: Don't leak the ecommunity_ecom2str string in debug
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-19 09:18:10 -04:00
Donald Sharp
dc38e9ce00 bgpd: Clean up peer status checking for a received nlri
In bgp_update_receive the first thing we do is establish
that the peer->status is Established.  We then do a bunch
of work and call bgp_nlri_parse where we break out for
each address family.  Each AFI is then checking for
being peer->status is Established again.  There is no
point in checking this again.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-16 09:12:55 -04: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
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
Mitesh Kanjariya
b57ba6d2a8 bgpd: carry two MPLS labels in EVPN NLRIs
When doing symmetric routing,
EVPN type-2 (MACIP) routes need to be advertised with two labels (VNIs)
the first being the L2 VNI (identifying the VLAN) and
the second being the L3 VNI (identifying the VRF).
The receive processing needs to handle one or two labels too.

Ticket: CM-18489
Review: CCR-6949
Testing: manual and bgp/evpn/mpls smoke

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-01-23 15:58:53 -08:00
Lou Berger
af8528faa0 bgpd: fix 'show bgp ipvX vpn rd' command
Signed-off-by: Lou Berger <lberger@labn.net>
2017-10-05 10:11:49 -04:00
Lou Berger
3d7c4cd734 bgpd: fix show bgp ipvX vpn all rd
Signed-off-by: Lou Berger <lberger@labn.net>
2017-10-05 10:11:49 -04:00
Lou Berger
1ae44dfcba bgpd: unify 'show bgp' with RD with normal unicast bgp show
Signed-off-by: Lou Berger <lberger@labn.net>
2017-10-05 10:11:49 -04:00
Daniel Walton
d114b977e9 *: support keywords that begin with uppercase letter
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

VARIABLE tokens must be all uppercase, this allows us to support WORD
tokens that begin with an uppercase letter.  The "Null0" keyword is an
example of where this is needed.

The only VARIABLE we had that wasn't already all uppercase was
ASN:nn_or_IP-address:nn
2017-09-14 18:07:30 +00:00
Renato Westphal
163076686e bgpd/ospfd: fix json leaks and blank output
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-26 12:28:56 -03: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
Donald Sharp
1ea6b3f237 Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:24:46 -04:00
David Lamparter
61b7d449bd *: remove VTYNL, part 3 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
6d3c2ed4ed *: remove VTYNL, part 1 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
David Lamparter
181039f3d7 *: ditch vty_outln(), part 2 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:19:58 +02:00
David Lamparter
5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
vivek
8557760ca8 bgpd: Separate out RD handling functions
BGP Route Distinguisher (RD) handling is common for different flavors
of BGP VPNs such as BGP/MPLS IP VPNs (RFC 4364) and BGP EVPNs (RFC 7432).
Separate out the RD handling functions into its own files.

Note: No functional change introduced with this commit.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:34:32 -04:00
Daniel Walton
1161690b93 Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-ipv4-plus-label-misc3
Conflicts:
	bgpd/bgp_route.c
2017-06-30 17:52:56 +00:00
Quentin Young
e31b6333f4 *: vty_outln (vty, "") --> vty_out (vty, VTYNL)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:56 +00:00
Quentin Young
1318e7c841 *: s/VTY_NEWLINE/VTYNL/g
Should be able to fit more vty_out onto one line now

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:54 +00:00
Quentin Young
96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +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
Renato Westphal
d81e237001 bgpd: remove unused str2tag() function
This function is not used anymore since commit fb1d2a2d9.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-19 10:49:24 -03:00
Donald Sharp
78ca62a7b2 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-19 09:41:15 -04:00
Lou Berger
fb1d2a2d97 bgpd: cleanup vpn label config, set BoS, use 'label' in place of 'tag'
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-18 17:42:04 -04:00
David Lamparter
e2f30ad1c2 Merge branch 'frr/pull/569'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:34:34 +02:00
Lou Berger
201c3dac29 bgpd: fix config of v6 vpn networks tags
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-17 14:56:43 -04: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
Renato Westphal
92a8bd6e7a bgpd: fix duplicate install of command
Only happens when FRR is configured with --enable-oldvpn-commands.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-12 12:02:24 -03:00
Renato Westphal
313605cb92 *: fix a bunch of segfaults detected by a CLI fuzzer
This patch fixes the following segfaults:
zebra aborted: vtysh -c "show ipv6 mroute"
zebra aborted: vtysh -c "configure terminal" -c "debug zebra kernel msgdump"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no packet-loss"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no metric"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no ava-bw"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no res-bw"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no use-bw"
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "area 1.1.1.1 nssa"
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "area 4294967295 nssa"
pimd aborted: vtysh -c "show ip msdp sa 1.1.1.1"
pimd aborted: vtysh -c "configure terminal" -c "ip ssmpingd"
pimd aborted: vtysh -c "configure terminal" -c "no ip ssmpingd"
pimd aborted: vtysh -c "configure terminal" -c "no ip msdp mesh-group WORD source"
pimd aborted: vtysh -c "configure terminal" -c "interface eth99" -c "ip pim hello 180"
bgpd aborted: vtysh -c "show bgp l2vpn evpn rd 1:1"
bgpd aborted: vtysh -c "clear vnc nve un *"
bgpd aborted: vtysh -c "clear vnc nve un 1.1.1.1"
bgpd aborted: vtysh -c "clear vnc nve un 2001:db8::1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export bgp ipv4 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export bgp ipv6 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export bgp route-map NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export zebra ipv4 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export zebra ipv6 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export zebra route-map NAME"
bgpd aborted: vtysh -c "configure terminal" -c "route-map RMAP permit 1" -c "no set ipv6 vpn next-hop"
bgpd aborted: vtysh -c "configure terminal" -c "route-map RMAP permit 1" -c "set vpnv4 next-hop"
bgpd aborted: vtysh -c "configure terminal" -c "route-map RMAP permit 1" -c "set vpnv6 next-hop"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "address-family ipv6 vpn" -c "network 2001:db8::1/128 rd 1:1 tag WORD"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "address-family vpnv6 unicast" -c "network 2001:db8::1/128 rd 1:1 tag WORD"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "no neighbor WORD shutdown message MSG..."
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "neighbor WORD shutdown message MSG..."

More to come later.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-04 14:39:58 -03:00
Donald Sharp
fcc65b0ff4 bgpd: Allow old vpnv4 commands to compile
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-28 10:55:45 -04:00
Philippe Guibert
3da6fcd557 bgpd: enhance network command for evpn route type 5
A new vty command available under evpn address family. This command
takes following format:

(af-evpn)# [no] network <A.B.C.D/M|X:X::X:X/M> rd ASN:nn_or_IP-address:nn ethtag WORD
                 label WORD esi WORD gwip A.B.C.D routermac WORD
		 [route-map WORD]

Among new parameters, ethtag stands for the ethernet tag indentifier.
ESI stands for the ethernet segment identifier, and must be entered in
following format: 00:11:22:33:44:55:66:77:88:99.
gwip stands for the gateway IP address contained in RT5 message. A
check is done on that value since if gwip is ipv4, then ip prefix must
be ipv4. The same for ipv6.
RouterMAc is the gateway mac address sent as extended community
attribute.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:59 +01:00
Philippe Guibert
784d3a4299 bgpd: enhance EPVN vty show commands
This patch introduces show show bgp evpn commands to dump
NLRI entries configured or received on BGP, related to EVPN
New command introduced is the following:
 show [ip] bgp l2vpn evpn [all | rd <rd name> ] [overlay]

Like for MPLS, similar set of commands is added for EVPN:
 show [ip] bgp l2vpn evpn [all|rd <RDNAME>]
 show [ip] bgp l2vpn evpn all neighbor <NEIGHBOR> routes
 show [ip] bgp l2vpn evpn all neighbor <NEIGHBOR> advertised-routes

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:58 +01:00
Philippe Guibert
7ef5a23288 bgpd: handling EVPN Route Type 5 NLRI message
This patch introduces code to receive a NLRI message with route type
5, as defined in draft-ietf-bess-evpn-prefix-advertisement-02. It
It increases the number of parameters to extract from the NLRI and
to store into bgp extra information structure. Those parameters are
the ESI (ethernet segment identifier), the gateway IP Address (which
acts like nexthop attribute but is contained inside the NLRI itself)
and the ethernet tag identifier ( that acts for the VXLan Identifier)
This patch updates bgp_update() and bgp_withdraw() api, and then does the
necessary adapations for rfapi.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:57 +01:00
Donald Sharp
3517059b32 bgpd: Fix help strings
Fix the missing help strings

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-27 15:52:16 -05:00
Donald Sharp
1dc84b65df Merge remote-tracking branch 'origin/pr/113' into pr/111 2017-01-27 12:39:06 -05:00
Donald Sharp
c016b6c796 Merge remote-tracking branch 'origin/master' into pr/111 2017-01-27 11:44:42 -05:00
Donald Sharp
7f12cb2b65 Merge remote-tracking branch 'origin/master' into bgpafisafi 2017-01-26 10:38:07 -05:00
Lou Berger
4f280b15b1 bgpd: more VPN&ENCAP show afi safi related cleanup
Issued ID'ed by regression

Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-24 17:07:02 -05:00
Lou Berger
b99615f95f bgpd: disambiguate differet forms of
show bgp ipv4 vpn
      address-family ipv4&6 vpn

Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-24 13:44:30 -05:00
G. Paul Ziemba
28070ee3c4 bgpd rfapi: Shift rfapi receive hooks for vpn and encap safis into
bgp_update/bgp_withdraw (Issue #91)

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2017-01-24 13:42:43 -05:00
Philippe Guibert
b2f0fa552b bgpd: move bgp_show_type enumerate to bgp_route.h
This bgp_show_type enumerate was duplicated and modified in several
places. The commit takes the enumerate with the biggest enumerate, so
that it can be used by all the functions using this enumerate.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-01-24 16:18:55 +01:00
Philippe Guibert
4e01997895 bgpd: fix ambiguity between show ip bgp ipv4|ipv6 encap|vpn commands
The commit is removed duplicated command show ip bgp ipv4|ipv6 enca|vpn
command that is conflicting between bgp_route.c and
bgp_mplsvpn.c/bgp_encap.c files. The fix is integrating the call to
specific mpls or encap settings from inside bgp_show_route() function.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-01-24 16:18:55 +01:00
Donald Sharp
9dd6d53149 bgpd: Fix function used only within KEEP_OLD_VPN_COMMANDS
The show_adj_route_vpn function is only currently used
in conjunction with the KEEP_OLD_VPN_COMMANDS #define.
Add this function to that define for the moment.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-23 22:34:49 -05:00
Lou Berger
ce8080dbd8 bgpd: disambiguate differet forms of
show bgp ipv4 vpn
      address-family ipv4&6 vpn

Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-22 21:08:05 -05:00
Philippe Guibert
d690237310 bgpd: add define of compilation for vpn commands
Use KEEP_OLD_VPN_COMMANDS define to brace some vty commands used by bgp
to configure or show vpnvx contexts using old method, that is to say
using vty keyword vpnv4 or vpnv6 command.
In addition to this, the commit adds two new commands under route-map
with new format:
[no] set ipv4|ipv6 vpn nexthop <IPv4 Address> | <IPv6 Address>
It also add following command in old format:
[no] set vpnv6 nexthop <IPv6 Address>
Note that the commit does not take into account the availability of old
commands that are not available in new format.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com
2017-01-18 12:39:46 +01:00
David Lamparter
eb3d20d398 Merge pull request #59 from donaldsharp/cli_cleanup
Cli cleanup, largely VNC related, minor bgpd/ospfd/lib fixes.
2017-01-17 21:36:07 +01:00
Donald Sharp
d306e8c3c0 Merge remote-tracking branch 'origin/stable/2.0' 2017-01-17 13:03:59 -05:00
Philippe Guibert
bac21a7c4b bgpd: avoid recalculating as_val value in str2prefix_rd
This is an optimisation that consists in avoiding calling twice atol()
function when converting an ext. community to an AS4 byte or a standard AS byte value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-01-17 17:51:40 +01:00