]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
6 years agoFRRouting Release 5.0 frr-5.0
Martin Winter [Fri, 8 Jun 2018 01:39:07 +0000 (18:39 -0700)]
FRRouting Release 5.0

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
6 years agoMerge pull request #2333 from pacovn/dev/5.0
Renato Westphal [Thu, 7 Jun 2018 14:54:34 +0000 (11:54 -0300)]
Merge pull request #2333 from pacovn/dev/5.0

bgpd label manager support fixes

6 years agobgpd, doc, ldpd, lib, tests, zebra: LM fixes 2333/head
paco [Thu, 7 Jun 2018 13:28:12 +0000 (15:28 +0200)]
bgpd, doc, ldpd, lib, tests, zebra: LM fixes

Corrections so that the BGP daemon can work with the label manager properly
through a label-manager proxy. Details:

- Correction so the BGP daemon behind a proxy label manager gets the range
  correctly (-I added to the BGP daemon, to set the daemon instance id)
- For the BGP case, added an asynchronous label manager connect command so
  the labels get recycled in case of a BGP daemon reconnection. With this,
  BGPd and LDPd would behave similarly.

Signed-off-by: F. Aragon <paco@voltanet.io>
6 years agoMerge pull request #2362 from donaldsharp/vrf_debug_5.0
Lou Berger [Mon, 4 Jun 2018 13:53:59 +0000 (09:53 -0400)]
Merge pull request #2362 from donaldsharp/vrf_debug_5.0

Couple of cherry-picks of code

6 years agoMerge pull request #2317 from pguibert6WIND/fs_zebra_complement
Donald Sharp [Mon, 4 Jun 2018 13:53:32 +0000 (09:53 -0400)]
Merge pull request #2317 from pguibert6WIND/fs_zebra_complement

Flowspec complement : port support and policy routing per interface and plugin wrapper

6 years agoMerge pull request #2357 from opensourcerouting/pbrd-ubuntu-fix
Donald Sharp [Mon, 4 Jun 2018 12:34:38 +0000 (08:34 -0400)]
Merge pull request #2357 from opensourcerouting/pbrd-ubuntu-fix

PBRd and BGPd ubuntu fix

6 years agobgpd: open per vrf listen socket for linux type vrfs 2362/head
Lou Berger [Sat, 2 Jun 2018 19:01:36 +0000 (15:01 -0400)]
bgpd: open per vrf listen socket for linux type vrfs

Signed-off-by: Lou Berger <lberger@labn.net>
6 years agolib: fix setsockopt arg
Lou Berger [Sun, 6 May 2018 15:25:58 +0000 (11:25 -0400)]
lib: fix setsockopt arg

Signed-off-by: Lou Berger <lberger@labn.net>
6 years agozebra: Add some vrf information to debug messages
Donald Sharp [Tue, 29 May 2018 14:33:04 +0000 (10:33 -0400)]
zebra: Add some vrf information to debug messages

When debugging code in redistribute.c, it is useful to output
the vrf we think the interface is in.  So display it
when we are debugging.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: Prevent possible uninited variable. 2357/head
Donald Sharp [Tue, 15 May 2018 17:57:40 +0000 (13:57 -0400)]
bgpd: Prevent possible uninited variable.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agopbrd: Fix compilation warn -> error
Donald Sharp [Tue, 15 May 2018 17:34:52 +0000 (13:34 -0400)]
pbrd: Fix compilation warn -> error

The buffer size was insufficiently sized to hold the
entirety of the data being passed in.

Modify the nht code to use a bit bigger buffer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agopbrd: Fix nearly impossible truncation
Donald Sharp [Thu, 3 May 2018 00:12:31 +0000 (20:12 -0400)]
pbrd: Fix nearly impossible truncation

