Commit Graph

918 Commits

Author SHA1 Message Date
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
2bb5d39b14 bgpd: show BGP GR Neighbor mode as “NotApplicable”,when local mode is “Disable”.
BGP GR Neighbor mode is showing the default string as “NotRecieved”,
as the bgp gr neighbour capability was not processed,
since the local mode is “Disable”.
However now it would be changed to  “NotApplicable”.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
5cce3f0544 bgpd: Adding BGP GR change mode config apply on notification sent & received.
* Changing GR mode on a router needs a session reset from the
SAME router to negotiate new GR capability.
* The present GR implementation needs a session reset after every
new BGP GR mode change.
* When BGP session reset happens due to sending or receiving BGP
notification after changing BGP GR mode, there is no need of
explicit session reset.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
3a75afa4b9 bgpd: Adding BGP GR Neighbour mode show, when local mode is “Disable”.
* BGP GR Neighbour mode in show command would show as
“NotApplicable”, when local mode is “Disable”. As the bgp
gr neighbour capability was not processed, since the local mode
is “Disable”.
* Minor changes in show Selection Deferral Time.

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
055679e915 bgpd: Adding BGP GR Per Neighbor config commands.
* Added configuration commands for enabling and disabling graceful restart
per neighbour.
Cmd : neighbor A.B.C.D graceful-restart
Cmd : no neighbor A.B.C.D graceful-restart
Cmd : neighbor A.B.C.D graceful-restart-helper
Cmd : no neighbor A.B.C.D graceful-restart-helper
Cmd : neighbor A.B.C.D graceful-restart-disable
Cmd : no neighbor A.B.C.D graceful-restart-disable
* Added configuration commands for disabling graceful restart at the global
Level.
Cmd : bgp graceful-restart disable
Cmd : no  bgp graceful-restart disable

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
Donatas Abraitis
80bf45b266 bgpd: Time to deprecate bgpTimerUp
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-01-04 00:41:47 +02:00
Quentin Young
85bb45956c bgpd: fix too much no listen doc string
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-02 16:26:31 -05:00
Donald Sharp
d2bee6ed41
Merge pull request #5595 from ton31337/fix/bgp_listen_definition
bgpd: Change description for `[no] bgp listen limit` commands
2019-12-31 09:10:04 -05:00
Zoltan Arnold Nagy
3c0e7aa488 bgpd: fix console typo
The console printout had a typo for the number of configured peers label.

Signed-off-by: Zoltan Arnold Nagy <zoltan.arnold.nagy@gmail.com>
2019-12-30 19:44:50 +01:00
Donatas Abraitis
1601a46f22 bgpd: Change description for [no] bgp listen limit commands
It's quite confusing when you see this:
```
exit1-debian-9(config-router)# bgp listen
  listen  Configure BGP defaults
```

