]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
4 years agobgpd: do not unregister for prefix nexthop updates if nh exists
Pat Ruddy [Fri, 26 Jun 2020 16:37:30 +0000 (17:37 +0100)]
bgpd: do not unregister for prefix nexthop updates if nh exists

since the addition of srte_color to the comparison for bgp nexthops
it is possible to have several nexthops per prefix but since zebra
only sores a per prefix registration we should not unregister for
nh notifications for a prefix unti all the nexthops for that prefix
have been deleted. Otherwise we can get into a deadlock situation
where BGP thinks we have registered but we have unregistered from zebra.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
4 years agobgpd: extend the NHT code to understand SR-TE colors
Renato Westphal [Wed, 26 Aug 2020 17:39:33 +0000 (14:39 -0300)]
bgpd: extend the NHT code to understand SR-TE colors

Extend the NHT code so that only the affected BGP routes are affected
whenever an SR-policy is updated on zebra.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agobgpd: Add support for SR-TE Policies in route-maps
Sebastien Merle [Tue, 28 Jan 2020 11:59:57 +0000 (11:59 +0000)]
bgpd: Add support for SR-TE Policies in route-maps

Example configuration:
    route-map SET_SR_POLICY permit 10
     set sr-te color 1
     !
    router bgp 1
     bgp router-id 1.1.1.1
     neighbor 2.2.2.2 remote-as 1
     neighbor 2.2.2.2 update-source lo
     address-family ipv4 unicast
      neighbor 2.2.2.2 next-hop-self
      neighbor 2.2.2.2 route-map SET_SR_POLICY in
     exit-address-family
     !
    !
Learned BGP routes from 2.2.2.2 are mapped to the SR-TE Policy
which is uniquely determined by the BGP nexthop (2.2.2.2 in this
case) and the SR-TE color in the route-map.

Co-authored-by: Renato Westphal <renato@opensourcerouting.org>
Co-authored-by: GalaxyGorilla <sascha@netdef.org>
Co-authored-by: Sebastien Merle <sebastien@netdef.org>
Signed-off-by: Sebastien Merle <sebastien@netdef.org>
4 years agobgpd: convert NHT code to use rb-trees instead of routing tables
Renato Westphal [Thu, 9 Apr 2020 18:56:11 +0000 (15:56 -0300)]
bgpd: convert NHT code to use rb-trees instead of routing tables

Fist, routing tables aren't the most appropriate data structure
to store nexthops and imported routes since we don't need to do
longest prefix matches with that information.

Second, by converting the NHT code to use rb-trees, we can index
the nexthops using additional information, not only the destination
address.  This will be useful later to index bgpd's nexthops by
both destination and SR-TE color.

Co-authored-by: Sebastien Merle <sebastien@netdef.org>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agoMerge pull request #7001 from ton31337/fix/deadcode_bgp_show_all_instances_neighbors_vty
Donald Sharp [Wed, 26 Aug 2020 13:27:12 +0000 (09:27 -0400)]
Merge pull request #7001 from ton31337/fix/deadcode_bgp_show_all_instances_neighbors_vty

bgpd: Remove a deadcode freeing JSON in bgp_show_all_instances_neighbors_vty

4 years agoMerge pull request #6903 from ton31337/fix/prevent_null_pointer_dereference_for_aspath
Rafael Zalamena [Wed, 26 Aug 2020 13:07:53 +0000 (10:07 -0300)]
Merge pull request #6903 from ton31337/fix/prevent_null_pointer_dereference_for_aspath

bgpd: Reuse bgp_adj_in for attr to avoid null dereference under aspath

4 years agoMerge pull request #5799 from pguibert6WIND/flowspec_ipv6
Donald Sharp [Wed, 26 Aug 2020 12:26:46 +0000 (08:26 -0400)]
Merge pull request #5799 from pguibert6WIND/flowspec_ipv6

Flowspec ipv6

4 years agobgpd: Remove a deadcode freeing JSON in bgp_show_all_instances_neighbors_vty
Donatas Abraitis [Wed, 26 Aug 2020 05:46:28 +0000 (08:46 +0300)]
bgpd: Remove a deadcode freeing JSON in bgp_show_all_instances_neighbors_vty

json = NULL; is set in a loop above and here we are trying to check and
free the object again which is never be reached.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #6983 from achernavin22/bgp_def_route_rt_map_no_match
Donald Sharp [Tue, 25 Aug 2020 19:32:33 +0000 (15:32 -0400)]
Merge pull request #6983 from achernavin22/bgp_def_route_rt_map_no_match

bgpd: withdraw default route when route-map has no match

4 years agoMerge pull request #6986 from achernavin22/bgp_reset_sess_if_ebgp_multihop
Donald Sharp [Tue, 25 Aug 2020 19:29:24 +0000 (15:29 -0400)]
Merge pull request #6986 from achernavin22/bgp_reset_sess_if_ebgp_multihop

bgpd: reset session if ebgp-multihop is set and no session established