Since we are writing into the name field which is PBR_MAP_NAMELEN
size, we are expecting this to field to be at max 100 bytes.
Newer compilers understand that the %s portion may be up to
100 bytes( because of the size of the string.  The %u portion
is expected to be 10 bytes.  So in `theory` there are situations
where we might truncate.  The reality this is never going to
happen( who is going to create a nexthop group name that is
over say 30 characters? ).  As such we are expecting the
calling function to subtract 10 from the size_t l before
we pass it in to get around this new gcc fun.

Fixes: #2163
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #2308 from opensourcerouting/dev-5.0-mpls_te_print_detail-fix
Olivier Dugeon [Fri, 1 Jun 2018 14:32:44 +0000 (16:32 +0200)]
Merge pull request #2308 from opensourcerouting/dev-5.0-mpls_te_print_detail-fix

isisd: fix mpls_te_print_detail to not read out-of-bounds

6 years agoMerge pull request #2341 from donaldsharp/watchfrr_5.0
Martin Winter [Fri, 1 Jun 2018 00:59:11 +0000 (02:59 +0200)]
Merge pull request #2341 from donaldsharp/watchfrr_5.0

Watchfrr 5.0

6 years agoredhat: Fix old systems on upgrade path 2340/head 2341/head
Donald Sharp [Wed, 30 May 2018 11:53:28 +0000 (07:53 -0400)]
redhat: Fix old systems on upgrade path

Fix old systems in upgrade path to enable watchfrr when upgrading.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoredhat: Make watchfrr the default
Donald Sharp [Thu, 17 May 2018 11:58:02 +0000 (07:58 -0400)]
redhat: Make watchfrr the default

With systemd being the default on more systems now, lets
configure watchfrr to start else systemd systems on
redhat will not stay up for more than 1 minute.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: attributes presence checked when mpreach is present 2317/head
Philippe Guibert [Fri, 25 May 2018 10:22:14 +0000 (12:22 +0200)]
bgpd: attributes presence checked when mpreach is present

On the case where an mp_unreach attribute is received, while there is no
mp_reach attribute too, it is not necessary to check for missing
attributes.

Fixes: 67495ddb2e5b ("bgpd: Fixes for recent well-known-attr check patch.")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: do not install BGP FS entries, while table range not obtained
Philippe Guibert [Wed, 23 May 2018 12:14:53 +0000 (14:14 +0200)]
bgpd: do not install BGP FS entries, while table range not obtained

Sometimes at startup, BGP Flowspec may be allocated a routing table
identifier not in the range of the predefined table range.
This issue is due to the fact that BGP peering goes up, while the BGP
did not yet retrieve the Table Range allocator.
The fix is done so that BGP PBR entries are not installed while
routing table identifier range is not obtained. Once the routing table
identifier is obtained, parse the FS entries and check that all selected
entries are installed, and if not, install it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: enhance debug bgp pbr error vty command
Philippe Guibert [Wed, 23 May 2018 12:10:38 +0000 (14:10 +0200)]
bgpd: enhance debug bgp pbr error vty command

Added following vty command:
[no] debug bgp pbr error

This permits dumping on the logs some errors related to PBR.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: increase buffer size to store ecomunity as a string
Philippe Guibert [Wed, 23 May 2018 10:10:00 +0000 (12:10 +0200)]
bgpd: increase buffer size to store ecomunity as a string

On the case where an ecom from FS redirect is received, the ecom may be
with the format A.B.C.D:E. On this case, the printable format of the
Flowspec redirect VRF ecom value may use more bytes in the buffer
dedicated for that. The buffer that stores the ecommunity is increased.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: brace zebra pbr traces
Philippe Guibert [Mon, 21 May 2018 10:02:52 +0000 (12:02 +0200)]
bgpd: brace zebra pbr traces

By default, some debug traces were displayed. Those pbr traces are
hidden with 'debug bgp zebra' command.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: add ZAPI_XXX_FAIL_REMOVE flag in switch
Philippe Guibert [Fri, 18 May 2018 16:15:47 +0000 (18:15 +0200)]
bgpd: add ZAPI_XXX_FAIL_REMOVE flag in switch

The new enums for handling REMOVE failures are appended in the switch
case.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agopbrd: add ZAPI_RULE_FAIL_REMOVE flag in switch
Philippe Guibert [Fri, 18 May 2018 15:11:50 +0000 (17:11 +0200)]
pbrd: add ZAPI_RULE_FAIL_REMOVE flag in switch

The notification handler consecutive to an add/remove of a rule in zebra
is being added the FAIL_REMOVE flag. It is mapped on REMOVE flag
behaviour for now.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: upon uninstalling pbr rule, update local structure
Philippe Guibert [Mon, 21 May 2018 14:40:31 +0000 (16:40 +0200)]
bgpd: upon uninstalling pbr rule, update local structure

Currently, uninstall pbr rule is not handled by BGP notification
handler. So the uninstall update of the structure is done, immediately
after sending the request of uninstall to zebra.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: add pbr objects fail_remove value into notification
Philippe Guibert [Fri, 18 May 2018 14:22:23 +0000 (16:22 +0200)]
zebra: add pbr objects fail_remove value into notification

After PBR or BGP sends back a request for sending a rule/ipset/ipset
entry/iptable delete, there may be issue in deleting it. A notification
is sent back with a new value indicating that the removal failed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: PBR show debugging IPSET/IPTABLE hooks declared
Philippe Guibert [Tue, 22 May 2018 07:42:55 +0000 (09:42 +0200)]
zebra: PBR show debugging IPSET/IPTABLE hooks declared

This hook can be used if the plugin module wrap_script is used.
This hook is called to dump the debugging status of this module, on the
vty.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: PBR config and monitor IPSET/IPTABLE hooks declared
Philippe Guibert [Fri, 4 May 2018 11:57:31 +0000 (13:57 +0200)]
zebra: PBR config and monitor IPSET/IPTABLE hooks declared

The following PBR handlers: ipset, and iptables will prioritary
call the hook from a possible plugin.
If a plugin is attached, then it will return a positive value.
That is why the return status is tested against 0 value, since that
means that there are no plugin module plugged

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: initialise nexthop structure, before filling in some attributes
Philippe Guibert [Thu, 3 May 2018 12:11:03 +0000 (14:11 +0200)]
bgpd: initialise nexthop structure, before filling in some attributes

In order to have a clean structure, a reset is done before using the
struct nexthop.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: traffic rate value is ignored for searching bpa
Philippe Guibert [Thu, 3 May 2018 12:09:35 +0000 (14:09 +0200)]
bgpd: traffic rate value is ignored for searching bpa

There are cases where a redirect IP or redirect VRF stops the ecom
parsing, then ignores a subsequent rate value, letting passed value to
0. Consequently, a new table identifier may be elected, despite the
routing procedure is the same. This fix ignores the rate value in bpa
list.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: handle more than one ext. community
Philippe Guibert [Thu, 3 May 2018 12:08:38 +0000 (14:08 +0200)]
bgpd: handle more than one ext. community

The ecommunity was badly read. This fix ensures that all ecom are reads
and stored in local structure.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: add vty command to restrict FS policy routing to a defined interface
Philippe Guibert [Wed, 25 Apr 2018 16:29:35 +0000 (18:29 +0200)]
bgpd: add vty command to restrict FS policy routing to a defined interface

policy routing is configurable via address-family ipv4 flowspec
subfamily node. This is then possible to restrict flowspec operation
through the BGP instance, to a single or some interfaces, but not all.

Two commands available:
[no] local-install [IFNAME]

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: display if FS entry is installed in PBR or not
Philippe Guibert [Fri, 20 Apr 2018 09:41:54 +0000 (11:41 +0200)]
bgpd: display if FS entry is installed in PBR or not

Once PBR rules installed, an information is printed in the main
show bgp ipv4 flowspec detail information.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: pbr support for port redirecting
Philippe Guibert [Fri, 30 Mar 2018 10:25:03 +0000 (12:25 +0200)]
bgpd: pbr support for port redirecting

Ability for BGP FS to convert some rules containining at least one
address and one port information into a pbr_match_entry rule.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: add 3 fields to ipset_entry : src,dst port, and proto
Philippe Guibert [Fri, 30 Mar 2018 11:01:39 +0000 (13:01 +0200)]
bgpd: add 3 fields to ipset_entry : src,dst port, and proto

Those 3 fields are read and written between zebra and bgpd.
This permits extending the ipset_entry structure.
Combinatories will be possible:
- filtering with one of the src/dst port.
- filtering with one of the range src/ range dst port
usage of src or dst is exclusive in a FS entry.
- filtering a port or a port range based on either src or dst port.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: do not account twice references to rule context
Philippe Guibert [Fri, 18 May 2018 14:14:46 +0000 (16:14 +0200)]
bgpd: do not account twice references to rule context

When rule add transaction is sent from bgpd to zebra, the reference
context must not be incremented while the confirmation message of
install has not been sent back; unless if the transaction failed to be
sent.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: add missing ecommunity flowspec to display
Philippe Guibert [Thu, 17 May 2018 07:30:28 +0000 (09:30 +0200)]
bgpd: add missing ecommunity flowspec to display

On some cases, the ecommunity flowspec for redirect vrf is not displayed
in all cases. On top of that, display the values if ecom can no be
decoded.
Also, sub_type and type are changed from int to u_int8_t, because the
values contains match the type and sub type of extended communities.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: update comment when calling pbr southbound interface
Philippe Guibert [Thu, 3 May 2018 06:56:42 +0000 (08:56 +0200)]
zebra: update comment when calling pbr southbound interface

Some documentation is updated.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: improve flowspec update of route to NH/VRF
Philippe Guibert [Mon, 21 May 2018 16:35:38 +0000 (18:35 +0200)]
bgpd: improve flowspec update of route to NH/VRF

The debugging message in charge of showing if the route is added or
witdrawn is changed accordingly to reflect this status.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: add notify value in zlog notification message for pbr
Philippe Guibert [Mon, 30 Apr 2018 08:35:10 +0000 (10:35 +0200)]
bgpd: add notify value in zlog notification message for pbr

notifications values from zebra related to pbr are dumped.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: handle iptable list of interfaces
Philippe Guibert [Wed, 25 Apr 2018 16:34:27 +0000 (18:34 +0200)]
zebra: handle iptable list of interfaces

Upon reception of an iptable_add or iptable_del, a list of interface
indexes may be passed in the zapi interface. The list is converted in
interface name so that it is ready to be passed to be programmed to the
underlying system.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: add 3 fields to ipset_entry : src,dst port, and proto
Philippe Guibert [Fri, 30 Mar 2018 11:01:39 +0000 (13:01 +0200)]
zebra: add 3 fields to ipset_entry : src,dst port, and proto

Those 3 fields are read and written between zebra and bgpd.
This permits extending the ipset_entry structure.
Combinatories will be possible:
- filtering with one of the src/dst port.
- filtering with one of the range src/ range dst port
usage of src or dst is exclusive in a FS entry.
- filtering a port or a port range based on either src or dst port.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: pbr vty show command for ipset and iptables
Philippe Guibert [Mon, 23 Apr 2018 13:17:19 +0000 (15:17 +0200)]
zebra: pbr vty show command for ipset and iptables

Two new vty show functions available:
show pbr ipset <NAME>
show pbr iptables <NAME>

Those function dump the underlying "kernel" contexts. It relies on the
zebra pbr contexts. This helps then to know which zebra pbr
context has been configured since those contexts are mainly configured
by BGP Flowspec.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: add netlink rule support for fwmark option
Philippe Guibert [Fri, 27 Apr 2018 14:32:51 +0000 (16:32 +0200)]
zebra: add netlink rule support for fwmark option

When a mark is set, incoming traffic having that mark set can be
redirected to a specific table identifier. This work is done through
netlink.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: handle notification in case pbr ipset, or iptables is removed
Philippe Guibert [Mon, 23 Apr 2018 13:31:04 +0000 (15:31 +0200)]
zebra: handle notification in case pbr ipset, or iptables is removed

In cast the removal of an iptable or an ipset pbr context is done,
then a notification is sent back to the relevant daemon that sent the
message.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: cleanup zebra policy context
Philippe Guibert [Wed, 21 Mar 2018 16:52:41 +0000 (17:52 +0100)]
zebra: cleanup zebra policy context

Upon the remote daemon leaving, some contexts may have to be flushed.
This commit does the change. IPset and IPSet Entries and iptables are
flushed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agoisisd: fix mpls_te_print_detail to not read out-of-bounds 2308/head
Christian Franke [Fri, 25 May 2018 16:21:25 +0000 (18:21 +0200)]
isisd: fix mpls_te_print_detail to not read out-of-bounds

6 years agozebra: ipset and ipset entry deletion remove entry from hash list too
Philippe Guibert [Thu, 26 Apr 2018 11:31:16 +0000 (13:31 +0200)]
zebra: ipset and ipset entry deletion remove entry from hash list too

This commit is a fix that removes the structure from the hash list,
instead of just removing that structure.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: rework pbr ipset entry
Philippe Guibert [Tue, 27 Mar 2018 09:27:10 +0000 (11:27 +0200)]
zebra: rework pbr ipset entry

Add ns_id into zebra_pbr ipset
This is important so that each ipset entry knows on which NETNS the
ipset entry must be inkected

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agoMerge pull request #2327 from pguibert6WIND/fix_other_static_owners
Donald Sharp [Wed, 30 May 2018 12:10:38 +0000 (08:10 -0400)]
Merge pull request #2327 from pguibert6WIND/fix_other_static_owners

Fix other static owners

6 years agoMerge pull request #2321 from ppmathis/backport/5.0
Donald Sharp [Wed, 30 May 2018 12:09:40 +0000 (08:09 -0400)]
Merge pull request #2321 from ppmathis/backport/5.0

*: Backport bugfixes and features into dev/5.0

6 years agozebra: Add a breadcrumb for when we ignore a route 2327/head
Donald Sharp [Fri, 25 May 2018 18:45:16 +0000 (14:45 -0400)]
zebra: Add a breadcrumb for when we ignore a route

When we receive a route that we think we own and we
are not in startup conditions, then add a small debug
to help debug the issue when this happens, instead
of silently just ignoring the route.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agotools, zebra: Use different protocol value for our statics
Donald Sharp [Fri, 25 May 2018 18:36:12 +0000 (14:36 -0400)]
tools, zebra: Use different protocol value for our statics

The re-use of RTPROT_STATIC has caused too many collisions
where other legitimate route sources are causing us to
believe we are the originator of the route.  Modify
the code so that if another protocol inserts RTPROT_STATIC
we will assume it's a Kernel Route.

Fixes: #2293
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: Fix memleak, adapt adv- to recv-routes code 2321/head
Pascal Mathis [Wed, 16 May 2018 19:55:55 +0000 (21:55 +0200)]
bgpd: Fix memleak, adapt adv- to recv-routes code

This commit tries to adapt a similar codeflow within the `show bgp [afi]
[safi] neighbor <neighbor> advertised-routes` command compared to its
`received-routes` and `filtered-routes` opponents. Some branching code
has been restructured to achieve this.

Additionally, this commit fixes a memory leak within `received-routes`
(and `filtered-routes`, although the issue has been present before the
previous commit!) where the previous implementation forgot to
deduplicate the BGP attributes.

When a user called `<...> received-routes route-map <RM-TEST>` and that
routemap changed any AS path or community parameters, the duplicated
memory for these parameters was never freed. This has been fixed by
ensuring to call `bgp_attr_undup()` accordingly.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit b755861b95142446bac05f0f2506647bbca5d2d8)