And:
```
exit1-debian-9(config-router)# no bgp listen
  listen  unset maximum number of BGP Dynamic Neighbors that can be created
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-27 15:48:03 +02:00
Donatas Abraitis
21d88a7147 bgpd: Make sure we can use no bgp listen range ...
Fixes:
```
exit1-debian-9(config-router)# no bgp listen range 192.168.10.0/24 peer-group TEST
% Peer-group does not exist
exit1-debian-9(config-router)#
```
Closes https://github.com/FRRouting/frr/issues/5570

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-19 22:32:19 +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
David Lamparter
dd65f45ebc bgpd: move config-write to bgp_vty.c
There's no good reason to have this in bgpd.c;  it's just there
historically.  Move it to bgp_vty.c where it makes more sense.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06 15:13:32 +01:00
David Lamparter
1c0d880814 lib: rename memory_vty.c to lib_vty.c
And memory_init() to lib_cmd_init().

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06 15:13:29 +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
David Lamparter
410e167972
bgpd: Autocomplete neighbor for clear bgp (#5434)
bgpd: Autocomplete neighbor for clear bgp
2019-12-03 17:13:21 +01:00
Donatas Abraitis
453c92f6e2 bgpd: Autocomplete neighbor for clear bgp
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-27 21:44:46 +02:00
Donatas Abraitis
c8d6f0d6c4 bgpd: Replace magic number 1 for TTL to BGP_DEFAULT_TTL
For readability and maintainability purposes.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-27 10:48:17 +02:00
Donatas Abraitis
4378f57c3e bgpd: Allow deleting by no bgp large-community-list standard WORD
Without with fix we can't delete large-community-list using
no bgp large-community-list standard WORD, but no bgp large-community-list WORD

Let's keep this identical what we have with expanded lists as well.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-26 21:20:05 +02:00
Donatas Abraitis
2f8cc0e565 bgpd: Use sequence numbers for community lists
This patch allows using sequence numbers for community lists. We already have
this for prefix-lists and access-lists.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-26 21:20:02 +02: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
Don Slice
8e5509b04b bgpd: remove error message for unkown afi/safi combination
Problem reported with error messages appearing in the log
complaining about invalid afi/safi combinations.  Determined
that the error messages were recently added in the function
that turns afi and safi values to strings.  Unfortunately,
the function is called from places using FOREACH_AFI_SAFI,
which spins thru every afi and safi number including some
that are not legal together (ipv4 evpn and l2vpn multicast
for example.)   This fix removes these error messages since
it is not necessarily an error to call it with invalid
combinations.

Ticket: CM-26883
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-10-24 11:29:40 +00:00
Quentin Young
8fa7732f5d bgpd: raise default & max r/w quanta to 64
Vectored writes are more efficient with a higher quantum.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-10-14 18:41:53 +00:00
Donald Sharp
5c117085f6
Merge pull request #5117 from ton31337/fix/remove_deprecation_for_ip_prefix
bgpd: Remove depracated `ip` prefix for as-path/extcommunity/large/co…
2019-10-14 08:14:05 -04:00
Donatas Abraitis
7b9a4750b8 bgpd: Remove depracated ip prefix for as-path/extcommunity/large/communities
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-08 08:39:55 +03: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
Quentin Young
c258527bd2 *: strip trailing whitespace
Some of it has snuck by CI

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-30 16:44:43 +00: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
200116db4c bgpd: Add Established and Dropped counts to JSON output of bgp summary
Based on a suggestion by Donald Sharp, this patch adds the counts of the
number of times a BGP peering session has transitioned from Estd->NotEstd
and from NotEstd->Estd to the JSON output only of the
"show [ip] bgp [vrf <vrf>] summary" command. The idea is that even if the
current session is well and up, but a sessions has trasnitionined in and
out of Estd state multiple times, its worth noting that. We cannot change
the non-JSON output as easily, and so this command only addresses the JSON
part for now. The fields added are the ones that were provided only as part
of the "show bgp neighbor" command.

Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-09-02 19:37:37 +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
Dinesh G Dutt
5cb5f4d04d bgpd: Eliminate all incorrect formulations of afi/safi in JSON
In a number of places, the JSON output had invalid key names for
AFI/SAFI. For example, the key name in JSON was "IPv4 Unicast" which
is invalid as a JSON Key name. Many JSON tools such as those used in
Ansible, jq etc. all fail to parse the output in these scenarios. The
valid name is ipv4Unicast. There's already a routine afi_safi_json()
defined to handle this change, but it was not consistently called.
The non-JSON version was called afi_safi_print() and it merely returned
the CLI version of the string, didn't print anything.

This patch deals with this issue by:
   - Renaming afi_safi_print to get_afi_safi_str()
   - get_afi_safi_str takes an additional param, for_json which if true
     will return the JSON-valid string
   - Renaming afi_safi_json to get_afi_safi_json_str()
   - Creating a new routine get_afi_safi_vty_str() for printing to vty
   - Consistently using get_afi_safi_str() with the appropriate for_json
     value

Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-08-27 14:05:39 +00:00
Donatas Abraitis
3eb0d26717
Merge pull request #4821 from vishaldhingra/lcomm_json
bgpd : Ambiguous command: show bgp large-community-list 1
2019-08-26 11:23:30 +03:00
vdhingra
960b69b9df bgpd : Ambiguous command: show bgp large-community-list 1
When user wants to dump individual large-community-list with the name
then bgp throws an error. It is due to command to dump the bgp RIB routes
having a particular large-community-list values. To segregate both the
commands this fix has added the detail keyword in the below command.
show bgp large-community-list <(1-500)|WORD> detail
The same code change is applicable for community-list also.

Signed-off-by: vishaldhingra<vdhingra@vmware.com>
2019-08-25 23:01:02 -07:00
Donatas Abraitis
5d4324440d
Merge pull request #4815 from NaveenThanikachalam/603_bgp_vty
bgpd: Large-communities CLI accepts configurations sans attributes.
2019-08-24 22:52:08 +03:00
Don Slice
dc91261567 bgpd: make clear bgp * clear all peers in all afi/safis
Problem reported that "clear bgp *" only cleared ipv6 peers.
Changed the logic to clear all afi/safis of all peers in
that case.  Also improved the operation of clearing
individual afi/safi using soft/in/out to do the right thing.

Ticket: CM-25887
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-08-20 13:50:58 +00:00
Donald Sharp
f79f7a7bb2 *: Fix spelling errors pointed out by debian packaging
Debian packaging when run finds a bunch of spelling errors:

I: frr: spelling-error-in-binary usr/bin/vtysh occurences occurrences
I: frr: spelling-error-in-binary usr/lib/frr/bfdd Amount of times Number of times
I: frr: spelling-error-in-binary usr/lib/frr/bgpd occurences occurrences
I: frr: spelling-error-in-binary usr/lib/frr/bgpd recieved received
I: frr: spelling-error-in-binary usr/lib/frr/isisd betweeen between
I: frr: spelling-error-in-binary usr/lib/frr/ospf6d Infomation Information
I: frr: spelling-error-in-binary usr/lib/frr/ospfd missmatch mismatch
I: frr: spelling-error-in-binary usr/lib/frr/pimd bootsrap bootstrap
I: frr: spelling-error-in-binary usr/lib/frr/pimd Unknwon Unknown
I: frr: spelling-error-in-binary usr/lib/frr/zebra Requsted Requested
I: frr: spelling-error-in-binary usr/lib/frr/zebra uknown unknown
I: frr: spelling-error-in-binary usr/lib/x86_64-linux-gnu/frr/libfrr.so.0.0.0 overriden overridden

This commit fixes all of them except the bgp `recieved` issue due to
it being part of json output.  That one will need to go through
a deprecation cycle.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-19 10:36:53 -04:00
Naveen Thanikachalam
82cdf28d2f bgpd: Large-communities CLI accepts configurations sans attributes.
BGP large-communities configuration CLI is successful even if
the command is configured without any attributes.
For ex., the below commands are successful.
         1) "bgp large-community-list standard TEST permit"
         2) "bgp large-community-list standard TEST deny"

The CLI definitions that allow these erroneous configurations need to be removed.

Signed-off-by: NaveenThanikachalam nthanikachal@vmware.com
2019-08-11 21:41:43 -07:00
Don Slice
3c13337daa bgpd: simplify json create/free for memleak fix
Ticket: CM-25616
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-08-05 05:53:13 -07:00
Don Slice
f86897b945 bgpd: resolve memleak on show bgp vrf all ipv6 unicast summary json
Problem reported with memory leak when the command "show bgp vrf all
ipv6 unicast summary json" is issued.  Found that the problem only
occurs if the configuration does not actually include the ipv6
address-family but does contain ipv4 unicast peers. If we didn't
match a peer in the address-family being displayed, we would create
the json object but never free it.  This fix actually stops creating
the json object in this section of code and lets the create happen
in the area where the match occurs.

Ticket: CM-25616
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-08-02 04:50:46 -07:00
Russ White
2d8b235823
Merge pull request #4582 from donaldsharp/do_not_warn
bgpd: Do not display to end user not found afi/safi's
2019-07-30 10:38:25 -04:00
Quentin Young
a041a8fff2
Merge pull request #4728 from ton31337/fix/next-hop-self_force_alias_for_ipv6
bgpd: Add hidden `next-hop-self all` for all address families
2019-07-29 12:41:55 -04:00
Don Slice
8fa7d4447f bgpd: solve invalid error message when clearing interface peer
Problem reported that if "clear bgp swp1" is issued, an error
message is received saying the name or address is malformed. This
was because of a change in bgp_vty.c that removed the storing
and passing of the interface name for this command. Commit that
caused the problem was ac5dec7e88ce2f8cd2943bb61437046718fb34c2.

Ticket: CM-25737
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-07-26 16:48:22 +00:00
Donatas Abraitis
2d94b6d1d2 bgpd: Add hidden next-hop-self all for all address families
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-07-25 15:14:40 +03:00
David Lamparter
2ed9fe4a2b bgpd: autocomplete "router bgp" ASN
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-03 16:55:24 +02:00
Russ White
53f477016e
Merge pull request #4496 from chiragshah6/evpn_dev2
bgpd: vrf route leak handle bgp instance delete recreate
2019-07-02 10:55:25 -04:00
Donald Sharp
e27957c062 bgpd: Fixup no redistribute ... commands to allow any order
The `no redistribute ...` commands were not allowing
the input to be in any order.  Fix code to allow this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-24 19:51:51 -04:00
Donald Sharp
5dbef72f7f bgpd: Do not display to end user not found afi/safi's
When we are issuing a new command:

router bgp
   bgp default local-preference ..
   -or-
   bgp cluster-id ...
   -or-
   bgp disable-ebgp-connected-route-check

Do not tell them that afi/safi's are not configured.  There is nothing
to do with this information and it will create confusion in the
end user that we are looking for afi/safi's that are never going to
be configed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-20 12:36:19 -04:00
David Lamparter
eaf58ba906 lib: use MTYPE_STATIC
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-06-21 08:54:25 +02:00
Donald Sharp
8091266418 bgpd: neighbor X:X::X default-originate complains about (null)
The `neighbor X:X::X default-originate command is complaining
that:
The route-map '(null)' does not exist.

