Commit graph

4020 commits

Author SHA1 Message Date
Russ White 5e34d224ea
Merge pull request #5783 from ton31337/fix/bad_formatting_bgpd_gr
bgpd: Format properly `show bgp neighbors` for graceful restart stuff
2020-02-25 11:01:27 -05:00
Donatas Abraitis 8cf0a20551
Merge pull request #5768 from donaldsharp/bgp_nexthop
Bgp nexthop
2020-02-20 10:05:53 +02:00
Donatas Abraitis 40b0108887
Merge pull request #5788 from karamalla0406/large_comm
bgpd: support 'show ip bgp large-community" on default vrf
2020-02-19 21:03:59 +01:00
Donald Sharp 3dbe2b6061 bgpd: Add a better breadcrumb for when bgp is missconfiged
Currently During bgp open collision resolution if both
the router-id's are the same, we correctly follow
the RFC and close the connection.  The problem is of course
that there is no notification of the error in configuration
to the end user other than a subtle open debug message.

Explicitly call out the miss-configuration as an error message
as that this miss-config took several hours of debugging to notice.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-19 10:52:14 -05:00
Donald Sharp 1a21da6b01
Merge pull request #5802 from ton31337/feature/aggregate-address_origin_override
bgpd: Allow overriding ORIGIN for aggregate-address
2020-02-19 08:38:31 -05:00
Donatas Abraitis 0bdcc3e3ef
Merge pull request #5809 from donaldsharp/vrf_name
Print out vrf name as well as id
2020-02-19 14:23:32 +01:00
Sri Mohana Singamsetty dea8e5f275
Merge pull request #5801 from donaldsharp/bgp_peer_sort
Bgp peer sort
2020-02-17 21:39:37 -08:00
Sri Mohana Singamsetty e661b88e62
Merge pull request #5790 from chiragshah6/mdev
bgpd: format fields to bgp evpn vni json cmds
2020-02-17 21:39:16 -08:00
Donald Sharp 4765870ee7
Merge pull request #5807 from ton31337/fix/do_not_show_failed_if_shutdown
bgpd: Show the real reason why the peer is failed
2020-02-17 09:29:28 -05:00
Jafar Al-Gharaibeh b5a3c5ef9f
Merge pull request #5815 from donaldsharp/feb_sa_stuff
bgpd: Fix up a couple of new SA issues found
2020-02-16 23:41:55 -06:00
Donald Sharp bed8d78bae bgpd: Add a couple more spaces for output on MsgRcvd and MsgSent
annie# show bgp ipv4 uni summ
BGP router identifier 192.168.201.136, local AS number 64539 vrf-id 0
BGP table version 22458946
RIB entries 1458006, using 178 MiB of memory
Peers 4, using 68 KiB of memory

Neighbor               V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
45.33.5.119            4          0       0       0        0    0    0    never       Active
65.19.134.122          4      15096 4611832  108292        0    0    0 6d22h55m       800670
107.13.46.23           4          0       0       0        0    0    0    never      Connect
robot(192.168.201.139) 4      64540 11159975 11365599        0    0    0 05w2d05h      Connect

Total number of neighbors 4

On very busy systems The column output for MsgRcvd and MsgSent can quickly move past 7 columns.
Add a couple more to allow for even display.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-16 20:38:13 -05:00
Donatas Abraitis 07d1e5d99d bgpd: Show the real reason why the peer is failed
If the peer was shutdown locally, it doesn't show up as admin. shutdown.
Instead it's treated as "Waiting for peer OPEN".

The same applies to when the peer reaches maximum-prefix count.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-14 23:23:52 +02:00
Donald Sharp 69337c345e bgpd: Use the enum properly in a switch for rpki commands
During route-map processing we return an enum, the rpki
code was doing some extra gyrations that were unnecessary.
Simplify.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-14 15:38:38 -05:00
Donald Sharp 8c9769e03b bgpd: Ensure we don't crash when registering RA's
There exists a code path that the ifp can be NULL.
Prevent an accident.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-14 15:35:37 -05:00
Donald Sharp 137147c66a bgpd: Print out vrf name as well as id
The vrf_id is not enough context for people.  Use the
actual name of the vrf if you can.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-14 08:44:27 -05:00
Mark Stapp 9df7724949
Merge pull request #5806 from ton31337/fix/remove_break_after_return
*: Remove break after return
2020-02-13 11:32:27 -05:00
Donatas Abraitis a01bc07e1e
Merge pull request #5787 from karamalla0406/rmac_check
bgpd: RFC compliance wrt invalid RMAC, GWIP, ESI and VNI
2020-02-13 17:50:16 +02:00
Donatas Abraitis 752022670a *: Remove break after return
Just a deadcode.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-13 15:39:54 +02:00
Donatas Abraitis 229757f195 bgpd: Allow overriding ORIGIN for aggregate-address
Override ORIGIN attribute if defined.
E.g.: Cisco and Juniper set ORIGIN for aggregated address
to IGP which is not what rfc4271 says.