6 years agobgpd: Implement new adjacent route show commands
Pascal Mathis [Wed, 16 May 2018 17:17:42 +0000 (19:17 +0200)]
bgpd: Implement new adjacent route show commands

This commit changes the behavior of `show bgp [afi] [safi] neighbor
<neighbor> received-routes [json]` to return all received prefixes
instead of filtering rejected/denied prefixes.

Compared to Cisco and Juniper products, this is the usual way how this
command is supposed to work, as `show bgp [afi] [safi] neighbor
<neighbor> routes` will already return all accepted prefixes.

Additionally, the new command `show bgp [afi] [safi] neighbor <neighbor>
filtered-routes` has been added, which returns a list of all prefixes
that got filtered away, so it can be roughly described as a subset of
"received prefixes - accepted prefixes".

As the already available `filtered_count` variable inside
`show_adj_route` has not been used before, the last output line
summarizing the amount of prefixes found was extended to also mention
the amount of filtered prefixes if present.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit 6392aaa6547e665859ab5c648df30c1c04e26f6d)

6 years agobgpd: Improve route-map matching for INET(6) AF
Pascal Mathis [Tue, 15 May 2018 17:22:25 +0000 (19:22 +0200)]
bgpd: Improve route-map matching for INET(6) AF

While the current implementation does pay attention to the AF
(inet/inet6) when comparing the IPv4/v6 address against an address-list
/ prefix-list inside a route-map, the AF check is being done rather
late, which leads to CPU cycles being wasted due to unnecessary list
lookups / address matching.

