Commit Graph

934 Commits

Author SHA1 Message Date
Quentin Young
263e82b308
Merge pull request #8052 from ton31337/feature/show_bgp_peer-groups_json 2021-03-17 15:08:00 -04:00
Donald Sharp
a59803d060 bgpd: Attempting to activate unicast and labeled-unicast
Should return an actual useful error message.
Commit: 055679e915 messed this error message
up.

Fixes: #8246
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-16 22:38:13 -04:00
Donatas Abraitis
6f4eacf315 bgpd: Add JSON output for show ip bgp peer-group command
```
exit1-debian-9# show bgp peer-group

BGP peer-group test, remote AS 123
  Peer-group type is external
  Configured address-families: IPv4 Unicast; IPv6 Unicast;
  1 IPv4 listen range(s)
    192.168.100.0/24
  2 IPv6 listen range(s)
    2001:db8:1::/64
    2001:db8:2::/64
  Peer-group members:
    192.168.200.1  Active
    2001:db8::1  Active

BGP peer-group test3
  Peer-group type is external
  Configured address-families: IPv4 Unicast;
exit1-debian-9#
exit1-debian-9# show bgp peer-group json
{
  "test":{
    "remoteAs":123,
    "type":"external",
    "addressFamiliesConfigured":[
      "IPv4 Unicast",
      "IPv6 Unicast"
    ],
    "dynamicRanges":{
      "IPv4":{
        "count":1,
        "ranges":[
          "192.168.100.0\/24"
        ]
      },
      "IPv6":{
        "count":2,
        "ranges":[
          "2001:db8:1::\/64",
          "2001:db8:2::\/64"
        ]
      }
    },
    "members":{
      "192.168.200.1":{
        "status":"Active"
      },
      "2001:db8::1":{
        "status":"Active"
      }
    }
  },
  "test3":{
    "type":"external",
    "addressFamiliesConfigured":[
      "IPv4 Unicast"
    ]
  }
}
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-03-14 19:25:02 +02:00
Donatas Abraitis
ef56aee47c bgpd: Add BGP Extended message support
Implement https://www.rfc-editor.org/rfc/rfc8654.txt

```
> | jq '."192.168.10.25".neighborCapabilities.extendedMessage'
"advertisedAndReceived"
```

Another side is Bird:

```
BIRD 2.0.7 ready.
Name       Proto      Table      State  Since         Info
v4         BGP        ---        up     19:39:15.689  Established
  BGP state:          Established
    Neighbor address: 192.168.10.123
    Neighbor AS:      65534
    Local AS:         65025
    Neighbor ID:      192.168.100.1
    Local capabilities
      Multiprotocol
        AF announced: ipv4
      Route refresh
      Extended message
      Graceful restart
      4-octet AS numbers
      Enhanced refresh
      Long-lived graceful restart
    Neighbor capabilities
      Multiprotocol
        AF announced: ipv4
      Route refresh
      Extended message
      Graceful restart
      4-octet AS numbers
      ADD-PATH
        RX: ipv4
        TX:
      Enhanced refresh
    Session:          external AS4
    Source address:   192.168.10.25
    Hold timer:       140.139/180
    Keepalive timer:  9.484/60
  Channel ipv4
    State:          UP
    Table:          master4
    Preference:     100
    Input filter:   ACCEPT
    Output filter:  ACCEPT
    Routes:         9 imported, 3 exported, 8 preferred
    Route change stats:     received   rejected   filtered    ignored   accepted
      Import updates:              9          0          0          0          9
      Import withdraws:            2          0        ---          2          0
      Export updates:             11          8          0        ---          3
      Export withdraws:            0        ---        ---        ---          0
    BGP Next hop:   192.168.10.25
