Commit Graph

918 Commits

Author SHA1 Message Date
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
Pascal Mathis
8d9b8ed99d
bgpd: Improve JSON support for large communities
The current implementation of building JSON output is greatly different
for large communities compared to standard communities. This is mainly
noticeable by the missing 'list' attribute, which usually offers an
array of all communities present on a BGP route.

This commit adds the missing functionality of properly returning a
'list' attribute in JSON output and also tries a similar approach like
the standard communities are using to implement this feature.

Additionally, the 'format' specifier has been completely removed from
large communities string/JSON rendering, as the official RFC8092 specifies that
there is only one canonical representation:

> The canonical representation of BGP Large Communities is three
> separate unsigned integers in decimal notation in the following
> order: Global Administrator, Local Data 1, Local Data 2. Numbers
> MUST NOT contain leading zeros; a zero value MUST be represented with
> a single zero. Each number is separated from the next by a single
> colon. For example: 64496:4294967295:2, 64496:0:0.

As the 'format' specifier has not been used/checked and only one
canonical representation exists per today, there was no reason to keep
the 'format' parameter in the function signature.

Last but not least, the struct attribute 'community_entry.config' is no
longer being used for large communities and instead 'lcommunity_str' is
being called to maintain a similar approach to standard communities.

As a side effect, this also fixed a memory leak inside 'community_entry_free'
which did not free the allocated memory for the 'config' attribute when
dealing with a large community.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-13 19:37:51 +02:00
Russ White
71ef4ee49a
Merge pull request #2132 from donaldsharp/missed_stuff
Missed stuff
2018-05-12 06:18:15 -04:00
Don Slice
47a306a040 bgpd: fix auto-completion for neighbors and peer-groups
Before this fix, both real neighbors and peer-groups were lumped
together in auto-completion and it didn't work at all for
peer-groups.  This fix changes that behavior to do the right
thing.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-05-10 17:59:27 +00:00
Mitesh Kanjariya
ace295a90d bgpd: enable neighbor-nexthop-self for l2vpn evpn address family
In the FRR implementation of EVPN,
eBGP leaf-spine peering for EVPN is fully supported by allowing
the next hop to be propagated and not rewritten at each hop.
There are other changes also related to route import to facilitate this.
However, propagating the next hop is not correct in some cases.
Specifically, if the DC is comprised of multiple PODs
with distinct intra-POD and inter-POD VxLAN tunnels,
EVPN routes received from an adjacent POD by a border/exit leaf
must be propagated into the local POD with the next hop rewritten (to self).

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-05-08 19:24:15 -04:00
Donald Sharp
0ca70ba5c1 bgpd: Dissallow mixing of import vrf and vpn commands
Do not allow the import vrf commands to be mixed with
import vpn commands.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Donald Sharp
69b07479f8 bgpd: Eliminate loop over afi's for vpn vrf leaking commands
The loop over all afi's implies that these commands actually need
to loop over all afi's to check the vpn policy.  We know the
appropriate afi based upon the node we are in.  So just return
the correct afi to look at and then just apply it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Don Slice
25679caa80 bgpd: disallow importing a vrf into itself
Prior to this fix, you could configure importing a vrf from inside
the same vrf.  This can lead to unexpected behavior in the leaking
process.  This fix disallows that behavior.

Ticket: CM-20539
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Don Slice
79ef8664a5 bgpd: fix crash on "no import vrf" if no default bgp instance
Tripped over a crash running the cli_crawler that occurred when the
sequence was doing "import vrf NAME" and "no import vrf NAME" inside
a vrf but a default bgp instance had not been created.  This fix
auto-creates the default instance if the "import vrf NAME" is
entered and a default instance does not exist.

Ticket: CM-20532
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Don Slice
e49840c895 bgpd: fix import vrf route-map issues
Prior to this fix, the import vrf route-map command only worked
if the route-map existed prior to the command.  Additionally, if
the import vrf route-map command was issued without an existing
route-map, the imported prefixes were not removed.  This fix
resolves both of thes mis-behaviors. bgp-smoke run with same
failures as base.