This commit checks the address family of a prefix right inside the
`route_match_ip(v6)_` functions before looking up any address- and/or
prefix-list, which should improve performance.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit 09cd98ebeef5e8d0c39a30574307a04bbb59b947)

6 years agobgpd: Respect AFI/SAFI when hard-clearing a peer
Pascal Mathis [Mon, 14 May 2018 20:52:31 +0000 (22:52 +0200)]
bgpd: Respect AFI/SAFI when hard-clearing a peer

The current implementation does not respect the AFI+SAFI combination of
a peer when executing a non-soft (hard) clear. An example would be the
command `clear bgp ipv4 unicast *`, which will clear all BGP peers, even
those that do not have IPv4-Unicast activated.

This commit fixes that behavior by applying the same rules to both soft
and hard clear commands, so that peers without a matching AFI+SAFI
combination will be no longer modified.

Additionally, this commit adds warning messages to all `clear bgp
[<afi>] [<safi>] <target>` commands when no matching peers with the given
AFI+SAFI combination could be found.

Both existing and new warning messages have been extended to also
mention the AFI+SAFI combination that is missing, which is more helpful
to the user than a generic expression 'No peer configured'.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit 3ae8bfa5d870d103325cf879a501758e217c6a89)

6 years agobgpd: Improve JSON support for large communities
Pascal Mathis [Sun, 13 May 2018 00:29:40 +0000 (02:29 +0200)]
bgpd: Improve JSON support for large communities