```

Tested at least as well with to make sure it works with backward compat.:
	ExaBGP 4.0.2-1c737d99.
	Arista vEOS 4.21.14M

Testing by injecint 10k routes with:
```
sharp install routes 172.16.0.1 nexthop 192.168.10.123 10000
```

Before extended message support:
```
2021/03/01 07:18:51 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:51 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:51 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:51 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:51 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:51 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:52 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:52 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:52 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:52 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:52 BGP: u1:s1 send UPDATE len 4096 (max message len: 4096) numpfx 809
2021/03/01 07:18:52 BGP: u1:s1 send UPDATE len 2186 (max message len: 4096) numpfx 427
2021/03/01 07:18:53 BGP: u1:s1 send UPDATE len 3421 (max message len: 4096) numpfx 674
```

After extended message support:
```
2021/03/01 07:20:11 BGP: u1:s1 send UPDATE len 50051 (max message len: 65535) numpfx 10000
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-03-04 21:32:36 +02:00
Philippe Guibert
a08032feae bgpd: accept (ext)community list sequence number set to 0
now that sequence number is configurable, there is no problem in
permitting to configure seq 0 sequence number.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-03-01 11:21:13 +01:00
Donatas Abraitis
2a267d5aca
Merge pull request #7460 from pguibert6WIND/remove_bgp_constraint
bgpd: upon bgp deletion, do not systematically ask to remove main bgp
2021-02-23 09:02:04 +02:00
Philippe Guibert
b8ad84d211 bgpd: add attribute-unchanged attribute to flowspec
flowspec address family can now use attribute-unchanged attribute.
This parameter is necessary when it comes to play with
route-server-client, as that latter command forces to change
attribute-unchanged nexthop.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-02-19 14:17:05 +01:00
Donald Sharp
2cbd181ac9 bgpd: When deleting a neighbor from a peer-group the PGNAME is optional
Currently when deleting a neighbor from a peer-group:
no neighbor A.B.C.D peer-group FOO

We must specify FOO, while A.B.C.D is sufficient enough of an
identifier to know what to do.

Make PGNAME optional on this command and just delete the peer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-11 13:35:22 -05:00
Pat Ruddy
0d020cd6d9 bgpd, lib: add mplsL3VpnVrf table
Add SNMP support for L3vpn Vrf table as defined in [RFC4382]
Keep track of vrf status for the table and for future traps.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-02-02 09:37:06 +00:00
Donald Sharp
4c3e9f072a bgpd: Remove hidden neighbor X route-map Y <in|out> command
This command was put in place to allow upgrades for the
neighbor command from the BGP_NODE and have it put
into the ipv4 uni node instead.  Since this
utterly kills the yang conversion.  I believe we need
to remove this.  Since people upgrading will just loose
the route-map applicatoin( if they are using such an old
config ) and RFC 8212 will come into play.  They'll figure
it out pretty fast.

Fixes: #7983
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-29 21:30:27 -05:00
Donatas Abraitis
749d0f27ab bgpd: Show NoNeg instead of bad parsing show bgp summary if disabled
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-28 16:36:15 +02:00
Donatas Abraitis
c854765f97 bgpd: Include local AS for JSON output in show bgp summary json cmd
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-28 16:36:14 +02:00
Donatas Abraitis
85eeb02915 bgpd: Add show bgp summary wide command
Add LocalAS into wide output and extend Desc to 64 chars instead of 20.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-28 16:35:16 +02:00
Russ White
72bd11663f
Merge pull request #7676 from ton31337/fix/show_ip_bgp_summary_description_truncate
bgpd: Strip neighbors's description to 20 chars in show bgp summary
2021-01-26 07:43:45 -05:00
Russ White
619a77da10
Merge pull request #7781 from chiragshah6/evpn_dev
[yang,bgpd]  convert neighbor prefix-list and route-map to transactional clis
2021-01-19 11:26:34 -05:00
Donald Sharp
2a059a5448 bgpd: Temp fix to allow numbered peers to be part of a peer group
Talking w/ Chirag and he indicated that we can just backout the command
to the original and things would `work` and they do( at least a quick test does )