Ticket: CM-20459
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: CCR-7358
2018-04-25 12:39:17 -04:00
Don Slice
0fb8d6e639 bgpd: fix incorrect config when importing vrf default
Found that when doing "import vrf default" in another vrf, an
extra line was added to the configuration in error.   This fix
resolves that incorrect configuration. Manual testing will be
attached to the defect.

Ticket: CM-20467
Signed-off-by: Don Slice <dslice@cumulustnetworks.com>
Reviewed by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Don Slice
a8dadcf6cc bgpd: add ability to import default vrf routes
signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Donald Sharp
020a3f60bd bgpd: Cleanup warnings found in CI
Cleanup some of the warnings found in the CI system.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
Don Slice
bb4f6190d9 bgpd: add import vrf route-map command
Added the cli for doing route-map filtering on imported routes via
the new "import vrf route-map <NAME> command.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00
vivek
53089bec65 bgpd: Implement show command for VRF route leaking
Implement "show bgp [vrf FOO] <afi> <safi> route-leak" which displays
operational information about VRF route leaking.

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

Ticket: CM-20256
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:16 -04:00
Donald Sharp
6e2c7fe69d bgpd: Handle when the import vrf has not been created.
When the `import vrf XXX` command is entered under
an afi/safi for bgp and the XXX vrf bgp instance
does not yet exist, auto-create it using the same
ASN that the we are importing into.

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

router bgp 4 vrf DONNA
  <config>
!

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

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

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:16 -04:00
Quentin Young
7298a8e105 bgpd: clean up clist management logic
* Remove unused parameter
* Restore behavior described by function comment
* Eliminate NPD caught by static analysis

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-17 13:58:24 -04:00
G. Paul Ziemba
e70e9f8e24 bgpd: vpn-vrf leaking: use dynamic label pool for "auto" labels
Add support for CLI "auto" keyword in vrf->vpn export label:

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

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-11 23:18:35 -07:00
Martin Winter
381fec2452
Merge pull request #2023 from LabNConsulting/working/master/confdate+release
Use new way of avoiding deprecated related warnings in non-dev branches
2018-04-05 01:23:37 +01:00
Lou Berger
e24be24183 *: Only test CONFDATE when VERSION_TYPE_DEV defined
Signed-off-by: Lou Berger <lberger@labn.net>
2018-04-03 13:47:50 -04:00
Philippe Guibert
925bf6718b bgpd: Flowspec client failed to update exit-address-family
Flowspec client failed to update `exit-address-family`.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-03 16:54:19 +02:00
jaydom
7c40bf391c bgpd: add flowspec feature
This work is derived from a work done by China-Telecom.
That initial work can be found in [0].
As the gap between frr and quagga is important, a reworks has been
done in the meantime.
The initial work consists of bringing the following:
- Bringing the client side of flowspec.
- the enhancement of address-family ipv4/ipv6 flowspec
- partial data path handling at reception has been prepared
- the support for ipv4 flowspec or ipv6 flowspec in BGP open messages,
  and the internals of BGP has been done.