4 years agoMerge pull request #6988 from mjstapp/fix_topo_stop_logic
Donald Sharp [Tue, 25 Aug 2020 18:59:11 +0000 (14:59 -0400)]
Merge pull request #6988 from mjstapp/fix_topo_stop_logic

tests: improve topotest stop logic

4 years agoMerge pull request #6970 from oleg-umnik/patch-1
Renato Westphal [Tue, 25 Aug 2020 16:16:54 +0000 (13:16 -0300)]
Merge pull request #6970 from oleg-umnik/patch-1

doc: vrf socket creation logic

4 years agotests: fix router stop logic
Mark Stapp [Tue, 25 Aug 2020 14:52:17 +0000 (10:52 -0400)]
tests: fix router stop logic

Change the public router stop method to always do a two-phase
shutdown - once without waiting and a second time with a wait.
Ordinary callers need to use this approach when stopping routers.
Move the detailed internal details to a private method that tests
should not call directly.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agotests: remove some unused imports
Mark Stapp [Tue, 25 Aug 2020 14:51:47 +0000 (10:51 -0400)]
tests: remove some unused imports

Remove unused imports from some topojson tests

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agotests: include all daemons in all-proto error tests
Mark Stapp [Tue, 25 Aug 2020 14:50:12 +0000 (10:50 -0400)]
tests: include all daemons in all-proto error tests

Some daemons run in all-protocol-startup weren't included in
error-output testing.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoMerge pull request #6938 from opensourcerouting/bgp-instance-shutdown
Russ White [Tue, 25 Aug 2020 14:31:01 +0000 (10:31 -0400)]
Merge pull request #6938 from opensourcerouting/bgp-instance-shutdown

bgpd: BGP instance administrative shutdown

4 years agobgpd: reset session if ebgp-multihop is set and no session established
Alexander Chernavin [Tue, 25 Aug 2020 13:51:22 +0000 (09:51 -0400)]
bgpd: reset session if ebgp-multihop is set and no session established

If you configure eBGP on loopbacks, you might miss setting the
ebgp-multihop option. Given that, the session will not be established
because of this. Now, the session is in Active state. When you update
your config afterwards and set the ebgp-multihop option to the
appropriate value, the session will still be in Active state. In fact,
it will be stuck in Active state and only services restart will help.

With this change, when set the ebgp-multihop option and no session was
established, reset the session.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
4 years agoMerge pull request #6975 from opensourcerouting/topotest-zebra-nl-buf-size
Donald Sharp [Tue, 25 Aug 2020 12:00:56 +0000 (08:00 -0400)]
Merge pull request #6975 from opensourcerouting/topotest-zebra-nl-buf-size

topotests: bump zebra netlink socket buffer size

4 years agoMerge pull request #6976 from achernavin22/rip_tools_key_chain_reloading
Donald Sharp [Tue, 25 Aug 2020 11:54:55 +0000 (07:54 -0400)]
Merge pull request #6976 from achernavin22/rip_tools_key_chain_reloading

lib, tools: fix reloading of key sub-context in key chains

4 years agobgpd: withdraw default route when route-map has no match
Alexander Chernavin [Tue, 25 Aug 2020 11:10:47 +0000 (07:10 -0400)]
bgpd: withdraw default route when route-map has no match

If you advertise a default route (via default-originate) only if some
prefix is present in the BGP RIB (route-map specified) and this prefix
becomes unavailable, the default route keeps being advertised.

With this change, when we iterate over the BGP RIB to check if we can
advertise the default route, skip unavailable prefixes.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
4 years agoMerge pull request #6959 from patrasar/bgp_collision_issue
Russ White [Tue, 25 Aug 2020 11:15:34 +0000 (07:15 -0400)]
Merge pull request #6959 from patrasar/bgp_collision_issue

bgpd: Fix BGP session stuck in OpenConfirm state

4 years agoMerge pull request #6962 from mjstapp/fix_zapi_nh_sort
Russ White [Tue, 25 Aug 2020 11:13:46 +0000 (07:13 -0400)]
Merge pull request #6962 from mjstapp/fix_zapi_nh_sort

lib: zapi nexthop sort fixes

4 years agoMerge pull request #6972 from ton31337/fix/bgp_filtered_routes_count_route-maps
Russ White [Tue, 25 Aug 2020 11:05:16 +0000 (07:05 -0400)]
Merge pull request #6972 from ton31337/fix/bgp_filtered_routes_count_route-maps

bgpd: Honor route-maps when forcing maximum-prefix for filtered routes

4 years agoMerge pull request #6978 from idryzhov/fix-bfdd
Rafael Zalamena [Tue, 25 Aug 2020 10:10:17 +0000 (10:10 +0000)]
Merge pull request #6978 from idryzhov/fix-bfdd

bfdd: fix parameter length

4 years agodoc: vrf socket creation logic
Oleg A. Arkhangelsky [Tue, 25 Aug 2020 05:25:51 +0000 (08:25 +0300)]
doc: vrf socket creation logic

Fix grammar

Signed-off-by: Oleg A. Arkhangelsky <sysoleg@yandex.ru>
4 years agoMerge pull request #6726 from Orange-OpenSource/dev_ospf_sr
Renato Westphal [Mon, 24 Aug 2020 19:23:45 +0000 (16:23 -0300)]
Merge pull request #6726 from Orange-OpenSource/dev_ospf_sr