Put this in place until a proper fix can be done.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-14 15:51:39 -05:00
Donald Sharp
484eabb1d7
Merge pull request #7439 from opensourcerouting/bgp-damp-profile2
bgpd: BGP route-flap dampening profiles for peers and peer groups
2021-01-12 11:45:41 -05:00
Chirag Shah
c668557533 bgpd: convert nbr rmap transactional cli
- Move vtysh handler to DEFPY
- Convert neighbor route-map command to transactional cli.
- After nb conversion, remove not used apis.
- Implement NB callbacks for afi-safis

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-01-09 23:06:02 -08:00
Chirag Shah
d9986d26c0 bgpd: convert neighbor plist to transactional cli
- Move vtysh handler to DEFPY
- Convert neighbor prefix-list command to transactional cli.
- After nb conversion, remove not used apis.
- implement NB apis for ipv4 afi-safis

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-01-09 23:06:01 -08:00
Donatas Abraitis
9af52ccf81 bgpd: Implement enhanced route refresh capability
16:40:49 BGP: 192.168.0.2: sending route-refresh (BoRR) for IPv4/unicast
16:40:51 BGP: 192.168.0.2: sending route-refresh (EoRR) for IPv4/unicast

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-05 20:19:41 +02:00
Russ White
ee117a8bd6
Merge pull request #7507 from ton31337/fix/bgpd_do_not_send_update_if_path_really_did_not_change
bgpd: Do not send BGP UPDATE if the route actually not changed
2021-01-05 10:26:18 -05:00
Donald Sharp
7d0d37de0c bgpd: Somewhat optimize string returns
There is no need for a cascading series of if statements
for the afi.  Clean it up slightly

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-17 16:39:35 -05:00
Donatas Abraitis
cb75bb3173 bgpd: Strip neighbors's description to 20 chars in show bgp summary
Also make sure we do not show descriptions with whitespace characters, just
take the first splitted by whitespace.

```
root@exit1-debian-9:~/frr# vtysh -c 'show run' | grep description
 neighbor 192.168.0.2 description 12346789012345678901234567890
root@exit1-debian-9:~/frr# vtysh -c 'show ip bgp summary' | grep 192.168.0.2
192.168.0.2     4      65030         0         0        0    0    0    never Idle (Admin)        0 1234678901234567890
```

```
root@exit1-debian-9:~/frr# vtysh -c 'show run' | grep description
 neighbor 192.168.0.2 description one two
root@exit1-debian-9:~/frr# vtysh -c 'show ip bgp summary' | grep 192.168.0.2
192.168.0.2     4      65030         0         0        0    0    0    never Idle (Admin)        0 one
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-12-17 10:06:35 +02:00
Russ White
a1333d8e47
Merge pull request #7735 from ton31337/fix/move_to_options_bgp_master_extra_zebra_data
bgpd: Use bgp master flags for send extra data to zebra
2020-12-15 07:14:17 -05:00
Donatas Abraitis
3a6290bdd1 *: Replace s_addr check agains 0 with INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-12-14 21:03:38 +02:00
Donatas Abraitis
ec0acb8052 bgpd: Use bgp master flags for send extra data to zebra
root@exit1-debian-9:~/frr# vtysh -c 'conf' -c 'bgp send-extra-data zebra'
root@exit1-debian-9:~/frr# vtysh -c 'show run' | grep send-extra
root@exit1-debian-9:~/frr# vtysh -c 'conf' -c 'no bgp send-extra-data zebra'
root@exit1-debian-9:~/frr# vtysh -c 'show run' | grep send-extra
no bgp send-extra-data zebra

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-12-14 20:33:41 +02:00
Donatas Abraitis
2adac2562a bgpd: Do not send BGP UPDATE if the route actually not changed
Reference: https://www.cmand.org/communityexploration

                     --y2--
                    /  |   \
  c1 ---- x1 ---- y1   |   z1
                    \  |   /
                     --y3--

1. z1 announces 192.168.255.254/32 to y2, y3.
2. y2 and y3 tags this prefix at ingress with appropriate
communities 65004:2 (y2) and 65004:3 (y3).
3. x1 filters all communities at the egress to c1.
4. Shutdown the link between y1 and y2.
5. y1 will generate a BGP UPDATE message regarding the next-hop change.
6. x1 will generate a BGP UPDATE message regarding community change.

To avoid sending duplicate BGP UPDATE messages we should make sure
we send only actual route updates. In this example, x1 will skip
BGP UPDATE to c1 because the actual route is the same
(filtered communities - nothing changes).

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-12-11 14:51:05 +02:00
Donald Sharp
9acb67cbf8 bgpd: Add global bgp suppress-fib-pending command
On top of the recent `bgp suppress-fib-pending which
was at a BGP_NODE level, add this command at the CONFIG_NODE
level as well and allow the command to apply to all instances
of bgp running.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-10 12:59:14 -05:00
Donald Sharp
e46723a50e bgpd, zebra: Add ability for bgp to send AS-Path information to zebra
Add a bit of code to allow bgp to send the AS-Path associated with
the route being installed to zebra so it can be displayed and
used as part of the `show ip route A` command in zebra.