- the memory contexts necessary for flowspec has been provisioned

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

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

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

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

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

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

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-27 15:21:51 +02:00
G. Paul Ziemba
c7109e09e7 bgp_vty.c: fix docstrings for bgp_imexport_vpn
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-19 22:14:43 -07:00
G. Paul Ziemba
d555f3e904 bgpd: vpn-vrf-leaking new CLI: address Vivek's review comments + crash fix
- vpn_leak_to_vpn_active(): check instance type
    - vpn_leak_prechange(): qualify with test for active
    - vpn_leak_postchange(): remove duplicated call to
	vpn_leak_from_vrf_update_all()

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

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-19 22:14:42 -07:00
G. Paul Ziemba
b9c7bc5ab0 bgpd: new vpn-policy CLI
PR #1739 added code to leak routes between (default VRF) VPN safi and unicast RIBs in any VRF. That set of changes included temporary CLI including vpn-policy blocks to specify RD/RT/label/&c. After considerable discussion, we arrived at a consensus CLI shown below.

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

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

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

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

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-19 22:13:43 -07:00
G. Paul Ziemba
ddb5b4880b bgpd: vpn-vrf route leaking
- add "debug bgp vpn label" CLI
    - improved debug messages for "debug bgp bestpath"
    - send vrf label to zebra after zebra informs bgpd of vrf_id
    - withdraw vrf_label from zebra if zebra informs bgpd that vrf_id is disabled
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09 16:42:40 -05:00
Donald Sharp
54085eafeb
Merge pull request #1428 from LabNConsulting/working/master/indent
frr: conform with COMMUNITY.md formatting rules
2018-03-07 10:44:37 -05:00
Quentin Young
8590fba34f
Merge pull request #1816 from pguibert6WIND/issue_clear_ipv6
bgpd: clear ip bgp instances with safi invalid
2018-03-07 10:28:29 -05:00
Philippe Guibert
9b475e76c6 bgpd: clear ip bgp instances with invalid safi
This commit fixes the handling of incoming parameters passed in
following vty functions:

clear ip bgp ipv6 [safi] prefix []
clear ip bgp [vrf ] ipv6 [safi] prefix []

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-07 15:58:48 +01:00
Christian Franke
5fe3789f98
Merge pull request #1812 from qlyoung/bgpd-fix-update-group-commands
bgpd: fix update-group show commands
2018-03-07 14:50:50 +01:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Philippe Guibert
6dfe83b8f7
Merge pull request #1728 from mkanjari/evpn-bug-fixes
Evpn bug fixes
2018-03-06 17:27:10 +01:00
Quentin Young
dc64bdec91
bgpd: fix update-group show commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-01 13:46:40 -05:00
Mitesh Kanjariya
ee851c8c77 bgpd: add show bgp vrf all l2vpn evpn summary as an option
Ticket: CM-19738
Review: CCR-7194
Testing: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-27 01:14:43 -08:00
Mitesh Kanjariya
f487dcaf74
Merge branch 'master' into evpn-bug-fixes 2018-02-21 00:36:58 -08:00
Daniel Walton
827ed7076d bgpd: "no neighbor 10.13.0.12 peer-group ibgp" does not remove peer
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This worked for unnumbered peers but not for numbered peers. This is
before the fix:

router bgp 100
 coalesce-time 1000
 neighbor FOO peer-group
 neighbor FOO remote-as external
 neighbor swp1 interface peer-group FOO
 neighbor 1.1.1.1 peer-group FOO
!
line vty
 exec-timeout 0 0
!
end
cel-redxp-10# wr
Note: this version of vtysh never writes vtysh.conf
Building Configuration...
Integrated configuration saved to /etc/frr/frr.conf
[OK]
cel-redxp-10# conf t
cel-redxp-10(config)# router bgp
cel-redxp-10(config-router)# no neighbor swp1 interface peer-group FOO
cel-redxp-10(config-router)# no neighbor 1.1.1.1 peer-group FOO
cel-redxp-10(config-router)# do show run
Building configuration...

Current configuration:
!
frr version 4.1-dev
frr defaults datacenter
hostname cel-redxp-10
!
service integrated-vtysh-config
!
password cn321
!
log syslog
!
router bgp 100
 coalesce-time 1000
 neighbor FOO peer-group
 neighbor FOO remote-as external
 neighbor 1.1.1.1 remote-as external
 !
 address-family ipv4 unicast
  no neighbor 1.1.1.1 activate
 exit-address-family
!
line vty
 exec-timeout 0 0
!
end
cel-redxp-10(config-router)#