ospfd: Segment Routing Improvement

4 years agoMerge pull request #6963 from chiragshah6/mdev
Renato Westphal [Mon, 24 Aug 2020 19:22:21 +0000 (16:22 -0300)]
Merge pull request #6963 from chiragshah6/mdev

*: record northbound transaction based on control flag

4 years agobgpd: alias for bgp no shutdown cmd
David Schweizer [Mon, 24 Aug 2020 16:16:49 +0000 (18:16 +0200)]
bgpd: alias for bgp no shutdown cmd

* Reverted back to using an ALIAS definition for the negated bgp
  shutdown command with a concatenated message string.
* Unified cli command descriptions for bgp shutdown commands.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
4 years agoMerge pull request #6912 from GalaxyGorilla/ospf_ti_lfa_prep
Olivier Dugeon [Mon, 24 Aug 2020 16:12:03 +0000 (18:12 +0200)]
Merge pull request #6912 from GalaxyGorilla/ospf_ti_lfa_prep

ospfd: preparation for TI-LFA

4 years agobfdd: fix parameter length
Igor Ryzhov [Mon, 24 Aug 2020 15:45:53 +0000 (18:45 +0300)]
bfdd: fix parameter length

There is no space reserved for "[source-addr='']".

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agolib, tools: fix reloading of key sub-context in key chains
Alexander Chernavin [Mon, 24 Aug 2020 13:28:28 +0000 (09:28 -0400)]
lib, tools: fix reloading of key sub-context in key chains

When you add a key chain in the RIP configuration file and reload the
configurations via the frr-reload.py script, the script will fail and
the key chain will not appear in the running configuration. The reason
is that frr-reload.py doesn't recognize key as a sub-context.

Before this change, keys were generated this way:

    key chain test
     key 2
      key-string 123
     key 3
      key-string 456

With this change, keys will be generated this way:

    key chain test
     key 2
      key-string 123
     exit
     key 3
      key-string 456
     exit

This will allow frr-reload.py to see the key sub-context and correctly
reload them.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
4 years agoMerge pull request #6948 from xThaid/proactive_arp
Rafael Zalamena [Mon, 24 Aug 2020 11:35:34 +0000 (11:35 +0000)]
Merge pull request #6948 from xThaid/proactive_arp

ospfd: make proactive ARP configurable

4 years agobgpd: minor fix for shutdown cli commands
David Schweizer [Mon, 24 Aug 2020 11:33:39 +0000 (13:33 +0200)]
bgpd: minor fix for shutdown cli commands

* Changed command description string to use "Remove" instead of
  "Disable" to prevent user confusion due to double negation.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
4 years agotopotests: bump zebra netlink socket buffer size
Rafael Zalamena [Mon, 24 Aug 2020 10:29:23 +0000 (07:29 -0300)]
topotests: bump zebra netlink socket buffer size

Use the same value as we use in production release configuration.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agodoc: Add docs for ospf proactive-arp command
Jakub Urbańczyk [Fri, 21 Aug 2020 11:50:01 +0000 (13:50 +0200)]
doc: Add docs for ospf proactive-arp command

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
4 years agobgpd: additional no bgp shutdown cli command
David Schweizer [Mon, 24 Aug 2020 06:12:16 +0000 (08:12 +0200)]
bgpd: additional no bgp shutdown cli command

* Added a "no bgp shutdown message MSG..." cli command for ease of use
  with copy/paste. Because of current limitations with DEFPY/ALIAS and
  the message string concatenation, a new command instead of an ALIAS
  had to be implemented.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
4 years agoMerge pull request #6967 from mjstapp/fix_sa_rib_dest
Rafael Zalamena [Sun, 23 Aug 2020 12:19:49 +0000 (12:19 +0000)]
Merge pull request #6967 from mjstapp/fix_sa_rib_dest

zebra: fix SA warning in rib_process()

4 years agoMerge pull request #6952 from opensourcerouting/fix_python27_build
Donatas Abraitis [Sat, 22 Aug 2020 19:07:18 +0000 (22:07 +0300)]
Merge pull request #6952 from opensourcerouting/fix_python27_build

python: Make FRR build compatible with python 2.7 and 3.x

4 years agobgpd: Honor route-maps when forcing maximum-prefix for filtered routes
Donatas Abraitis [Sat, 22 Aug 2020 15:21:27 +0000 (18:21 +0300)]
bgpd: Honor route-maps when forcing maximum-prefix for filtered routes

This will check route-maps as well, not only prefix-lists, access-lists, and
filter-lists.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agodoc: vrf socket creation logic
Oleg A. Arkhangelsky [Fri, 21 Aug 2020 17:16:03 +0000 (20:16 +0300)]
doc: vrf socket creation logic

Make documentation consistent with 0556fc3 changes.

Signed-off-by: Oleg A. Arkhangelsky <sysoleg@yandex.ru>
4 years agozebra: fix SA warning in rib_process()
Mark Stapp [Fri, 21 Aug 2020 13:34:19 +0000 (09:34 -0400)]
zebra: fix SA warning in rib_process()

