Commit Graph

415 Commits

Author SHA1 Message Date
Donatas Abraitis
85c58de773
Merge pull request #5761 from qlyoung/fix-bgp-gr-cruft
Fix bgp gr style
2020-02-06 08:16:25 +02:00
Quentin Young
362353195a bgpd, lib: fix style from BGP GR code
This patch fixes the noncompliant style for the following commit range:

4a6e80fbf
2ba1fe695
efcb2ebbb
8c48b3b69
dc95985fe
0f0444fbd
85ef4179a
eb451ee58
2d3dd828d
9e3b51a7f
d6e3c15b6
34aa74486
6102cb7fe
d7b3cda6f
2bb5d39b1
5f9c1aa29
5cce3f054
3a75afa4b
f009ff269
cfd47646b
2986cac29
055679e91
034e185dc
794b37d52
b0965c44e
949b0f24f
63696f1d8

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-04 15:19:04 -05:00
Quentin Young
36e8dd8afb bgpd: use _RO list iter variant for gr macro
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-04 15:10:54 -05:00
Quentin Young
e1b36e132b *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-04 13:19:37 -05:00
bisdhdh
2ba1fe6951 bgpd: BGP Garaceful Restart debug logs.
Reorganizing bgp gr debug logs and code review comments.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:36:33 +05:30
bisdhdh
2d3dd828db bgpd: Adding header files for BGPD-ZEBRA integration for GR.
Data Structures, function declaration and Macros forSignalling
from BGPD to ZEBRA to enable or disable GR feature in ZEBRA
depending on bgp per peer gr configuration.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
9e3b51a7f3 bgpd: Restarting node does not send EOR after the convergence.
*After a restarting router comes up and the bgp session is
successfully established with the peer. If the restarting
router doesn’t have any route to send, it send EOR to
the peer immediately before receiving updates from its peers.
*Instead the restarting router should send EOR, if the
selection deferral timer is not running OR count of eor received
and eor required are matches then send EOR.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
d6e3c15b62 bgpd: Added hidden CLI command to disable sending of End-of-Rib.
BGP disable EOR sending is a useful command for testing various
scenarios of BGP graceful restart.
* Added the hidden CLI command :  bgp graceful-restart disable-eor
* The CLI will not be displayed in "show running-config" and will not
  be stored in configuration file.
* When enabled, EOR will not be sent to peer

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
Signed-off-by: Soman K S <somanks@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
d7b3cda6f7 bgpd: BGP tcp session failed to apply GR configuration on the transferred
bgp tcp connection.

When the BGP peer is configured between two bgp routes  both routers would create
peer structure , when they receive each other’s open message. In this event both
speakers, open duplicate TCP sessions and send OPEN messages on each socket
simultaneously, the BGP Identifier is used to resolve which socket should be closed.
If BGP GR is enabled the old tcp session is dumped and the new session is retained.
So while this transfer of connection is happening, if all the bgp gr config
is not migrated to the new connection, the new bgp gr mode will never get applied.
Fix Summary:
1.  Replicate GR configuration from the old session to the new session in bgp_accept().
2.  Replicate GR configuration from stub to full-fledged peer in bgp_establish().
3.  Disable all NSF flags, clear stale routes (if present), stop  restart & stale timers
    (if they are running) when the bgp GR mode is changed to “Disabled”.
4.  Disable R-bit in cap, if it is not set the received open message.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
f009ff2697 bgpd: Adding Selection Deferral Timer handler changes.
* Selection Deferral Timer for Graceful Restart.
* Added selection deferral timer handling function.
* Route marking as selection defer when update message is received.
* Staggered processing of routes which are pending best selection.
* Fix for multi-path test case.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
cfd47646b3 bgpd: Adding changes for Selection Deferral Timer config cmd
and DS.

* Added config commands and data structures for deferral timer
configuration and processing.
Cmd : bgp graceful-restart select-defer-time (0-3600)
Cmd : no bgp graceful-restart select-defertime (0-3600)

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
Signed-off-by: Soman K S <somanks@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
2986cac299 bgpd: Adding BGP GR Per Neighbor show commands.
* Added new show command to show the graceful restart
information for each neighbor.
Cmd: show bgp [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] graceful-restart
* Changes to show neighbors commands for displaying
graceful restart information.
Cmd :show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
794b37d521 bgpd: Adding BGP GR Global & Per Neighbour FSM changes
* Added FSM for peer and global configuration for graceful restart
 * Added debug option BGP_GRACEFUL_RESTART for logs specific to
 graceful restart processing

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
b0965c44e9 bgpd: BGP Graceful Restart Per Neighbor(BGPN), DS & header files.
This pr contains all the header files changes for BGP GR per Neighbour(BGPN)
feature.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
Donatas Abraitis
fde246e835 bgpd: Add an option to limit outgoing prefixes
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-01-17 16:20:28 +02:00
David Lamparter
5d5393b943 bgpd: use new defaults system (v2)
This moves all the DFLT_BGP_* stuff over to the new defaults mechanism.
bgp_timers_nondefault() added to get better file-scoping.