The current implementation of building JSON output is greatly different
for large communities compared to standard communities. This is mainly
noticeable by the missing 'list' attribute, which usually offers an
array of all communities present on a BGP route.

This commit adds the missing functionality of properly returning a
'list' attribute in JSON output and also tries a similar approach like
the standard communities are using to implement this feature.

Additionally, the 'format' specifier has been completely removed from
large communities string/JSON rendering, as the official RFC8092 specifies that
there is only one canonical representation:

> The canonical representation of BGP Large Communities is three
> separate unsigned integers in decimal notation in the following
> order: Global Administrator, Local Data 1, Local Data 2. Numbers
> MUST NOT contain leading zeros; a zero value MUST be represented with
> a single zero. Each number is separated from the next by a single
> colon. For example: 64496:4294967295:2, 64496:0:0.

As the 'format' specifier has not been used/checked and only one
canonical representation exists per today, there was no reason to keep
the 'format' parameter in the function signature.

Last but not least, the struct attribute 'community_entry.config' is no
longer being used for large communities and instead 'lcommunity_str' is
being called to maintain a similar approach to standard communities.

As a side effect, this also fixed a memory leak inside 'community_entry_free'
which did not free the allocated memory for the 'config' attribute when
dealing with a large community.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit 8d9b8ed99de997a4ade10b98aac4ea43add2f9c8)

6 years agolib: Moved no-password warnings into header file
Pascal Mathis [Sun, 13 May 2018 17:11:43 +0000 (19:11 +0200)]
lib: Moved no-password warnings into header file

The warning string which appears when the users executes 'no (enable)
password' was moved into command.h and declared as a constant named
'NO_PASSWD_CMD_WARNING'.

This avoids duplicate code and makes it easy to change the warning
message in all places at once.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit 4911ca9cab5d75b5031edb83b52423ed47798324)

6 years agolib: Improved warnings for 'no (enable) password'
Pascal Mathis [Sat, 12 May 2018 18:19:49 +0000 (20:19 +0200)]
lib: Improved warnings for 'no (enable) password'

When the user executes one of the commands 'no password' or 'no enable
password', a warning message gets shown to inform the user of the
security implications.

While the current implementation works, a warning message gets printed
once for each daemon, which can lead to seeing the same message many
times. This does not affect functionality, but looks like an error to
the user as it can be seen within issue #1432.

This commit only prints the warning message inside lib when vtysh
dispatch is not being used. Additionally, the warning message was copied
into the vtysh command handlers, so that they get printed exactly once.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit eb83f7ce842944518bac726c19eb071257a2ed56)