Fix an SA warning about a possible NULL pointer deref in
rib_process().

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agotests: Cleanup and fix error message in bgp_features testsuite
Martin Winter [Fri, 21 Aug 2020 11:46:02 +0000 (13:46 +0200)]
tests: Cleanup and fix error message in bgp_features testsuite

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years agobgpd: fix Dereference of null pointer in flowspec
Philippe Guibert [Fri, 21 Aug 2020 06:42:20 +0000 (08:42 +0200)]
bgpd: fix Dereference of null pointer in flowspec

a dereference of null pointer exists in current flowspec code, with
prefix pointer. check validity of pointer before going ahead.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: remove warnings related to line too longs in bgp code
Philippe Guibert [Thu, 2 Jul 2020 06:14:41 +0000 (08:14 +0200)]
bgpd: remove warnings related to line too longs in bgp code

remove warnings related to line too long in bgp code.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: do not forget to set the size of community val length
Philippe Guibert [Wed, 17 Jun 2020 13:10:37 +0000 (15:10 +0200)]
bgpd: do not forget to set the size of community val length

because ecommunity structure can host both ext community and ipv6 ext
community, do not forget to set the unit_size field.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: remove sprintf() usage on flowspec
Philippe Guibert [Tue, 16 Jun 2020 06:42:10 +0000 (08:42 +0200)]
bgpd: remove sprintf() usage on flowspec

flowspec is being removed from remaining sprintf() calls.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgp, zebra: add some alignments with remarks from community
Philippe Guibert [Mon, 20 Apr 2020 16:02:46 +0000 (18:02 +0200)]
bgp, zebra: add some alignments with remarks from community

align the code to remarks from community.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agotopotest: add bgp flowspec ipv4/ipv6 test
Philippe Guibert [Mon, 20 Apr 2020 08:52:57 +0000 (10:52 +0200)]
topotest: add bgp flowspec ipv4/ipv6 test

this test ensures that an incoming bgp ipv4 and ipv6 flowspec
entry is received with a nexthop IP associated.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agodoc: add bgp flowspec ipv6 documentation
Philippe Guibert [Mon, 20 Apr 2020 07:18:20 +0000 (09:18 +0200)]
doc: add bgp flowspec ipv6 documentation

add bgp flowspdec ipv6 documentation.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: fill in local ecommunity context with ecom unit length
Philippe Guibert [Tue, 22 Oct 2019 07:21:28 +0000 (09:21 +0200)]
bgpd: fill in local ecommunity context with ecom unit length

because the same extended community can be used for storing ipv6 and
ipv4 et communities, the unit length must be stored. do not forget to
set the standard value in bgp evpn.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: fallback proto icmp/v6 to appropriate l3 filter
Philippe Guibert [Mon, 21 Oct 2019 09:12:25 +0000 (11:12 +0200)]
bgpd: fallback proto icmp/v6 to appropriate l3 filter

if match protocol is icmp, then this protocol will be filtered with afi
= ipv4. however, if afi = ipv6, then the icmp protocol will fall back to
icmpv6.
note that this patch has also been done to simplify the policy routing,
as BGP will only handle TCP/UDP/ICMP(v4 or v6) protocols.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: limit policy routing with flowlabel, fragment, and prefix offset
Philippe Guibert [Mon, 21 Oct 2019 09:05:44 +0000 (11:05 +0200)]
bgpd: limit policy routing with flowlabel, fragment, and prefix offset

the following 3 options are not supported in current implementation of
policy routing. for that, inform the user that the flowspec entry is
invalid when attempting to use :
- prefix offset with src, or dst ipv6 address ( see [1])
- flowlabel value - limitation due to [0]
- fragment ( implementation not done today).

[0] https://bugzilla.netfilter.org/show_bug.cgi?id=1375
[1] https://bugzilla.netfilter.org/show_bug.cgi?id=1373

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agozebra: add icmpv6 table of type / code
Philippe Guibert [Fri, 18 Oct 2019 20:30:24 +0000 (22:30 +0200)]
zebra: add icmpv6 table of type / code

this table contains the list of icmp type/code for icmpv6.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: support for flowspec interface list per address-family
Philippe Guibert [Thu, 17 Oct 2019 14:11:57 +0000 (16:11 +0200)]
bgpd: support for flowspec interface list per address-family

in addition to ipv4 flowspec, ipv6 flowspec address family can configure
its own list of interfaces to monitor. this permits filtering the policy
routing only on some interfaces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: support for bgp ipv6 ext community, and flowspec redirect ipv6
Philippe Guibert [Thu, 17 Oct 2019 14:08:16 +0000 (16:08 +0200)]
bgpd: support for bgp ipv6 ext community, and flowspec redirect ipv6

rfc 5701 is supported. it is possible to configure in bgp vpn, a list of
route target with ipv6 external communities to import. it is to be noted
that this ipv6 external community has been developed only for matching a
bgp flowspec update with same ipv6 ext commmunity.
adding to this, draft-ietf-idr-flow-spec-v6-09 is implemented regarding
the redirect ipv6 option.