This enables the same behavior, optionally.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-13 11:07:40 +02:00
Sri Mohana Singamsetty 60092db3fd
Merge pull request #5798 from donaldsharp/bgp_packet_reformat
bgpd: Reformat bpacket_reformat_for_peer
2020-02-12 16:25:49 -08:00
Donald Sharp 469cbb0ffe bgpd: Further peer_sort refinements
Track the returned peer_sorted value and use it where
we can and recalculate where necessary.

This is an effort to reduce the amount of work done here.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-12 14:45:06 -05:00
Donald Sharp bf0d28dcf7 bgpd: Create peer_sort_lookup()
The act of peer_sort() being called always set this value
even when we are just looking it up.  We need to seperate
out the idea of lookup from set.

For those places that this is immediately obvious that
this is a lookup switch over to using this function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-12 14:45:06 -05:00
Donald Sharp f041034e44 bgpd: Reformat bpacket_reformat_for_peer
This function was heavily indented, reformat to reduce indentation
levels a bit.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-12 12:06:07 -05:00
Donatas Abraitis a53ca37b89 bgpd: Format properly show bgp neighbors for graceful restart stuff
Before:

```
  Graceful restart informations:
    End-of-RIB send: IPv4 Unicast
    End-of-RIB received: IPv4 Unicast
    Local GR Mode  : Helper*
    Remote GR Mode : Helper
    R bit          : False
    Timers :
     Configured Restart Time(sec)  : 120
     Received Restart Time(sec)    : 120
    IPv4 Unicast :
     F bit                 : False
     End-of-RIB Received   : Yes
     End-of-RIB Send       : Yes
     EoRSentAfterUpdate   : Yes
     Timers:
      Configured Stale Path Time(sec)        : 360
```

After:

```
  Graceful restart informations:
    End-of-RIB send: IPv4 Unicast
    End-of-RIB received: IPv4 Unicast
    Local GR Mode: Helper*
    Remote GR Mode: Helper
    R bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 120
    IPv4 Unicast:
      F bit: False
      End-of-RIB sent: Yes
      End-of-RIB sent after update: Yes
      End-of-RIB received: Yes
      Timers:
        Configured Stale Path Time(sec): 360
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-12 11:00:45 +02:00
Kishore Aramalla 4d6784636c bgpd: support 'show ip bgp large-community" on default vrf
This command works only in the case of vrf/view.
Adding support for default VRF as well.

Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
2020-02-11 12:38:25 -08:00
Kishore Aramalla c6ec0c745a bgpd: RFC compliance wrt invalid RMAC, GWIP, ESI and VNI
A route where ESI, GW IP, MAC and Label are all zero at the same time SHOULD
be treat-as-withdraw.
Invalid MAC addresses are broadcast or multicast MAC addresses. The route
MUST be treat-as-withdraw in case of an invalid MAC address.

As FRR support Ethernet NVO Tunnels only.
Route will be withdrawn when ESI, GW IP and MAC are zero or Invalid MAC

Test cases:
1) ET-5 route with valid RMAC extended community
2) ET-5 route no RMAC extended community
3) ET-5 route with Multicast MAC in RMAC extended community
4) ET-5 route with Broadcast MAC in RMAC extended community

Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
2020-02-11 12:36:50 -08:00
Quentin Young f94ed830df
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
bgpd: Format properly `show bgp summary failed`
2020-02-11 14:45:40 -05:00
Chirag Shah 0b509723a0 bgpd: change evpn vni json field format
Change advertiseSviMacip to advertiseSviMacIp in
json output.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 11:38:26 -08:00
Chirag Shah 37ae1adbfa bgpd: readjust fields in evpn vni json cmd
1) Keep consistant field name, such as
"inKernel".
2) Keep fields order same for both outputs.

Testing Done:

TORS1# show bgp l2vpn evpn vni json
{
  "advertiseGatewayMacip":"Disabled",
  "advertiseSviMacip":"Disabled",
  "advertiseAllVnis":"Enabled",
  "flooding":"Head-end replication",
  "numVnis":8,
  "numL2Vnis":5,
  "numL3Vnis":3,
  "1002":{
    "vni":1002,
    "type":"L2",
    "inKernel":"True",
    "rd":"27.0.0.15:8",
    "originatorIp":"27.0.0.15",
    "mcastGroup":"0.0.0.0",
    "advertiseGatewayMacip":"Disabled",
    "advertiseSviMacip":"Disabled",
    "importRTs":[
      "5550:1002"
    ],
    "exportRTs":[
      "5550:1002"
    ]
  },
}

TORS1# show bgp l2vpn evpn vni 1002 json
{
  "vni":1002,
  "type":"L2",
  "inKernel":"True",
  "rd":"27.0.0.15:8",
  "originatorIp":"27.0.0.15",
  "mcastGroup":"0.0.0.0",
  "advertiseGatewayMacip":"Disabled",
  "advertiseSviMacip":"Disabled",
  "importRts":[
    "5550:1002"
  ],
  "exportRts":[
    "5550:1002"
  ]
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 11:11:28 -08:00
Chirag Shah 7c9cb387ff bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.

Ticket:CM-28328
Reviewed By:
Testing Done:

TORS1# show bgp l2vpn evpn vni json
{
  "advertiseGatewayMacip":"Disabled",
  "advertiseSviMacip":"Disabled",
  "advertiseAllVnis":"Enabled",
  "flooding":"Head-end replication",
  "numVnis":8,
  "numL2Vnis":5,
  "numL3Vnis":3,
  "1002":{
    "vni":1002,
    "type":"L2",
    "inKernel":"True",
    "originatorIp":"27.0.0.15",
    "rd":"27.0.0.15:8",
    "mcastGroup":"0.0.0.0",
    "advertiseGatewayMacip":"Disabled",
    "advertiseSviMacip":"Disabled",
    "importRTs":[
      "5550:1002"
    ],
    "exportRTs":[
      "5550:1002"
    ]
  },
}

TORS1# show bgp l2vpn evpn vni 1002 json
{
  "vni":1002,
  "type":"L2",
  "kernelFlag":"Yes",
  "rd":"27.0.0.15:8",
  "originatorIp":"27.0.0.15",
  "mcastGroup":"0.0.0.0",
  "advertiseGatewayMacip":"Disabled",
  "advertiseSviMacip":"Disabled",
  "importRts":[
    "5550:1002"
  ],
  "exportRts":[
    "5550:1002"
  ]
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 11:11:28 -08:00
Donatas Abraitis e91c24c8c2 bgpd: Format properly show bgp summary failed
Before:
```
Neighbor        EstdCnt DropCnt ResetTime Reason
192.168.0.1           0       0    never  Waiting for peer OPEN
```

After:
```
Neighbor        EstdCnt DropCnt ResetTime Reason
192.168.0.1           0       0     never Waiting for peer OPEN
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-11 18:05:02 +02:00
Russ White 8d61adbf07
Merge pull request #5785 from ton31337/fix/replace_gtsm_hops_to_readable_macros
bgpd: Use readable macros for peer->gtsm_hops instead of literals
2020-02-11 10:40:35 -05:00
Russ White 35f50b9305
Merge pull request #5744 from ton31337/fix/thread-as-withdraw_attributes
bgpd: Update some attributes how they are handled if malformed
2020-02-11 10:04:19 -05:00
Donatas Abraitis 724935d5a2
Merge pull request #5789 from donaldsharp/bgp_ebgp_reason
bgpd: Update failed reason to distinguish some NHT scenarios
2020-02-11 10:42:23 +02:00
Donald Sharp 1e91f1d119 bgpd: Update failed reason to distinguish some NHT scenarios
Current failed reasons for bgp when you have a peer that
is not online yet is `Waiting for NHT`, even if NHT has
succeeded.  Add some code to differentiate this.