After the fix "no neighbor 1.1.1.1 peer-group FOO" removes the 1.1.1.1
neighbor.
2018-02-15 20:55:43 +00:00
G. Paul Ziemba
a4d82a8adc bgpd: ran indent.py on some files prior to bgp vpn-vrf leaking changes
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-02-09 10:22:50 -08:00
Mitesh Kanjariya
2ca3a78b68 bgpd: enunciate the error message if user tries to configure 'router bgp'
We need a better error message. "Multiple BGP processes are configured"
doesnt makes sense anymore as with l3vni,
we could have multiple auto configured bgp instances.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-08 23:02:28 -08:00
Philippe Guibert
8e71b98f72
Merge pull request #1654 from mkanjari/evpn-symm-routing-enhancements
Evpn symmetric routing enhancements
2018-02-08 11:46:29 +01:00
Lou Berger
30a6095ac9
Merge pull request #1694 from qlyoung/fix-bgp-default-shutdown-conf-write
bgpd: fixup default shutdown
2018-02-05 16:04:08 -06:00
mitesh
9d00a48754 bgpd: allow evpn safi under vrf instance
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-05 13:29:52 -08:00
Donald Sharp
15c81ca495 bgpd: Add ability to see martian next-hop's for a vrf
We've run across an issue where the local connected
ip address is not being removed in some error condition.
During trackdown it was noticed that we cannot look
at this table for views/vrf's.  While we don't have the
bug tracked down yet this will help us figure it out.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-02 19:26:22 -05:00
Quentin Young
b012cbe2b1
bgpd: improve default shutdown help string
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-30 11:47:34 -05:00
Lou Berger
08951735bd
Merge pull request #1690 from dslicenc/bgpd-vrf-show-cm17377
bgpd: fix output of show bgp vrf all neighbor x.x.x.x
2018-01-30 11:42:26 -05:00
Quentin Young
8175f54a2d
bgpd: fixup default shutdown
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-30 10:12:19 -05:00
Don Slice
71aedaa394 bgpd: fix output of show bgp vrf all neighbor x.x.x.x
Problem reported with output of the command "show bgp vrf all
neighbor x.x.x.x" not limiting the output to that peer in any vrf.
This fix corrects the logic to display by neighbor
(ipv4/ipv6/interface) in any vrf.

Ticket: CM-17377
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-01-30 12:30:35 +00:00
Russ White
983976514f
Merge pull request #1679 from qlyoung/revert-remove-options-directly-connected
Revert "bgpd: disallow invalid config at cli layer"
2018-01-29 08:25:49 -05:00
Quentin Young
7ebe625c3a
Revert "bgpd: disallow invalid config at cli layer"
This reverts commit a174be631a.

Turns out we need that variable to accept peer groups.
2018-01-26 17:16:12 -05:00
Don Slice
3946bdcc81 bgpd: remove poorly located bestpath json output
The bestpath multipath-relax setting was added to the output of
"show ip bgp neighbor json" several months ago but this is not
the correct place to display that information and this fix removes
it from there.  The multipath-relax setting  was also added
to the output of "show ip bgp sum json" which is fine.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-01-25 17:52:27 +00:00
Mitesh Kanjariya
3194717445 bgpd: unblock l2vpn evpn for non default vrf
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-01-23 15:58:53 -08:00
Philippe Guibert
a8bf7d9c9e bgpd: fix compilation issue with bgpd
Changes due to the change of vrf_id_t moved from 16 bits to 32 bits.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-01-22 13:52:24 +01:00
Russ White
7256280c1b
Merge pull request #1627 from qlyoung/bgp-autoshutdown
BGP auto-shutdown
2018-01-16 15:29:17 -05:00
Renato Westphal
9d57c91faf
Merge pull request #1635 from qlyoung/bgpd-remove-options-directly-connected
bgpd: disallow invalid config at cli layer
2018-01-16 10:11:39 -02:00
Quentin Young
f26845f9a6
bgpd: add neighbor autoshutdown
Adds ability to specify that peers should be administratively shutdown
when first configured.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-12 15:03:24 -05:00
Quentin Young
a174be631a
bgpd: disallow invalid config at cli layer
Remove the ability to attempt to configure a couple of options on
directly connected neighbors that don't make sense for them, as well as
the soft error handling code.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-12 15:00:37 -05:00
Mitesh Kanjariya
9bb77a5b3d
Merge branch 'master' into evpn-symmetric-routing 2018-01-11 09:00:23 -08:00
Russ White
d29715c48b
Merge pull request #1619 from donaldsharp/bgp_debugging
bgpd: 'summary' to show NoNeg if peer did not negotiate afi/safi
2018-01-10 20:00:51 -05:00
Russ White
bb469889e5
Merge pull request #1586 from donaldsharp/1585_fix
bgpd: Fix peer uptime display in milliseconds
2018-01-10 19:58:09 -05:00
Daniel Walton
95077abf60 bgpd: 'summary' to show NoNeg if peer did not negotiate afi/safi
If we have configured neighbor 1.1.1.1 for an afi/safi but they have not
activated that afi/safi with us then display "NoNeg" in the state column
of the summary output.  This is to make troubleshooting afi/safi
easier.

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2018-01-10 12:15:44 -05:00
Quentin Young
0112e9e0b9
bgpd: use atomic_* ops on _Atomic variables
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-09 15:40:48 -05:00
Donald Sharp
d3c7efede7 bgpd: Allow for deprecation of json bgpTimerUp
The bgpTimerUp value was incorrectly named, add
a correct name bgpTimerUpMsec and add some
code to allow for deprecation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-03 11:19:20 -05:00
Donald Sharp
e033027459 bgpd: Fix peer uptime display in milliseconds
For some reason bgp is calculating the peer uptime
in miliseconds incorrectly.  Additionally we have
the peer_uptime function call that should be doing this!
But since we've choosen different names for the json output
we cannot fix it at this point.

