Commit Graph

1142 Commits

Author SHA1 Message Date
Donald Sharp
1af6e82b81 bgpd: Remove newlines from zlog, they are not allowed
commit: a486300b26
introduced newlines in zlog_XX messaging.  Not allowed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-26 10:06:38 -04:00
Russ White
3bf3144517
Merge pull request #11523 from pguibert6WIND/bgp_no_retain
Bgp no retain
2022-07-26 08:50:59 -04:00
Donald Sharp
c3aaa89a44 bgpd: Convert thread_cancel to THREAD_OFF and use THREAD_ARG
Just convert all uses of thread_cancel to THREAD_OFF.  Additionally
use THREAD_ARG instead of t->arg to get the arguement.  Individual
files should never be accessing thread private data like this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:30:49 -04:00
Donald Sharp
fa5806c318 bgpd: Remove various macros that overlap THREAD_OFF
Let's just use THREAD_OFF consistently in the code base
instead of each daemon having a special macro that needs to
be looked at and remembered what it does.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:36 -04:00
Donald Sharp
a6de2db239
Merge pull request #11646 from opensourcerouting/fix/memory_show
bgpd: Show extended communities memory consumption
2022-07-19 14:13:17 -04:00
Russ White
96575121cf
Merge pull request #11611 from fdumontet6WIND/FMJA/desc_mess
bgp:change in showing neighbor description
2022-07-19 08:38:53 -04:00
Donatas Abraitis
145f7619aa bgpd: Show extended communities memory consumption
Just fix the description because it's wrong.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-19 14:06:17 +03:00
Francois Dumontet
64541ffa8f bgp:change in showing neighbor description
currently "show bgp summary" and "sho bgp summary wide" commands
provide a description string until a whitespace is occuring this
respectively with size limits of 20 and 60 chars

now theses two commands are providing strings with all
characters until the last witespace before size limit

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2022-07-18 14:12:23 +02:00
Donatas Abraitis
00e6edb97d bgpd: Add constants for some repetitive CLI strings
"Address Family\n"
"Address Family modifier\n"

Before:

```
donatas-laptop(config-router)# address-family ipv4
  <cr>
  flowspec         Address Family Modifier
  labeled-unicast  Address Family modifier
  multicast        Address Family modifier
  unicast          Address Family Modifier
  vpn              Address Family modifier
```

After:

```
donatas-laptop(config-router)# address-family
  ipv4   Address Family
  ipv6   Address Family
  l2vpn  Address Family
donatas-laptop(config-router)# address-family ipv4
  <cr>
  flowspec         Address Family modifier
  labeled-unicast  Address Family modifier
  multicast        Address Family modifier
  unicast          Address Family modifier
  vpn              Address Family modifier
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-18 10:12:57 +03:00
Philippe Guibert
a486300b26 bgpd: implement retain route-target all behaviour
A new command is available under SAFI_MPLS_VPN:

With this command, the BGP vpnvx prefixes received are
not kept, if there are no VRF interested in importing
those vpn entries.

A soft refresh is performed if there is a change of
configuration: retain cmd, vrf import settings, or
route-map change.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-07-18 08:57:19 +02:00
Quentin Young
ecf2b628d9 bgpd: rename update_type enum values
These values were named WITHDRAW and UPDATE. Yeah, you guessed it, those
are already #define's elsewhere (bgp_debug.h). Hilarity ensues.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-07-01 15:22:04 +03:00
Russ White
9a4b3d5467
Merge pull request #11486 from taspelund/bgp_timer_always_on
bgpd: include 0 in configured hold/keepalive
2022-06-28 16:54:09 -04:00
Donatas Abraitis
7dddd1f733 bgpd: Make sure peer-groups/unnumbered work too with BGP role
Just adding a support for peer-groups, because now it's not possible to
configure BGP role for peer-groups.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-28 18:32:11 +03:00
Trey Aspelund
e93d5c298d bgpd: include 0 in configured hold/keepalive
The default keepalive/hold timers are always exposed via this commit:
```
commit 9b1b96233d (origin/bgp_timer_always_on)
Author: Trey Aspelund <taspelund@nvidia.com>
Date:   Mon Jun 27 23:20:33 2022 +0000

    bgpd: always display keepalive/hold intervals

    `show bgp neighbors <peer> [json]` was only displaying the configured
    keepalive and holdtime intervals when they differed from the default
    values.  Since default config is still config, let's make sure these
    values are always displayed.

    Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