6 years agolib: Ported 'no (enable) password' from stable/3.0
Pascal Mathis [Fri, 11 May 2018 00:54:30 +0000 (02:54 +0200)]
lib: Ported 'no (enable) password' from stable/3.0

The pull request #1545 from @donaldsharp introduced the command 'no
password' to remove an existing terminal connection password.
Additionally, warnings have been added to both 'no password' and 'no
enable password' to make the user aware of any security implications.

It seems that this specific pull request was never merged against master
and got lost. This commit is a cherry-pick of d4961273cb with fixed
conflicts and updated documentation.

Thanks to @donaldsharp and @pogojotz for the original PR.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit 322e2d5c694449ee604c339abb0e9fc14babdc45)

6 years agodebianpkg: improve VTYSH_PAGER environment check
Pascal Mathis [Thu, 10 May 2018 22:03:23 +0000 (00:03 +0200)]
debianpkg: improve VTYSH_PAGER environment check

The current post-installation scripts for all Debian packages execute
grep 'VTYSH_PAGER=/bin/cat' to check if the VTYSH_PAGER variable is
present within /etc/environment.

While presence of that environment variable should be checked, the
current implementation does not handle this line being a comment (and
therefor not active) or the user picking a different VTYSH_PAGER than
/bin/cat.

This commit ensures that the environment variable can be freely changed
by the user, while still guaranteeing that it is present in the file
without being a comment.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit 332266dbd1b5edd5bc0af3b5a4bd52b62a992fa3)

6 years agobgpd: fix and improve snmp peer lookups
Pascal Mathis [Thu, 10 May 2018 21:35:37 +0000 (23:35 +0200)]
bgpd: fix and improve snmp peer lookups

The previous implementation of bgp_peer_lookup_next did not consider the
internal ordering of peers when using peer groups, which led to all
standalone peers being skipped that had a lower IP address than the
highest IP address of a peer belonging to a group.

As the ordering of peers can not be arbitrary due to SNMP requiring
increasing OIDs when walking an OID tree, this commit fixes the bug by
properly looping through all peers and detecting the next highest IP
address.

Additionally, this commit improved both bgp_peer_lookup_next and
peer_lookup_addr_ipv4 by using the socketunion stored within the peer
struct (peer->su) instead of calling inet_pton for each peer during
comparison.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
(cherry picked from commit 2b8e62f2db185e5c2c11d691523b3f734d224e95)

6 years agoMerge pull request #2306 from opensourcerouting/dev-5.0-isis-tlv-copy-fix
Jafar Al-Gharaibeh [Tue, 29 May 2018 15:45:59 +0000 (11:45 -0400)]
Merge pull request #2306 from opensourcerouting/dev-5.0-isis-tlv-copy-fix

isisd: fix bug in tlv_copy of empty MT-router-info

6 years agoMerge pull request #2311 from Fredi-raspall/fix_label_manager_dev_5.0
Donald Sharp [Tue, 29 May 2018 14:26:50 +0000 (10:26 -0400)]
Merge pull request #2311 from Fredi-raspall/fix_label_manager_dev_5.0

Fix label manager dev 5.0

6 years agoMerge pull request #2313 from opensourcerouting/dev-5.0-malloc-0-fix
Donald Sharp [Tue, 29 May 2018 14:22:15 +0000 (10:22 -0400)]
Merge pull request #2313 from opensourcerouting/dev-5.0-malloc-0-fix

lib: make allocators work for allocation sizes of 0

6 years agolib: make allocators work for allocation sizes of 0 2313/head
Christian Franke [Tue, 29 May 2018 12:47:20 +0000 (14:47 +0200)]
lib: make allocators work for allocation sizes of 0

Fixes: #2155
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
6 years agolib, zebra: fix formatting and style 2311/head
Fredi Raspall [Tue, 8 May 2018 08:13:20 +0000 (10:13 +0200)]
lib, zebra: fix formatting and style

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
6 years agobgpd/bgp_zebra.c: Fix process of label-chunk msg
Fredi Raspall [Wed, 2 May 2018 14:30:26 +0000 (16:30 +0200)]
bgpd/bgp_zebra.c: Fix process of label-chunk msg

All messages to/from the label manager include two additional
fields: protocol and instance. This patch fixes the parsing
of label chunks response used by BGPd, which did not consider
the two fields.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
6 years agozebra, lib: Fix SA warning and formatting.
Fredi Raspall [Tue, 1 May 2018 18:43:14 +0000 (20:43 +0200)]
zebra, lib: Fix SA warning and formatting.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
6 years agozebra: LM temporally ignore id/proto mismatch error
Fredi Raspall [Fri, 27 Apr 2018 18:29:52 +0000 (20:29 +0200)]
zebra: LM temporally ignore id/proto mismatch error

Since BGPd is not currently setting ID and PROTOCOL in label
requests, temporally disable mismatch error propagation.

This commit will be reverted once fixes for BGPd and label
manager are integrated.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
6 years agozebra: Fix label manager proxy mode.
Fredi Raspall [Fri, 27 Apr 2018 16:47:51 +0000 (18:47 +0200)]
zebra: Fix label manager proxy mode.