uptime contains the number of seconds of uptime here.  Just
multiply by 1k and display that( as peer_uptime does )

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

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-14 16:43:31 -05:00
Mitesh Kanjariya
94c2f693a4 bgpd: evpn enabled should only be checked for default instance
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14 10:57:07 -08:00
Mitesh Kanjariya
0b5131c951 bgpd: handle different sequence of bgp vrf create/delete
BGP VRF can be created/deleted either via config or via l3vni add/del.
We need to handle various sequences.

1. If user config is presented, an l3vni del should not delete the vrf instance
2. do not write bgp config in show running for auto created vrf
2. If l3vni present, disallow the cli for deleting bgp vrf instance
3. If l3vni is added and vrf config is present set the flags properly
4. if bgp vrf is configured unset the AUTO flag

Ticket: CM-18630
Review: CCR-6906
Testing: Manual

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

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-06 17:38:24 -05:00
Renato Westphal
2e4c229616 *: make clippy usage more consistent
Fixes #1511.

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

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

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

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

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

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

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:58 -05:00
Lou Berger
09c0e3c04a
Merge pull request #1448 from qlyoung/fix-peer-group-name
bgpd: fix `show bgp peer-group NAME`
2017-11-29 03:37:48 +08:00
Quentin Young
1d35f21875
bgpd: fix some vrf related cli
argv_find() searching for wrong thing

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-28 12:46:58 -05:00
Renato Westphal
fcaae8e4ec
Merge pull request #1474 from qlyoung/foreach_afi_safi
bgpd: use FOREACH_AFI_SAFI where possible
2017-11-22 13:54:30 -02:00
Quentin Young
05c7a1cc93
bgpd: use FOREACH_AFI_SAFI where possible
Improves consistency and readability.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-21 13:02:06 -05:00
Donald Sharp
a69ea8aeac bgpd: Only build json for community when needed
Building a communities json object every time is
both expensive and memory wasteful.  Modify
code to only build the json object when needed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-17 09:04:26 -05:00
Quentin Young
ff9959b0c7
bgpd: fix show bgp peer-group NAME
Fixes a bug whereby all peer-groups would be shown even when a
particular peer-group was specified for display.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-14 16:55:22 -05:00
Renato Westphal
f498ca82bd
Merge pull request #1370 from dslicenc/cm18408-bgp-timers
bgpd: fix various problems with hold/keepalive timers
2017-11-06 14:06:12 -02:00
Don Slice
d25e4efc52 bgpd: fix various problems with hold/keepalive timers
Problem reported that we weren't adjusting the keepalive timer
correctly when we negotiated a lower hold time learned from a
peer.  While working on this, found we didn't do inheritance
correctly at all.  This fix solves the first problem and also
ensures that the timers are configured correctly based on this
priority order - peer defined > peer-group defined > global config.
This fix also displays the timers as "configured" regardless of
which of the three locations above is used.

