]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
4 years agobgpd: fix Prefix-SID parse error
Hiroki Shirokura [Mon, 3 Feb 2020 23:25:26 +0000 (23:25 +0000)]
bgpd: fix Prefix-SID parse error

Prefix-SID is desined to capable for TLV array.
That behaviour is important to support SR-MPLS feature
and that supported by previous PR #5418.

In that implementation, but if some additional data
(such as next BGP update message or next path attributes)
was present after Prefix-SID path attribute,
bgpd will parse that addional data as Prefix-SID TLV.

This commit fix that. before this commit, loop condition
is determed by stream is readable or not. In more correct
implementatoin, the prefix-sid boundaly should be checked
additonally. the length of Prefix-sid path attribute can
be get by bgp_attr_parse_args.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
4 years agotopotests: add bgp_prefix_sid
Hiroki Shirokura [Sun, 2 Feb 2020 12:18:05 +0000 (12:18 +0000)]
topotests: add bgp_prefix_sid

This commit add behavior test for BGP Prefix-SID path
attribute generically.  In this time, there are only
1-test for Prefix-SID type-1 Label-Index TLV.

There are 3 nodes r1(FRR), peer1(exabgp) and peer2(exabgp)
on this topotest. And it perform following:

* peer1 advertise Prefix-SID to r1
* r1 is received Prefix-SID from peer1
* bgpd on r1 check the path attribute and parse correctly.
* user can check information from type-1 information via show cli
* bgpd on r1 advertise Prefix-SID to peer2
* peer2 is received Prefix-SID from r1
* peer2 check the path attribute and parse correctly.