Practically, under bgp vpn, under ipv6 unicast, it is possible to
configure : [no] rt6 redirect import <IPV6>:<AS> values.

An incoming bgp update with fs ipv6 and that option matching a bgp vrf,
will be imported in that bgp vrf.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgp, zebra: add family attribute to ipset and iptable context
Philippe Guibert [Wed, 16 Oct 2019 09:07:41 +0000 (11:07 +0200)]
bgp, zebra: add family attribute to ipset and iptable context

in order to create appropriate policy route, family attribute is stored
in ipset and iptable zapi contexts. This commit also adds the flow label
attribute in iptables, for further usage.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: support for redirect ipv6 simpson method
Philippe Guibert [Wed, 16 Oct 2019 08:05:36 +0000 (10:05 +0200)]
bgpd: support for redirect ipv6 simpson method

this commit supports [0] where ipv6 address is encoded in nexthop
attribute of nlri, and not in bgp redirect ip extended community. the
community contains only duplicate information or not.
Adding to this, because an action or a rule needs to apply to either
ipv4 or ipv6 flow, modify some internal structures so as to be aware of
which flow needs to be filtered. This work is needed when an ipv6
flowspec rule without ip addresses is mentioned, we need to know which
afi is served. Also, this work will be useful when doing redirect VRF.

[0] draft-simpson-idr-flowspec-redirect-02.txt

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd, lib: support for flow_label flowspec type
Philippe Guibert [Wed, 16 Oct 2019 06:44:20 +0000 (08:44 +0200)]
bgpd, lib: support for flow_label flowspec type

in ipv6 flowspec, a new type is defined to be able to do filtering rules
based on 20 bits flow label field as depicted in [0]. The change include
the decoding by flowspec, and the addition of a new attribute in policy
routing rule, so that the data is ready to be sent to zebra.
The commit also includes a check on fragment option, since dont fragment
bit does not exist in ipv6, the value should always be set to 0,
otherwise the flowspec rule becomes invalid.

[0] https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-09

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: ipv6 flowspec address decoding and validation
Philippe Guibert [Wed, 16 Oct 2019 06:42:30 +0000 (08:42 +0200)]
bgpd: ipv6 flowspec address decoding and validation

as per [0], ipv6 adress format introduces an ipv6 offset that needs to
be extracted too. The change include the validation, decoding for
further usage with policy-routing and decoding for dumping.

[0] https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-09

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: flowspec code support for ipv6
Philippe Guibert [Mon, 14 Oct 2019 16:02:22 +0000 (18:02 +0200)]
bgpd: flowspec code support for ipv6

until now, the assumption was done in bgp flowspec code that the
information contained was an ipv4 flowspec prefix. now that it is
possible to handle ipv4 or ipv6 flowspec prefixes, that information is
stored in prefix_flowspec attribute. Also, some unlocking is done in
order to process ipv4 and ipv6 flowspec entries.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agolib: add family attribute for flowspec prefix structure
Philippe Guibert [Tue, 15 Oct 2019 13:01:39 +0000 (15:01 +0200)]
lib: add family attribute for flowspec prefix structure

to recognize whether a flowspec prefix has been carried out by
ipv4 flowspec or ipv6 flowspec ( actually, the hypothesis is that only
ipv4 flowspec is supported), then a new attribute should contain the
family value: AF_INET or AF_INET6. That value will be further used in
the BGP flowspec code.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: Fix BGP session stuck in OpenConfirm state
Sarita Patra [Fri, 21 Aug 2020 06:33:09 +0000 (23:33 -0700)]
bgpd: Fix BGP session stuck in OpenConfirm state

Issue:
1. Initially BGP start listening to socket.
2. Start timer expires and BGP tries to connect to peer and moved
   to Idle->connect (lets say peer datastructre X)
3. Connect for X succeeds and hence moved from idle ->connect with
   FD-x.
4. A incoming connection is accepted and a new peer datastructure Y
   is created with FD-y moves from idle->Active state.
5. Peer datastercture Y FD-y sends out OPEN and moves to
   Active->Opensent state.
6. Peer datastrcture Y FD-y receives OPEN and moved from Opensent->
   Openconfirm state.
7. Meanwhile on peer datastrcture X FD-x sends out a OPEN message
   and moved from connect->Opensent.
8. For peer datastrcture Y FD-y keep alive is received and it is
   moved from OpenConfirm->Established.
9. In this case peer datastructure Y FD-y is a accepted connection
   so we try to copy all its parameter to peer datastructure X and
   delete Y.
10. During this process TCP connection for the accepted connection
    (FD-y) goes down and hence get remote address and port fails.
11. With this failure bgp_stop function for both peer datastrure X
    and peer datastructure Y is called.
12. By this time all the parameters include state for datastrcture
    for X and Y are exchanged. Peer Y FD-y when it entered this
    function had state OpenConfirm still which has been moved to peer
    datastrcture X.