The current implementation did not consider multiple clients to
a label-manager acting as proxy, i.e. relaying messages to another
label manager. Specifically, upon a client's request, it checked
the socket & buffer from the actual label manager for pending
responses and directly copìed them to the client --currently--
being served. As a result, if two clients (e.g. ldpd and bgpd)
sent requests, it could happen that responses being 'on the wire'
from the real label manager towards the proxy, where relayed to
the wrong client. This patch, which requires all msgs to include
a a proto & instance pair, lookups up the zserv client that a
message (response) is to be relayed to.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
6 years agozebra, lib: Add client proto & instance in zserv
Fredi Raspall [Thu, 26 Apr 2018 08:56:19 +0000 (10:56 +0200)]
zebra, lib: Add client proto & instance in zserv

Add client proto and instance number in all msg (request and
responses) to/form a label manager. This is required for a
label manager acting as 'proxy' (i.e. relaying messages towards
another label manager) to correctly deliver responses to the
requesting clients.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
6 years agozebra: fix broken label manager proxy mode.
Fredi Raspall [Wed, 25 Apr 2018 10:18:10 +0000 (12:18 +0200)]
zebra: fix broken label manager proxy mode.

In a prior refactor, label manager proxy functionality
was broken in two places:

1) in function relay_response_back(), "dst" stream was
accidentally  replaced by "src".

2) in zread_relay_label_manager_request(), src was set to point
to a global struct stream *ibuf that was not used/initialized
anywhere.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
6 years agoisisd: fix bug in tlv_copy of empty MT-router-info 2306/head
Christian Franke [Mon, 28 May 2018 12:13:18 +0000 (14:13 +0200)]
isisd: fix bug in tlv_copy of empty MT-router-info

6 years agoMerge pull request #2285 from qlyoung/update-doc-titles-5.0
Jafar Al-Gharaibeh [Sun, 27 May 2018 16:51:32 +0000 (12:51 -0400)]
Merge pull request #2285 from qlyoung/update-doc-titles-5.0

doc: update doc titles [5.0]

6 years agodoc: update doc titles 2285/head
Quentin Young [Wed, 9 May 2018 14:44:08 +0000 (10:44 -0400)]
doc: update doc titles

Should be a bit easier to Google this way.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoMerge pull request #2269 from opensourcerouting/rpki-spec-fix-5.0
Donald Sharp [Tue, 22 May 2018 17:11:57 +0000 (13:11 -0400)]
Merge pull request #2269 from opensourcerouting/rpki-spec-fix-5.0

redhat: Fix RPKI RPM build option (dev/5.0)

6 years agoredhat: Fix RPKI RPM build option 2269/head
Martin Winter [Mon, 21 May 2018 13:41:42 +0000 (06:41 -0700)]
redhat: Fix RPKI RPM build option

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
6 years agoMerge pull request #2244 from donaldsharp/cp_into_50
Renato Westphal [Wed, 16 May 2018 14:45:41 +0000 (11:45 -0300)]
Merge pull request #2244 from donaldsharp/cp_into_50

Fix compilation against rtrlib with ssh

6 years agoFix compilation against rtrlib with ssh 2244/head
Andrey Korolyov [Sun, 13 May 2018 10:36:50 +0000 (13:36 +0300)]
Fix compilation against rtrlib with ssh

Signed-off-by: Andrey Korolyov <andrey@xdel.ru>
6 years agoMerge pull request #2224 from qlyoung/fix-vpath-build-5.0
Lou Berger [Tue, 15 May 2018 15:48:50 +0000 (11:48 -0400)]
Merge pull request #2224 from qlyoung/fix-vpath-build-5.0

doc: support VPATH builds [5.0]

6 years agodoc: support VPATH builds 2224/head
Quentin Young [Wed, 2 May 2018 18:42:28 +0000 (14:42 -0400)]
doc: support VPATH builds

Documentation was not fully using Automake / Autoconf and therefore needs
modifications to support black magic VPATH builds.

* Convert Makefile's to Autoconf-controlled Makefile.in's
* Tweak loading of pygments lexer to handle runtime paths
* Update .gitignore's as necessary

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoMerge pull request #2219 from pguibert6WIND/misc_crashes_moving_ifp_from_netns
Donald Sharp [Sat, 12 May 2018 14:01:31 +0000 (10:01 -0400)]
Merge pull request #2219 from pguibert6WIND/misc_crashes_moving_ifp_from_netns

Misc crashes moving ifp from netns

6 years agoMerge pull request #2218 from pguibert6WIND/issue_2177
Donald Sharp [Sat, 12 May 2018 13:59:45 +0000 (09:59 -0400)]
Merge pull request #2218 from pguibert6WIND/issue_2177

pbrd: encode null fwmark to be consistent with zebra decode rule

6 years agozebra: avoid inactivating twice an interface 2219/head
Philippe Guibert [Fri, 4 May 2018 11:49:56 +0000 (13:49 +0200)]
zebra: avoid inactivating twice an interface