This test uses exabgp's generic path attribute feature
of exabgp is used to advertise Prefix-SID path attribute
to bgpd. generic path attribute feature enable exabgp
users to specify binary format path attribute.
we can send valious binary pattern
(but overflow test doesn't can be performed).

The reason why this commit uses generic attribute feature
is that exabgp v3 doesn't support Prefix-SID path attribute
and topotest support exabgp only v3. (fyr. exabgp v4 supports it).
Thus this test includes little complicated binary format,
so I wrote full binary desection and explanation.
If topotest support exabgp v4, this test should
be rewrite with non generic attribute feature.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
4 years agoMerge pull request #5806 from ton31337/fix/remove_break_after_return
Mark Stapp [Thu, 13 Feb 2020 16:32:27 +0000 (11:32 -0500)]
Merge pull request #5806 from ton31337/fix/remove_break_after_return

*: Remove break after return

4 years agoMerge pull request #5805 from donaldsharp/babel_int_return
Mark Stapp [Thu, 13 Feb 2020 16:32:06 +0000 (11:32 -0500)]
Merge pull request #5805 from donaldsharp/babel_int_return

babeld: GCC complaining about no return in non-void function

4 years agoMerge pull request #5787 from karamalla0406/rmac_check
Donatas Abraitis [Thu, 13 Feb 2020 15:50:16 +0000 (17:50 +0200)]
Merge pull request #5787 from karamalla0406/rmac_check

bgpd: RFC compliance wrt invalid RMAC, GWIP, ESI and VNI

4 years agobabeld: GCC complaining about no return in non-void function
Donald Sharp [Thu, 13 Feb 2020 13:44:40 +0000 (08:44 -0500)]
babeld: GCC complaining about no return in non-void function

The babel_main_loop function did not have a return for
a non-void function.  For some reason gcc is starting to complain
about this now.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years ago*: Remove break after return
Donatas Abraitis [Thu, 13 Feb 2020 13:21:26 +0000 (15:21 +0200)]
*: Remove break after return

Just a deadcode.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #5798 from donaldsharp/bgp_packet_reformat
Sri Mohana Singamsetty [Thu, 13 Feb 2020 00:25:49 +0000 (16:25 -0800)]
Merge pull request #5798 from donaldsharp/bgp_packet_reformat

bgpd: Reformat bpacket_reformat_for_peer

4 years agobgpd: Reformat bpacket_reformat_for_peer
Donald Sharp [Tue, 11 Feb 2020 03:03:02 +0000 (22:03 -0500)]
bgpd: Reformat bpacket_reformat_for_peer

This function was heavily indented, reformat to reduce indentation
levels a bit.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoMerge pull request #5794 from mjstapp/remove_nexthop_matched_flag
Quentin Young [Wed, 12 Feb 2020 16:29:22 +0000 (11:29 -0500)]
Merge pull request #5794 from mjstapp/remove_nexthop_matched_flag

lib,zebra: remove unused MATCHED nexthop flag

4 years agolib,zebra: remove unused MATCHED nexthop flag
Mark Stapp [Tue, 11 Feb 2020 16:14:37 +0000 (11:14 -0500)]
lib,zebra: remove unused MATCHED nexthop flag

Remove an unused flag value from the nexthop struct.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agobgpd: RFC compliance wrt invalid RMAC, GWIP, ESI and VNI
Kishore Aramalla [Mon, 10 Feb 2020 19:38:27 +0000 (11:38 -0800)]
bgpd: RFC compliance wrt invalid RMAC, GWIP, ESI and VNI

A route where ESI, GW IP, MAC and Label are all zero at the same time SHOULD
be treat-as-withdraw.
Invalid MAC addresses are broadcast or multicast MAC addresses. The route
MUST be treat-as-withdraw in case of an invalid MAC address.

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

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

Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
4 years agoMerge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
Quentin Young [Tue, 11 Feb 2020 19:45:40 +0000 (14:45 -0500)]
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed

bgpd: Format properly `show bgp summary failed`

4 years agoMerge pull request #5778 from ton31337/fix/add_doc_for_ebgp_connected_route_check
Quentin Young [Tue, 11 Feb 2020 16:29:04 +0000 (11:29 -0500)]
Merge pull request #5778 from ton31337/fix/add_doc_for_ebgp_connected_route_check

doc: Add few words about `bgp disable-ebgp-connected-route-check`

4 years agobgpd: Format properly `show bgp summary failed`
Donatas Abraitis [Tue, 11 Feb 2020 16:02:19 +0000 (18:02 +0200)]
bgpd: Format properly `show bgp summary failed`

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

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

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #5785 from ton31337/fix/replace_gtsm_hops_to_readable_macros
Russ White [Tue, 11 Feb 2020 15:40:35 +0000 (10:40 -0500)]
Merge pull request #5785 from ton31337/fix/replace_gtsm_hops_to_readable_macros

bgpd: Use readable macros for peer->gtsm_hops instead of literals

4 years agoMerge pull request #5744 from ton31337/fix/thread-as-withdraw_attributes
Russ White [Tue, 11 Feb 2020 15:04:19 +0000 (10:04 -0500)]
Merge pull request #5744 from ton31337/fix/thread-as-withdraw_attributes

bgpd: Update some attributes how they are handled if malformed

4 years agoMerge pull request #5789 from donaldsharp/bgp_ebgp_reason
Donatas Abraitis [Tue, 11 Feb 2020 08:42:23 +0000 (10:42 +0200)]
Merge pull request #5789 from donaldsharp/bgp_ebgp_reason

bgpd: Update failed reason to distinguish some NHT scenarios

4 years agobgpd: Update failed reason to distinguish some NHT scenarios
Donald Sharp [Tue, 11 Feb 2020 00:25:52 +0000 (19:25 -0500)]
bgpd: Update failed reason to distinguish some NHT scenarios

Current failed reasons for bgp when you have a peer that
is not online yet is `Waiting for NHT`, even if NHT has
succeeded.  Add some code to differentiate this.

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

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

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

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

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoMerge pull request #5763 from ton31337/fix/return_without_parent
Renato Westphal [Mon, 10 Feb 2020 21:49:06 +0000 (18:49 -0300)]
Merge pull request #5763 from ton31337/fix/return_without_parent

*: Remove parenthesis on return for constants

4 years agoMerge pull request #5776 from volta-networks/fix_ldp_topol_test
Renato Westphal [Mon, 10 Feb 2020 21:48:25 +0000 (18:48 -0300)]
Merge pull request #5776 from volta-networks/fix_ldp_topol_test

ldpd: Fix LDP topotest to validate MPLS LDP CLI output

4 years agoMerge pull request #5770 from ton31337/fix/remove_bgp_flag_functions
Sri Mohana Singamsetty [Mon, 10 Feb 2020 16:31:59 +0000 (08:31 -0800)]
Merge pull request #5770 from ton31337/fix/remove_bgp_flag_functions

bgpd: Replace bgp_flag_* to [UN]SET/CHECK_FLAG macros

4 years agobgpd: Use readable macros for peer->gtsm_hops instead of literals
Donatas Abraitis [Mon, 10 Feb 2020 14:17:40 +0000 (16:17 +0200)]
bgpd: Use readable macros for peer->gtsm_hops instead of literals

Do the same way like BGP_DEFAULT_TTL

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agotests: Fix LDP topotest to validate MPLS LDP CLI output
Karen Schoener [Thu, 6 Feb 2020 21:19:40 +0000 (16:19 -0500)]
tests: Fix LDP topotest to validate MPLS LDP CLI output

Fixing existing ldp-topol test to validate MPLS LDP CLI output.

Signed-off-by: Karen Schoener <karen@voltanet.io>
4 years agoMerge pull request #5772 from adharkar/frr-master-ipv6_nexthop
Donatas Abraitis [Mon, 10 Feb 2020 09:09:32 +0000 (11:09 +0200)]
Merge pull request #5772 from adharkar/frr-master-ipv6_nexthop

bgpd: EVPN crash because of incorrect nexthop for IPv6 prefix

4 years ago*: Remove parenthesis on return for constants
Donatas Abraitis [Sun, 9 Feb 2020 12:21:56 +0000 (14:21 +0200)]
*: Remove parenthesis on return for constants

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agotools: Add coccinelle script to remove parenthesis on return
Donatas Abraitis [Sun, 9 Feb 2020 12:20:37 +0000 (14:20 +0200)]
tools: Add coccinelle script to remove parenthesis on return

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #5781 from LabNConsulting/working/master/tt-catch-notifications
Donatas Abraitis [Sun, 9 Feb 2020 07:12:05 +0000 (09:12 +0200)]
Merge pull request #5781 from LabNConsulting/working/master/tt-catch-notifications

topotest: bgp_l3vpn_to_bgp_vrf - report unexpected BGP notifications

4 years agotopotest: bgp_l3vpn_to_bgp_vrf - report unexpected BGP notifications
Lou Berger [Sat, 8 Feb 2020 15:36:49 +0000 (10:36 -0500)]
topotest: bgp_l3vpn_to_bgp_vrf - report unexpected BGP notifications

Signed-off-by: Lou Berger <lberger@labn.net>
4 years agodoc: Add few words about `bgp disable-ebgp-connected-route-check`
Donatas Abraitis [Fri, 7 Feb 2020 18:56:54 +0000 (20:56 +0200)]
doc: Add few words about `bgp disable-ebgp-connected-route-check`

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agobgpd: EVPN crash because of incorrect nexthop for IPv6 prefix
Ameya Dharkar [Thu, 6 Feb 2020 21:47:43 +0000 (13:47 -0800)]
bgpd: EVPN crash because of incorrect nexthop for IPv6 prefix

RCA:
When we install IPv6 prefix imported from EVPN RT-5 in vrf, nexthop of the IPv6
route should be IPv4 mapped IPv6 address. In function
install_evpn_route_entry_in_vrf, we generate a new attribute with IPv4 mapped
IPv6 nexthop, but we use parent->attr while creating the actual route.
Thus, Ipv4 nexthop is assigned to this route.
Because of this incorrect nexthop, we observed a crash in function
update_ipv6nh_for_route_install.

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

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
4 years agobgpd: Replace bgp_flag_* to [UN]SET/CHECK_FLAG macros
Donatas Abraitis [Thu, 6 Feb 2020 14:37:20 +0000 (16:37 +0200)]
bgpd: Replace bgp_flag_* to [UN]SET/CHECK_FLAG macros

Most of the code uses macros, thus let's keep the code unified.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agotools: Add coccinelle script to replace all bgp_flag_* functions
Donatas Abraitis [Thu, 6 Feb 2020 14:24:22 +0000 (16:24 +0200)]
tools: Add coccinelle script to replace all bgp_flag_* functions

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #5722 from donaldsharp/kernel_routes
Russ White [Thu, 6 Feb 2020 13:04:42 +0000 (08:04 -0500)]
Merge pull request #5722 from donaldsharp/kernel_routes

Kernel routes

4 years agoMerge pull request #5767 from ton31337/fix/replace_s_addr_0_to_INADDR_ANY
Donald Sharp [Thu, 6 Feb 2020 12:30:21 +0000 (07:30 -0500)]
Merge pull request #5767 from ton31337/fix/replace_s_addr_0_to_INADDR_ANY

MOAR CODE NAZI: replace s_addr 0 => INADDR_ANY

4 years agoMerge pull request #5765 from Spantik/bugs
Donald Sharp [Thu, 6 Feb 2020 12:27:27 +0000 (07:27 -0500)]
Merge pull request #5765 from Spantik/bugs

OSPF: Multi instance broken

4 years agotools: Add coccinelle script to replace s_addr 0 to INADDR_ANY
Donatas Abraitis [Thu, 6 Feb 2020 06:50:50 +0000 (08:50 +0200)]
tools: Add coccinelle script to replace s_addr 0 to INADDR_ANY

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years ago*: Replace s_addr 0 => INADDR_ANY
Donatas Abraitis [Thu, 6 Feb 2020 06:49:02 +0000 (08:49 +0200)]
*: Replace s_addr 0 => INADDR_ANY

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #5761 from qlyoung/fix-bgp-gr-cruft
Donatas Abraitis [Thu, 6 Feb 2020 06:16:25 +0000 (08:16 +0200)]
Merge pull request #5761 from qlyoung/fix-bgp-gr-cruft

Fix bgp gr style

4 years agoOSPF: Multi instance broken
Santosh P K [Wed, 5 Feb 2020 17:40:00 +0000 (09:40 -0800)]
OSPF: Multi instance broken

Multi instance ospf support was broken due to PR #4564.
Adding fix back and extra checks to support multi instance
OSPF.

Fixes issues #5343 & #5741

Signed-off-by: Santosh P K <sapk@vmware.com>
4 years agoMerge pull request #5104 from opensourcerouting/route-map-nbv2
Donald Sharp [Wed, 5 Feb 2020 16:54:21 +0000 (11:54 -0500)]
Merge pull request #5104 from opensourcerouting/route-map-nbv2

lib: migrate route map to use northbound

4 years agolib: fix route-map YANG module on old gcc versions
Rafael Zalamena [Wed, 5 Feb 2020 14:09:31 +0000 (11:09 -0300)]
lib: fix route-map YANG module on old gcc versions

Copy the fix made in 'lib/if.c' to 'lib/routemap_northbound.c' so we can
have a working YANG model when compiled with GCC version less than 5.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agobgpd: Update some attributes how they are handled if malformed
Donatas Abraitis [Wed, 29 Jan 2020 13:09:37 +0000 (15:09 +0200)]
bgpd: Update some attributes how they are handled if malformed

According to https://tools.ietf.org/html/rfc7606 some of the attributes
MUST be handled as "treat-as-withdraw" approach.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #5758 from sworleys/Doc-No-Pbr-Dyn-Rules
Renato Westphal [Wed, 5 Feb 2020 04:50:19 +0000 (01:50 -0300)]
Merge pull request #5758 from sworleys/Doc-No-Pbr-Dyn-Rules

doc: indicate non-support for dynamic pbr maps

4 years agoMerge pull request #5750 from qlyoung/fix-null-after-xfree
Renato Westphal [Wed, 5 Feb 2020 04:49:08 +0000 (01:49 -0300)]
Merge pull request #5750 from qlyoung/fix-null-after-xfree

*: don't null after XFREE; XFREE does this itself

4 years agoMerge pull request #5760 from ton31337/fix/shorthand_operator
Renato Westphal [Wed, 5 Feb 2020 04:45:55 +0000 (01:45 -0300)]
Merge pull request #5760 from ton31337/fix/shorthand_operator

zebra: Use shorthand operator in ifm_read()

4 years agoMerge pull request #5717 from pguibert6WIND/flowspec_issue_redistribute
Quentin Young [Tue, 4 Feb 2020 20:48:24 +0000 (15:48 -0500)]
Merge pull request #5717 from pguibert6WIND/flowspec_issue_redistribute

Flowspec issue redistribute

4 years agoMerge pull request #5759 from ton31337/fix/void_no_return
Quentin Young [Tue, 4 Feb 2020 20:45:01 +0000 (15:45 -0500)]
Merge pull request #5759 from ton31337/fix/void_no_return

zebra, lib: Remove return from void functions

4 years agobgpd, lib: fix style from BGP GR code
Quentin Young [Fri, 31 Jan 2020 18:04:00 +0000 (13:04 -0500)]
bgpd, lib: fix style from BGP GR code

This patch fixes the noncompliant style for the following commit range:

4a6e80fbf
2ba1fe695
efcb2ebbb
8c48b3b69
dc95985fe
0f0444fbd
85ef4179a
eb451ee58
2d3dd828d
9e3b51a7f
d6e3c15b6
34aa74486
6102cb7fe
d7b3cda6f
2bb5d39b1
5f9c1aa29
5cce3f054
3a75afa4b
f009ff269
cfd47646b
2986cac29
055679e91
034e185dc
794b37d52
b0965c44e
949b0f24f
63696f1d8

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agobgpd: use _RO list iter variant for gr macro
Quentin Young [Fri, 31 Jan 2020 18:03:27 +0000 (13:03 -0500)]
bgpd: use _RO list iter variant for gr macro

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years ago*: remove null check before XFREE
Quentin Young [Tue, 4 Feb 2020 18:19:37 +0000 (13:19 -0500)]
*: remove null check before XFREE

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agozebra: Use shorthand operator in ifm_read()
Donatas Abraitis [Tue, 4 Feb 2020 18:11:59 +0000 (20:11 +0200)]
zebra: Use shorthand operator in ifm_read()

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agotools: Add coccinelle script to check if we use shorthand operators
Donatas Abraitis [Tue, 4 Feb 2020 18:08:50 +0000 (20:08 +0200)]
tools: Add coccinelle script to check if we use shorthand operators

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agotools: Add coccinelle script to check if void does not have return
Donatas Abraitis [Tue, 4 Feb 2020 18:05:40 +0000 (20:05 +0200)]
tools: Add coccinelle script to check if void does not have return

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agozebra, lib: Remove return from void functions
Donatas Abraitis [Tue, 4 Feb 2020 18:05:21 +0000 (20:05 +0200)]
zebra, lib: Remove return from void functions

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agolib: fix route map northbound memory leak
Rafael Zalamena [Tue, 15 Oct 2019 02:29:19 +0000 (23:29 -0300)]
lib: fix route map northbound memory leak

Keep a list of hook contexts used by northbound so we don't lose the
pointer when free()ing the route map index entry data.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years ago*: fix route map integration
Rafael Zalamena [Tue, 1 Oct 2019 20:56:41 +0000 (17:56 -0300)]
*: fix route map integration

Add the appropriated code to bootstrap route map northbound for all
daemons.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: add backward compatibility for route map
Rafael Zalamena [Tue, 1 Oct 2019 18:52:51 +0000 (15:52 -0300)]
lib: add backward compatibility for route map

Allow old CLI users to still print their configuration without migrating
to northbound.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix route map generic error output
Rafael Zalamena [Mon, 30 Sep 2019 18:02:15 +0000 (15:02 -0300)]
lib: fix route map generic error output

Two fixes here:

*   Don't attempt to use `vty` pointer in vty;
*   When `vty` is unavailable output to log;

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agoyang/lib: add filter model to code
Rafael Zalamena [Tue, 1 Oct 2019 20:56:16 +0000 (17:56 -0300)]
yang/lib: add filter model to code

This fixes a warning on daemons that use route map about filter yang
model not being included in the binary.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: implement new route map CLI
Rafael Zalamena [Mon, 30 Sep 2019 18:01:46 +0000 (15:01 -0300)]
lib: implement new route map CLI

Use the northbound back-end instead of the old route map CLI.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: implement route map northbound
Rafael Zalamena [Mon, 30 Sep 2019 13:34:49 +0000 (10:34 -0300)]
lib: implement route map northbound

Based on the route map old CLI, implement the route map handling using
the exported functions.

Use a curry-like programming pattern avoid code repetition when
destroying match/set entries. This is needed by other daemons that
implement custom route map functions and need to pass to lib their
specific destroy functions.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: export route map structures and functions
Rafael Zalamena [Mon, 30 Sep 2019 13:17:33 +0000 (10:17 -0300)]
lib: export route map structures and functions

These exported items are going to be used by the new northbound CLI.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agoyang: update route map model
Rafael Zalamena [Fri, 27 Sep 2019 22:32:10 +0000 (19:32 -0300)]
yang: update route map model

Important changes:

  * Rename top container `route-map` to `lib`;
  * Rename list `instance` to `route-map`;
  * Move route map repeated data to list `entry`;
  * Use interface reference instead of typedef'ed string;
  * Remove some zebra specific route map conditions;
  * Protect `tag` set value with `when "./action = 'tag'"`;

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agoMerge pull request #5169 from ton31337/feature/sequence_numbers_for_community_lists
Quentin Young [Tue, 4 Feb 2020 16:56:29 +0000 (11:56 -0500)]
Merge pull request #5169 from ton31337/feature/sequence_numbers_for_community_lists

bgpd: Use sequence numbers for community lists

4 years agodoc: indicate non-support for dynamic pbr maps
Stephen Worley [Tue, 4 Feb 2020 16:35:31 +0000 (11:35 -0500)]
doc: indicate non-support for dynamic pbr maps

Indicate in the doc clearly that we do not support the dynamic
creation of pbr maps for sub-interfaces when the master has
an interface. Such as in vlans. It must be explicitly added.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agobgpd: forge bgp flowspec packets to be sent
Philippe Guibert [Tue, 21 Jan 2020 12:17:45 +0000 (13:17 +0100)]
bgpd: forge bgp flowspec packets to be sent

bgp flowspec packets are being forged correctly. There is no need to
check for bgp length, as the bgp nlri length is checked at reception.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: when nexthop IP is available for flowspec, keep it
Philippe Guibert [Tue, 21 Jan 2020 12:15:42 +0000 (13:15 +0100)]
bgpd: when nexthop IP is available for flowspec, keep it

keep original nexthop IP address when propagating bgp updates to other
peers.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agoMerge pull request #5739 from mjstapp/nhg_show_ordered
Renato Westphal [Tue, 4 Feb 2020 16:37:24 +0000 (13:37 -0300)]
Merge pull request #5739 from mjstapp/nhg_show_ordered

zebra: show zebra nexthop-groups without copying

4 years agoMerge pull request #5653 from slankdev/slankdev-bgpd-support-prefix-sid-srv6-l3vpn
Donald Sharp [Tue, 4 Feb 2020 16:37:10 +0000 (11:37 -0500)]
Merge pull request #5653 from slankdev/slankdev-bgpd-support-prefix-sid-srv6-l3vpn

bgpd: additional Prefix-SID sub-types for supporting SRv6 l3vpn

4 years agoMerge pull request #5746 from donaldsharp/bgp_sa
Russ White [Tue, 4 Feb 2020 16:24:08 +0000 (11:24 -0500)]
Merge pull request #5746 from donaldsharp/bgp_sa

Coverioty sa stuff

4 years agoMerge pull request #5207 from Spantik/ZERBA_GR
Donald Sharp [Tue, 4 Feb 2020 15:57:29 +0000 (10:57 -0500)]
Merge pull request #5207 from Spantik/ZERBA_GR

Zebra: Adding GR infrastructure for clients.

4 years agozebra: show zebra nexthop-groups without copying
Mark Stapp [Tue, 28 Jan 2020 19:45:53 +0000 (14:45 -0500)]
zebra: show zebra nexthop-groups without copying

Use a hash walker/iterator instead of a temporary list to
show zebra's nexthop-groups/nexthop-hash-entries.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoMerge pull request #5737 from mjstapp/zebra_disable_kern_nhs
Russ White [Tue, 4 Feb 2020 13:12:34 +0000 (08:12 -0500)]
Merge pull request #5737 from mjstapp/zebra_disable_kern_nhs

zebra: add config to disable use of kernel nexthops

4 years agozebra: top has already been derefed
Donald Sharp [Fri, 31 Jan 2020 15:46:05 +0000 (10:46 -0500)]
zebra: top has already been derefed

The top variable has already been derefed by the time we get
to the test to see if it is non-NULL.  No need to check it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agolib: Test return of fcntl in agentx.c
Donald Sharp [Fri, 31 Jan 2020 15:44:23 +0000 (10:44 -0500)]
lib: Test return of fcntl in agentx.c

The agentx.c code was calling fcntl but not testing return
code and handling it, thus making SA unhappy.

Fix.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agobgpd: Remove dead call to get_afi_safi_str
Donald Sharp [Fri, 31 Jan 2020 15:30:22 +0000 (10:30 -0500)]
bgpd: Remove dead call to get_afi_safi_str

There is no need for a call into get_afi_safi_str for the
json side since we add it based upon the afi safi str below.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agobgpd: Tell Coverity SA that regex cannot be NULL here
Donald Sharp [Fri, 31 Jan 2020 15:26:33 +0000 (10:26 -0500)]
bgpd: Tell Coverity SA that regex cannot be NULL here

The coverity SA believes that the regex value can possibly
be NULL.  Not possible so let's make it happy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years ago*: don't null after XFREE; XFREE does this itself
Quentin Young [Mon, 3 Feb 2020 16:22:13 +0000 (11:22 -0500)]
*: don't null after XFREE; XFREE does this itself

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #5745 from donaldsharp/bgp_formating
Donatas Abraitis [Sun, 2 Feb 2020 13:37:44 +0000 (15:37 +0200)]
Merge pull request #5745 from donaldsharp/bgp_formating

Bgp formating

4 years agoMerge pull request #5669 from donaldsharp/nhg_ip
Mark Stapp [Fri, 31 Jan 2020 16:35:22 +0000 (11:35 -0500)]
Merge pull request #5669 from donaldsharp/nhg_ip

Nhg ip cleanups

4 years agobgpd: enums in switches do not need default
Donald Sharp [Fri, 31 Jan 2020 14:24:58 +0000 (09:24 -0500)]
bgpd: enums in switches do not need default

If you have enums handled in a switch adding a default case
makes it fun to fix when new stuff is added later.  Remove.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agobgpd: Cleanup some bad formating
Donald Sharp [Fri, 31 Jan 2020 14:19:24 +0000 (09:19 -0500)]
bgpd: Cleanup some bad formating

Some recent commits got some bad formating.  Clean this up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agodoc: Update doc to reflect changes in `show nexthop-group rib` command
Donald Sharp [Wed, 15 Jan 2020 13:28:22 +0000 (08:28 -0500)]
doc: Update doc to reflect changes in `show nexthop-group rib` command

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agozebra: nexthop groups vrf's are only a function of namespaces
Donald Sharp [Mon, 13 Jan 2020 21:11:46 +0000 (16:11 -0500)]
zebra: nexthop groups vrf's are only a function of namespaces

Nexthop groups as a whole do not make sense to have a vrf'ness
As that you can have a arbitrary number of nexthops that point
to separate vrf's.

Modify the code to make this distinction, by clearly delineating
the line between the nhg and the nexthop a bit better.
Nexthop groups having a vrf_id only make sense if you are using
network namespaces to represent them.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agozebra: Modify 'show nexthop-group rib ip|ipv6'
Donald Sharp [Mon, 13 Jan 2020 21:00:33 +0000 (16:00 -0500)]
zebra: Modify 'show nexthop-group rib ip|ipv6'

The zebra implementation of nexthop groups has
two types of nexthops groups currently.  Singleton
objects which have afi's and combined nexthop groups
that do not.  Specifically call this out in the code
to make this distinction.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoMerge pull request #5637 from sworleys/NHG-Zapi-Fuzz
Mark Stapp [Fri, 31 Jan 2020 13:21:36 +0000 (08:21 -0500)]
Merge pull request #5637 from sworleys/NHG-Zapi-Fuzz

Zebra nhg/nexthop fixes

4 years agozebra: Capabality and stale route handling for GR client.
Santosh P K [Thu, 9 Jan 2020 17:53:27 +0000 (09:53 -0800)]
zebra: Capabality and stale route handling for GR client.

Handling capability received from client. It may contain
GR enable/disable, Stale time changes, RIB update complete
for given AFi, ASAFI and instance. It also has changes for
stale route handling.

Signed-off-by: Santosh P K <sapk@vmware.com>
4 years agozebra: add null check before connecting recursive depend
Stephen Worley [Tue, 21 Jan 2020 20:03:52 +0000 (15:03 -0500)]
zebra: add null check before connecting recursive depend

Add a null check in `handle_recursive_depend()` so it
doesn't try to add a NULL pointer to the RB tree.

This was found with clang SA.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agozebra: reset nexthop pointer in zread of nexthops
Stephen Worley [Mon, 6 Jan 2020 18:33:45 +0000 (13:33 -0500)]
zebra: reset nexthop pointer in zread of nexthops

We were not resetting the nexthop pointer to NULL for each
new read of a nexthop from the zapi route. On the chance we
get a nexthop that does not have a proper type, we will not
create a new nexthop and update that pointer, thus it still
has the last valid one and will create a group with two
pointers to the same nexthop.

Then when it enters any code that iterates the group, it loops
endlessly.

This was found with zapi fuzzing.

```
0x00007f728891f1c3 in jhash2 (k=<optimized out>, length=<optimized out>, initval=12183506) at lib/jhash.c:138
0x00007f728896d92c in nexthop_hash (nexthop=<optimized out>) at lib/nexthop.c:563
0x00007f7288979ece in nexthop_group_hash (nhg=<optimized out>) at lib/nexthop_group.c:394
0x0000000000621036 in zebra_nhg_hash_key (arg=<optimized out>) at zebra/zebra_nhg.c:356
0x00007f72888ec0e1 in hash_get (hash=<optimized out>, data=0x7ffffb94aef0, alloc_func=0x0) at lib/hash.c:138
0x00007f72888ee118 in hash_lookup (hash=0x7f7288de2f10, data=0x7f728908e7fc) at lib/hash.c:183
0x0000000000626613 in zebra_nhg_find (nhe=0x7ffffb94b080, id=0, nhg=0x6020000032d0, nhg_depends=0x0, vrf_id=<optimized out>,
    afi=<optimized out>, type=<optimized out>) at zebra/zebra_nhg.c:541
0x0000000000625f39 in zebra_nhg_rib_find (id=0, nhg=<optimized out>, rt_afi=AFI_IP) at zebra/zebra_nhg.c:1126
0x000000000065f953 in rib_add_multipath (afi=AFI_IP, safi=<optimized out>, p=0x7ffffb94b370, src_p=0x0, re=0x6070000013d0,
    ng=0x7f728908e7fc) at zebra/zebra_rib.c:2616
0x0000000000768f90 in zread_route_add (client=0x61f000000080, hdr=<optimized out>, msg=<optimized out>, zvrf=<optimized out>)
    at zebra/zapi_msg.c:1596
0x000000000077c135 in zserv_handle_commands (client=<optimized out>, msg=0x61b000000780) at zebra/zapi_msg.c:2636
0x0000000000575e1f in main (argc=<optimized out>, argv=<optimized out>) at zebra/main.c:309
```

```
(gdb) p *nhg->nexthop
$4 = {next = 0x5488e0, prev = 0x5488e0, vrf_id = 16843009, ifindex = 16843009, type = NEXTHOP_TYPE_IFINDEX, flags = 8 '\b', {gate = {ipv4 = {s_addr = 0},
      ipv6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}},
    bh_type = BLACKHOLE_UNSPEC}, src = {ipv4 = {s_addr = 0}, ipv6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0,
          0}, __u6_addr32 = {0, 0, 0, 0}}}}, rmap_src = {ipv4 = {s_addr = 0}, ipv6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0,
          0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}}, resolved = 0x0, rparent = 0x0, nh_label_type = ZEBRA_LSP_NONE, nh_label = 0x0, weight = 1 '\001'}
(gdb) quit

```

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agozebra: don't created connected if duplicate depend
Stephen Worley [Mon, 6 Jan 2020 17:58:41 +0000 (12:58 -0500)]
zebra: don't created connected if duplicate depend

Since we are using a UNIQUE RB tree, we need to handle the
case of adding in a duplicate entry into it.

The list API code returns NULL when a successfull add
occurs, so lets pull that handling further up into
the connected handlers. Then, free the allocated
connected struct if it is a duplicate.

This is a pretty unlikely situation to happen.

Also, pull up the RB handling of _del RB API as well.

This was found with the zapi fuzzing code.

```
==1052840==
==1052840== 200 bytes in 5 blocks are definitely lost in loss record 545 of 663
==1052840==    at 0x483BB1A: calloc (vg_replace_malloc.c:762)
==1052840==    by 0x48E1008: qcalloc (memory.c:110)
==1052840==    by 0x44D357: nhg_connected_new (zebra_nhg.c:73)
==1052840==    by 0x44D300: nhg_connected_tree_add_nhe (zebra_nhg.c:123)
==1052840==    by 0x44FBDC: depends_add (zebra_nhg.c:1077)
==1052840==    by 0x44FD62: depends_find_add (zebra_nhg.c:1090)
==1052840==    by 0x44E46D: zebra_nhg_find (zebra_nhg.c:567)
==1052840==    by 0x44E1FE: zebra_nhg_rib_find (zebra_nhg.c:1126)
==1052840==    by 0x45AD3D: rib_add_multipath (zebra_rib.c:2616)
==1052840==    by 0x4977DC: zread_route_add (zapi_msg.c:1596)
==1052840==    by 0x49ABB9: zserv_handle_commands (zapi_msg.c:2636)
==1052840==    by 0x428B11: main (main.c:309)
```

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agozebra: Handling of connection disconnect and connect with GR.
Santosh P K [Thu, 9 Jan 2020 16:39:50 +0000 (08:39 -0800)]
zebra: Handling of connection disconnect and connect with GR.

Zebra will have special handling for clients with GR enabled.
When client disconnects with GR enabled, then a stale client
will be created and its RIB will be retained till stale timer
or client comes up and updated its RIB.

Co-authored-by: Santosh P K <sapk@vmware.com>
Co-authored-by: Soman K S <somanks@vmware.com>
Signed-off-by: Santosh P K <sapk@vmware.com>
4 years agozebra: Header file changes and show commands.
Santosh P K [Tue, 22 Oct 2019 14:01:58 +0000 (07:01 -0700)]
zebra: Header file changes and show commands.

Adding header files changes where structure to hold
received graceful restart info from client is defined.
Also there are changes for show commands where exisiting
commands are extended.

Co-authored-by: Santosh P K <sapk@vmware.com>
Co-authored-by: Soman K S <somanks@vmware.com>
Signed-off-by: Santosh P K <sapk@vmware.com>
4 years agolib: Adding GR capabilites encode and decode.
Santosh P K [Wed, 29 Jan 2020 06:50:27 +0000 (22:50 -0800)]
lib: Adding GR capabilites encode and decode.

For Graceful restart clients have to send GR capabilities
library functions are added to encode capabilities and
also for zebra to decode client capabilities.

Co-authored-by: Santosh P K <sapk@vmware.com>
Co-authored-by: Soman K S <somanks@vmware.com>
Signed-off-by: Santosh P K <sapk@vmware.com>
4 years agoMerge pull request #5210 from bisdhdh/master
Russ White [Tue, 28 Jan 2020 16:47:09 +0000 (11:47 -0500)]
Merge pull request #5210 from bisdhdh/master

bgpd:BGP Graceful Restart Per Neighbor(BGPN) Feature.

4 years agoMerge pull request #4773 from thozza/31-prefix-bcast-addr
Russ White [Tue, 28 Jan 2020 16:42:45 +0000 (11:42 -0500)]
Merge pull request #4773 from thozza/31-prefix-bcast-addr

ipv4_broadcast_addr() didn't comply with RFC3021

4 years agoMerge pull request #5721 from mjstapp/vty_copy_to_runn
Russ White [Tue, 28 Jan 2020 16:31:25 +0000 (11:31 -0500)]
Merge pull request #5721 from mjstapp/vty_copy_to_runn

vtysh: add a cli that reads a file into running-config

4 years agozebra: add config to disable use of kernel nexthops
Mark Stapp [Tue, 28 Jan 2020 16:00:42 +0000 (11:00 -0500)]
zebra: add config to disable use of kernel nexthops

Add a config that disables use of kernel-level nexthop ids.
Currently, zebra always uses nexthop ids if the kernel supports
them.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoMerge pull request #5706 from mjstapp/fix_nh_debug_show
Russ White [Tue, 28 Jan 2020 15:27:43 +0000 (10:27 -0500)]
Merge pull request #5706 from mjstapp/fix_nh_debug_show

zebra: include zebra nexthop debug in show runn

4 years agoMerge pull request #5716 from opensourcerouting/bfdd-log
Russ White [Tue, 28 Jan 2020 15:25:56 +0000 (10:25 -0500)]
Merge pull request #5716 from opensourcerouting/bfdd-log

bfdd: remove logging shim & fix warnings