```

However it mistakenly changed the logic to only display the peer's
timers if the configured value was non-zero.  This updates the logic to
check PEER_FLAG_TIMER to determine if the values were configured,
given 0 is a valid value (to disable keepalives).

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2022-06-28 14:58:51 +00:00
Lou Berger
613025ef10
Merge pull request #11093 from donaldsharp/allow_martians
Allow martians
2022-06-28 10:38:57 -04:00
Russ White
fe9a6ecc4a
Merge pull request #11483 from taspelund/bgp_timer_always_on
bgpd: always display keepalive/hold intervals
2022-06-28 07:00:30 -04:00
Trey Aspelund
9b1b96233d bgpd: always display keepalive/hold intervals
`show bgp neighbors <peer> [json]` was only displaying the configured
keepalive and holdtime intervals when they differed from the default
values.  Since default config is still config, let's make sure these
values are always displayed.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2022-06-27 23:37:21 +00:00
Donatas Abraitis
83194f394b bgpd: Use uin64_t for peer->flags
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-27 17:22:54 +03:00
Donatas Abraitis
f646c17a43
Merge pull request #11426 from error2407/open_policy
bgpd: Add RFC9234 implementation
2022-06-27 09:57:29 +03:00
Donald Sharp
8666265e2e bgpd: Add bgp allow-martian-nexthop command
The command `debug bgp allow-martian` is not actually
a debug command it's a command that when entered allows
bgp to not reset a peering when a martian nexthop is
passed in the nlri.

Add the `bgp allow-martian-nexthop` command and allow it to be
used.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-24 07:45:46 -04:00
Eugene Bogomazov
8f2d6021f8 bgpd: Add patches for RFC9234 implementation
This commit fixes some issues that were noted by the reviewer

Signed-off-by: Eugene Bogomazov <eb@qrator.net>
2022-06-21 17:41:53 +03:00
Donatas Abraitis
47e1288431 *: Replace sockunion2str => %pSU
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-21 13:34:56 +03:00
Donald Sharp
1e592331cb bgpd: Display useful values when using json for missing neighbor state
When a peer has not established connection yet, these values:
`hostLocal`, `portLocal`, `hostForeign`, `portForeign` might
not have any values and json output will not display anything
for them.  Modify the code to display some nominal values in
this situation so that parsers are not surprised.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-17 13:43:30 -04:00
Eugene Bogomazov
d864dd9eb1 bgpd: Add RFC9234 implementation
RFC9234 is a way to establish correct connection roles (Customer/
Provider, Peer or with RS) between bgp speakers. This patch:
- Add a new configuration/terminal option to set the appropriate local
role;
- Add a mechanism for checking used roles, implemented by exchanging
the corresponding capabilities in OPEN messages;
- Add strict mode to force other party to use this feature;
- Add basic support for a new transitive optional bgp attribute - OTC
(Only to Customer);
- Add logic for default setting OTC attribute and filtering routes with
this attribute by the edge speakers, if the appropriate conditions are
met;
- Add two test stands to check role negotiation and route filtering
during role usage.

Signed-off-by: Eugene Bogomazov <eb@qrator.net>
2022-06-17 13:14:46 +03:00
Donald Sharp
be9778a3c1
Merge pull request #11395 from opensourcerouting/fix/autocompete_for_rmap_bgp
*: Use autocomplete for route-maps under commands that require it
2022-06-14 10:48:36 -04:00
Donatas Abraitis
70dd370f5a *: Use autocomplete for route-maps under commands that require it
For example:

```
donatas-laptop# show bgp ipv4 unicast neighbors 127.0.0.2 advertised-routes route-map ?
  RMAP_NAME  Name of the route map
       testas2 testas

donatas-laptop(config)# router bgp
donatas-laptop(config-router)# address-family ipv4
donatas-laptop(config-router-af)# redistribute connected route-map ?
  RMAP_NAME  Pointer to route-map entries
       testas2 testas