eva# show ip route 20.0.0.0/11
Routing entry for 20.0.0.0/11
  Known via "bgp", distance 20, metric 0, best
  Last update 00:00:00 ago
  * 192.168.161.1, via enp39s0, weight 1
    AS-Path: 60000 64539 15096 6939 8075

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-08 09:07:21 -05:00
Donatas Abraitis
3cc92134a3
Merge pull request #7349 from opensourcerouting/bgp-delayopen
bgpd: RFC 4271 optional session attribute DelayOpenTimer
2020-12-03 08:26:44 +02:00
Philippe Guibert
999e803f31 bgpd: upon bgp deletion, do not systematically ask to remove main bgp
Dependencies between bgp instances is necessary only when it comes to
configure some specific services like ipv4-vpn, ipv6-vpn or l2vpn-evpn.
The list of config possibilities is listed, and an error is returned if
one of the above services is configured on the bgp vrf instance.

There may be some missingn services not covered. For clarification, here
are services configured on bgp vrf instances, while trying to delete
main bgp instance:
- if evpn main instance is the main bgp instance, and if evpn rt5
service is configured (with advertise command)
- if a vni is configured in the vrf instance
- if l3vpn import/export commands are solicitated for
importing/exporting entries from a vpnv4/6 network located on main bgp
instance. (in l3vpn, the main bgp instance is the location where vpnv4/6
sits).

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-12-02 10:17:06 +00:00
Philippe Guibert
aa72bd7e7f bgpd: add peer description for each afi/safi line in show summary
For each afi/safi of 'show bgp summary', display the peer description
each time needed. This information is useful, for instance in the case
of a device connected with multiple peers.
The topotest all_protocol_startup is changed accordingly.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-12-01 08:06:37 +00:00
Quentin Young
8395c1f865 bgpd: remove unused, uninitialized sockunion
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-11-25 12:51:52 -05:00
Donatas Abraitis
a616dd1fa0 bgpd: Show pfxSnt in JSON output for show bgp summary even if not established
spine1-debian-9# show ip bgp summary json
{
"ipv4Unicast":{
  "routerId":"192.168.3.2",
  "as":200,
  "vrfId":0,
  "vrfName":"default",
  "tableVersion":4,
  "ribCount":1,
  "ribMemory":184,
  "peerCount":1,
  "peerMemory":23384,
  "peers":{
    "192.168.0.1":{
      "hostname":"exit1-debian-9",
      "remoteAs":100,
      "version":4,
      "msgRcvd":5,
      "msgSent":6,
      "tableVersion":0,
      "outq":0,
      "inq":0,
      "peerUptime":"00:00:09",
      "peerUptimeMsec":9000,
      "peerUptimeEstablishedEpoch":1606206209,
      "pfxRcd":0,
      "pfxSnt":0,
      "state":"Idle (Admin)",
      "connectionsEstablished":1,
      "connectionsDropped":1,
      "idType":"ipv4"
    }
  },
  "failedPeers":1,
  "totalPeers":1,
  "dynamicPeers":0,
  "bestPath":{
    "multiPathRelax":"false"
  }
}
}

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-11-25 08:50:28 +02:00
Donatas Abraitis
0e1f8ab575 bgpd: Add peerState field into JSON output for show bgp summary
vtysh -c 'show bgp summary json' | \
> jq '.ipv4Unicast.peers."192.168.0.2".peerState'
"Passive"

vtysh -c 'show bgp summary json' | \
> jq '.ipv4Unicast.peers."192.168.0.2".state'
"Established"

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-11-24 16:04:45 +02:00
Donatas Abraitis
0b34518c56 Revert "bgpd: identify passive connections in JSON summary"
This reverts commit 266ae3aa53.
2020-11-24 15:32:35 +02:00
vdhingra
00908b7a8a bgpd: sh running config is not considering values provided via -e for max-paths
problem
1. run the bgp with -e1 option
2. c t
   router bgp 100