v2: moved everything into bgp_vty.c so that the core BGP code is
independent of the CLI-specific defaults.  This should make the future
northbound conversion easier.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06 15:13:32 +01:00
Donald Sharp
2d3c8c2957
Merge pull request #5305 from ton31337/feature/draft-ietf-idr-deprecate-as-set-confed-set
bgpd: Reject incoming and outgoing UPDATES for AS_SET and AS_CONFED_SET
2019-12-03 21:29:09 -05:00
Donatas Abraitis
fb29348a19 bgpd: Reject routes having AS_SET or AS_CONFED_SET
This is the first step towards eliminating AS_SET and AS_CONFED_SET types
and obsolete them in the future.

More information:
https://datatracker.ietf.org/doc/html/draft-ietf-idr-deprecate-as-set-confed-set-02

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-14 19:19:04 +02:00
Donatas Abraitis
4e2786df3e bgpd: Notify "Peer De-configured" after entering 'no neighbor <neighbor> cmd'
Before changes:

~# vtysh -c 'show ip bgp neighbors 192.168.0.2 json' | \
	jq '."192.168.0.2".lastNotificationReason'
null

After changes:

~# vtysh -c 'show ip bgp neighbors 192.168.0.2 json' | \
	jq '."192.168.0.2".lastNotificationReason'
"Cease/Peer Unconfigured"

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-06 20:38:02 +02:00
Rafael Zalamena
2b31007ca2 bgpd: expose sender side AS path loop detection
The sender side AS path loop detection code was implemented since the
import of Quagga code, however it was always disabled by a `ifdef`
guard.

Lets allow the user to decide whether or not to enable this feature on
run-time.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-10-29 16:29:09 -03:00
Donald Sharp
2d50e11896
Merge pull request #5216 from ton31337/fix/override_peers_ttl_if_peer_group_configured
bgpd: Override peer's TTL only if peer-group is configured with TTL
2019-10-25 14:03:06 -04:00
Donatas Abraitis
a0903cd24c bgpd: Override peer's TTL only if peer-group is configured with TTL
When a peer-group is configured for an already configured eBGP neighbor,
ebgp-multihop command is removed for that peer.

This fix remains configured peer's ebgp-multihop value if peer-group does
not have ebgp-multihop configured.

!
router bgp 100
 neighbor A8 peer-group
 neighbor A9 peer-group
 neighbor A9 ebgp-multihop 12
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 4.4.4.4 remote-as 123
 !

spine1-debian-9#
spine1-debian-9# conf
spine1-debian-9(config)# router bgp 100
spine1-debian-9(config-router)# neighbor 3.3.3.3 peer-group A8
spine1-debian-9(config-router)# do sh run

!
router bgp 100
 neighbor A8 peer-group
 neighbor A9 peer-group
 neighbor A9 ebgp-multihop 12
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 peer-group A8
 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 4.4.4.4 remote-as 123
!

spine1-debian-9(config-router)# neighbor 4.4.4.4 peer-group A9
spine1-debian-9(config-router)# do sh run

!
router bgp 100
 neighbor A8 peer-group
 neighbor A9 peer-group
 neighbor A9 ebgp-multihop 12
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 peer-group A8
 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 4.4.4.4 remote-as 123
 neighbor 4.4.4.4 peer-group A9
!

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-23 18:04:14 +03:00
Donald Sharp
c2d020ad71 bgpd: Add ability to set tcp socket buffer size
Add -s X or --socket_size X to the bgp cli to allow
the end user to specify the outgoing bgp tcp kernel
socket buffer size.

It is recommended that this option is only used on
large scale operations.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-16 07:42:05 -04:00
Donatas Abraitis
a0a87037ac bgpd: Use uint32_t for maximum-prefix
Currently we have unsigned long which is not what we defined
in CLI (1-4294967295).

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-04 15:46:21 +03:00
Donald Sharp
a3116965bb bgpd: rmap_type is 8 bit but we have 9 bits of flags
The newly added PEER_RMAP_TYPE_AGGREGATE flag is setup to
be the 9th bit:

But the flag we are putting it into:
uint8_t rmap_type;

is 8 bits.  Adjust the size.

Found by Coverity SA Scan
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-24 08:29:46 -04:00
Lou Berger
ccc13acc0f
Merge pull request #4866 from ton31337/feature/apply_route-map_for_aggregate-address
bgpd: Apply route-map for aggregate-address
2019-09-10 11:59:10 -04:00
Quentin Young
1ce14168b3
Merge pull request #4809 from martonksz/master
bgpd: hook for bgp peer status change events
2019-09-09 10:55:00 -04:00
Dinesh G Dutt
05912a17e6 bgpd: Fixes to error message printed for failed peerings
There was a silly bug introduced when the command to show failed sessions
was added. A missing "," caused the wrong error message to be printed.
Debugging this led down a path that:
   - Led to discovering one more error message that needed to be added
   - Providing the error code along with the string in the JSON output
     to allow programs to key off numbers rather than strings.
   - Fixing the missing ","
   - Changing the error message to "Waiting for Peer IPv6 LLA" to
     make it clear that we're waiting for the link local addr.

Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-09-03 19:55:49 +00:00
Dinesh G Dutt
3577f1c54f bgpd: Add a new command to only show failed peerings
In a data center, having 32-128 peers is not uncommon. In such a situation, to find a
peer that has failed and why is several commands. This hinders both the automatability of
failure detection and the ease/speed with which the reason can be found. To simplify this
process of catching a failure and its cause quicker, this patch does the following:

1. Created a new function, bgp_show_failed_summary to display the
   failed summary output for JSON and vty
2. Created a new function to display the reset code/subcode. This is now used in the
   failed summary code and in the show neighbors code
3. Added a new variable failedPeers in all the JSON outputs, including the vanilla
   "show bgp summary" family. This lists the failed session count.
4. Display peer, dropped count, estd count, uptime and the reason for failure as the
   output of "show bgp summary failed" family of commands
5. Added three resset codes for the case where we're waiting for NHT, waiting for peer
   IPv6 addr, waiting for VRF to init.

This also counts the case where only one peer has advertised an AFI/SAFI.

The new command has the optional keyword "failed" added to the classical summary command.

The changes affect only one existing output, that of "show [ip] bgp neighbors <nbr>". As
we track the lack of NHT resolution for a peer or the lack of knowing a peer IPv6 addr,
the output of that command will show a "waiting for NHT" etc. as the last reset reason.

This patch includes update to the documentation too.

Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-09-02 14:21:44 +00:00
Donatas Abraitis
20894f50bd bgpd: Apply route-map for aggregate-address command
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-08-28 16:45:21 +03:00
Marton Kun-Szabo
7d8d0eabb4 bgpd: hook for bgp peer status change events
Generally available hook for plugging application-specific
code in for bgp peer change events.

This hook (peer_status_changed) replaces the previous, more
specific 'peer_established' hook with a more general-purpose one.
Also, 'bgp_dump_state' is now registered under this hook.

Signed-off-by: Marton Kun-Szabo <martonk@amazon.com>
2019-08-13 11:59:27 -07:00
Dinesh Dutt
dcc1615e1b bgpd: Display received and advertised EVPN routes from neighbors
"show bgp l2vpn evpn neighbors <neighbor> [advertised-routes|routes]' did
not work due to various bugs. First, the command only accepted IPv4
addresses as valid neighbor ID, thereby rejecting unnumbered BGP and IPv6
neighbor address. Second, the SAFI was hardcoded to MPLS_VPN even though
we were passing the safi. Third, "all" made no sense in the command context
and to make the command uniform across all address families, I removed the
"all" keyword from the command.

Signed-off-by: Dinesh G Dutt <ddps4u@gmail.com>
2019-08-08 04:17:26 +00:00
David Lamparter
2b9bcf306d bgpd: add instance delete & config write hooks
Both of these hooks are necessary for proper operation of extensions
that need to latch on to a particular instance.

- without the delete hook, it's impossible to get rid of stale
  references, leading to crashes with invalid instance pointers.
- the config-write hook is necessary because per-instance config needs
  to be written inside the "router bgp" block to have the appropriate
  context; adding a separate config node can't do that.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-03 16:56:22 +02:00
David Lamparter
b4d46cc9b1 bgpd: count some per-peer stats (for BMP)
These counters are accessible through BMP and may be useful to monitor
bgpd.  A CLI to show them could also be added if people are interested.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-03 16:53:12 +02:00
David Lamparter
1a1f453436 bgpd: fix last_reset_cause setup
last_reset_cause_size is the length *used* in last_reset_cause[].  It's
straight up used wrong here; we're saving off a reset cause and need to
check against the *available* size in last_reset_cause[].

This could actually have led to (hopefully rare) crashes in the assert
there, since the assert condition might fail incorrectly.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-03 16:50:36 +02:00
Donald Sharp
d5568431f7 bgpd: BGP_ERR_MULTIPLE_INSTANCE_NOT_SET is an impossible condition
This code is not returned anywhere in the system as that bgp
is by default multiple-instance 'only' now.  So remove
the last remaining bits of it from the code base.

Remove BGP_ERR_MULTIPLE_INSTANCE_USED too.

Make bgp_get explicitly return BGP_SUCCESS
instead of 0.

