Commit Graph

962 Commits

Author SHA1 Message Date
Christian Hopps 3bb513c399 lib: adapt to version 2 of libyang
Compile with v2.0.0 tag of `libyang2` branch of:
https://github.com/CESNET/libyang

staticd init load time of 10k routes now 6s vs ly1 time of 150s

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-05-13 16:24:48 -04:00
Russ White 825f41b486
Merge pull request #8589 from idryzhov/bgp-cli-nb-fixes
bgp cli/nb fixes
2021-05-11 07:58:23 -04:00
David Lamparter c93d410837
Merge pull request #8642 from idryzhov/bgp-gr-no-oper
bgpd: don't return error for GR no-op commands
2021-05-09 19:24:10 +02:00
Igor Ryzhov 895b0d0ad6 bgpd: don't return error for GR no-op commands
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-06 21:33:14 +03:00
Donatas Abraitis ed0e57e3f0 bgpd: Create BGP alias names for community/large-community
Show alias name instead of numerical value in `show bgp <prefix>. E.g.:

```
root@exit1-debian-9:~/frr# vtysh -c 'sh run' | grep 'bgp community alias'
bgp community alias 65001:123 community-1
bgp community alias 65001:123:1 lcommunity-1
root@exit1-debian-9:~/frr#
```

```
exit1-debian-9# sh ip bgp 172.16.16.1/32
BGP routing table entry for 172.16.16.1/32, version 21
Paths: (2 available, best #2, table default)
  Advertised to non peer-group peers:
  65030
    192.168.0.2 from home-spine1.donatas.net(192.168.0.2) (172.16.16.1)
      Origin incomplete, metric 0, valid, external, best (Neighbor IP)
      Community: 65001:12 65001:13 community-1 65001:65534
      Large Community: lcommunity-1 65001:123:2
      Last update: Fri Apr 16 12:51:27 2021
exit1-debian-9#
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-05-05 16:37:00 +03:00
Donatas Abraitis 48c2039199
Merge pull request #8564 from rameshabhinay/bgp_tcp_mss
bgpd: Support tcp-mss for bgp neighbors
2021-05-05 13:45:39 +03:00
Igor Ryzhov 8acb8bff38
Merge pull request #8625 from c-po/graceful-restart 2021-05-05 09:44:25 +03:00
Christian Poessinger 5b899e99fe bgpd: changing graceful-restart parameters should not be considered as error
vtysh will return an informational message to the user that changing any
graceful-shutdown related parameter will require a peer reset. This is should
not be treated as an error message (resulting in a return code of 1) but
rather as a simple information to the user.

This fixes GitHub issue https://github.com/FRRouting/frr/issues/8403

$ vtysh -c configure -c 'router bgp 100' -c 'bgp graceful-restart'
Graceful restart configuration changed, reset all peers to take effect
$ echo $?
0

Signed-off-by: Christian Poessinger <christian@poessinger.com>
2021-05-04 23:32:41 +02:00
Donald Sharp 39d8dd2d17 bgpd: Consolidate dampening show run output with the rest of that code
For whatever reason the dampening show run code was outside the normal
loop of code that handles the afi/safi portion.  consolidate it into
the rest of the normal code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-04 16:25:58 -04:00
Donald Sharp dcc862322c bgpd: No need to check if we are a dynamic peer or not
bgp_config_write_peer_af already checks to see if we are
a dynamic peer.  No need to do so right before we call it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-04 16:25:58 -04:00
Donald Sharp 783492c7cd bgpd: Do not output peer doppleganger dampened output
When we are cycling through all peers and looking for
dampening data to dump, do not consider non-configed
peers( dopplegangers ).

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-04 16:25:58 -04:00
Abhinay Ramesh 4ab467017e bgpd: Support tcp-mss for bgp neighbors
Problem Statement:
=================
In scale setup BGP sessions start flapping.

RCA:
====
In virtualized environment there are multiple places where
MTU need to be set. If there are some places were MTU is not set
properly then there is chances that BGP packets get fragmented,
in scale setup this will lead to BGP session flap.

Fix:
====
A new tcp option is provided as part of this implementation,
which can be configured per neighbor and helps to set the TCP
max segment size. User need to derive the path MTU between the BGP
neighbors and set that value as part of tcp-mss setting.

1. CLI Configuration:
	[no] neighbor <A.B.C.D|X:X::X:X|WORD> tcp-mss (1-65535)

2. Running config
    frr# show running-config
    router bgp 100
     neighbor 198.51.100.2 tcp-mss 150       => new entry
     neighbor 2001:DB8::2 tcp-mss 400        => new entry

3. Show command
    frr# show bgp neighbors 198.51.100.2
    BGP neighbor is 198.51.100.2, remote AS 100, local AS 100, internal link
    Hostname: frr
      Configured tcp-mss is 150, synced tcp-mss is 138     => new display

4. Show command json output

    frr# show bgp neighbors 2001:DB8::2 json
    {
      "2001:DB8::2":{
        "remoteAs":100,
        "bgpTimerKeepAliveIntervalMsecs":60000,
        "bgpTcpMssConfigured":400,                               => new entry
        "bgpTcpMssSynced":388,                                  => new entry

Risk:
=====
Low - This is a config driven feature and it sets the max segment
size for the TCP session between BGP peers.

Tests Executed:
===============
Have done manual testing with three router topology.
1. Executed basic config and un config scenarios
2. Verified if the config is updated in running config
   during config and no config operation
3. Verified the show command output in both CLI format and
   JSON format.
4. Verified if TCP SYN messages carry the max segment size
   in their initial packets.
5. Verified the behaviour during clear bgp session.
6. done packet capture to see if the new segment size
   takes effect.

Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
2021-05-04 06:21:24 +00:00
Igor Ryzhov d3e3677096 bgpd: forbid modification of bgp instance type
If a user issues the following commands:
```
router bgp 65000 vrf red
router bgp 65000 view red
```
bgpd ends up having NB config inconsistent with actual data.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-29 16:50:29 +03:00
Igor Ryzhov ea1a5c00df bgpd: fix pending commit check
Calling nb_cli_pending_commit_check only makes sense after nb_cli_apply_changes.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-12 16:42:51 +03:00
Philippe Guibert 5b1b6b8bb2 bgpd: increase the maximum number of neighbors
increase the maximum number of neighbors in a bgp group.
Set the maximum value to 50000 instead of 5000.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-02 09:01:02 +02:00
Russ White 42ff46239b
Merge pull request #8267 from idryzhov/bgp-cli-fixes
bgp cli fixes
2021-03-30 10:40:43 -04:00
Russ White 40bf85a391
Merge pull request #8056 from jmmikkel/peertype
bgpd: Add "bgp bestpath peer-type multipath-relax"
2021-03-30 10:26:57 -04:00
Igor Ryzhov 4062b455a6 bgpd: don't use operational state in "router bgp" command
Instead of using bgp_get_default which refers to operational state, we
can check existence of the default node using only candidate config.
The same thing is done in "no router bgp" command.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-23 20:50:05 +03:00
Igor Ryzhov 45d1d7c9a2 bgpd: remove duplicated checks from CLI
Those checks are already done in NB layer.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-23 20:50:05 +03:00
Joanne Mikkelson ee88563ac2 bgpd: Add "bgp bestpath peer-type multipath-relax"
This new BGP configuration is akin to "bgp bestpath aspath
multipath-relax". When applied, paths learned from different peer types
will be eligible to be considered for multipath (ECMP). Paths from all
of eBGP, iBGP, and confederation peers may be included in multipaths
if they are otherwise equal cost.

This change preserves the existing bestpath behavior of step 10's result
being returned, not the result from steps 8 and 9, in the case where
both 8+9 and 10 determine a winner.

Signed-off-by: Joanne Mikkelson <jmmikkel@arista.com>
2021-03-23 08:59:33 -07:00
Rafael Zalamena 21bfce9827 bgpd: rework BFD integration
Remove old BFD API usage and replace it with the new one.

Highlights:

 - More shared code: the daemon gets notified with callbacks instead of
   having to roll its own code to find the notified sessions.

 - Less code to integrate with BFD.

 - Remove hidden commands to configure single / multi hop. Use
   protocol data instead.

   BGP can determine if a peer is single/multi hop according to the
   following criteria:

    a. If the IP address is a link-local address (single hop)

    b. The network is shared with peer (single hop)

    c. BGP is configured for eBGP multi hop / TTL security (multi hop)

 - Respect the configuration hierarchy:

    a. Peer configuration take precendence over peer-group
       configuration.

    b. When peer group configuration is removed, reset peer
       BFD configurations to defaults (unless peer had specific
       configs).

       Example:

         neighbor foo peer-group
         neighbor foo bfd profile X
         neighbor 192.168.0.2 peer-group foo
         neighbor 192.168.0.2 bfd
         ! If peer-group is removed the profile configuration gets
         ! removed from peer 192.168.0.2, but BFD will still enabled
         ! because of the neighbor specific bfd configuration.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-03-23 12:40:10 -03:00
Russ White 38981e4bba
Merge pull request #8120 from ton31337/feature/bgp_ipv6_default_activated
bgpd: Activate ipv6-unicast for peer automatically if globally defined
2021-03-23 09:36:43 -04:00
Igor Ryzhov 7a89002ab6
Merge pull request #8296 from chiragshah6/mdev
bgpd: convert send-community to transactional cli
2021-03-23 00:19:33 +03:00
Donatas Abraitis 37916b2b11
Merge pull request #8121 from opensourcerouting/macro-cleanup
*: require ISO C11 + semicolons after file-scope macros
2021-03-22 11:00:34 +02:00
Chirag Shah e48a9a90e0 bgpd: convert send-community to transactional cli
[no] neighbor <A.B.C.D|X:X::X:X|WORD> send-community

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-03-19 22:23:00 -07:00
Quentin Young 263e82b308
Merge pull request #8052 from ton31337/feature/show_bgp_peer-groups_json 2021-03-17 15:08:00 -04:00
David Lamparter 67b0f40c98 *: require semicolon after FRR_CFG_DEFAULT_*
... again ...

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:39 +01:00
David Lamparter 8451921b70 *: require semicolon after DEFINE_HOOK & co.
See previous commit.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:17 +01: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 e84c59af5b bgpd: Activate ipv6-unicast for peer automatically if globally defined
When you use a single BGP session for both IPv4 and IPv6 it's a bit
annoying going into ipv6 address-family and explicitly activating it.

Let's get this automatically if enabled with `bgp default ipv6-unicast`.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-02-28 19:49:43 +02: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