Upon inspection of the code we were passing a NULL
string to the lookup.  Testing for null gets us this:

donna.cumulusnetworks.com# conf t
donna.cumulusnetworks.com(config)# router bgp 99
donna.cumulusnetworks.com(config-router)# neighbor 2001:1::1:2 remote-as 99
donna.cumulusnetworks.com(config-router)# neighbor 2001:1::1:2 default-originate
donna.cumulusnetworks.com(config-router)# end
donna.cumulusnetworks.com# show run
Building configuration...

Current configuration:
!
frr version 7.2-dev
frr defaults datacenter
hostname donna.cumulusnetworks.com
log stdout
no ipv6 forwarding
!
ip route 4.5.6.7/32 10.50.11.4
!
router bgp 99
 neighbor 2001:1::1:2 remote-as 99
 !
 address-family ipv4 unicast
  neighbor 2001:1::1:2 default-originate

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-20 11:12:35 -04: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
Chirag Shah
b20875ea0e bgpd: vrf leak show cmds to check deleted instance
When a source bgp vrf instance is deleted, ensure the referencing
of it in vrf route leak show commands.

Ticket:CM-20534 CM-24484

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-06-17 15:41:51 -07:00
Chirag Shah
48381346d7 bgpd: router bgp export leaked vpn routes
two bgp vrf instance has vrf route leak configured,
when a source vrf x is deleted, its leaked routes are cleaned
up from the destination and vpn table.

With this change when a source bgp instance is reconfigured,
export its routes back to destination vrfs where it is configured
as leak.

Ticket:CM-20534 CM-24484
Reviewed By:
Testing Done:

configure vrf leak between two vrf intances,
delete and readd source vrf and checked its routes
exported to vpn table and leaked vrfs table.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-06-17 15:41:50 -07:00
Chirag Shah
9ecf931b13 bgpd: no router bgp cleanup vrf leaked vpn routes
A VRF leak is configured between two vrfs,
bgp VRF X and VRF Y.
When a bgp VRF X is removed, unimport bgp VRF X routes
from VPN and VRF Y.
If VRF X is also importing from bgp VRF Y, remove X from
export list of Y and do required route cleanup.

Ticket:CM-20534 CM-24484
Reviewed By:
Testing Done:

Before deleteing vrf1002:
nl1# show ip route vrf vrf1003 9.9.2.4/32
Routing entry for 9.9.2.4/32
  Known via "bgp", distance 200, metric 0, vrf vrf1003, best
  Last update 00:04:51 ago
  * 200.2.8.2, via swp1.2(vrf vrf1002)
  * 200.2.9.2, via swp2.2(vrf vrf1002)
  * 200.2.10.2, via swp3.2(vrf vrf1002)

Instance vrf1003:
This VRF is importing IPv4 Unicast routes from the following VRFs:
  vrf1002
Import RT(s): 6.0.2.9:2
This VRF is exporting IPv4 Unicast routes to the following VRFs:
  vrf1002
RD: 6.0.3.9:3
Export RT: 6.0.3.9:3

After deleting vrf1002:
nl1(config)# no router bgp 64902 vrf vrf1002

nl1# show ip route vrf vrf1003 9.9.2.4/32
Routing entry for 9.9.2.4/32
  Known via "bgp", distance 20, metric 0, vrf vrf1003, best
  Last update 00:00:32 ago
  * 200.3.8.2, via swp1.3
  * 200.3.9.2, via swp2.3
  * 200.3.10.2, via swp3.3

Instance vrf1003:
This VRF is importing IPv4 Unicast routes from the following VRFs:
  vrf1002
Import RT(s):
This VRF is not exporting IPv4 Unicast routes to any other VRF

nl1# show bgp ipv4 vpn
No BGP prefixes displayed, 0 exist

Readd vrf1002:
points back to source vrf

nl1# show ip route vrf vrf1003 9.9.2.4/32
Routing entry for 9.9.2.4/32
  Known via "bgp", distance 200, metric 0, vrf vrf1003, best
  Last update 00:00:21 ago
  * 200.2.8.2, via swp1.2(vrf vrf1002)
  * 200.2.9.2, via swp2.2(vrf vrf1002)
  * 200.2.10.2, via swp3.2(vrf vrf1002)

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-06-17 15:39:13 -07:00
Quentin Young
dec5b24733
Merge pull request #4505 from ton31337/feature/autocomplete_bgp_peer-group
bgpd: List all groups dynamically for commands with peer-group
2019-06-17 13:53:48 -04:00
Chirag Shah
efb4077a9c bgpd: show bgp vrfs formatting
show bgp vrfs command is formatted with couple
of things.

show bgp vrfs to inclue bgp vrf instance's
SVI interface.
Move L3vni, RMAC and SVI value in next line.

Ticket:CM-25317
Reviewed By:CCR-8816
Testing Done:

New Output:
TORS1# show bgp vrfs
Type  Id     routerId          #PeersVfg  #PeersEstb  Name
             L3-VNI            RouterMAC              Interface