Remove the multi-instance error code too.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-18 09:26:00 -04:00
Lou Berger
5beabde635
Merge pull request #4499 from kssoman/core
bgpd: Process core when bgp instance is deleted
2019-06-13 16:08:11 -04:00
David Lamparter
0688fd81d0
bgpd, lib: Add iana_afi2str and iana_safi2str for eye pleasing strings (#4439)
bgpd, lib: Add iana_afi2str and iana_safi2str for eye pleasing strings
2019-06-13 22:06:49 +02:00
Soman K S
9f822fa2db bgpd: Process core when bgp instance is deleted
* When the bgp is being deleted and routes are in clear workqueue
  and new aggregate address being allocated
* Added flag BGP_FLAG_DELETE_IN_PROGRESS in bgp structure to
  bgp instance is being  deleted
* When adding aggregate route check this flag and  peer_self is valid

Signed-off-by: Soman K S <somanks@vmware.com>
2019-06-11 06:20:09 -07:00
Donald Sharp
d8a9922d58 bgpd: Remove BGP_OPT_CONFIG_CISCO
The BGP_OPT_CONFIG_CISCO command could no longer be set
as such remove it from the system as a viable option to
be used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-03 15:06:16 -04:00
Donald Sharp
8fbb485392 bgpd: Remove BGP_OPT_MULTIPLE_INSTANCE flag
Since we no-longer allow you to select multiple-instance
or not from the cli, let's completely remove the flag
as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-03 14:53:55 -04:00
Donald Sharp
17136bf23e lib, bgpd: Create iana_afi.h for storing iana_afi/safi enums
The iana_afi_t and iana_safi_t were being created in zebra.h
and zebra.h is a bit of a dumping ground.  When the iana_afi2str and
iana_safi2str functions were created, it was correctly pointed out
that we should just use the internal afi_t and safi_t 2str functions
but to do that we would need to include prefix.h in zebra.h.  Which
really is not the right thing to do.  This tells us that we need
to break out this code into it's own header.

Move to iana_afi.h the enums and specific functions and remove
from zebra.  Convert to using the afi2str and safi2str functions.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-02 15:02:07 -04:00
Renato Westphal
6982ab8f68 bgpd: remove deprecated "bgp enforce-first-as" command
The one-year deprecation period has passed, remove it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-05-20 22:04:52 -03:00
Donald Sharp
5e76ce5069
Revert "bgpd: Prevent IPv6 routes received via a ibgp session with own ip as nexthop " 2019-05-02 07:15:39 -04:00
Biswajit Sadhu
2f6197b044 bgpd: Prevent IPv6 routes received via a ibgp session with own ip as nexthop
Prevent IPv6 routes received via a ibgp session with one of its own interface
ip as nexthop from getting installed in the BGP table.

Implemented IPV6 HASH table, where we need to add any ipv6 address as they
gets configured and delete them from the HASH table as the ipv6 addresses
get unconfigured. The above hash table is used to verify if any route learned
via BGP has nexthop which is equal to one of its its connected ipv6 interface.

Signed-off-by: Biswajit Sadhu sadhub@vmware.com
2019-04-24 00:40:01 -07:00
Tuetuopay
d074383c62
Merge branch 'master' into evpn-session-vrf 2019-03-28 18:41:38 +01:00
Tuetuopay
e2f3a930c5 bgpd: Allow non-default instance to be EVPN one
This makes the instance bearing the advertise-all-vni config option
register to zebra as the EVPN one, forwarding it the option.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:14 +01:00
Lou Berger
0eccb48001
Merge pull request #3947 from dslicenc/bgpd-redist-connected-vrf
Bgpd redist connected vrf
2019-03-17 14:26:44 -04:00
Donald Sharp
86dd09667a
Merge pull request #3920 from AkhileshSamineni/show_bgp_ipv6_summary_fix_master
bgpd: Incorrect number of peers count in "show bgp ipv6 summary" output
2019-03-15 08:54:03 -04:00
Don Slice
401d56cc52 bgpd: fix redistribution into vrf when networking is restarted
Found that previous fix for this issue caused collatoral damage and
reverted that fix.  This fix clears the vrf_bitmaps when the vrf is
disabled/deleted and then re-applies the redist config when the vrf
is re-enabled.

Ticket: CM-24231
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-03-14 15:17:47 +00:00
David Lamparter
ab04f34ff8
Merge pull request #3860 from AkhileshSamineni/show_bgp_af_neigh_fix
bgpd: 'show bgp [ipv4|ipv6] neighbors' displays all address family neighbors
2019-03-11 19:43:05 +01:00
Akhilesh Samineni
210ec2a0d6 bgpd: Incorrect number of peers count in "show bgp ipv6 summary output
The "show bgp ipv6 summary" output displays incorrect number of peers count.

sonic# show bgp ipv6 summary

IPv6 Unicast Summary:
BGP router identifier 10.1.0.1, local AS number 65100 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 5, using 103 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2003::1 4 65099 0 0 0 0 0 never Active
2088::1 4 65100 0 0 0 0 0 never Active
3021::2 4 65100 0 0 0 0 0 never Active

Total number of neighbors 3
sonic#
In the above output, the peers count displays as 5 but the actual peer count is 3, i.e.. 3 neighbors are activated in ipv6 unicast address family.
Displayed peer count (5) is the number of the neighbors activated in a BGP instance.

Fix : Now the peers count displays the number of neighbors activated per afi/safi.
After Fix:
sonic# show bgp ipv6 summary

IPv6 Unicast Summary:
BGP router identifier 10.1.0.1, local AS number 65100 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 3, using 62 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2003::1 4 65099 0 0 0 0 0 never Active
2088::1 4 65100 0 0 0 0 0 never Active
3021::2 4 65100 0 0 0 0 0 never Active

Total number of neighbors 3
sonic#

Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
2019-03-07 13:17:25 +05:30
vivek
0483af6e4c zebra, bgpd: Exchange L3 interface for VRF's VNI
In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

The implementation currently derives this L3 interface for EVPN tenant
routes using special code that looks at route flags. This patch
exchanges the L3 interface between zebra and bgpd as part of the L3-VNI
exchange in order to eliminate some this special code.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-27 11:52:34 +00:00
Akhilesh Samineni
d1927ebe5f bgpd: 'show bgp [ipv4|ipv6] neighbors' displays all address family neighbors
Display only ipv4 neighbors when 'show bgp ipv4 neighbors' command is issued.
Display only ipv6 neighbors when 'show bgp ipv6 neighbors' command is issued.
Take the address family of the peer address into account, while displaying the neighbors.

Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
2019-02-24 15:00:31 +05:30
Donatas Abraitis
9dac9fc80e bgpd: Implement RFC8212
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-02-17 23:17:00 +02:00
Donald Sharp
2b697c3d47
Merge pull request #3414 from pguibert6WIND/iprule_any_flowspec_handling_2
Iprule any flowspec handling
2019-01-29 14:01:38 -05:00
Philippe Guibert
27e376d4e1 bgpd: an hash list of pbr iprule is created
that iprule list stands for the list of fs entries that are created,
based only on ip rule from/to rule.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-01-29 14:15:09 +01:00
Don Slice
faa16034cb bgpd: improve peer-group remote-as definitions
Problem reported that with certain sequences of defining the
remote-as on the peer-group and the members, the configuration would
become wrong, with configured remote-as settings not reflected in
the config but peers unable to come up.  This fix resolves these
inconsistencies.

Ticket: CM-19560
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-01-23 12:23:47 +00:00
Renato Westphal
1c4213d862
Merge pull request #3198 from donaldsharp/mac_rejection
Mac rejection
2019-01-10 11:21:18 -02:00
Lou Berger
943d595a01 bgpd: don't use BGP_ATTR_VNC(255) unless ENABLE_BGP_VNC_ATTR is defined
Signed-off-by: Lou Berger <lberger@labn.net>
2019-01-07 11:51:06 -05:00
Donald Sharp
48ecf8f510 bgpd: Add code to dump the forthcoming mac hash
Add a bit of code that allows us to dump the mac hash.  Future
commits will actually add entries to the mac hash and then operate
on it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-12 16:11:45 -05:00
Russ White
19e5a46591
Merge pull request #3176 from chiragshah6/evpn_dev
zebra: duplicate address detection and dampening
2018-11-25 22:17:33 -05:00
Mark Stapp
fb88590c77
Merge pull request #3359 from qlyoung/true-atomics
Restrict atomics to 32-bits only
2018-11-20 11:43:10 -05:00
Quentin Young
0545c37384 *: only use 32-bit atomics
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-11-19 18:44:35 +00:00
root
36dc75886d bgpd: Creating Loopback Interface Flaps BGPd (#2865)
* The function bgp_router_id_zebra_bump() will check for active bgp
  peers before chenging the router ID.
  If there are established peers, router ID is not modified
  which prevents the flapping of established peer connection

* Added field in bgp structure to store the count of established peers

Signed-off-by: kssoman <somanks@vmware.com>
2018-11-19 04:35:32 -08:00
Chirag Shah
85c8d83b81 bgpd: dup addr detect data struct for cfg
Enable/disable duplicate address detection
there are 3 actions
warning-only: Default action which generates
only frr warning (syslog) to user for any
duplicate detecton
freeze: Permanently freezes address, manual
intervene required.
freeze with time: An address will recover once
the time has expired (auto-recovery).

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-11-17 19:22:16 -08:00
Philippe Guibert
0b014ea675 bgpd: allow vrf validity and bgp vrf import/export, when zebra is off
if zebra is not started, then vrf identifiers are not available. This
prevents import/exportation to be available. This commit permits having
import/export available, even when zebra is not started.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-11-13 15:29:11 +01:00
Mitch Skiba
dcc68b5e2a bgpd: Re-use TX Addpath IDs where possible
The motivation for this patch is to address a concerning behavior of
tx-addpath-bestpath-per-AS. Prior to this patch, all paths' TX ID was
pre-determined as the path was received from a peer. However, this meant
that any time the path selected as best from an AS changed, bgpd had no
choice but to withdraw the previous best path, and advertise the new
best-path under a new TX ID. This could cause significant network
disruption, especially for the subset of prefixes coming from only one
AS that were also communicated over a bestpath-per-AS session.

The patch's general approach is best illustrated by
txaddpath_update_ids. After a bestpath run (required for best-per-AS to
know what will and will not be sent as addpaths) ID numbers will be
stripped from paths that no longer need to be sent, and held in a pool.
Then, paths that will be sent as addpaths and do not already have ID
numbers will allocate new ID numbers, pulling first from that pool.
Finally, anything left in the pool will be returned to the allocator.

In order for this to work, ID numbers had to be split by strategy. The
tx-addpath-All strategy would keep every ID number "in use" constantly,
preventing IDs from being transferred to different paths. Rather than
create two variables for ID, this patch create a more generic array that
will easily enable more addpath strategies to be implemented. The
previously described ID manipulations will happen per addpath strategy,
and will only be run for strategies that are enabled on at least one
peer.

Finally, the ID numbers are allocated from an allocator that tracks per
AFI/SAFI/Addpath Strategy which IDs are in use. Though it would be very
improbable, there was the possibility with the free-running counter
approach for rollover to cause two paths on the same prefix to get
assigned the same TX ID. As remote as the possibility is, we prefer to
not leave it to chance.

This ID re-use method is not perfect. In some cases you could still get
withdraw-then-add behaviors where not strictly necessary. In the case of
bestpath-per-AS this requires one AS to advertise a prefix for the first
time, then a second AS withdraws that prefix, all within the space of an
already pending MRAI timer. In those situations a withdraw-then-add is
more forgivable, and fixing it would probably require a much more
significant effort, as IDs would need to be moved to ADVs instead of
paths.

Signed-off-by Mitchell Skiba <mskiba@amazon.com>
2018-11-10 00:16:36 +00:00
Don Slice
5742e42b98 bgpd: make name of default vrf/bgp instance consistent
Problems were reported with the name of the default vrf and the
default bgp instance being different, creating confusion.  This
fix changes both to "default" for consistency.

Ticket: CM-21791
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: CCR-7658
Testing: manual testing and automated tests before pushing
2018-10-31 06:20:37 -04:00
Russ White
79e8a97c1a
Merge pull request #3024 from ton31337/fix/validate_route-map
bgpd: Check if route-map really exists before applying to the peer
2018-10-14 08:48:48 -04:00
Donald Sharp
fd06964433 bgpd: Add '[no] flood <disable|head-end-replication>'
Add the '[no] flood <disable|head-end-replication>' command
to the l2vpn evpn afi/safi sub commands for bgp.  This command
when entered as 'flood disable' will turn off type 3 route
generation for the transmittal of the type 3 route necessary
for BUM replication on the remote VTEP.  Additionally it will
turn off the BUM handling via the new zebra command,
ZEBRA_VXLAN_FLOOD_CONTROL.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-11 20:27:28 -04:00
Donatas Abraitis
1de2762153 bgpd: Check if route-map really exists before applying to the peer
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2018-10-11 10:56:12 +03:00
Lou Berger
d127c61aeb
Merge pull request #3010 from opensourcerouting/no-frr-thread-id
lib: frr_pthread minor simplification
2018-09-22 15:02:09 -04:00
David Lamparter
1ac267a2d9 lib: remove frr_pthread->id
All I can see is an unneccessary complication.  If there's some purpose
here it needs to be documented...

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-19 22:01:46 +02:00
paco
f533be73f6
bgpd, doc, ldpd, lib, tests, zebra: LM fixes
Corrections so that the BGP daemon can work with the label manager properly
through a label-manager proxy. Details:

- Correction so the BGP daemon behind a proxy label manager gets the range
  correctly (-I added to the BGP daemon, to set the daemon instance id)
- For the BGP case, added an asynchronous label manager connect command so
  the labels get recycled in case of a BGP daemon reconnection. With this,
  BGPd and LDPd would behave similarly.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-18 17:39:16 +02:00
Donald Sharp
17cdd31e00 bgpd: Prevent possible crash when parsing v6 attributes
The peer->nexthop.ifp pointer must be set when parsing the
attributes in bgp_mp_reach_parse, notice this
and fail gracefully.

Rework bgp_nexthop_set to remove the HAVE_CUMULUS and to
fail the nexthop_set when we have a zebra connection and
no ifp pointer, as that not havinga zebra connection and
no ifp pointer is legal.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-12 09:00:43 -04:00
Don Slice
94d4c685c5 bgpd/ospfd: resolve warnings for bgp/ospf json commit
Signed-off-by: Don Slice <dslice@cumulusnetwork.com>
2018-08-30 15:54:46 +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
Pascal Mathis
3f54c705ec
bgpd: Cleanup of bgp daemon code
This commit removes various parts of the bgpd implementation code which
are unused/useless, e.g. unused functions, unused variable
initializations, unused structs, ...

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-07-07 22:51:13 +02:00
Pascal Mathis
a14810f43f
bgpd: Implement group-overrides for peer attrs
This commit introduces BGP peer-group overrides for the last set of
peer-level attrs which did not offer that feature yet. The following
attributes have been implemented: description, local-as, password and
update-source.

Each attribute, with the exception of description because it does not
offer any inheritance between peer-groups and peers, is now also setting
a peer-flag instead of just modifying the internal data structures. This
made it possible to also re-use the same implementation for attribute
overrides as already done for peer flags, AF flags and AF attrs.

The `no neighbor <neigh> description` command has been slightly changed
to support negation for no parameters, one parameter or * parameters
(LINE...). This was needed for the test suite to pass and is a small
change without any bigger impact on the CLI.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:32 +02:00
Pascal Mathis
b90a8e13ee
bgpd: Implement group-overrides for peer timers
This commit implements BGP peer-group overrides for the timer flags,
which control the value of the hold, keepalive, advertisement-interval
and connect connect timers. It was kept separated on purpose as the
whole timer implementation is quite complex and merging this commit
together with with the other flag implementations did not seem right.

Basically three new peer flags were introduced, namely
*PEER_FLAG_ROUTEADV*, *PEER_FLAG_TIMER* and *PEER_FLAG_TIMER_CONNECT*.
The overrides work exactly the same way as they did before, but
introducing these flags made a few conditionals simpler as they no
longer had to compare internal data structures against eachother.

Last but not least, the test suite has been adjusted accordingly to test
the newly implemented flag overrides.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:30 +02:00
Pascal Mathis
e7103a9644
bgpd: Fix AF-attribute overrides when binding peer
The current implementation of the overrides for peer address-family
attributes suffered a bug, which caused all peer-specific attributes to
be lost when the peer was added to a peer-group which already had that
specific address-family active.

This commit extends the *peer_group2peer_config_copy_af* function to
respect overridden flags properly. Additionally, the arguments of the
macros *PEER_ATTR_INHERIT* and *PEER_STR_ATTR_INHERIT* have been
reordered to be more consistent and easy to read.

This commit also adds further test cases to the BGP peer attributes test
suite, so that this kind of error is being caught in future commits. The
missing AF-attribute *distribute-list* has also been added to the test
suite.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:25 +02:00
Pascal Mathis
9fb964de21
bgpd: Implement group-overrides for peer flags
The current implementation of peer flags (e.g. shutdown, passive, ...)
only has partial support for overriding flags of a peer-group when the
peer is a member. Often settings might get lost if the user toys around
with the peer-group configuration, which can lead to disaster.

This commit introduces the same override implementation which was
previously integrated to support proper peer flag/attribute override on
the address-family level. The code is very similar and the global
attributes now use their separate state-arrays *flags_invert* and
*flags_override*.

The test suite for BGP peer attributes was extended to also check peer
global attributes, so that the newly introduced changes are covered. An
additional feature was added which allows to test an attribute with an
*interface-peer*, which can be configured by running `neighbor IF-TEST
interface`. This was introduced so that the dynamic runtime inversion of
the `extended-nexthop` flag, which is only enabled by default for
interface peers, can also be tested.

Last but not least, two small changes have been made to the current bgpd
implementation:

- The command `strict-capability-match` can now also be set on a
peer-group, it seems like this command slipped through while
implementing peer-groups in the very past.

- The macro `COND_FLAG` was introduced inside lib/zebra.h, which now
allows to either set or unset a flag based on a condition. The syntax
for using this macro is: `COND_FLAG(flag_variable, flag, condition)`

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:18 +02:00
paco
cc32742c09
bgpd: null check (Coverity 1399270)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-13 17:15:21 +02:00
Quentin Young
483e5a3aa5
Merge pull request #2304 from ppmathis/enhancement/bgp-pg-overrides
bgpd: Add proper support for overriding peer-group AF-flags/filters
2018-06-05 11:51:57 -04:00
Donald Sharp
3b7268448f
Merge pull request #2259 from ppmathis/enhancement/peer-enforce-first-as
bgpd: Move 'enforce-first-as' from global to peer
2018-06-04 09:35:00 -04:00
mitesh
50f74cf131 *: support for evpn type-4 route
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-05-30 07:48:20 -04:00
Pascal Mathis
cf9ac8bfb0
bgpd: Fix style issues for peer-group overrides
This commit fixes all outstanding style/formatting issues as detected by
'git clang-format' or 'checkpath' for the new peer-group override
implementation, which spanned across several commits.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-28 19:25:51 +02:00
Pascal Mathis
27c05d4d43
bgpd: Fix group overrides for inverted AF flags
This commit fixes peer-group overrides for inverted AF flags. This
implementation is currently only being used by the three 'send-community'
flags. Commit 70ee29b4d introduced generic support for overriding AF
flags, but did not support inverted flags.

By introducing an additional array on the BGP peer structure called
'af_flags_invert' all current and future flags which should work in an
inverted way can now also be properly overridden.

The CLI commands will work exactly the same way as before, just that 'no
<command>' now sets the flag and override whereas '<command>' will unset
the flag and remove the override.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-28 19:20:25 +02:00
Pascal Mathis
70ee29b4db
bgpd: Improve group overrides for AF filters
This commit adds the same peer-group override capabilites as d122d7cf7
for all filter/map options that can be enabled/disabled on each
address-family of a BGP peer.

All currently existing filter/map options are being supported:
filter-list, distribute-list, prefix-list, route-map and unsuppress-map

To implement this behavior, a new peer attribute 'filter_override' has
been added together with various PEER_FT_ (filter type) constants for
tracking the state of each filter in the same way as it is being done
with 'af_flags_override'.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-27 19:41:25 +02:00
Pascal Mathis
598ce6bd70
bgpd: Improve group overrides for AF flags
The current implementation for overriding peer-group configuration on a
peer member consists of several bandaids, which introduce more issues
than they fix. A generic approach for implementing peer-group overrides
for address-family flags is clearly missing.

This commit implements a generic and sane approach to overriding
peer-group configuration on a peer-member. A separate peer attribute
called 'af_flags_override' which was introduced in 04e1c5b is being used
to keep track of all address-family flags, storing whether the
configuration is being inherited from the parent-group or overridden.

All address-family flags are being supported by this implementation
(note: flags, not filters/maps) except 'send-community', which currently
breaks due to having the three flags enabled by default, which is not
being properly handled within this commit; all flags are supposed to
have an 'off'/'false' state by default.

In the interest of readability and comprehensibility, the flag
'send-community' is being fixed in a separate commit.

The following rules apply when looking at the new peer-group override
implementation this commit provides:

- Each peer-group can enable every flag (except the limitations noted
above), which gets automatically inherited to all members.

- Each peer can enable each flag independently and/or modify their
value, if available. (e.g.: weight <value>)

- Each command executed on a neighbor/peer gets explicitely set as an
override, so even when the peer-group has the same kind of
configuration, both will show up in 'show running-configuration'.

- Executing 'no <command>' on a peer will remove the peer-specific
configuration and make the peer inherit the configuration from the
peer-group again.

- Executing 'no <command>' on a peer-group will only remove the flag
from the peer-group, however not from peers explicitely setting that
flag.

This guarantees a clean implementation which does not break, even when
constantly messing with the flags of a peer-group. The same behavior is
present in Cisco devices, so people familiar with those should feel safe
when dealing with FRRs peer-groups.

The only restriction that now applies is that single peer cannot
disable a flag which was set by a peer-group, because 'no <command>' is
already being used for disabling a peer-specific override. This is not
supported by any known vendor though, would require many specific
edge-cases and magic comparisons and will most likely only end up
confusing the user. Additionally, peer-groups should only contain flags
which are being used by all peer members.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-27 19:41:23 +02:00
Philippe Guibert
4762c2137d bgpd: add vty command to restrict FS policy routing to a defined interface
policy routing is configurable via address-family ipv4 flowspec
subfamily node. This is then possible to restrict flowspec operation
through the BGP instance, to a single or some interfaces, but not all.

Two commands available:
[no] local-install [IFNAME]

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-05-25 15:49:38 +02:00
Pascal Mathis
47cbc09b63
bgpd: Move 'enforce-first-as' from global to peer
This commit moves the command 'bgp enforce-first-as' from global BGP
instance configuration to peer/neighbor configuration, which can now be
changed by executing '[no] neighbor <neighbor> enforce-first-as'.

End users can now enforce sane first-AS checking on regular sessions
while e.g. disabling the checks on routeserver sessions, which usually
strip away their own AS number from the path.

To ensure backwards-compatibility, a migration routine was added which
automatically sets the 'enforce-first-as' flag on all configured
neighbors if the old global setting was activated. The old global
command immediately disappears after running the migration routine once.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-19 14:43:42 +02:00
Donald Sharp
51f9d3e70f
Merge pull request #2034 from vincentbernat/fix/rfc8365-auto-rt
bgpd: add an option for RT auto-derivation to use RFC 8635.
2018-05-16 12:13:04 -04:00
Russ White
2d6d27bcf1
Merge pull request #2196 from LabNConsulting/working/master/bgpd-shutdown-race
BGP: Preclude race condition between listener thread and core during shutdown
2018-05-12 06:27:00 -04:00
Lou Berger
97b4a0ec78 bgpd: block io thread reads once shutdown has started
Signed-off-by: Lou Berger <lberger@labn.net>
2018-05-10 08:47:11 -04:00
Quentin Young
04e1c5bb4a bgpd: fix maximum-prefix + peer-group
Attribute set on peer was being overridden when set on the peer-group.

This commit also adds a parallel flags array that indicates whether a
particular flag is sourced from the peer-group or is peer-specific. It
assumes the default state of all flags is unset. This looks to be true
except in the case of PEER_FLAG_SEND_COMMUNITY,
PEER_FLAG_SEND_EXT_COMMUNITY, and PEER_FLAG_SEND_LARGE_COMMUNITY; these
flags are set by default except when the user specifies to use
config-type = cisco. However the flag field can merely be flipped to
mean the negation of those options in a future commit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-07 14:44:10 -04:00
Philippe Guibert
f3d32faaed bgpd: initialise hash lists for pbr
bgp structure is being extended with hash sets that will be used by
flowspec to give policy routing facilities.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-30 11:56:23 +02: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