3. show running config
    !
     address-family ipv6 multicast
      maximum-paths 1
      maximum-paths ibgp 1
     exit-address-family
    !
address families should not dump maximum-paths if there
value is same as value provided at run time.

fix
if the maxpaths_ebgp value is same as multipath_num global
object, don't dump maximum-paths.

Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2020-11-20 02:32:18 -08:00
Donatas Abraitis
53a85efa51
Merge pull request #7554 from donaldsharp/sockunion2hostprefix_watch_returns
bgpd, lib, nhrpd, zebra: verify return of sockunion2hostprefix
2020-11-19 11:26:02 +02:00
Donald Sharp
0154d8ce45 bgpd, lib, nhrpd, zebra: verify return of sockunion2hostprefix
The return from sockunion2hostprefix tells us if the conversion
succeeded or not.  There are places in the code where we
always assume that it just `works`, since it can fail
notice and try to do the right thing.

Please note that failure of this function for most cases
of sockunion2hostprefix is highly highly unlikely as that
the sockunion was already created and tested elsewhere
it's just that this function can fail.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-18 11:04:27 -05:00
Donatas Abraitis
151c9d9ec6
Merge pull request #7548 from vincentbernat/feature/json-passive
bgpd: identify passive connections in JSON summary
2020-11-18 08:39:28 +02:00
Vincent Bernat
266ae3aa53 bgpd: identify passive connections in JSON summary
When using non JSON output, passive connections are marked with:

    BGP state = Active (passive)

However, such an information is not available in JSON output. This
commit adds that. It also adds "Active (NSF passive)" flag, like the
regular output.

Signed-off-by: Vincent Bernat <vincent@bernat.ch>
2020-11-17 20:29:31 +01:00
Chirag Shah
232c75cd03 bgpd: convert to yang modeled nbr cmds
Convert to (DEFUN_YANG) yang modeled neighbor configuration
commands to count them in batched execution as part of backoff timer
introduced as part of PR # 6727

These configuration commands already converted transactional cli
but missed to mark them as (DEFUN_YANG).

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-11-17 08:31:34 -08:00
Santosh P K
9b936c5c36
Merge pull request #4770 from kssoman/fib
Advertise FIB installed routes to bgp peers
2020-11-12 18:59:24 +05:30
Chirag Shah
555c8ab7ad bgpd: fix compiler warnings in nbr cmd
Addressed the gcc-10 buffer overflow warnings.
Put a sanity check of not using prefix for
neighbor update-source with interface option.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-11-06 11:43:36 -08:00
Soman K S
c208c58670 bgpd: Advertise FIB installed routes to bgp peers (Part 2)
* Added CLI command "[no] bgp suppress-fib-pending" to enable and
  disable suppress-fib-pending
* Send ZEBRA_ROUTE_NOTIFY_REQUEST to zebra when "bgp suppress-fib-pending"
  is enabled or disabled
* Define BGP_DEFAULT_UPDATE_ADVERTISEMENT_TIME which is the delay added
  to update group timer.
* Added error codes

Signed-off-by: kssoman <somanks@gmail.com>
2020-11-06 08:46:04 +05:30
David Schweizer
0221327c75
bgpd: vtysh commands for peer/group dampening profiles
Additional cli commands to add dampening profiles to peers / peer groups
and functions to save dampening configurations.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2020-11-02 16:30:02 +01:00
Chirag Shah
8611c7f3b6 bgpd: convert neighbor peer config to transactional
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-10-27 11:28:17 -07:00
Chirag Shah
04261decb9 bgpd: convert max prefix clis to transactional
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-10-27 11:27:53 -07:00
Chirag Shah
f4b8ec0721 bgpd: neighbor peergrp config to transactional cli
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-10-27 11:27:03 -07:00
Rafael Zalamena
7f2f38c62f
Merge pull request #7189 from maduri111/bgpd-conditional-adv
bgpd: conditional advertisement
2020-10-27 12:24:24 -03:00