eva# show bgp ipv4 uni summ failed
BGP router identifier 192.168.201.135, local AS number 3923 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 2, using 43 KiB of memory
Neighbor        EstdCnt DropCnt ResetTime Reason
192.168.44.1          0       0    never  Waiting for NHT
192.168.201.139       0       0    never  Waiting for Open to Succeed
Total number of neighbors 2
eva#

eva# show bgp nexthop
Current BGP nexthop cache:
 192.168.44.1 invalid, peer 192.168.44.1
  Must be Connected
  Last update: Mon Feb 10 19:05:19 2020

 192.168.201.139 valid [IGP metric 0], #paths 0, peer 192.168.201.139

So 192.168.201.139 is a peer for a connected route that has not been
created on .139, while 44.1 nexthop tracking has not succeeded yet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-10 19:46:48 -05:00
Renato Westphal 4b08a72ed1
Merge pull request #5763 from ton31337/fix/return_without_parent
*: Remove parenthesis on return for constants
2020-02-10 18:49:06 -03:00
Sri Mohana Singamsetty a41de4cad5
Merge pull request #5770 from ton31337/fix/remove_bgp_flag_functions
bgpd: Replace bgp_flag_* to [UN]SET/CHECK_FLAG macros
2020-02-10 08:31:59 -08:00
Donatas Abraitis e2521429a6 bgpd: Use readable macros for peer->gtsm_hops instead of literals
Do the same way like BGP_DEFAULT_TTL

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-10 16:23:09 +02:00
Donatas Abraitis 95f7965d09 *: Remove parenthesis on return for constants
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-09 14:21:56 +02:00
Ameya Dharkar 4e72ff729d bgpd: EVPN crash because of incorrect nexthop for IPv6 prefix
RCA:
When we install IPv6 prefix imported from EVPN RT-5 in vrf, nexthop of the IPv6
route should be IPv4 mapped IPv6 address. In function
install_evpn_route_entry_in_vrf, we generate a new attribute with IPv4 mapped
IPv6 nexthop, but we use parent->attr while creating the actual route.
Thus, Ipv4 nexthop is assigned to this route.
Because of this incorrect nexthop, we observed a crash in function
update_ipv6nh_for_route_install.

Fix:
Pass the new attribute with Ipv4 mapped Ipv6 nexthop to
bgp_create_evpn_bgp_path_info

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2020-02-06 13:51:46 -08:00
Donatas Abraitis 892fedb611 bgpd: Replace bgp_flag_* to [UN]SET/CHECK_FLAG macros
Most of the code uses macros, thus let's keep the code unified.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 17:11:38 +02:00
Donald Sharp 8c5c49ace8 bgpd: Cleanup compile error?
For some reason we are getting a compile error around a variable I didn't
touch in the other commits.  Make it happy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-06 08:23:13 -05:00
Donald Sharp c4fb250491 bgpd: Fix up some poor formatting
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-06 07:24:53 -05:00
Donald Sharp e26c305530 bgpd: Store data in final temp variable
There is no need to have a temp variable to then store that
data in another temporary variable.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-06 07:24:53 -05:00
Donald Sharp af34d2da11 bgpd: bgp_nexthop_self optimize afi and new_afi handling
The new_afi and afi were being used over and over.  Switch
to the end result we want and just use that from the get go.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-06 07:24:53 -05:00
Donald Sharp 2ec802d173 bgpd: Remove prefix pointer creation
The creation of a prefix pointer is unnecessary.  Save the
prefix as part of the actual data structure.  This will
reduce the data needed by 8 bytes per nexthop stored.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-06 07:24:53 -05:00
Donald Sharp e61f7c0a10 bgpd: show martian nexthops improve code flow
The show martian nexthops command for bgp had some strangely
duplicated code.  Refactor.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-06 07:24:53 -05:00
Donatas Abraitis 975a328e2e *: Replace s_addr 0 => INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 09:00:12 +02:00
Donatas Abraitis 85c58de773
Merge pull request #5761 from qlyoung/fix-bgp-gr-cruft
Fix bgp gr style
2020-02-06 08:16:25 +02:00
Donald Sharp 792465c09f
Merge pull request #5104 from opensourcerouting/route-map-nbv2
lib: migrate route map to use northbound
2020-02-05 11:54:21 -05:00