donatas-laptop(config-router-af)# network 192.168.0.0/23 route-map ?
  RMAP_NAME  Name of the route map
       testas2 testas
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-13 21:00:51 +03:00
Donatas Abraitis
be8d17335f bgpd: Show TTL value unconditionally for neighbors
If GTSM configured - show this value, otherwise TTL.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-10 16:55:02 +03:00
Donatas Abraitis
8cfa1e7846 bgpd: Simplify BGP community alias handling
Also, warn in CLI an operator if we are trying to overwrite an existing
community alias with an existing alias.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-26 20:15:35 +03:00
Donatas Abraitis
d13d137a1b bgpd: Fix memory leak for BGP community alias in CLI
Before:
```
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :      100     40        4000      100      4000
Large Community value         :      100     12        2400      100      2400
root@spine1-debian-11:~/frr# for x in $(seq 1 100); do vtysh -c 'conf' -c 'bgp community alias 123:123:123 testas' > /dev/null; done
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :      200     40        8000      200      8000
Large Community value         :      200     12        4800      200      4800
root@spine1-debian-11:~/frr# for x in $(seq 1 100); do vtysh -c 'conf' -c 'bgp community alias 123:123:123 testas' > /dev/null; done
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :      300     40       12000      300     12000
Large Community value         :      300     12        7200      300      7200
root@spine1-debian-11:~/frr#
```

After:
```
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :        0     40           0        1        56
Large Community display string:        0   8192           0        1      8200
Large Community value         :        0     12           0        1        24
root@spine1-debian-11:~/frr# for x in $(seq 1 100); do vtysh -c 'conf' -c 'bgp community alias 123:123:123 testas' > /dev/null; done
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :        0     40           0        1        56
Large Community display string:        0   8192           0        1      8200
Large Community value         :        0     12           0        1        24
root@spine1-debian-11:~/frr#
```

After we call [l]community_str2com(), we should free the memory.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-26 15:31:35 +03:00
Sri Mohana Singamsetty
93480825fb
Merge pull request #11204 from anlancs/fix/bgpd-check-vnihash
bgpd: remove unnecessary check for evpn
2022-05-19 09:38:10 -07:00
anlan_cs
f33bf7c0eb bgpd: remove unnecessary check for evpn
Since `bgp->vnihash` is naturally non-NULL, remove check for this field.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-15 01:32:14 -04:00
Pavel Shirshov
425bd64be8 bgpd: Allow bgp to control the DSCP session TOS value
Allow BGP to control the TOS DSCP value in the tcp header
via a new command at the bgp global level `bgp session-dscp <0-63>`

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Pavel Shirhov <pavelsh@microsoft.com>
2022-05-13 14:14:35 -04:00
Donald Sharp
69df174216
Merge pull request #11188 from opensourcerouting/fix/argv_find
bgpd: Cleanup
2022-05-13 07:35:57 -04:00
Donald Sharp
aa53c036c0 bgpd: Change single value bitfield to a bool
The maxpaths same_clusterlen value was a uint16_t
with a single bit being used.  No other values are
being stored.  Let's remove the bitfield and simplify
to a bool.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-12 10:20:28 -04:00
Donatas Abraitis
9b01d28988 bgpd: Check argv_find() value instead of the index
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-12 10:25:02 +03:00
Donatas Abraitis
e34627f9c7 bgpd: Reuse index from argv_find only if found
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-12 09:57:13 +03:00
Donatas Abraitis
1ae314be4f bgpd: Send Hard Reset Notification for BGP_NOTIFY_CEASE_ADMIN_RESET
`clear bgp neighbor` should send Hard Reset and graceful restart should be
activated. Let's make this adjustable.

https://datatracker.ietf.org/doc/html/rfc8538#section-5.1

   +-------+------------------------------------+----------------------+
   | Value |                Name                |  Suggested Behavior  |
   +-------+------------------------------------+----------------------+
   |   1   | Maximum Number of Prefixes Reached |      Hard Reset      |
   |   2   |      Administrative Shutdown       |      Hard Reset      |
   |   3   |         Peer De-configured         |      Hard Reset      |
   |   4   |        Administrative Reset        | Provide user control |
   |   5   |        Connection Rejected         |    Graceful Cease    |
   |   6   |     Other Configuration Change     |    Graceful Cease    |
   |   7   |  Connection Collision Resolution   |    Graceful Cease    |
   |   8   |          Out of Resources          |    Graceful Cease    |
   |   9   |             Hard Reset             |      Hard Reset      |
   +-------+------------------------------------+----------------------+