13. In bgp_stop it will stop all the timers and take action only if
    peer is in established state. Now that peer datastrcture X and Y
    are not in established state (in this function) it will simply
    close all timers and close the socket and assigns socket for both
    the peer datastrcture to -1.
14. Peer datastrcture Y will be deleted as it is a datastrcture created
    due to accept of connection where as peer datastrcture X will be held
    as it is created with configuration.
15. Now peer datastrcture X now holds a state of OpenConfirm without any
    timers running.
16. With this any new incoming connection will never be able to establish
    as there is config connection X which is stuck in OpenConfirm.

Fix:
 While transferring the peer datastructure Y FD-y (accepted connection)
 to the peer datastructure X, if TCP connection for FD-y goes down, then
 1. Call fsm event bgp_stop for X (do cleanup with bgp_stop and move the
    state to Idle) and
 2. Call fsm event bgp_stop for Y (do cleanup with bgp_stop and gets deleted
    since it is an accept connection).

Signed-off-by: Sarita Patra <saritap@vmware.com>
4 years agobgpd: Don't stop hold timer in OpenConfirm State
Sarita Patra [Fri, 21 Aug 2020 06:29:08 +0000 (23:29 -0700)]
bgpd: Don't stop hold timer in OpenConfirm State

Issue:

1. Initially BGP start listening to socket.
2. Start timer expires and BGP tries to connect to peer and moved
   to Idle->connect (lets say peer datastructre X)
3. Peer datastrcture Y FD-X receives OPEN and moved from Opensent->
   Openconfirm state and start the hold timer.
4. In the OpenConfirm state, the hold timer is stopped. So peer X
   waits for Keepalive message from peer. If the Keepalive message
   is not received, then it will be in OpenConfirm state for
   indefinite time.
5. Due to this it neither close the existing connection nor it will
   accept any connection from peer.

Fix:
In the OpenConfirm state, don't stop the hold timer.
 1. Upon receipt of a neighbor’s Keepalive, the state is moved to
    Established.
 2. But If the hold timer expires, a stop event occurs, the state
    is moved to Idle.
This is as per RFC.

Signed-off-by: Sarita Patra <saritap@vmware.com>
4 years agoMerge pull request #6955 from opensourcerouting/staticd-optional-color
Donald Sharp [Fri, 21 Aug 2020 00:14:33 +0000 (20:14 -0400)]
Merge pull request #6955 from opensourcerouting/staticd-optional-color

staticd: fix warning when creating routes without SR-TE colors

4 years agoMerge pull request #6960 from opensourcerouting/sysrepo-plugin-update
Donald Sharp [Fri, 21 Aug 2020 00:11:15 +0000 (20:11 -0400)]
Merge pull request #6960 from opensourcerouting/sysrepo-plugin-update

lib: adapt plugin to use new Sysrepo version

4 years agotests: Add new bgp_features testsuite with test for bgp shutdown
Martin Winter [Thu, 20 Aug 2020 23:36:21 +0000 (01:36 +0200)]
tests: Add new bgp_features testsuite with test for bgp shutdown

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years ago*: record transaction based on control flag
Chirag Shah [Thu, 20 Aug 2020 19:09:53 +0000 (12:09 -0700)]
*: record transaction based on control flag

In case of config rollback is enabled,
record northbound transaction based on a control flag.
The actual frr daemons would set the flag to true via
nb_init from frr_init.
This will allow test daemon to bypass recording
transacation to db.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
4 years agolib: zapi nexthop sort fixes
Mark Stapp [Thu, 20 Aug 2020 18:50:38 +0000 (14:50 -0400)]
lib: zapi nexthop sort fixes

The sorting for zapi nexthops in zapi routes needs to match
the sorting of nexthops done in zebra. Ensure all zapi_nexthop
attributes are included in the sort.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agolib: add yang modules to native module list
Chirag Shah [Wed, 19 Aug 2020 21:00:41 +0000 (14:00 -0700)]
lib: add yang modules to native module list

Signed-off-by: Chirag Shah <chirag@nvidia.com>
4 years agoospfd: make proactive ARP configurable
Jakub Urbańczyk [Wed, 19 Aug 2020 12:19:19 +0000 (14:19 +0200)]
ospfd: make proactive ARP configurable

OSPFD sends ARP proactively to speed up convergence for /32 networks
on a p2p connection. It is only an optimization, so it can be disabled.

It is enabled by default.

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
4 years agolib: adapt plugin to use new Sysrepo version
Renato Westphal [Wed, 19 Aug 2020 23:33:40 +0000 (20:33 -0300)]
lib: adapt plugin to use new Sysrepo version

Sysrepo recently underwent a complete rewrite, where some substantial
architectural changes were made (the most important one being the
extinction of the sysrepod daemon). While most of the existing API
was preserved, quite a few backward-incompatible changes [1] were
introduced (mostly simplifications). This commit adapts our sysrepo
northbound plugin to those API changes in order for it to be compatible
with the latest Sysrepo version.

Additional notes:
* The old Sysrepo version is EOL and not supported anymore.
* The new Sysrepo version requires libyang 1.x.

Closes #6936