Ticket: CM-18408
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: CCR-6807
Testing-performed:  Manual testing successful, fix tested by
submitter, bgp-smoke completed successfully
2017-10-26 11:55:31 -04:00
Donald Sharp
7d4aea3007 bgpd: Allow route-map match peer... to have auto-complete
The match peer command doees not currently have an auto-complete
ability.  Let's add it in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-25 09:24:53 -04:00
Renato Westphal
efd7904eab *: add missing \n in some help strings
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-24 19:30:30 -02:00
Donald Sharp
86a55b996a bgpd: Display unsigned ints
We are storing data as an unsigned int and we should not
display it as a signed number.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-17 20:57:40 -04:00
Lou Berger
6660407d60 Merge pull request #1324 from donaldsharp/bgp_aspath
bgpd: Add ability to display information about bestpath in json
2017-10-16 14:51:02 -04:00
Donald Sharp
57a9c8a831 bgpd: Add ability to display information about bestpath in json
When retrieving information about neighbors or summary in json
add some information about what bestPath particulars we have for
this bgp session.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-11 08:16:51 -04:00
Lou Berger
2131d5cf65 bgpd: only allow unicast|multicast SAFIs in VRF/View (i.e., non-core) BGP instances
Signed-off-by: Lou Berger <lberger@labn.net>
2017-10-09 11:21:03 -04:00
Lou Berger
24345e82e8 bgpd: remove old/broken vpnv4 from of show bgp
Signed-off-by: Lou Berger <lberger@labn.net>
2017-10-05 10:11:49 -04:00
Daniel Walton
d114b977e9 *: support keywords that begin with uppercase letter
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

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

The only VARIABLE we had that wasn't already all uppercase was
ASN:nn_or_IP-address:nn
2017-09-14 18:07:30 +00:00
Donald Sharp
3f65c5b1f7 bgpd: Add various hash optimizations
1) Add hash names to all hash_create calls

2) Fix community_hash, ecommunity_hash and lcommunity_hash key
creation

3) Fix output of community and lcommunity iterators( why would
we want to see the memory location of the backet? ).

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-05 14:33:06 -04:00
Renato Westphal
5ba345ccb2 Merge pull request #1047 from dwalton76/bgpd-draft-ietf-grow-bgp-gshut-10
bgpd: implement draft-ietf-grow-bgp-gshut-10
2017-09-05 10:20:49 -03:00
Quentin Young
60466a63f2
*: fix style
Fixes style nits introduced by recent pull requests.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-30 11:27:11 -04:00
Donald Sharp
32592ffb4f Merge pull request #1056 from opensourcerouting/oldbits-0
"pathspace" options, vtysh-suid-cleanups, "vty_frame()"
2017-08-29 17:48:36 -04:00
David Lamparter
ea47320b1d bgpd: remove some deep nesting
Some of this was so egregiously stupid, I couldn't look at it without
gouging my eyes out...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-29 08:36:03 +02:00
David Lamparter
2b79110731 bgpd: get rid of afi_header_vty_out() & co.
afi_header_vty_out() is easily replaced with vty_frame(), which means we
can drop a whole batch of "int *write" args as well as the entirety of
bgp_config_write_family_header().

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

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-29 08:36:03 +02:00
Mitesh Kanjariya
09fdc88c8c Merge branch 'master' into dev-master 2017-08-28 18:19:03 -07:00
Daniel Walton
31d5efe2ea Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-draft-ietf-grow-bgp-gshut-10
Conflicts:
	bgpd/bgp_route.c
2017-08-28 06:59:38 -07:00