DFLT  0      27.0.0.15         2          2           default
             0                 00:00:00:00:00:00      unknown
 VRF  31     45.0.8.2          0          0           vrf3
             4003              00:02:00:00:00:4e      vlan4003
 VRF  35     45.0.2.2          0          0           vrf1
             4001              00:02:00:00:00:4e      vlan4001
 VRF  25     45.0.6.2          0          0           vrf2
             4002              00:02:00:00:00:4e      vlan4002

Total number of VRFs (including default): 4

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-06-14 08:47:26 -07:00
Donatas Abraitis
d7b9898c7f bgpd: List all groups dynamically for commands with peer-group
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-06-11 23:29:32 +03:00
Don Slice
8688b3e76b bgpd: add l2vpn evpn to afi safi parse utility
Problem reported with "clear bgp l2vpn evpn * soft" clearing the
wrong afi/safi (cleared ipv6 unicast instead).  Determined that
the calling function used the argv_find_and_parse_afi/safi routines
to determine the correct afi/safi to pass on.  Since l2vpn/evpn were
missing from the lookup, the command defaulted to ipv6 unicast.  This
fix just adds that afi/safi to the lookup routine.

Ticket: CM-25167
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-06-10 05:48:36 -07:00
Donald Sharp
4a3c9cfd11 bgpd: Remove [no] bgp config-type <cisco|zebra>
This command has been deprecated for a year and no-one has complained.
Remove from system.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-03 14:58:26 -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
7ccee8feee bgpd: Remove deprecated '[no] bgp multiple-instance' command
Remove this command from the cli.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-03 14:40:32 -04:00
Lou Berger
692f6582cc
Merge pull request #4384 from dslicenc/bgp-no-delete-default
bgpd: disable deleting default instance if vrf instances exist
2019-05-28 11:45:34 -04:00
Donald Sharp
cac9e917eb bgpd: Display FD used for peer
When issuing a `show bgp neighbor...` command display to the
end user the FD used for communication.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-24 08:27:19 -04:00
Don Slice
dd5868c2cc bgpd: disable deleting default instance if vrf instances exist
Problem reported with deleting the default BGP instance where there
are vrf instances that depend on it (like l2vpn evpn vrfs).  Since
importing for vrf route-leaking also requires the existence of the
default instance, disallowing deleting the BGP default instance if
anyt vrf instance is also defined.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-05-22 13:04:26 -07: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
Russ White
caca2c705c
Merge pull request #4339 from sworleys/Add-AFI_UNSPEC
lib,bgpd,pbrd: Add AFI_UNSPEC to AFI enum
2019-05-16 09:59:55 -04:00
Stephen Worley
b26f891dca lib,bgpd,pbrd: Add AFI_UNSPEC to AFI enum
Add an upspecified option to the AFI enum and update
switch statements using it in bgpd and pbrd.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-05-14 12:19:12 -07:00
Sarita Patra
52e5b8c408 bgpd: display bgp neighbor advertised-routes json warning message
Issue 1:
Getting an empty json without any warning message, while executing
the command "show ip bgp neighbor <x.x.x.x> advertised-routes
json" when the bgp instance is not present or getting created.

Issue 2:
Getting an empty json without any warning message, while executing
the command "show ip bgp vrf/view <name> advertised-routes json"
when the specified view/vrf is not present.

Fix:
Display warning message while executing the above cli commands, when
the bgp instance, specified vrf is not present.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-05-14 12:11:34 -07:00
Donatas Abraitis
16941c05ad bgpd: Remove unnecessary trailing tab
This is very annoying and every time I have to fix this manually
after auto-formatting.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-05-11 10:14:06 +03:00
vishaldhingra
169b72c851 bgpd : lcommlist not shows the standard and expanded conf. correctly.
lcommunity_list_show uses the wrong macro to calculate the style.
Use the correct one LARGE_COMMUNITY_LIST_STANDARD.

Signed-off-by: vishaldhingra<vdhingra@vmware.com>
2019-05-07 21:12:03 -07:00
Donatas Abraitis
1bc4e53187 bgpd: Make sure next-hop-self all backward compatible with force
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-04-25 16:39:49 +03:00
Russ White
ecedbaa13b
Merge pull request #3932 from nitinsoniism/bgp_gshut_clear_soft_in_out
bgpd: handle all afi safi while bgp clear soft
2019-03-31 17:05:14 -04:00
Nitin Soni
99b3ebd3b9 bgpd: handle all afi safi while bgp clear soft
Currently, as part of bgp clear soft inboud and outbound we don't handle
l2vpn evpn. Now clearing soft for all supported afi safi.
One of the examples where this was a problem -

