]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
4 years agoMerge pull request #6531 from chiragshah6/yang_nb5
Renato Westphal [Thu, 11 Jun 2020 01:56:27 +0000 (22:56 -0300)]
Merge pull request #6531 from chiragshah6/yang_nb5

yang, zebra: redefine nexthop model

4 years agozebra: rib nb changes with redefined nexthop model
Chirag Shah [Fri, 5 Jun 2020 22:45:12 +0000 (15:45 -0700)]
zebra: rib nb changes with redefined nexthop model

RIB operational northbound changes based on redfined
nexthop model.

Testing Done:

{
  "afi-safi-name": "ipv4-unicast",
  "table-id": 254,
  "route": [
    {
      "prefix": "0.0.0.0/0",
      "route-entry": [
        {
          "protocol": "kernel",
          "distance": 0,
          "metric": 100,
          "selected": [null],
          "installed": [null],
          "internal-flags": 8,
          "internal-status": 16,
          "uptime": "2020-06-06T00:28:26.139797Z",
          "nexthop-group": {
            "id": 15,
            "nexthop": [
              {
                "nh-type": "ip4-ifindex",
                "vrf": "0",
                "gateway": "10.0.2.2",
                "interface": "enp0s3",
                "active": [null],
                "fib": [null]
              }
            ]
          }
        }
      ]
    },
    {
      "prefix": "1.1.1.4/32",
      "route-entry": [
        {
          "protocol": "kernel",
          "distance": 0,
          "metric": 0,
          "selected": [null],
          "installed": [null],
          "internal-flags": 8,
          "internal-status": 16,
          "uptime": "2020-06-06T00:28:26.139790Z",
          "nexthop-group": {
            "id": 16,
            "nexthop": [
              {
                "nh-type": "ifindex",
                "vrf": "0",
                "gateway": "",
                "interface": "dummy4",
                "active": [null],
                "fib": [null]
              }
            ]
          }
        }
      ]
    }
  ]
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
4 years agoyang: redefine nexthop operational model
Chirag Shah [Fri, 29 May 2020 04:44:37 +0000 (21:44 -0700)]
yang: redefine nexthop operational model

Separate out nexthop config and operational models.
nexthop-group config model has list of nexthop-groups
where else operational nexthop group is single entity
underneath list of nexthops.

The common code is fectored into grouping to use among
config and operational model.

nexthop operational model caters to RIB operational model.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
4 years agoMerge pull request #6471 from volta-networks/fix_zebra_register_rnh_pseudowire
Donald Sharp [Wed, 10 Jun 2020 23:03:06 +0000 (19:03 -0400)]
Merge pull request #6471 from volta-networks/fix_zebra_register_rnh_pseudowire

zebra: Every time zebra receives a ZEBRA_PW_SET, zebra should evaluate nh

4 years agoMerge pull request #6557 from opensourcerouting/zlogbuf-litter
Donald Sharp [Wed, 10 Jun 2020 22:59:25 +0000 (18:59 -0400)]
Merge pull request #6557 from opensourcerouting/zlogbuf-litter

lib: set up TLS log buffer after forking

4 years agoMerge pull request #6542 from mjstapp/zebra_opaque_unicast
Renato Westphal [Wed, 10 Jun 2020 22:06:16 +0000 (19:06 -0300)]
Merge pull request #6542 from mjstapp/zebra_opaque_unicast

Zebra opaque unicast messages

4 years agosharpd,zebra: unicast support for zapi messages
Mark Stapp [Mon, 8 Jun 2020 20:38:36 +0000 (16:38 -0400)]
sharpd,zebra: unicast support for zapi messages

Distinguish between unicast and broadcast opaque messages
in zebra handler code. Add cli and internal api changes to
have sharpd send unicast opaque messages. Add opaque cli
commands to the sharp user doc.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agolib: set up TLS log buffer after forking
David Lamparter [Wed, 10 Jun 2020 18:30:02 +0000 (20:30 +0200)]
lib: set up TLS log buffer after forking

... it contains our pid, so doing it before fork leads to littering
buffers since we try to clean up with the forked pid...

Fixes: #6541
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
4 years agoMerge pull request #6528 from mjstapp/fix_zebra_mpls_sa
Donald Sharp [Wed, 10 Jun 2020 17:57:02 +0000 (13:57 -0400)]
Merge pull request #6528 from mjstapp/fix_zebra_mpls_sa

zebra: fix coverity SA warnings

4 years agoMerge pull request #6555 from mjstapp/fix_ebgp_policy_topo_timeout
Donald Sharp [Wed, 10 Jun 2020 17:56:38 +0000 (13:56 -0400)]
Merge pull request #6555 from mjstapp/fix_ebgp_policy_topo_timeout

tests: raise convergence timeout in bgp_ebgp_requires_policy

4 years agoMerge pull request #6543 from volta-networks/fix_isis_afset_noarea
Donald Sharp [Wed, 10 Jun 2020 17:56:00 +0000 (13:56 -0400)]
Merge pull request #6543 from volta-networks/fix_isis_afset_noarea

isisd: fix segfault in isis_circuit_af_set

4 years agoMerge pull request #6414 from opensourcerouting/nb-error-handling
Santosh P K [Wed, 10 Jun 2020 17:17:07 +0000 (22:47 +0530)]
Merge pull request #6414 from opensourcerouting/nb-error-handling

NB context + enhanced error handling

4 years agoMerge pull request #6465 from xThaid/iprules
Stephen Worley [Wed, 10 Jun 2020 16:35:36 +0000 (12:35 -0400)]
Merge pull request #6465 from xThaid/iprules

zebra: move ip rule installation to use dplane thread

4 years agoMerge pull request #6460 from rgirada/ospf_external_lsa
Donald Sharp [Wed, 10 Jun 2020 16:35:17 +0000 (12:35 -0400)]
Merge pull request #6460 from rgirada/ospf_external_lsa

ospfd: External LSA lookup in LSDB failed in a specific scenario

4 years agotests: raise convergence timeout in bgp_ebgp_requires_policy
Mark Stapp [Wed, 10 Jun 2020 15:01:47 +0000 (11:01 -0400)]
tests: raise convergence timeout in bgp_ebgp_requires_policy

Timeout was 30 seconds, raise it to 130.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoisisd: prevent segfault in isis_circuit_af_set
Emanuele Di Pascale [Wed, 10 Jun 2020 12:29:02 +0000 (14:29 +0200)]
isisd: prevent segfault in isis_circuit_af_set

before the last commit, it was possible under some
circumstances to call isis_circuit_af_set on a circuit
with a NULL area, e.g. if the circuit was deconfigured
due to a validation error. While this should not happen
now, let's add an explicit check to avoid crashing if
a regression is introduced.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
4 years agoisisd: keep circuit config on conf->up failure
Emanuele Di Pascale [Tue, 9 Jun 2020 16:01:25 +0000 (18:01 +0200)]
isisd: keep circuit config on conf->up failure

if we are not able to bring a circuit up due to some config
issue, e.g. a low MTU compared to the area lsp-mtu, we should
not remove the configuration, as this will push out of sync
with the YANG state and create more issues down the line.
Instead, keeping the circuit state at C_STATE_CONF should be
sufficient.

For the specific case of the MTU mismatch above, this also means
that when we receive a new IF_UP_FROM_Z when the MTU is changed
we will be able to bring the circuit up as we should.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
4 years agozebra: separate code encoding netlink msg
Jakub Urbańczyk [Mon, 1 Jun 2020 16:07:18 +0000 (18:07 +0200)]
zebra: separate code encoding netlink msg

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
4 years agotopotest: add pbr test suite
Jakub Urbańczyk [Tue, 26 May 2020 16:24:16 +0000 (18:24 +0200)]
topotest: add pbr test suite

Add some basic tests for installing PBR rules into the kernel.

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
4 years agozebra: convert ip rule installation to use dplane thread
Jakub Urbańczyk [Sun, 24 May 2020 17:03:25 +0000 (19:03 +0200)]
zebra: convert ip rule installation to use dplane thread

 * Implement new dataplane operations
 * Convert existing code to use dataplane context object
 * Modify function preparing netlink message to use dataplane
   context object

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
4 years agozebra: prepare dplane to deal with pbr rules
Jakub Urbańczyk [Sun, 24 May 2020 16:44:36 +0000 (18:44 +0200)]
zebra: prepare dplane to deal with pbr rules

This commit is the first step to convert IP rule installation to
use dplane thread.
 * Add dataplane's internal representation of a pbr rule
 * Add dplane stats related to rules
 * Introduce a new type of dplane operation

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
4 years agoMerge pull request #6544 from mjstapp/fix_topo_lib_bgp_timeout
Donald Sharp [Wed, 10 Jun 2020 13:19:26 +0000 (09:19 -0400)]
Merge pull request #6544 from mjstapp/fix_topo_lib_bgp_timeout

tests: include lib/bgp.py convergence timeout to 130

4 years agolib,sharpd: add a SHARP_STR alias
Mark Stapp [Thu, 4 Jun 2020 17:26:50 +0000 (13:26 -0400)]
lib,sharpd: add a SHARP_STR alias

Add a vty-friendly protocol name alias for sharpd.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agolib,zebra,sharpd: modify opaque zapi message to support unicast
Mark Stapp [Thu, 4 Jun 2020 17:11:35 +0000 (13:11 -0400)]
lib,zebra,sharpd: modify opaque zapi message to support unicast

Start modifying the OPAQUE zapi message to include optional
unicast destination zapi client info. Add a 'decode' api and
opaque msg struct to encapsulate that optional info.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agolib,zebra: rename opaque decode api
Mark Stapp [Thu, 4 Jun 2020 13:40:35 +0000 (09:40 -0400)]
lib,zebra: rename opaque decode api

Change name of an opaque zapi api to 'decode' to align with the
other zapi message parsing apis. Missed that in the original
opaque commits.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoMerge pull request #6493 from opensourcerouting/workflow-debian
Donald Sharp [Wed, 10 Jun 2020 12:15:35 +0000 (08:15 -0400)]
Merge pull request #6493 from opensourcerouting/workflow-debian

doc/workflow: write down debian/* branch semantics

4 years agoMerge pull request #6532 from wesleycoakley/pbrd-moretopo
Mark Stapp [Wed, 10 Jun 2020 12:14:39 +0000 (08:14 -0400)]
Merge pull request #6532 from wesleycoakley/pbrd-moretopo

tests: Expand pbrd topology tests

4 years agotests: include lib/bgp.py convergence timeout to 130
Mark Stapp [Tue, 9 Jun 2020 19:05:16 +0000 (15:05 -0400)]
tests: include lib/bgp.py convergence timeout to 130

The convergence timeout in lib/bgp.py was something like 40 secs;
that's not really long enough for the CI. Raise the timeout to
40 x 3 secs.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoMerge pull request #6537 from volta-networks/fix_isis_adj_up_init
Donald Sharp [Wed, 10 Jun 2020 12:13:34 +0000 (08:13 -0400)]
Merge pull request #6537 from volta-networks/fix_isis_adj_up_init

isisd: fix adj up->init transition

4 years agoMerge pull request #6550 from ton31337/fix/bgp_dampening_vty_bug
Donald Sharp [Wed, 10 Jun 2020 12:12:01 +0000 (08:12 -0400)]
Merge pull request #6550 from ton31337/fix/bgp_dampening_vty_bug

bgpd: Duplicate `bgp dampening ...` stuff

4 years agozebra: fix coverity SA warnings
Mark Stapp [Mon, 8 Jun 2020 11:58:19 +0000 (07:58 -0400)]
zebra: fix coverity SA warnings

Fix a few coverity warnings.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoMerge pull request #6546 from opensourcerouting/topofixes-2
Mark Stapp [Wed, 10 Jun 2020 11:57:31 +0000 (07:57 -0400)]
Merge pull request #6546 from opensourcerouting/topofixes-2

topotests: stabilize ospf-sr

4 years agoMerge pull request #5323 from opensourcerouting/filter-nb
Donald Sharp [Wed, 10 Jun 2020 10:59:32 +0000 (06:59 -0400)]
Merge pull request #5323 from opensourcerouting/filter-nb

lib: migrate FRR filter to northbound

4 years agobgpd: Allow setting dampening for more address families
Donatas Abraitis [Wed, 10 Jun 2020 07:10:18 +0000 (10:10 +0300)]
bgpd: Allow setting dampening for more address families

Until now, it was possible to set only for ipv4 unicast/multicast.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agobgpd: Print dampening configuration per AF, not per neighbor
Donatas Abraitis [Wed, 10 Jun 2020 07:09:01 +0000 (10:09 +0300)]
bgpd: Print dampening configuration per AF, not per neighbor

This caused duplicate `bgp dampening ...` to be printed per neighbor.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #6548 from qlyoung/alpine-chown
Donatas Abraitis [Wed, 10 Jun 2020 06:49:12 +0000 (09:49 +0300)]
Merge pull request #6548 from qlyoung/alpine-chown

docker: don't fail on chown /etc/frr

4 years agodocker: don't fail on chown /etc/frr
Quentin Young [Wed, 10 Jun 2020 04:20:04 +0000 (00:20 -0400)]
docker: don't fail on chown /etc/frr

If we can chown /etc/frr then fine, but there's circumstances where we
won't be able to - for instance, if running FRR in Kubernetes where
/etc/frr/* is actually a virtual filesystem.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agotopotests: MPLS table output is not ordered
Rafael Zalamena [Tue, 9 Jun 2020 21:45:29 +0000 (18:45 -0300)]
topotests: MPLS table output is not ordered

Don't expect ordered output from `show mpls table json`.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agoisisd: fix adj up->init transition
Emanuele Di Pascale [Mon, 8 Jun 2020 16:00:42 +0000 (18:00 +0200)]
isisd: fix adj up->init transition

there are some paths, e.g. when an established neighbor
sends us hellos with a different IS level, where we go
from adj_state UP to INIT. In such cases we might not
update our SPFs or the circuit state, as the state change
function was only testing for the UP and DOWN cases.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
4 years agoMerge pull request #6510 from donaldsharp/useful_timings
Mark Stapp [Tue, 9 Jun 2020 19:15:04 +0000 (15:15 -0400)]
Merge pull request #6510 from donaldsharp/useful_timings

tests: Allow a useful amount of time for bgp to converge

4 years agoMerge pull request #6332 from kssoman/fix
Quentin Young [Tue, 9 Jun 2020 17:09:19 +0000 (13:09 -0400)]
Merge pull request #6332 from kssoman/fix

bgpd: Avoid extra copy of received data to buffer

4 years agoMerge pull request #6494 from mjstapp/fix_if_del_addr
Stephen Worley [Tue, 9 Jun 2020 16:04:33 +0000 (12:04 -0400)]
Merge pull request #6494 from mjstapp/fix_if_del_addr

zebra: include dest addr when deleting p2p from interface

4 years agoMerge pull request #6533 from opensourcerouting/topofixes
Donald Sharp [Tue, 9 Jun 2020 14:29:18 +0000 (10:29 -0400)]
Merge pull request #6533 from opensourcerouting/topofixes

topotests: stabilize ospf-sr-topo1

4 years agoMerge pull request #6512 from donaldsharp/pim_missed_merge
Russ White [Tue, 9 Jun 2020 12:01:16 +0000 (08:01 -0400)]
Merge pull request #6512 from donaldsharp/pim_missed_merge

Pim missed merge

4 years agoMerge pull request #6529 from ton31337/fix/refcnt_check_for_dep_data_route-map
Russ White [Tue, 9 Jun 2020 12:00:00 +0000 (08:00 -0400)]
Merge pull request #6529 from ton31337/fix/refcnt_check_for_dep_data_route-map

lib: Make sure route_map_dep_data is not NULL before decrementing refcount

4 years agoMerge pull request #6536 from NaveenThanikachalam/gr
Russ White [Tue, 9 Jun 2020 11:40:27 +0000 (07:40 -0400)]
Merge pull request #6536 from NaveenThanikachalam/gr

bgpd: Update GR flags when peer is bound to group

4 years agobgpd: Update GR flags when peer is bound to group
Naveen Thanikachalam [Tue, 9 Jun 2020 09:01:20 +0000 (02:01 -0700)]
bgpd: Update GR flags when peer is bound to group

When a peer is bound to a peer-group, the GR flags set on the
peer are over-written.
Update the GR flags for the peer after it has been bound to a
peer-group.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
4 years agotopotests: stabilize ospf-sr-topo1 run
Rafael Zalamena [Mon, 8 Jun 2020 19:14:41 +0000 (16:14 -0300)]
topotests: stabilize ospf-sr-topo1 run

Use `json_cmp` instead of raw text comparison. It should fix some of the
ordering problems we are seeing in CI runs.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agotopotests: remove old FRR version check
Rafael Zalamena [Mon, 8 Jun 2020 19:13:25 +0000 (16:13 -0300)]
topotests: remove old FRR version check

Topotest is now part of FRR repo and the code is versioned with the
tests.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agotests: pbr topotest verifying vrf functionality
Wesley Coakley [Mon, 8 Jun 2020 17:39:04 +0000 (13:39 -0400)]
tests: pbr topotest verifying vrf functionality

Creates a VRF in the kernel and tests areas of pbrd not covered before

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
4 years agotests: pbr topotest flaps ifaces, maps, nh-groups
Wesley Coakley [Fri, 5 Jun 2020 21:42:11 +0000 (17:42 -0400)]
tests: pbr topotest flaps ifaces, maps, nh-groups

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
4 years agotests: pbr topotests variety of maps and nh-groups
Wesley Coakley [Fri, 5 Jun 2020 17:59:55 +0000 (13:59 -0400)]
tests: pbr topotests variety of maps and nh-groups

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
4 years agolib: Make sure route_map_dep_data is not NULL before decrementing refcount
Donatas Abraitis [Mon, 8 Jun 2020 11:58:53 +0000 (14:58 +0300)]
lib: Make sure route_map_dep_data is not NULL before decrementing refcount

```
2  0x00007fb9adb07a10 in core_handler (signo=11, siginfo=0x7ffe1414a630, context=<optimized out>) at lib/sigevent.c:228
        sa_default = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {0 <repeats 16 times>}}, sa_flags = 0, sa_restorer = 0x0}
        sigset = {__val = {8192, 0 <repeats 15 times>}}
3  <signal handler called>
No locals.
4  route_map_dep_update (type=RMAP_EVENT_CLIST_DELETED, rmap_name=0x55d807ddd410 "export4-as49917", dep_name=<optimized out>, dephash=0x55d807adf170) at lib/routemap.c:2750
        dep = 0x55d807d35b00
        dname = 0x55d8081ba560 "123:124"
        rname = 0x55d8081ba540 "export4-as49917"
        ret = 0
        dep_data = 0x0
        ret_dep_data = 0x0
        tmp_dep_data = {rname = 0x55d8081ba540 "export4-as49917", refcnt = 0}
5  route_map_upd8_dependency (type=RMAP_EVENT_CLIST_DELETED, arg=<optimized out>, rmap_name=0x55d807ddd410 "export4-as49917") at lib/routemap.c:2865
        upd8_hash = 0x55d807adf170
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #6182 from Orange-OpenSource/dev_ospf_sr
Renato Westphal [Sun, 7 Jun 2020 00:29:43 +0000 (21:29 -0300)]
Merge pull request #6182 from Orange-OpenSource/dev_ospf_sr

OSPF: Add ECMP support to Segment Routing

4 years agoMerge pull request #6507 from donaldsharp/extcommunity_bgp
Sri Mohana Singamsetty [Sat, 6 Jun 2020 21:13:29 +0000 (14:13 -0700)]
Merge pull request #6507 from donaldsharp/extcommunity_bgp

bgpd: Actually find the sequence number for `bgp extcommunity-list...`

4 years agoMerge pull request #6521 from donaldsharp/memory_wumps
Renato Westphal [Fri, 5 Jun 2020 23:03:35 +0000 (20:03 -0300)]
Merge pull request #6521 from donaldsharp/memory_wumps

zebra: nhlfe_alloc should not fail

4 years agoMerge pull request #6516 from qlyoung/fix-northbound-userdata-disappearance
Renato Westphal [Fri, 5 Jun 2020 23:00:38 +0000 (20:00 -0300)]
Merge pull request #6516 from qlyoung/fix-northbound-userdata-disappearance

lib: move all userdata when changing node xpath

4 years agolib: use relative XPath to filter entry attributes
Rafael Zalamena [Fri, 5 Jun 2020 19:40:16 +0000 (16:40 -0300)]
lib: use relative XPath to filter entry attributes

We can avoid a big amount of `snprintf` by using relative XPath in
`nb_cli_apply_changes`.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: filter remove extra CLI transaction
Rafael Zalamena [Fri, 5 Jun 2020 18:31:34 +0000 (15:31 -0300)]
lib: filter remove extra CLI transaction

`acl_get_seq` should be able to get the sequence number from candidate
configuration without needing to commit anything midway.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: filter remove unused variable
Rafael Zalamena [Fri, 5 Jun 2020 18:11:03 +0000 (15:11 -0300)]
lib: filter remove unused variable

Remove variable that is not being used.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: remove filter northbound wrapper functions
Rafael Zalamena [Fri, 5 Jun 2020 18:07:47 +0000 (15:07 -0300)]
lib: remove filter northbound wrapper functions

Lets just use them directly to avoid extra code and to be extra clear
that we are using those callbacks.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: don't set NULL after an XFREE
Rafael Zalamena [Fri, 5 Jun 2020 18:06:31 +0000 (15:06 -0300)]
lib: don't set NULL after an XFREE

Avoid two assignment operations by just letting XFREE do its thing.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: add YANG model enumerations for filter
Rafael Zalamena [Fri, 5 Jun 2020 18:05:34 +0000 (15:05 -0300)]
lib: add YANG model enumerations for filter

Avoid magic numbers by using enumerations.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years ago*: integrate remaining daemons with filter
Rafael Zalamena [Mon, 4 May 2020 21:56:56 +0000 (18:56 -0300)]
*: integrate remaining daemons with filter

Don't crash when trying to `show running-config` because of missing
filter northbound integration.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: implement legacy prefix list behaviour
Rafael Zalamena [Mon, 4 May 2020 20:34:07 +0000 (17:34 -0300)]
lib: implement legacy prefix list behaviour

Some tests expect that a prefix list structure is gone after all its
entries are removed, so lets keep that behaviour.

NOTE: users using YANG/northbound directly without CLI won't be
affected.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: implement additional CLI prefix list check
Rafael Zalamena [Mon, 4 May 2020 20:32:06 +0000 (17:32 -0300)]
lib: implement additional CLI prefix list check

Changes:
- Move the `TODO` to the appropriated place and hint how to resolve
  it.
- Apply mask to prefix when storing it in the data structures. We
  can't just add a validation for it otherwise it will break old
  CLIs.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix route map crash on prefix list removal
Rafael Zalamena [Sat, 2 May 2020 01:14:00 +0000 (22:14 -0300)]
lib: fix route map crash on prefix list removal

Changes:
- Refactor list entry deletion to use a function that properly notifies
  route map on deletion (fixes a heap-use-after-free).
- Prefix list entry wild card sets `le` to maximum IP mask value and
  `any` is a boolean.
- Fix prefix list trie removal order (in `prefix_list_entry_update_start`).
- Let only the `any` callback change the value of field `any`.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix two filter cli problems
Rafael Zalamena [Fri, 1 May 2020 14:45:45 +0000 (11:45 -0300)]
lib: fix two filter cli problems

- Show the correct cisco style access list extended information.
- `assert` action so static analyzer doesn't complain about possible
  NULL usage.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: properly apply prefix list entries
Rafael Zalamena [Fri, 1 May 2020 15:10:40 +0000 (12:10 -0300)]
lib: properly apply prefix list entries

After the commands started working I noticed that prefix lists were
still not working and displaying incorrect information in
`show ip prefix-list`.

Turns out `any` must be set to `0` when a prefix is set and the prefix
entry **must** be installed in the prefix list head.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix prefix list installation
Rafael Zalamena [Fri, 1 May 2020 13:34:03 +0000 (10:34 -0300)]
lib: fix prefix list installation

Based on the function `prefix_list_entry_add` and
`prefix_list_entry_delete` it was created two functions to replicate
its functionality without the assumption we are always alocating a new
prefix list entry.

Since the prefix list entry is stored in the YANG private data
structures, we want to avoid the allocation/free of memory that is
hold by the schema.

Every time a prefix list entry values change we must call
`prefix_list_entry_update_start` to uninstall the entry from prefix
list internal structures and then call
`prefix_list_entry_update_finish` to put them back.

The variable `installed` in the prefix list entry tracks the
installation status of the internal structure. It is possible that a
user unconfigures or forgets to add a `prefix` value and so we can't
install the entry until then.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix access list mac removal command
Rafael Zalamena [Fri, 1 May 2020 13:10:16 +0000 (10:10 -0300)]
lib: fix access list mac removal command

Copy & paste mistake: MAC commands need `X:X:X:X:X:X` and not
`X:X::X:X/M` types. Also, MAC access-list don't use `exact-match`.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: add 'no ... remark LINE' commands
Rafael Zalamena [Fri, 1 May 2020 13:06:14 +0000 (10:06 -0300)]
lib: add 'no ... remark LINE' commands

Implement the commands `no ... remark LINE` for cisco and zebra style
access lists to match `ipX prefix-list description LINE` command set.

It useful when you just want to go through the command history and
prepend a `no` to a `remark` or `description` command. Example:

```
access-list foo remark just another acl
!
! ...
!
! Suddenly we decide we no longer think that remark is useful,
! lets press up key to find that line in history and append `no`:
no access-list foo remark just another acl
```

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: bump filter CLI XPath buffers size
Rafael Zalamena [Thu, 30 Apr 2020 21:21:12 +0000 (18:21 -0300)]
lib: bump filter CLI XPath buffers size

Bump the size of the buffers so the new compilers don't complain about
possible truncation:
```
lib/filter_cli.c: In function ‘ipv6_prefix_list_magic.isra.0’:
lib/filter_cli.c:1336:5: error: ‘%lld’ directive output may be truncated writing between 1 and 20 bytes into a region of size between 16 and 527 [-Werror=format-truncation=]
 1336 |     "%s/entry[sequence='%" PRId64 "']", xpath, sseq);
      |     ^~~~~~~~~~~~~~~~~~~~~~
lib/filter_cli.c:1336:25: note: format string is defined here
 1336 |     "%s/entry[sequence='%" PRId64 "']", xpath, sseq);
lib/filter_cli.c:1336:5: note: directive argument in the range [-92233720368547758039223372036854775807]
 1336 |     "%s/entry[sequence='%" PRId64 "']", xpath, sseq);
      |     ^~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix prefix list mask length check
Rafael Zalamena [Thu, 30 Apr 2020 20:53:11 +0000 (17:53 -0300)]
lib: fix prefix list mask length check

Implement the restriction from the old CLI to northbound.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix prefix list description command
Rafael Zalamena [Thu, 30 Apr 2020 20:23:51 +0000 (17:23 -0300)]
lib: fix prefix list description command

Changes:
- Use `description` on CLI but `remark` on YANG like access-list (also
  because `description` is a reserved word).
- Rename YANG model field and northbound code.
- Fix wrong sequence type get.
- Fix wrong action XPath in action callback.
- Fix wrong concat in (ipv6|mac) access-list.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: migrate filter configuration writer
Rafael Zalamena [Thu, 30 Apr 2020 16:56:05 +0000 (13:56 -0300)]
lib: migrate filter configuration writer

Use northbound to write the configuration from now on. While here, fix
how `exact-match` configuration is being created.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix filter northbound crash when batching
Rafael Zalamena [Thu, 30 Apr 2020 13:35:22 +0000 (10:35 -0300)]
lib: fix filter northbound crash when batching

Look up next sequence number by checking XPath instead of trying to
access unallocated context data structures.

This only applies for creation, on destroy the data structures must be
there.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: introduce the yang_dnode_iterate helper
Renato Westphal [Thu, 7 Nov 2019 19:55:18 +0000 (16:55 -0300)]
lib: introduce the yang_dnode_iterate helper

Implement helper function that iterates over data nodes that satisfy
XPath query.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agolib: fix rebase conflicts
Rafael Zalamena [Wed, 29 Apr 2020 18:28:38 +0000 (15:28 -0300)]
lib: fix rebase conflicts

Changes:
- Remove unused variable.
- Make prototypes static like the declaration.
- Fix new compilers complaint about uninitialized values.
- Fix new compilers complaint about small buffer for `snprintf` concatenation.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix northbound conflicts
Rafael Zalamena [Wed, 29 Apr 2020 18:33:46 +0000 (15:33 -0300)]
lib: fix northbound conflicts

Changes:
- Use the northbound callback prototypes.
- Re-implement the removed function: `ipv4_network_addr` (more
  information: https://github.com/FRRouting/frr/pull/5535 )

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: migrate prefix-list to use northbound
Rafael Zalamena [Mon, 11 Nov 2019 23:25:20 +0000 (20:25 -0300)]
lib: migrate prefix-list to use northbound

Implement all northbound CLI commands for prefix lists.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: fix filter northbound double removal
Rafael Zalamena [Fri, 8 Nov 2019 19:19:38 +0000 (16:19 -0300)]
lib: fix filter northbound double removal

Don't auto remove filter main access list data structure, it has to be
done manually (or via northbound).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: migrate filter CLI to use northbound
Rafael Zalamena [Fri, 8 Nov 2019 17:50:00 +0000 (14:50 -0300)]
lib: migrate filter CLI to use northbound

Migrate all filter commands to use the newly implemented northbound.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years ago*: add filter northbound support
Rafael Zalamena [Fri, 8 Nov 2019 17:41:46 +0000 (14:41 -0300)]
*: add filter northbound support

Allow all daemons to work with filter northbound.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: implement filter northbound
Rafael Zalamena [Fri, 8 Nov 2019 17:48:50 +0000 (14:48 -0300)]
lib: implement filter northbound

Implement all access-list and prefix-list northbound callbacks.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: export prefix-lists functions
Rafael Zalamena [Mon, 11 Nov 2019 23:21:25 +0000 (20:21 -0300)]
lib: export prefix-lists functions

Export all functions that are going to be used by the northbound.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agolib: export access-lists shared functions
Rafael Zalamena [Fri, 8 Nov 2019 17:46:17 +0000 (14:46 -0300)]
lib: export access-lists shared functions

These functions are going to be used by the new filter northbound
implementation.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agoyang: update filter yang model
Rafael Zalamena [Fri, 4 Oct 2019 13:16:35 +0000 (10:16 -0300)]
yang: update filter yang model

Important changes:

*   Limit the access-list name length according to header definition;
*   Add another list (sequence) inside instances to avoid repeated fields;

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agozebra: nhlfe_alloc should not fail
Donald Sharp [Fri, 5 Jun 2020 13:02:44 +0000 (09:02 -0400)]
zebra: nhlfe_alloc should not fail

Let's prevent nhlfe_alloc from actually returning anything that can fail:

1) nexthop_new -> never returns NULL so checking for NULL here
makes no sense, remove it.

2) lsp not being NULL is a assert condition here as that it's
a precondition for the function to work properly.

3) since nhlfe_alloc cannot return NULL now remove tests
for it in callng functions

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agolib: move all userdata when changing node xpath
Quentin Young [Thu, 4 Jun 2020 23:26:42 +0000 (19:26 -0400)]
lib: move all userdata when changing node xpath

All userdata pointers need to be rekeyed to their new xpaths, not just
the one associated with the dnode being moved.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agobgpd: Actually find the sequence number for `bgp extcommunity-list...`
Donald Sharp [Tue, 2 Jun 2020 20:10:48 +0000 (16:10 -0400)]
bgpd: Actually find the sequence number for `bgp extcommunity-list...`

The code in the bgp extcommunity-list function was using
argv_find to get the correct idx.  The problem was that
we had already done argv_finds before and idx was non-zero
thus having us always set the seq pointer to what was last
looked up.  This causes us to pass in a value to the
underlying function and it would just wisely ignore it
causing a seq number of 0.

We would then write this seq number of 0 and then immediately
reject it on read in again.  BOO!

Actually handle argv_find the way it was meant to be.

Ticket:CM-29926
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoMerge pull request #6513 from donaldsharp/allow_filter_deletion
Donatas Abraitis [Thu, 4 Jun 2020 05:49:35 +0000 (08:49 +0300)]
Merge pull request #6513 from donaldsharp/allow_filter_deletion

lib: Allow deletion of some access-lists

4 years agolib: Allow deletion of some access-lists
Donald Sharp [Thu, 4 Jun 2020 00:01:48 +0000 (20:01 -0400)]
lib: Allow deletion of some access-lists

Recent rework of access lists to allow sequence numbers
accidently introduced the inability to delete some
access lists.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoospfd: Move Segment Routing Zebra functions
Olivier Dugeon [Tue, 2 Jun 2020 17:24:46 +0000 (19:24 +0200)]
ospfd: Move Segment Routing Zebra functions

For coherency, move and rename functions that send MPLS labels configurations
from ospf_sr.c to ospf_zebra.c:
 - ospf_zebra_update_prefix_sid()
 - ospf_zebra_delete_prefix_sid()
 - ospf_zebra_send_adjacency_sid()

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
4 years agoospfd: Update Prefix & Adjacency SIDs Management
Olivier Dugeon [Tue, 12 May 2020 14:42:38 +0000 (16:42 +0200)]
ospfd: Update Prefix & Adjacency SIDs Management

SIDs are not uninstall in LFIB when ospf adjacenyi or loopback goes down as
self LSA flusing is not handle by ospf_ext_link_lsa_update(). The patch
introduces new functions ospf_sr_ext_itf_add() and ospf_sr_ext_itf_delete() in
ospf_sr.c to directly manage LFIB for SIDs when change is detected in
ospf_ext_link_ism_change() and ospf_ext_link_nsm_change().

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
4 years agoospfd: OSPF Segment Routing topostest update
Olivier Dugeon [Tue, 7 Apr 2020 18:29:28 +0000 (20:29 +0200)]
ospfd: OSPF Segment Routing topostest update

Update OSPF Segment Routing topotest in conformity to ECMP
 - Add one more interface between r1 and r2 for ECMP
 - Anonymize Adjacency SID
 - Update expected json output

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
4 years agoospfd: OSPF Segment Routing improvement
Olivier Dugeon [Tue, 7 Apr 2020 17:36:12 +0000 (19:36 +0200)]
ospfd: OSPF Segment Routing improvement

 - Improve parsing of Router Information, especially when a router
   stops advertising Segment Routing capabilities
 - Finish conversion to '%pFX' and '%pI4'

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
4 years agoospfd: Add ECMP support to OSPF Segment Routing
Olivier Dugeon [Fri, 20 Mar 2020 10:34:52 +0000 (11:34 +0100)]
ospfd: Add ECMP support to OSPF Segment Routing

 * Change sr_prefix structure in ospf_sr.h to add support to ECMP
 * Add new Segment Routing information to ospf_paths in ospf_route.h
 * Backport MPLS label configuration from IS-IS Segment Routing implementation
 * Re-write log message in ospf_sr.c and ospf_ext.c

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
4 years agodocker: fix centos7 install
Quentin Young [Mon, 1 Jun 2020 20:03:35 +0000 (16:03 -0400)]
docker: fix centos7 install

We require python3-sphinx for RPM builds, but it wasn't being installed.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #6508 from RichardWu-Hebut/master
Donald Sharp [Wed, 3 Jun 2020 17:09:27 +0000 (13:09 -0400)]
Merge pull request #6508 from RichardWu-Hebut/master

zebra: Fix zebra crashed in building FPM netlink message when bgp sen…