[1] https://github.com/sysrepo/sysrepo/blob/devel/CHANGES

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agobgpd: minor fix and code style compliance
David Schweizer [Thu, 20 Aug 2020 14:50:21 +0000 (16:50 +0200)]
bgpd: minor fix and code style compliance

* Applied style suggestions by automated compliance check.
* Fixed function bgp_shutdown_enable to use immutable message string.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
4 years agoMerge pull request #6951 from donaldsharp/zebra_table
Rafael Zalamena [Thu, 20 Aug 2020 14:25:14 +0000 (14:25 +0000)]
Merge pull request #6951 from donaldsharp/zebra_table

zebra: Add table id to debug output

4 years agoMerge pull request #6924 from AnuradhaKaruppiah/mem-fixes
Rafael Zalamena [Thu, 20 Aug 2020 14:12:51 +0000 (14:12 +0000)]
Merge pull request #6924 from AnuradhaKaruppiah/mem-fixes

bgpd: fixes for problems found during EVPN fuzzing

4 years agoOSPFd: Correct Extended Prefix flooding for SR
Olivier Dugeon [Thu, 9 Jul 2020 08:51:58 +0000 (10:51 +0200)]
OSPFd: Correct Extended Prefix flooding for SR

PR #6416 that solves opsf crash when segment routing is restarted, introduce a
regression in Extended Prefix flooding: when segment routing prefix is modified
or removed, new segment routing prefix is no more flooded. This patch correct
this regression.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
4 years agoOSPFd: Explicit Null option for Segment-Routing
Olivier Dugeon [Wed, 8 Jul 2020 18:12:19 +0000 (20:12 +0200)]
OSPFd: Explicit Null option for Segment-Routing

Add new option to `segment-routing prefix` command to set the
Explcit Null flag in addition to the No-PHP flag. MPLS LFIB configuration
has been also updated to take into account the Explicit Null flag.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
4 years agoMerge pull request #6738 from deastoe/frr-reload-log-level
Rafael Zalamena [Thu, 20 Aug 2020 13:42:34 +0000 (13:42 +0000)]
Merge pull request #6738 from deastoe/frr-reload-log-level

tools: frr-reload: more detailed log level control

4 years agoospfd: Add Segment Routing Local Block
Olivier Dugeon [Thu, 18 Jun 2020 17:46:28 +0000 (19:46 +0200)]
ospfd: Add Segment Routing Local Block

RFC 8665 defines a Segment Routing Local Block for Adjacency SID.
This patch provides the possibility to modify the SRLB as well as
reserved the block range from the Label Manager.

 - Introduce new CLI 'segment-routing local-block'
 - Add local block to SRDB structure
 - Parse / Serialize SRLB in Router Information LSA
 - Update OSPF-SR topotest
 - Update documentation

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
4 years agoospfd: Add Label Manager for Segment Routing
Olivier Dugeon [Tue, 16 Jun 2020 14:49:38 +0000 (16:49 +0200)]
ospfd: Add Label Manager for Segment Routing

Segment Routing Global Block is now using the Label Manager to reserved
label range. Label Manager connection uses the synchronous mode and dedicated
thread timer is used to establish the connection in safe manner without
blocking OSPFd is the Label Manager is not available.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
4 years agoMerge pull request #6954 from donaldsharp/packet_detail
Rafael Zalamena [Thu, 20 Aug 2020 10:16:59 +0000 (10:16 +0000)]
Merge pull request #6954 from donaldsharp/packet_detail

zebra: Limit packet dumps for received data to `detail` level

4 years agoMerge pull request #6945 from qlyoung/nb-more-messages
Renato Westphal [Wed, 19 Aug 2020 23:14:05 +0000 (20:14 -0300)]
Merge pull request #6945 from qlyoung/nb-more-messages

More gRPC logging + errmsg for no changes

4 years agostaticd: fix warning when creating routes without SR-TE colors
Renato Westphal [Wed, 19 Aug 2020 22:48:21 +0000 (19:48 -0300)]
staticd: fix warning when creating routes without SR-TE colors