On applying graceful-shutdown, bgp clear soft inboud and outbound don't
handle AFI L2VPN and SAFI EVPN. Gshut gets applied to EVPN Type 5 routes
by asking peer to refresh the routes (provided we have config - "advertise
ipv4/ipv6 unicast" as part of l2vpn evpn) but is not applied to type 2
and type 3 EVP routes. This fix takes care of l2vpn evpn type2 and type3
routes being readvertised with gshut community.

This fix also fixes similar issues related to following where bgp clear
soft is requred for l2vpn evpn -
-config bgp cluster-id
-config bgp client-to-client reflection
-config bgp default local-preference
-config bgp route-reflector allow-outbound-policy
-config bgp disable-ebgp-connected-route-check

Ticket: CM-22813
Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
Reviewed-by: CCR-8361
Testing-Done:
-With gshut configured on all BGP VRFs (operator has to know about the
auto-created BGP VRFs - we do show them in show commands - and turn on
graceful-shutdown in all of them.
-We announce all EVPN routes (type-2, type-3 and type-5) with GSHUT and
we mark IPv4/IPv6 routes in a VRF that are based on received EVPN type-2
or type-5 routes with local pref 0.
-On the receiver side, when EVPN routes are received with GSHUT, the
correct handling takes place (to treat them with local preference 0, and
hence not select them)
-When the gshut configuration is removed on all BGP VRFs, we re-announce
all of our EVPN routes without GSHUT and receiver does the appropriate
thing. Also, we no longer mark EVPN-based IPv4/IPv6 routes with local
pref 0.
-evpn-smoke
-bgp-smoke
2019-03-26 09:34:29 -07: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
fc2408ec18 bgpd: move bgp_update_redist_vrf_bitmaps to bgp_zebra.c for wider use beyond bgp_vty
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-03-14 15:05:38 +00:00
David Lamparter
0a04c7a659
Merge pull request #3925 from chiragshah6/evpn_dev2
bgpd: vrl route-leak show with all vrfs option
2019-03-11 19:48:31 +01: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
David Lamparter
83152933da
Merge pull request #3898 from dslicenc/peer-group-remote-as
bpgd: resolve more neighbor peer-group issues
2019-03-11 19:40:24 +01:00
Chirag Shah
0391580665 bgpd: vrl route-leak show with all vrfs option
VRF Route Leak's
show bgp vrf all ipv4 unicast route-leak
is not supported with `all` keyword.

Testing Done:

bl1# show bgp vrf all ipv4 unicast route-leak

Instance default:
This VRF is not importing IPv4 Unicast routes from any other VRF
This VRF is not exporting IPv4 Unicast routes to any other VRF

Instance vrf3:
This VRF is importing IPv4 Unicast routes from the following VRFs:
  vrf1
Import RT(s): 144.1.1.2:10
This VRF is exporting IPv4 Unicast routes to the following VRFs:
  vrf1
RD: 144.1.3.2:9
Export RT: 144.1.3.2:9

Instance vrf1:
This VRF is importing IPv4 Unicast routes from the following VRFs:
  vrf3
Import RT(s): 144.1.3.2:9
This VRF is exporting IPv4 Unicast routes to the following VRFs:
  vrf3
RD: 144.1.1.2:10
Export RT: 144.1.1.2:10

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-03-07 15:44:13 -08: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
David Lamparter
d3b05897ed
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
2019-03-06 15:54:44 +01:00
Don Slice
390485fdc9 bpgd: resolve more neighbor peer-group issues
Found in testing that in a certain sequence, a neighbor's peer-group
membership would be lost.  This fix resolves that issue. Additionally
found that "no neighbor swp1 remote-as 2" would sometimes leave the
config with "neighbor swp1 remote-as 0" rather than removing from the
config. That one is also resolved.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-03-02 19:44:10 +00:00
Rafael Zalamena
64e4a6c56f vtysh: hide old BGP vpnv(4|6) commands
Only show them when explicit compiled with KEEP_OLD_VPN_COMMANDS.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-28 11:15:15 -03:00
Quentin Young
0a22ddfbb1 *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:46 +00:00
Tim Bray
e3b78da875 *: Rename backet to bucket
Presume typo from original author

Signed-off-by: Tim Bray <tim@kooky.org>
2019-02-25 16:22:36 +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
David Lamparter
cbcaac3fb1
Merge pull request #3746 from ton31337/feature/rfc_8212
bgpd: Implement RFC8212
2019-02-19 13:54:23 +01:00
David Lamparter
b57442d701
Merge pull request #3706 from pguibert6WIND/graceful_restart_range
Graceful restart range
2019-02-18 13:10:31 +01:00
Donatas Abraitis
9dac9fc80e bgpd: Implement RFC8212
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-02-17 23:17:00 +02:00
Quentin Young
3b61f61005 bgpd: use correct specifier to print asn
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-04 16:50:30 +00:00
Philippe Guibert
c1779b7dcd bgpd: enlarge bgp stalepath timer range from 1-3600 to 1-4095
the maximum value for stalepath timer is extended to 4095 to align with
bgp restart timer value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-01-30 17:10:31 +01:00
Philippe Guibert
c72d031488 bgpd: increase bgp restart timer value from 1-3600 to 1-4095
rfc of bgp graceful restart mechanism permits to increase the
restart timer, since its value is encoded on 12 bit.
So make available the possibility to extend it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-01-30 17:10:31 +01:00
Russ White
fc6da51705
Merge pull request #3653 from dslicenc/bgpd-remote-as
bgpd: improve peer-group remote-as definitions
2019-01-29 09:58:02 -05:00
Donald Sharp
dc2f50f378 bgpd: interface based peers should automatically override it's peer group
When a interface based peer is setup and if it is part of a peer
group we should ignore this and just use the PEER_FLAG_CAPABILITY_ENHE
no matter what.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-25 20:40:05 -05:00
Donald Sharp
b77004d632 bgpd: Fix crash in various 'show bgp neighbor json' commands
bgp would crash with various `show bgp neighbor json` commands
based upon whether or not it did a pretty print of the output
or not.  This is because we were freeing the data 2 times.
Cleanup so that we free the json data 1 time.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-25 20:28:23 -05:00
Anuradha Karuppiah
ec0ab5443f bgpd: reinstate current bgp best route on an inactive neigh del
When an inactive-neigh delete is rxed bgp will not have a local path to
remove (and re-run path selection). Instead it simply re-installs the
current best remote path if any.

Ticket: CM-23018
Testing Done: evpn-min

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-01-25 14:19:26 -05: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
Lou Berger
07f451afef
Merge pull request #3532 from donaldsharp/community_list_speedup
bgp Community list speedup
2019-01-15 10:05:20 -05:00
Renato Westphal
1c4213d862
Merge pull request #3198 from donaldsharp/mac_rejection
Mac rejection
2019-01-10 11:21:18 -02:00
Donald Sharp
e237b0d211 bgpd: Further refine hash lookup to store hash value
Further refine the previous commit to store the hash value in
both the `struct community_list` as well as the `struct rmap_community`
structures.  This allows us to know a priori what our hash value
is.  This change cuts another couple of seconds of convergence
off to ~55 seconds and further reduces cpu load of bgp:

   16      40061.706    433732       92    330102      129   1242965 RWTEX TOTAL

Down from ~43 seconds previously.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-08 20:24:13 -05:00
Quentin Young
01cbfd0484 bgpd: fix json double free when showing neighbors
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-12-17 22:18:13 +00: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
Donald Sharp
fd5e7b705e bgpd: Allow soft clear of l2vpn evpn afi/safi
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-12 16:10:30 -05:00
Philippe Guibert
616c6ee8bd bgpd: add neighbor l2vpn evpn software discovery inbound command
this command permits configuring adj-rib-in for l2vpn evpn entries.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-12-12 16:10:30 -05:00
Lou Berger
9bdb632c68
Merge pull request #3093 from donaldsharp/bgp_node_continued
Bgp node continued
2018-12-11 11:13:25 -05:00
David Lamparter
54f29523d9 bgpd: re-add spelling error in JSON output
I bulk-fixed "recieved" as a misspelling in 0437e10... but didn't notice
there was a JSON value among these.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-07 20:06:53 +01:00
David Lamparter
1061bb9a4f
Merge pull request #3357 from ton31337/fix/optional_args_for_extcommunity-lists
bgpd: Remove extcommunity-list by name without typing full rule
2018-12-04 15:34:59 +01:00
Russ White
eda41b4c21
Merge pull request #3325 from adeg/bugfix/bgpd-vtysh-fixes
bgp_vty: Fix vpn_leak_postchange_all() every time "router bgp ASNUM" context is entered
2018-11-25 22:39:47 -05:00
Donatas Abraitis
d4455c8975 bgpd: Remove extcommunity-list by name without typing full rule
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2018-11-19 13:12:23 +02:00
Donald Sharp
67009e2200 bgpd: Abstract bgp_table retrieving/setting from info pointer
Convert the set/get of bgp_table's from the info pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-16 09:43:35 -05:00
Anton Degtyarev
3702f84d9f bgpd: add missing endline
Missing endline was resulting in garbled output in vtysh in some cases, for example, when there were no peers configured and the user has issued "bgp disable-ebgp-connected-route-check" command.

Signed-off-by: Anton Degtyarev <anton@cumulusnetworks.com>
2018-11-14 03:57:46 +03:00
Anton Degtyarev
ecec94950f bgpd: Fix bgpd doing vpn_leak_postchange_all() every time "router bgp ASNUM" command is entered in vtysh
In rare cases when the default BGP instance is instantiated after VRF bgp instances (see comment to bgp_mplsvpn.c:vpn_leak_postchange_all() for an example), the "router bgp" command needs to call vpn_leak_postchange_all() to start the route leaking process. The issue was it was never checked if the "router bgp" command was used to create the default BGP instance or just to enter into "router bgp" command context. This resulted in vpn_leak_postchange_all() executed every time (and vpn routes re-announced to all peers) when the user was entering "router bgp" command context.

Signed-off-by: Anton Degtyarev <anton@cumulusnetworks.com>
2018-11-14 03:54:56 +03: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
Russ White
2379dbecbd
Merge pull request #3202 from donaldsharp/evpn_dump
Evpn dump
2018-11-08 18:13:27 -05:00
Rafael Zalamena
591328ffc6
Merge pull request #3205 from donaldsharp/default
bgpd: make name of default vrf/bgp instance consistent
2018-11-07 18:48:21 -02:00
Renato Westphal
8dfa7e4680
Merge pull request #3162 from pguibert6WIND/vpn_route_map_issue
bgpd: vpn route-map config should be kept, except if vrf list is on
2018-11-03 15:20:20 -03:00
adharkar
2531163802
Merge branch 'master' into frr-bgp_cli 2018-10-31 15:54:43 -07:00
Donald Sharp
093e3f23f6 bgpd, lib, vtysh, zebra: Convert to using CMD_VNI_RANGE
For the vni range use a macro to keep track of it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-31 06:23:32 -04:00
Anuradha Karuppiah
8029b21687 bgpd: hidden commands to add/del a local mac
local mac add/del comes from zebra. the hidden commands help verify
various race conditions between bgp and zebra.

Ticket: CM-22687
Reviewed By: CCR-7939

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2018-10-31 06:23:32 -04: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
Quentin Young
3c4b8fe21f bgpd: fix small error in community-list patch
Couldn't delete an expanded community-list by name alone

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-10-29 14:08:45 +00:00
Donatas Abraitis
174b5cb932 bgpd: Remove community-list by name without typing full rule
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2018-11-15 22:58:49 +02:00
David Lamparter
0437e10517 *: spelchek
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25 20:10:57 +02:00
David Lamparter
0abf76d519
Merge pull request #3204 from ton31337/fix/make_vrf_import_default_selectable
bgpd: Select default routing table when importing VRF routes into global
2018-10-23 18:34:15 +02:00
Donatas Abraitis
4d1b335c74 bgpd: Select default routing table when importing VRF routes into global
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2018-10-23 18:00:02 +03:00
Renato Westphal
e2f68d82e9
Merge pull request #3191 from donaldsharp/more_vty
bgpd: Add a better breadcrumb for interface based peers
2018-10-18 11:54:58 -03:00
Don Slice
43d3f4fcd3 bgpd: add command to display update groups for l2vpn evpn
For troubleshooting purposes, it's useful to display the update-groups
for l2vpn evpn

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-10-17 18:50:09 +00:00
Lakshman Krishnamoorthy
a6627c993e bgpd: Route Server support for evpn address-family
Signed-off-by: Lakshman Krishnamoorthy lkrishnamoor@vmware.com
2018-10-16 17:44:57 -07:00
Donald Sharp
d762bcc370 bgpd: Add a better breadcrumb for interface based peers
If you are using bgp unnumbered( or interface based peers )
when we detect an error give the user a bit more of a clue
what they may have done wrong.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-16 17:44:12 -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
Russ White
97dc689417
Merge pull request #3142 from donaldsharp/bgp_peerhash
Bgp peerhash
2018-10-12 16:55:50 -04:00
Ameya Dharkar
37d4e0dfab bgpd: BGP JSON new fields
1. "show bgp ipv4 json"
  - Added "network" field which displays a prefix in 'prefix/prefixlen' format.

2. "show bgp ipv6 json"
  - Added "network" field which displays a prefix in 'prefix/prefixlen' format.
  - JSON does not have "prefix", "prefixLen" fields which are present in IPv4
    command. Added these fields as they are useful.

3. "show bgp ipv4/ipv6 neighbor <neighbor_addr> advertised-routes json"
  - Added "network" field.

4. "show bgp ipv4/ipv6 summary json"
  - Added "pfxSnt" for peers. This count is obtained from corresponding
    update_subgroup.

5. "show bgp neighbor json"
  - Added "sentPrefixCounter"

Signed-off-by: Ameya Dharkar <adharkar@vmware.org>
2018-10-11 15:35:21 -07: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
Philippe Guibert
8a066a70c3 bgpd: vpn route-map config should be kept, except if vrf list is on
When executing vpn route-map config for importation, the running-config
records vrf import route-map instead. Actually, this is a problem when
restarting configuring when using vpn route-map. The choice is done to
move to vrf format, when at least one import list is created for vrfs.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-10-11 08:42:18 +02:00
Donald Sharp
4b7e606625 bgpd: Convert struct bgp_info to struct bgp_path_info
Do a straight conversion of `struct bgp_info` to `struct bgp_path_info`.
This commit will setup the rename of variables as well.

This is being done because `struct bgp_info` is not descriptive
of what this data actually is.  It is path information for routes
that we keep to build the actual routes nexthops plus some extra
information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09 14:14:25 -04:00
Donald Sharp
cc4d4ce822 bgpd: Cleanup peer->su handling
Cleanup calls where we were passing in the su for
peer creation a tiny bit.

Creating a peer from the cli will always have a conf_if *or*
a su but not both. While a doppelganger will have both.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-07 20:55:52 -04:00
Ameya Dharkar
50e05855f0 bgpd: BGP JSON show commands enhancements
1. "show bgp ipv4 json"
  - Corresponding CLI has "network" field which displays a prefix in
    'prefix/prefixlen' format. Added this "network" field to JSON as well.
  - Following fields have different names in JSON and CLI.
      CLI      JSON
      metric   med
      locPrf   localPref
      path     aspath

    Added fields "metric", "locPrf" and "path" in JSON for CLI/JSON
    consistency. Older JSON fields med, localPref, aspath will be
    deprecated in future.

2. "show bgp ipv6 json"
  - Similar changes as "show bgp ipv4 json"
  - JSON does not have "prefix", "prefixLen" fields which are present in IPv4
  command. Added these fields as they are useful.

3. "show bgp ipv4/ipv6 neighbor <neighbor_addr> advertised-routes json"
  - Added "network" field.
  - Added locPrf, path fields for CLI/JSON consistency. localPref, aspath will
  be deprecated in future.

4. "show bgp ipv4/ipv6 summary json"
  - Added "pfxRcd" for CLI/JSON consistency.
    "prefixReceivedCount" will be deprecated in future.
  - Added "pfxSnt" for peers. This count is obtalned from corresponding
    update_subgroup. This needed a fix in the code where we copy fields
    for a split update_subgroup from the parent update_subgrp.
    New subgrp should inherit subgrp->scount(Count of advertized prefixes)
    of the parent subgrp.

5. "show bgp neighbor json"
  - Added "sentPrefixCounter"

6. "show bgp ipv4/ipv6 <prefix> json"
  - Added "metric" field for CLI/JSON consistency.
    "med" will be deprecated in future.

Signed-off-by: Ameya Dharkar <adharkar@vmware.org>
2018-10-05 15:06:17 -07:00
Sarita Patra
7336e10117 bgpd: remove ip prefix from as-path, <large,ext>community-list
The existing commands "ip as-path", "ip community list", "ip extcommunity
list" & "ip largecommunity list" is used to configure both for ipv4 and
ipv6. So the prefix "ip" is removed from these commands.
All the configuration, show related configuration, show running config
& boot up with write memory is also verified with the provided fix.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2018-10-04 21:50:44 -07:00
Donald Sharp
af97a18b10 bgpd: Make struct bgp_addr a private data structure
The `struct bgp_addr` is not needed for anything other than
the address hash.  Isolate this data structure so that it
is not polluting up the name space.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-21 15:51:58 -04:00
David Lamparter
2fa3198399
Merge pull request #3023 from qlyoung/ultimate-warning-reference-cards-rename
warning reference cards rename
2018-09-14 17:35:58 +02: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
F. Aragon
7fe96307ee
bgpd lib ospf6d pbrd tests zebra: shadowing fixes
This fixes all remaining local variable shadowing cases

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-13 17:37:08 +02:00
David Lamparter
1fbd4e382a
Merge pull request #2945 from dslicenc/bgp-ospf-json
bgpd/ospfd: make bgp and ospf json response a bit more consistent
2018-09-01 05:05:30 +02:00
Don Slice
ca61fd2587 bgpd: convert from conditional operator to if-then for json changes
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-31 17:11:23 +00:00
Don Slice
985d248279 bgpd: change conditional operators for bgp/ospf json changes
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-31 12:50:02 +00: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
Philippe Guibert
9a8bdf1c25 bgpd: handle vrf aliases in vty API
Because a VRF name can be used for default VRF, or an alias of an
already created VRF can be passed as parameter, the default VRF name
must be found out. This avoids creating double BGP instances for
example.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-28 16:23:50 +02:00
Donald Sharp
ec4f07507b bgpd: Fix CONFDATE to 2019 for a couple of items.
While perusing CONFDATE I noticed that we had a couple
CONFDATE 201805, which we were not picking up( for other
reasons and fixed in a different PR ).  But upon investigation
of these I noticed that the commits where in 201805, so these
CONFDATES should be in 2019

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-24 15:21:04 -04:00
Donald Sharp
529089b58e
Merge pull request #2804 from kssoman/bgp_fix
When redistribute options are changed, call bgp_redistribute_unreg()
2018-08-24 07:46:22 -04:00
kssoman
e923dd62ef bgpd : Change of options in redistribute command does not get applied
* Added parameter in bgp_redistribute_set() to indicate change
  in redistribute option
* If there is change, call bgp_redistribute_unreg() to withdraw routes

Signed-off-by: kssoman <somanks@vmware.com>
2018-08-22 05:00:15 -07:00
Don Slice
6ce24e5247 bgpd: fix additional issue with bgp route-leak json commit
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-20 21:05:57 +00:00
Don Slice
04c9077f81 bgpd: fix issues with bgp route-leak json commit
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-20 19:36:11 +00:00
Don Slice
b46dfd2022 bgpd: add json output to bgp route-leak show command
Ticket: CM-20259
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-18 11:43:08 +00:00
Russ White
91a4566c1c
Merge pull request #2852 from donaldsharp/bgp_clean
Bgp clean
2018-08-16 11:30:03 -04:00
Donald Sharp
b7cd3069c0 bgpd: Modify warn to info for deprecated commands
Modify zlog_warn to zlog_info commands for notification of
deprecated commands.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-16 08:24:09 -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
Russ White
9e03825743
Merge pull request #2800 from adharkar/frr-bgp_cli
bgpd: Added local router-id to "show bgp neighbor"
2018-08-08 06:37:51 -04:00
Ameya Dharkar
0e38aeb41e bgpd: Added local router-id to "show bgp neighbor"
Signed-off-by: Ameya Dharkar adharkar@vmware.com
2018-08-07 15:25:47 -07:00
Dongling Duan
b4e9dcba1e bgpd: Fix show ip bgp summary json command for dynamicPeers
The dn_count for dynamic Peers was not being updated when
using json output.

Signed-off-by: Dongling Duan <dlduan@amazon.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-31 19:02:55 -04:00
Chirag Shah
81cf0de50e bgpd: Add evpn prefix to debug bgp updates prefix
Adding EVPN prefix of Type 2, 3 and 5 routes to bgp updates
prefix filters.

Ticket:CM-14476
Testing Done:

Configure multiple evpn options under 'debug bgp updates prefix'.
Below is the running-config output.

MAC-IP route with just MAC:
debug bgp updates prefix l2vpn evpn type macip mac
00:02:00:0a:0a:0a
MAC-IP route with MAC and IP:
debug bgp updates prefix l2vpn evpn type macip mac
00:02:00:00:00:0c ip 45.0.1.9
MAC-IP route with just MAC and IPv6:
debug bgp updates prefix l2vpn evpn type
macip mac 00:02:00:00:00:0a ip 2001:fee1:0:1::8
Type-3:
debug bgp updates prefix l2vpn evpn type multicast ip 27.0.1.19
Type-5:
debug bgp updates prefix l2vpn evpn type prefix
ip 2060:1:1:1::/64

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-07-24 06:45:40 -07:00
Donald Sharp
c4aee4fe31
Merge pull request #2652 from LabNConsulting/working/master/confdate_cleanup
Simplify deprecation check
2018-07-23 08:46:26 -04:00
Ameya Dharkar
d0086e8e39 bgpd: Changes to BGP show json commands
Added localRouterID to "show bgp neighbor json"
Added json O/P to "show bgp [AFI] community <community>"

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2018-07-19 13:46:46 -07: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
Lou Berger
bee57a7a07 bgpd: remove VERSION_TYPE_DEV from CONFDATE checks
Signed-off-by: Lou Berger <lberger@labn.net>
2018-07-10 16:20:09 -04: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
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
Tigran Martirosyan
9199a725f4 fixed #2567: Json status of BGP peer is not updated properly 2018-06-30 16:27:25 +04:00
paco
343cdb6143
bgpd: copy-paste error (Coverity 1399202)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-28 15:31:38 +02:00
Russ White
f1b5eeea03
Merge pull request #2545 from pacovn/Coverity_1468413_Explicit_null_dereferenced
bgpd: null check (Coverity 1468413)
2018-06-26 11:14:39 -04:00
Quentin Young
f07e1c4fe4 bgpd: remove DEFUN_DEPRECATED usage
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-25 16:38:48 +00:00
paco
867f0ccaec
bgpd: null check (Coverity 1468413)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-25 15:03:17 +02:00
Quentin Young
0a8990d5f8
Merge pull request #2501 from pacovn/infer_unused1
bgpd isisd ldpd lib ospfd pimd: redundancy (infer, grouped)
2018-06-21 15:12:33 -04:00
paco
a2b6e694b1
bgpd isisd ldpd lib ospfd pimd: redundancy (infer)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-20 22:25:28 +02:00
paco
5d5ba0185d
bgpd, lib, ospfd, zebra: all_digit moved to frrstr
This solves a pending FIXME

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-19 17:59:53 +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
527de3dca2
bgpd: Cleanup peer/AF-flag override implementation
This commit cleans up some ugly leftovers from previous flag-override
implementation and refactors the AF-flag override implementation to
match the same behavior the newly added peer-flag override
implementation has.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:27 +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
d6ceaca343
bgpd: dead code (Coverity 1399246)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-13 12:25:45 +02:00
Donald Sharp
2f8f4f1001 bgpd: Actually display labeled unicast routes received
The labeled unicast and unicast tables have been combined
into the unicast table.  Additionally we have a restriction
where if you configure labeled unicast you cannot configure
unicast.  This created a bug with 'show bgp ipv4 labeled-unicast summ'
command where we were displaying NoNeg, because v4 has been intentionally
turned off.

Modify the code so that when we are looking up if we have negotiated
a capapbility we use the correct one, while still using the appropriate
table for prefix count.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-07 17:10:38 -04:00
Lou Berger
480e99c6c1
Merge pull request #2351 from donaldsharp/bgp_deprecation
Bgp deprecation
2018-06-05 12:05:39 -04: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
Donald Sharp
1cc406605b bgpd: Deprecate and hide the no bgp multiple-instance command
This command needs to be deprecated.  It partially implements
a refusal to create multiple instances.  If you do not need
multiple instances, just don't create them in the cli instead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-01 15:15:30 -04:00
Donald Sharp
798467a200 bgpd: Hide and deprecate bgp config-type cisco command
This command needs to be deprecated.  It sets a small variety
of options via the BGP_OPT_CONFIG_CISCO flag.  Set for removal
in 1 year.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-01 15:15:30 -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
G. Paul Ziemba
21a16cc2a3 bgpd: issue 2263: fix "no label vpn export auto"
This command should unset the label (instead of wrongly
setting to "auto")

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-05-26 07:05:42 -07:00
Don Slice
88b7d2555c bgpd: improve error message for neighbor not found
Problem reported due to tab completion showing all possible peers
in every vrf, but when neighbor in wrong vrf entered "no such
neighbor" is the error message.  Making it slightly more clear
with "no such neighbor in the view/vrf" to clue the user that they
may have specified the wrong vrf.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-05-24 10:51:17 -04: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
Russ White
1cbbd4950b
Merge pull request #2231 from ppmathis/fix/clear-bgp-afi
bgpd: Respect AFI/SAFI when hard-clearing a peer
2018-05-18 02:48:59 -04:00
Pascal Mathis
3ae8bfa5d8
bgpd: Respect AFI/SAFI when hard-clearing a peer
The current implementation does not respect the AFI+SAFI combination of
a peer when executing a non-soft (hard) clear. An example would be the
command `clear bgp ipv4 unicast *`, which will clear all BGP peers, even
those that do not have IPv4-Unicast activated.

This commit fixes that behavior by applying the same rules to both soft
and hard clear commands, so that peers without a matching AFI+SAFI
combination will be no longer modified.

Additionally, this commit adds warning messages to all `clear bgp
[<afi>] [<safi>] <target>` commands when no matching peers with the given
AFI+SAFI combination could be found.

Both existing and new warning messages have been extended to also
mention the AFI+SAFI combination that is missing, which is more helpful
to the user than a generic expression 'No peer configured'.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-14 22:52:31 +02:00