This code is a sanity check to avoid double unlink of interface.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: fix missing node attribute set in ifp
Philippe Guibert [Fri, 4 May 2018 07:43:52 +0000 (09:43 +0200)]
zebra: fix missing node attribute set in ifp

There are cases when switching from one netns to an other one, where the
if_table registration by index has not been flushed. This fix mitigates
the potential crashes, in case the ifp->node pointer is null, the value
is overwritten by the route_node obtained.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: avoid case where same interface pointer returned
Philippe Guibert [Fri, 4 May 2018 07:26:10 +0000 (09:26 +0200)]
zebra: avoid case where same interface pointer returned

When checking for a duplicate interface in an other NETNS, one may find
an interface in default VRF. That interface may have been moved to that
default VRF, for further action. Prevent from doing any action at this
point.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agozebra: improve logs when replacing interface to an other netns
Philippe Guibert [Tue, 24 Apr 2018 10:19:48 +0000 (12:19 +0200)]
zebra: improve logs when replacing interface to an other netns

The log information is better displated.
Also the variable name fits better with other_ifp, than with old_ifp.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agopbrd: encode null fwmark to be consistent with zebra decode rule 2218/head
Philippe Guibert [Mon, 7 May 2018 16:59:41 +0000 (18:59 +0200)]
pbrd: encode null fwmark to be consistent with zebra decode rule

A null 4-byte long fwmark is encoded in pbr rule.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agoMerge pull request #2165 from pguibert6WIND/bgp_fs_pbr
Russ White [Tue, 8 May 2018 23:55:44 +0000 (19:55 -0400)]
Merge pull request #2165 from pguibert6WIND/bgp_fs_pbr

Bgp Flowspec Policy Based Routing

6 years agoMerge pull request #2176 from opensourcerouting/dev-5.0-isis-redist-metric
Donald Sharp [Tue, 8 May 2018 15:31:09 +0000 (11:31 -0400)]
Merge pull request #2176 from opensourcerouting/dev-5.0-isis-redist-metric

dev/5.0: isis redist metric

6 years agoisisd: use 0 as default-metric for redistribution 2176/head
Christian Franke [Mon, 7 May 2018 11:46:03 +0000 (13:46 +0200)]
isisd: use 0 as default-metric for redistribution

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
6 years agovtysh: add bgp_flowspec_vty to Makefile.am 2165/head
Philippe Guibert [Wed, 25 Apr 2018 07:24:00 +0000 (09:24 +0200)]
vtysh: add bgp_flowspec_vty to Makefile.am

In order to be able to configure flowspec from vtysh, the bgp_vty
flowspec file is added into vtysh files to parse.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: handle bgp pbr hash list destroy upon BGP destroy
Philippe Guibert [Tue, 24 Apr 2018 14:35:00 +0000 (16:35 +0200)]
bgpd: handle bgp pbr hash list destroy upon BGP destroy

Upon BGP destroy, the hash list related to PBR are removed.
The pbr_match entries, as well as the contained pbr_match_entries
entries.
Then the pbr_action entries. The order is important, since the former
are referencing pbr_action. So the references must be removed, prior to
remove pbr action.
Also, the zebra associated contexts are removed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: rewiew bgp pbr log messages with debug bgp pbr
Philippe Guibert [Wed, 18 Apr 2018 15:49:25 +0000 (17:49 +0200)]
bgpd: rewiew bgp pbr log messages with debug bgp pbr

log messages are now guarded with debug bgp pbr.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: add pbr error flag for pbr errors
Philippe Guibert [Wed, 18 Apr 2018 15:46:49 +0000 (17:46 +0200)]
bgpd: add pbr error flag for pbr errors

Some errors messages were not guarded. now those log messages
are guarded.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: handle FS redirect VRF rule in PBR
Philippe Guibert [Tue, 17 Apr 2018 16:32:49 +0000 (18:32 +0200)]
bgpd: handle FS redirect VRF rule in PBR

Upon redirect VRF message from FS, add a default route to the VRF
interface associated to the VRF.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: get table identifier from table manager
Philippe Guibert [Tue, 3 Apr 2018 13:06:50 +0000 (15:06 +0200)]
bgpd: get table identifier from table manager

A table chunk of 100000 is allocated from zebra, and when needed in
flowspec, the table identifier is extracted from that chunk.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: handle FS redirect IP rule in PBR
Philippe Guibert [Wed, 28 Mar 2018 12:51:57 +0000 (14:51 +0200)]
bgpd: handle FS redirect IP rule in PBR

If a new rule is identified, a new table identifier is created.
In that table, add a default route when possible. If redirect IP rule is
identified, then add a default route to that IP address.
If redirect VRF is identified, nothing is done for now

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agobgpd: allow flowspec entries to be announced to zebra
Philippe Guibert [Fri, 26 Jan 2018 17:36:24 +0000 (18:36 +0100)]
bgpd: allow flowspec entries to be announced to zebra

Flowspec entries are allowed to be announced.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>