The SR-TE color YANG leaf is optional so it shouldn't be created
unconditionally (it doesn't have a default value).

Fixes warnings like this when routes are created without specifying
a SR-TE color:
STATIC: libyang: Invalid value "" in "srte-color" element.
(/frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-s
taticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[p
refix='99.0.0.1/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[distance='1'
]/frr-nexthops/nexthop[nh-type='ip4'][vrf='default'][gateway='192.168.1.2'][inte
rface='(null)']/srte-color)

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agozebra: Limit packet dumps for received data to `detail` level
Donald Sharp [Wed, 19 Aug 2020 22:33:05 +0000 (18:33 -0400)]
zebra: Limit packet dumps for received data to `detail` level

When turning on `debug zebra packet detail` or `debug zebra packet recv detail`
only display the detailed packet dump when `detail` is added.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agolib: fill nb errmsg when no changes during prep
Quentin Young [Tue, 18 Aug 2020 19:59:41 +0000 (15:59 -0400)]
lib: fill nb errmsg when no changes during prep

During the prep phase to apply a northbound commit, if no changes were
detected make sure we fill the error message buffer to explain this.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agoMerge pull request #6949 from ton31337/fix/sizeof_for_bgp_dump_attr_inbgp_attr_malformed
Quentin Young [Wed, 19 Aug 2020 18:00:01 +0000 (14:00 -0400)]
Merge pull request #6949 from ton31337/fix/sizeof_for_bgp_dump_attr_inbgp_attr_malformed

bgpd: Use sizeof() in bgp_dump_attr()

4 years agozebra: Add table id to debug output
Donald Sharp [Wed, 19 Aug 2020 14:11:06 +0000 (10:11 -0400)]
zebra: Add table id to debug output

There are a bunch of places where the table id is not being outputed
in debug messages for routing changes.  Add in the table id we
are operating on.  This is especially useful for the case where
pbr is working.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agopython: Make FRR build compatible with python 2.7 and 3.x
Martin Winter [Wed, 19 Aug 2020 17:14:29 +0000 (19:14 +0200)]
python: Make FRR build compatible with python 2.7 and 3.x

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years agoMerge pull request #6939 from sworleys/NH-Vrf-Del
Mark Stapp [Wed, 19 Aug 2020 16:15:56 +0000 (12:15 -0400)]
Merge pull request #6939 from sworleys/NH-Vrf-Del

lib: fix crash in show nexthop when vrf deleted

4 years agobgpd: documentation for bgp admin shutdown.
David Schweizer [Wed, 19 Aug 2020 15:31:17 +0000 (17:31 +0200)]
bgpd: documentation for bgp admin shutdown.

* Added an entry in the user documentation for the bgp shutdown cli
  command.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
4 years agoMerge pull request #6941 from donaldsharp/bgp_json_crash
Renato Westphal [Wed, 19 Aug 2020 15:08:44 +0000 (12:08 -0300)]
Merge pull request #6941 from donaldsharp/bgp_json_crash

bgpd: Prevent crash when displaying json of a vrf all command

4 years agobgpd: Use sizeof() in bgp_dump_attr()
Donatas Abraitis [Wed, 19 Aug 2020 12:57:26 +0000 (15:57 +0300)]
bgpd: Use sizeof() in bgp_dump_attr()

Missed this in 5022c8331d0119886a08dcef7b1eee4525b4d63a

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #6920 from opensourcerouting/nb-errors-apply-phase
Donald Sharp [Wed, 19 Aug 2020 12:15:24 +0000 (08:15 -0400)]
Merge pull request #6920 from opensourcerouting/nb-errors-apply-phase

lib: don't ignore error messages generated during the commit apply phase

4 years agoMerge pull request #6943 from ton31337/fix/replace_sizeof_instead_of_constant_for_bgp...
Renato Westphal [Wed, 19 Aug 2020 10:36:13 +0000 (07:36 -0300)]
Merge pull request #6943 from ton31337/fix/replace_sizeof_instead_of_constant_for_bgp_dump_attr

bgpd: Use sizeof() in bgp_dump_attr()

4 years agolib: add better zlogging to gRPC Commit RPC
Quentin Young [Tue, 18 Aug 2020 19:01:34 +0000 (15:01 -0400)]
lib: add better zlogging to gRPC Commit RPC

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agolib: fix crash in show nexthop when vrf deleted
Stephen Worley [Tue, 18 Aug 2020 15:24:22 +0000 (11:24 -0400)]
lib: fix crash in show nexthop when vrf deleted

Fix a crash where if we issue a show run after a vrf has been
deleted we would crash here due to not null checking.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agobgpd: Use sizeof() in bgp_dump_attr()
Donatas Abraitis [Tue, 18 Aug 2020 18:43:07 +0000 (21:43 +0300)]
bgpd: Use sizeof() in bgp_dump_attr()

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agobgpd: Prevent crash when displaying json of a vrf all command
Donald Sharp [Tue, 18 Aug 2020 17:54:03 +0000 (13:54 -0400)]
bgpd: Prevent crash when displaying json of a vrf all command

When iterating over a `show ip bgp vrf all neighbors json` command
bgp is crashing.

The json variable was being double freed.  When freeing it, set it
to NULL and then check to make sure it exists before we free.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoMerge pull request #5702 from vishaldhingra/bgp_nb
Quentin Young [Tue, 18 Aug 2020 15:50:09 +0000 (11:50 -0400)]
Merge pull request #5702 from vishaldhingra/bgp_nb

bgpd : bgp yang definition

4 years agoMerge pull request #6929 from donaldsharp/bgp_relax_do_not_do_it
Russ White [Tue, 18 Aug 2020 15:23:52 +0000 (11:23 -0400)]
Merge pull request #6929 from donaldsharp/bgp_relax_do_not_do_it

bgpd: Actually respect RFC 6286 for router_id

4 years agoMerge pull request #6937 from donaldsharp/git_blame_can_be_awesome
Lou Berger [Tue, 18 Aug 2020 15:23:06 +0000 (11:23 -0400)]
Merge pull request #6937 from donaldsharp/git_blame_can_be_awesome

*: Give git a clue about our whitespace changes