Enabled by default.

Co-authored-by: Biswajit Sadhu <biswajit.sadhu@gmail.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-10 09:04:25 +03:00
Russ White
2cf70f4ee0
Merge pull request #11147 from opensourcerouting/feature/gr_n-bit_cli_knob
bgpd: Add CLI knob to enable graceful restart for BGP notifications
2022-05-09 19:35:14 -04:00
Donatas Abraitis
f2ca5c5b95 bgpd: Add CLI knob to enable graceful restart for BGP notifications
N-bit flag should be exchanged in BGP OPEN messages, not only when the
bgpd is restarted/started.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-05 12:35:03 +03:00
Donald Sharp
c4786405b5 bgpd: Refuse to let interfaced peering to change capability extended-nexthop
Do not interface based peers change anything about when a
[no] neighbor <interface> capability extended-nexthop
is entered.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-04 07:51:20 -04:00
Donald Sharp
8e89adc1ed bgpd: enhanced capability is always turned on for interface based peers
FRR is displaying that the peer enhanced capability command is not
turned on when the interface is part of a peer group.  Saving the
config and then reloading actually turns it off.

Fix the code so that FRR does not display the enhanced capability
for interface based peers.

Fixes: #11108
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-04 07:51:14 -04:00
Donatas Abraitis
eea685b6d3 bgpd: Implement CEASE/Hard Reset notification
Also, add N-Bit (Notification) flag for Graceful Restart.

This is a preparation for RFC8538.

More information: https://datatracker.ietf.org/doc/html/rfc8538

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-02 09:43:40 +03:00
Donatas Abraitis
54394daa2d bgpd: Rename graceful restart constants for R-bit capabilities
Just to better understand what they mean.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-27 22:32:54 +03:00
Russ White
7c6316c521
Merge pull request #11013 from opensourcerouting/fix/convert_bgp_peer_sort_t_to_enum
bgpd: typedef enum to enum
2022-04-13 14:52:58 -04:00
Donatas Abraitis
cd876f8a78
Merge pull request #10935 from anlancs/zebra-mh-esi-warning
zebra: adjust the warnings for ESI of evpn-mh
2022-04-13 15:45:07 +03:00
Donatas Abraitis
9c2fd3fe44 bgpd: Convert vpn_policy_direction_t to enum
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:13:55 +03:00
Russ White
695c24c3b0
Merge pull request #10994 from opensourcerouting/fix/autocomplete_for_advertise_map
bgpd: Use autocomplete for route-map under conditional advertisements CLI
2022-04-12 14:40:33 -04:00
Russ White
94ee557658
Merge pull request #10999 from opensourcerouting/fix/bgp_aliases_with_community
bgpd: Allow setting BGP [large]community in route-maps
2022-04-12 14:37:58 -04:00
Donatas Abraitis
6e37924b05 bgpd: Show conditional advertisement timers in neighbor CLI output
```
spine1-debian-11# sh ip bgp neighbors 192.168.0.1
BGP neighbor is 192.168.0.1, remote AS 65001, local AS 65000, external link
Hostname: exit1-debian-11
  BGP version 4, remote router ID 192.168.10.123, local router ID 192.168.100.1
  BGP state = Established, up for 00:00:32
  Last read 00:00:30, Last write 00:00:30
  Hold time is 180, keepalive interval is 60 seconds
  Configured conditional advertisements interval is 5 seconds
  Time until conditional advertisements begin is 4 seconds
```

```
    "bgpTimerConfiguredConditionalAdvertisementsSec":5,
    "bgpTimerUntilConditionalAdvertisementsSec":1,
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-09 18:12:36 +03:00
Donatas Abraitis
c0945b7828 bgpd: Allow setting BGP [large]community in route-maps
Before:
```
spine1-debian-11(config-route-map)# bgp community alias 65001:65001 test1
spine1-debian-11(config)# route-map rm permit 10
spine1-debian-11(config-route-map)# set community 65001:65001
% Malformed communities attribute
```

After:
```
spine1-debian-11(config)# bgp community alias 65001:65001 test1
spine1-debian-11(config)# route-map rm permit 10
spine1-debian-11(config-route-map)# set community 65001:65001
spine1-debian-11(config-route-map)#
```

Same for large-communities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-09 17:34:06 +03:00