]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
16 months agotests: Use JSON camelCase naming for tests
Donatas Abraitis [Tue, 31 Jan 2023 10:47:43 +0000 (12:47 +0200)]
tests: Use JSON camelCase naming for tests

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months ago*: Drop deprecated incorrect JSON fields with wrong naming
Donatas Abraitis [Tue, 31 Jan 2023 08:18:28 +0000 (10:18 +0200)]
*: Drop deprecated incorrect JSON fields with wrong naming

Deprecation cycle already passed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agoMerge pull request #12709 from donaldsharp/update_withdraw_always_work
Donatas Abraitis [Tue, 31 Jan 2023 06:50:06 +0000 (08:50 +0200)]
Merge pull request #12709 from donaldsharp/update_withdraw_always_work

bgpd: bgp_update and bgp_withdraw never return failures

16 months agobgpd: bgp_update and bgp_withdraw never return failures
Donald Sharp [Mon, 30 Jan 2023 21:02:23 +0000 (16:02 -0500)]
bgpd: bgp_update and bgp_withdraw never return failures

These two functions always return 0.  As such any and all
tests against this make no sense.  Remove the return 0
to a void and follow the chain, logically, to remove all
the dead code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
16 months agoMerge pull request #12700 from taspelund/martian_tip_improvement
Donatas Abraitis [Mon, 30 Jan 2023 08:52:44 +0000 (10:52 +0200)]
Merge pull request #12700 from taspelund/martian_tip_improvement

BGP Martian Tunnel-IP Improvements

16 months agoMerge pull request #12703 from donaldsharp/basic_babel
Donatas Abraitis [Mon, 30 Jan 2023 08:45:49 +0000 (10:45 +0200)]
Merge pull request #12703 from donaldsharp/basic_babel

Basic babel

16 months agotests: Super simple babel test
Donald Sharp [Sat, 28 Jan 2023 16:17:08 +0000 (11:17 -0500)]
tests: Super simple babel test

Just get babel started and ensure that the v4 routes
are actually installed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
16 months agobabeld: During intf startup, ignore address already in use
Donald Sharp [Sat, 28 Jan 2023 14:32:34 +0000 (09:32 -0500)]
babeld: During intf startup, ignore address already in use

When listening on a multicast group.  No need to actually
fail the operation when it's already being used.

Let's not treat the Address already in use error message
as one that is stopping everything from working.  Especially
since multiple interface events cause this to happen.

Without this, if config is read in before full connection
to zebra, babel will never establish neighbors.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
16 months agobabeld: The function is already a pointer
Donald Sharp [Sat, 28 Jan 2023 14:31:52 +0000 (09:31 -0500)]
babeld: The function is already a pointer

Don't send the address of in.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
16 months agobgpd: move tunnel-ip comparison into handler
Trey Aspelund [Wed, 25 Jan 2023 18:25:20 +0000 (13:25 -0500)]
bgpd: move tunnel-ip comparison into handler

Moves the old/new IP comparison into handle_tunnel_ip_change instead of
expecting the caller to do the check on their own.
Also changes handle_tunnel_ip_change to return void since it only ever
returned 0 in all cases.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
16 months agobgpd: only unimport routes if tunnel-ip changes
Trey Aspelund [Wed, 25 Jan 2023 18:07:43 +0000 (13:07 -0500)]
bgpd: only unimport routes if tunnel-ip changes

When processing a new local VNI, we were always walking the global EVPN
table to look for routes that needed to be removed due to a martian
nexthop change (specifically a tunnel-ip change).
Since the martian TIP table is global (all VNIs) + the walk is also in
the global table (all VNIs), we can trust that any new TIP from any VNI
would result in routes getting removed from the global table and
unimported from all live (L2)VNIs.
i.e.
The only time this update is actionable is if we are adding/removing an
IP from the martian TIP table, and we do not need to walk the table for
normal refcount adjustments.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
16 months agoMerge pull request #12690 from opensourcerouting/feature/deny_merging_prs_with_freeze...
Donald Sharp [Fri, 27 Jan 2023 12:43:02 +0000 (07:43 -0500)]
Merge pull request #12690 from opensourcerouting/feature/deny_merging_prs_with_freeze_label

github: Prevent merging (fail CI) if 'freeze' label exists for PR

16 months agoMerge pull request #12691 from mjstapp/fix_dplane_prov_lock
Donald Sharp [Fri, 27 Jan 2023 12:35:50 +0000 (07:35 -0500)]
Merge pull request #12691 from mjstapp/fix_dplane_prov_lock

zebra: fix SA warning, don't lock plugin list

17 months agoMerge pull request #12696 from donaldsharp/shadowed
Donatas Abraitis [Fri, 27 Jan 2023 09:50:27 +0000 (11:50 +0200)]
Merge pull request #12696 from donaldsharp/shadowed

Shadowed

17 months agolib: Remove global variable exposure `struct host host`
Donald Sharp [Thu, 26 Jan 2023 15:53:47 +0000 (10:53 -0500)]
lib: Remove global variable exposure `struct host host`

This was only used in one place and we have accessor functions
now.  So let's use them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agowatchfrr: dmn variable shadows previous declaration
Donald Sharp [Thu, 26 Jan 2023 15:44:52 +0000 (10:44 -0500)]
watchfrr: dmn variable shadows previous declaration

There is no need to declar the same temp variable 2 times.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: i declaration shadows other i declared
Donald Sharp [Thu, 26 Jan 2023 15:41:55 +0000 (10:41 -0500)]
zebra: i declaration shadows other i declared

Clear up some confustion

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agolib: Forward declaration of a struct does not need to have data type
Donald Sharp [Thu, 26 Jan 2023 15:37:39 +0000 (10:37 -0500)]
lib: Forward declaration of a struct does not need to have data type

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agoMerge pull request #12694 from donaldsharp/zebra_rib_dead_code
Rafael Zalamena [Thu, 26 Jan 2023 16:30:55 +0000 (13:30 -0300)]
Merge pull request #12694 from donaldsharp/zebra_rib_dead_code

remove dead code

17 months agolib: Remove dead code
Donald Sharp [Wed, 25 Jan 2023 20:45:39 +0000 (15:45 -0500)]
lib: Remove dead code

wheel_stop and wheel_start have never been used.  Let's just remove
them.  After close to 7 years, if needed someone else can add back in.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: Remove impossible to use function
Donald Sharp [Wed, 25 Jan 2023 20:27:41 +0000 (15:27 -0500)]
zebra: Remove impossible to use function

The rib_update_handle_vrf function is no longer being used.
Cleanup it's usage from zebra.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: fix SA warning, don't lock plugin list
Mark Stapp [Wed, 25 Jan 2023 13:38:47 +0000 (08:38 -0500)]
zebra: fix SA warning, don't lock plugin list

Locking around the list of providers/plugins is not
helpful - these only change at init time. Clear some SA
warnings by removing the locking.

Signed-off-by: Mark Stapp <mjs@labn.net>
17 months agoMerge pull request #12685 from louis-6wind/fix-vpnv4-noretain
Donatas Abraitis [Wed, 25 Jan 2023 09:23:08 +0000 (11:23 +0200)]
Merge pull request #12685 from louis-6wind/fix-vpnv4-noretain

topotests: fix bgp_vpnv4_noretain

17 months agogithub: Prevent merging (fail CI) if 'freeze' label exists for PR
Donatas Abraitis [Wed, 25 Jan 2023 08:43:55 +0000 (10:43 +0200)]
github: Prevent merging (fail CI) if 'freeze' label exists for PR

Mostly useful duging the freeze period to warn the maintainers from merging
unwanted PRs.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #12660 from Pdoijode/ip-nht-json-changes
Donatas Abraitis [Wed, 25 Jan 2023 08:32:18 +0000 (10:32 +0200)]
Merge pull request #12660 from Pdoijode/ip-nht-json-changes

zebra: fix JSON fields for "show ip/ipv6 nht"

17 months agoMerge pull request #12684 from chiragshah6/fdev2
Donatas Abraitis [Wed, 25 Jan 2023 08:30:10 +0000 (10:30 +0200)]
Merge pull request #12684 from chiragshah6/fdev2

bgpd: evpn route detail json display non prett

17 months agozebra: fix JSON fields for "show ip/ipv6 nht"
Pooja Jagadeesh Doijode [Wed, 25 Jan 2023 02:15:36 +0000 (18:15 -0800)]
zebra: fix JSON fields for "show ip/ipv6 nht"

1. Renamed "gates" to "nexthops"
2. Displaying afi of the nexthops being dispalyed in place of
   "nexthops" JSON object in the old JSON output
3. Calling show_route_nexthop_helper() and show_nexthop_json_helper()
   instead of print_nh() inorder to keeps the fields in "nexthops"
   JSON object in sync with "nexthops" JSON object of
   "show nexthop-group rib json".

Updated vtysh:
    r1# show ip nht
    192.168.0.2
     resolved via connected
     is directly connected, r1-eth0 (vrf default)
     Client list: static(fd 28)
    192.168.0.4
     resolved via connected
     is directly connected, r1-eth0 (vrf default)
     Client list: static(fd 28)

Updated JSON:
    r1# show ip nht json
    {
      "default":{
        "ipv4":{
          "192.168.0.2":{
            "nhtConnected":false,
            "clientList":[
              {
                "protocol":"static",
                "socket":28,
                "protocolFiltered":"none"
              }
            ],
            "nexthops":[
              {
                "flags":3,
                "fib":true,
                "directlyConnected":true,
                "interfaceIndex":2,
                "interfaceName":"r1-eth0",
                "vrf":"default",
                "active":true
              }
            ],
            "resolvedProtocol":"connected"
          }
        }
      }
    }

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
17 months agoMerge pull request #12680 from mjstapp/fix_dplane_lists
Rafael Zalamena [Tue, 24 Jan 2023 21:46:52 +0000 (18:46 -0300)]
Merge pull request #12680 from mjstapp/fix_dplane_lists

zebra: use typesafe lib lists in zebra dplane

17 months agoMerge pull request #12670 from louis-6wind/fix-bfd-zclient
Rafael Zalamena [Tue, 24 Jan 2023 19:52:54 +0000 (16:52 -0300)]
Merge pull request #12670 from louis-6wind/fix-bfd-zclient

lib: do not reopen a zclient socket for bfd

17 months agoMerge pull request #12575 from anlancs/fix/build-vtysh-missing-dir
David Lamparter [Tue, 24 Jan 2023 16:40:55 +0000 (17:40 +0100)]
Merge pull request #12575 from anlancs/fix/build-vtysh-missing-dir

17 months agoMerge pull request #12682 from opensourcerouting/time-cs
Russ White [Tue, 24 Jan 2023 15:51:44 +0000 (10:51 -0500)]
Merge pull request #12682 from opensourcerouting/time-cs

*: fix time truncation in many places

17 months agoMerge pull request #12678 from opensourcerouting/fix/missing_no_form_for_path_attribu...
Russ White [Tue, 24 Jan 2023 15:45:03 +0000 (10:45 -0500)]
Merge pull request #12678 from opensourcerouting/fix/missing_no_form_for_path_attribute_discard

bgpd: Add missing `no` form for `neighbor path-attribute discard` cmd

17 months agoMerge pull request #12634 from anlancs/fix/lib-seq-adjust-return-value
Russ White [Tue, 24 Jan 2023 15:36:17 +0000 (10:36 -0500)]
Merge pull request #12634 from anlancs/fix/lib-seq-adjust-return-value

lib: fix wrong returned value for filter

17 months agoMerge pull request #12640 from vfreex/babel-no-commands
Russ White [Tue, 24 Jan 2023 15:33:24 +0000 (10:33 -0500)]
Merge pull request #12640 from vfreex/babel-no-commands

babeld: Add missing `no` commands

17 months agoMerge pull request #10405 from kanaya516/feature/adj-sid-yang
Russ White [Tue, 24 Jan 2023 15:26:07 +0000 (10:26 -0500)]
Merge pull request #10405 from kanaya516/feature/adj-sid-yang

isisd: yang for adjacency-sid and lan-adjacency-sid

17 months agoMerge pull request #12647 from anlancs/fix/bgpd-type-2
Russ White [Tue, 24 Jan 2023 15:13:22 +0000 (10:13 -0500)]
Merge pull request #12647 from anlancs/fix/bgpd-type-2

bgpd: cosmetic changes for debug

17 months agolib: remove concurrent nexthop zapi (un)registration
Louis Scalbert [Mon, 23 Jan 2023 12:33:22 +0000 (13:33 +0100)]
lib: remove concurrent nexthop zapi (un)registration

Daemons like staticd already implement nexthop zapi (un)registration.
b7ca809d1c ("lib: BFD automatic source selection") has implemented a
concurrent nexthop (un)registration. Some nexthop could be unregistred
by the bfd whereas they were still needed by the daemon.

Let the deamons deal with nexthop zapi (un)registration.

Fixes: b7ca809d1c ("lib: BFD automatic source selection")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
17 months agolib: do not reopen a zclient socket for bfd
Louis Scalbert [Mon, 23 Jan 2023 10:57:57 +0000 (11:57 +0100)]
lib: do not reopen a zclient socket for bfd

b7ca809d1c ("lib: BFD automatic source selection") has added a dedicated
zclient socket for nht tracking. Since the bfd lib is used by daemons
that already has a zclient socket, those daemons has now a second
zclient socket. However, zebra does not distinguish the two zclient
sessions. For example, the interfaces are asked a second via
zebra_message_send(zclient, ZEBRA_INTERFACE_ADD, VRF_DEFAULT) in
zclient_start(). As a result, callbacks functions like bgp_ifp_create()
are called a second time, which causes some processing overhead and
might cause bugs.

Re-use the existing zclient socket for nht tracking.

Note that BFD automatic source selection is only currently implemented
in staticd. Other daemons will require to add the following in their
ZEBRA_NEXTHOP_UPDATE callback function:

>  if (zclient->bfd_integration)
> bfd_nht_update(&matched, &nhr);

Fixes: b7ca809d1c ("lib: BFD automatic source selection")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
17 months agoMerge pull request #12681 from pguibert6WIND/vpnv6_encode_plus
Donatas Abraitis [Tue, 24 Jan 2023 12:47:58 +0000 (14:47 +0200)]
Merge pull request #12681 from pguibert6WIND/vpnv6_encode_plus

Vpnv6 encode plus

17 months agotopotests: fix bgp_vpnv4_noretain
Louis Scalbert [Mon, 23 Jan 2023 17:03:58 +0000 (18:03 +0100)]
topotests: fix bgp_vpnv4_noretain

Fix the following issues:
- two tests are done in one function. Dispatch the tests in two
functions to help the test debug.
- the first test passes even if a third prefix is not filtered. Match
the exact to avoid false positive.
- the expected values contains variable like version. Do no check
variable values.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
17 months agoMerge pull request #12679 from spk-hebbar/master
Donatas Abraitis [Tue, 24 Jan 2023 08:01:55 +0000 (10:01 +0200)]
Merge pull request #12679 from spk-hebbar/master

zebra_fpm: Add support for other protocols in fpm:netlink

17 months agobgpd: fix when route-map changes the link local nexthop for vpnv6
Philippe Guibert [Mon, 23 Jan 2023 15:31:12 +0000 (16:31 +0100)]
bgpd: fix when route-map changes the link local nexthop for vpnv6

This fix updates the nexthop length of a bgp update to be
transmitted to a remote peer. Before the previous commit,
the ipv6 nexthop length was internally set to 32 bytes which
was not correct, as it should be 48 bytes which is conform
to the vpnv6 encoding format.

However, without the previous match, even if internally, the
nexthop length was set to 32, the real nexthop length was set
to 48 bytes, and everything was operating ok.

Now, if we use the following route-map, and attach it to
outgoing for vpnv6 address family, then we have a malformed
packet detected, and the peering breaks.

 > route-map rmap permit 1
 > set ipv6 next-hop global 5:5::3:6
 > set ipv6 next-hop local fe80:55::333:222

Maintain the mp_nexthop_len to 48 bytes if it was already set
to 48 previously.

Fixes: 35ac9b53f2e2 ("bgpd: fix vpnv6 nexthop encoding")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agobgpd: evpn route detail json display non prett
Chirag Shah [Tue, 24 Jan 2023 06:18:24 +0000 (22:18 -0800)]
bgpd: evpn route detail json display non prett

For BGP evpn route table detail json to use
non pretty form of display.

Problem:
In scaled evpn route table detail json dump
occupies high resources (CPU + memory) of the system.
In high scale evpn route dump using pretty form
hogs CPU for a while which can trigger watchfrr
to kill bgpd.

Solution:
Avoid pretty JSON print for detail version dump

Signed-off-by: Chirag Shah <chirag@nvidia.com>
17 months agoMerge pull request #12677 from opensourcerouting/fix/ospf_potential_memory_leak
mobash-rasool [Tue, 24 Jan 2023 04:24:44 +0000 (09:54 +0530)]
Merge pull request #12677 from opensourcerouting/fix/ospf_potential_memory_leak

ospfd: Free memory for JSON allocated object before return

17 months agozebra_fpm: Add support for other protocols in fpm:netlink
Spoorthi K [Mon, 23 Jan 2023 03:34:04 +0000 (09:04 +0530)]
zebra_fpm: Add support for other protocols in fpm:netlink

    fpm:netlink format doesn't indicate the protocol information
    in routes of BGP, OSPF and other protocols. Routes of those
    protocols just indicate protocol as zebra.

    The below route is actually BGP route but 'proto': 11
    indicates that it is zebra.

    {'attrs': [('RTA_DST', 'dummy'),
               ('RTA_PRIORITY', 0),
               ('RTA_GATEWAY', 'dummy'),
               ('RTA_OIF', 2)],
     'dst_len': 32,
     'family': 2,
     'flags': 0,
     'header': {'flags': 1025,
                'length': 60,
                'pid': 3160253895,
                'sequence_number': 0,
                'type': 24},
     'proto': 11,
     'scope': 0,
     'src_len': 0,
     'table': 254,
     'tos': 0,
     'type': 1}

    with this change it is now seen with 'proto': 186
    indicates that it is BGP.

    {'attrs': [('RTA_DST', 'dummy'),
               ('RTA_PRIORITY', 0),
               ('RTA_GATEWAY', 'dummy'),
               ('RTA_OIF', 2)],
     'dst_len': 32,
     'family': 2,
     'flags': 0,
     'header': {'flags': 1025,
                'length': 60,
                'pid': 3160253895,
                'sequence_number': 0,
                'type': 24},
     'proto': 186,
     'scope': 0,
     'src_len': 0,
     'table': 254,
     'tos': 0,
     'type': 1}

Signed-off-by: Spoorthi K <spk@redhat.com>
17 months agobgpd: encode properly vpnv6 nexthop
Philippe Guibert [Mon, 23 Jan 2023 15:27:45 +0000 (16:27 +0100)]
bgpd: encode properly vpnv6 nexthop

This change updates the nexthop attribute length
accordingly to the safi used. Actually, with the
previous commit, the length calculated was not
aligned with the real nexthop length. Such packet
received by remote peer was malformed, and this
was resulting in breaking vpnv6 peering.

Fix this by updating appropriately the real
nexthop length.

Fixes: 35ac9b53f2e2 ("bgpd: fix vpnv6 nexthop encoding")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agozebra: use typesafe lib lists in zebra dplane
Mark Stapp [Fri, 20 Jan 2023 22:24:17 +0000 (17:24 -0500)]
zebra: use typesafe lib lists in zebra dplane

Replace some of the old queue/DLIST macros with typesafe
dlists.

Signed-off-by: Mark Stapp <mjs@labn.net>
17 months agoospfd: Free memory for JSON allocated object before return
Donatas Abraitis [Mon, 23 Jan 2023 11:46:42 +0000 (13:46 +0200)]
ospfd: Free memory for JSON allocated object before return

For show_ip_ospf_database_type_adv_router_common().

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoisisd: fix time truncation on display
Rafael Zalamena [Mon, 23 Jan 2023 11:16:39 +0000 (08:16 -0300)]
isisd: fix time truncation on display

Use a larger storage to keep the `time_t` that is platform agnostic and
use the appropriated printing primitive.

Found by Coverity Scan (CID 1519793)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agobgpd: Add missing `no` form for `neighbor path-attribute discard` cmd
Donatas Abraitis [Sun, 22 Jan 2023 19:56:31 +0000 (21:56 +0200)]
bgpd: Add missing `no` form for `neighbor path-attribute discard` cmd

Just forgot this _somehow_ :)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #12673 from chiragshah6/fdev1
Donatas Abraitis [Sun, 22 Jan 2023 19:19:04 +0000 (21:19 +0200)]
Merge pull request #12673 from chiragshah6/fdev1

ospfd: fix crash show ip ospf border-routers json

17 months agoospfd: Free memory for JSON allocated object before return
Donatas Abraitis [Sun, 22 Jan 2023 19:01:51 +0000 (21:01 +0200)]
ospfd: Free memory for JSON allocated object before return

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #12671 from vfreex/babel-fix-terminal
Donatas Abraitis [Sat, 21 Jan 2023 22:02:05 +0000 (00:02 +0200)]
Merge pull request #12671 from vfreex/babel-fix-terminal

babeld: Fix --terminal option

17 months agoospfd: fix crash show ip ospf border-routers json
Chirag Shah [Sat, 21 Jan 2023 07:21:01 +0000 (23:21 -0800)]
ospfd: fix crash show ip ospf border-routers json

When show ip ospf border-routers json (without vrf)
specificed, it leads to crash if there no border-routers
information.

Fix:
Do not free json object if use_vrf flag (means vrf option
is not passed) is not set.

Ticket:#3229017
Issue:3229017
Testing Done:

with fix:
l1# show ip ospf border-routers json
{
}
l1# show ip ospf vrf default border-routers json
{
}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
17 months agobabeld: Add missing `no` commands
Yuxiang Zhu [Sat, 14 Jan 2023 12:02:41 +0000 (20:02 +0800)]
babeld: Add missing `no` commands

Some babeld commands doesn't have the corresponding negative commands
defined, so those commands doesn't work with frr-reload.py.

This PR adds those missing commands.

Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
17 months agobgpd: fix time truncation due to parameter type
Rafael Zalamena [Fri, 20 Jan 2023 19:20:56 +0000 (16:20 -0300)]
bgpd: fix time truncation due to parameter type

Use the correct function parameters type to avoid truncation and other
signal issues.

Found by Coverity Scan (CID 1519802)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months ago*: introduce function for sequence numbers
Rafael Zalamena [Thu, 19 Jan 2023 15:16:11 +0000 (12:16 -0300)]
*: introduce function for sequence numbers

Don't directly use `time()` for generating sequence numbers for two
reasons:
1. `time()` can go backwards (due to NTP or time adjustments)
2. Coverity Scan warns every time we truncate a `time_t` variable for
   good reason (verify that we are Y2K38 ready).

Found by Coverity Scan (CID 151981215197861519783 and 1519772)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agoldpd: fix time truncation
Rafael Zalamena [Thu, 19 Jan 2023 15:21:27 +0000 (12:21 -0300)]
ldpd: fix time truncation

Use bigger storage for handling time variables so we don't truncate.

Found by Coverity Scan (CID 1519735)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agobabeld: Fix --terminal option
Yuxiang Zhu [Wed, 18 Jan 2023 19:16:22 +0000 (19:16 +0000)]
babeld: Fix --terminal option

babeld's `--terminal` option doesn't work because it replaces `stdin`
with `/dev/null`. It seems to me this function can be removed as `frr_run`
handles that in daemon mode.

Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
17 months agoMerge pull request #12666 from donaldsharp/bgp_outq_limit
Donatas Abraitis [Fri, 20 Jan 2023 09:59:34 +0000 (11:59 +0200)]
Merge pull request #12666 from donaldsharp/bgp_outq_limit

Bgp outq limit

17 months agoMerge pull request #12664 from pguibert6WIND/vpnv6_encoding_nexthop
Donatas Abraitis [Fri, 20 Jan 2023 09:45:51 +0000 (11:45 +0200)]
Merge pull request #12664 from pguibert6WIND/vpnv6_encoding_nexthop

bgpd: fix vpnv6 nexthop encoding

17 months agoMerge pull request #12669 from proelbtn/fix-accept-own-rd-check
Donatas Abraitis [Fri, 20 Jan 2023 09:12:47 +0000 (11:12 +0200)]
Merge pull request #12669 from proelbtn/fix-accept-own-rd-check

bgpd: Skip RD match if ACCEPT_OWN excended community is not attached

17 months agobgpd: fix vpnv6 nexthop encoding
Philippe Guibert [Thu, 19 Jan 2023 10:04:37 +0000 (11:04 +0100)]
bgpd: fix vpnv6 nexthop encoding

In ipv6 vpn, when the global and the local ipv6 address are received,
when re-transmitting the bgp ipv6 update, the nexthop attribute
length must still be 48 bytes.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agobgpd: Skip RD match if ACCEPT_OWN is not enabled
Ryoga Saito [Thu, 19 Jan 2023 11:51:44 +0000 (20:51 +0900)]
bgpd: Skip RD match if ACCEPT_OWN is not enabled

RFC7611 introduces new extended community ACCEPT_OWN and is already
implemented for FRR in the previous PR. However, this PR broke
compatibility about importing VPN routes.

Let's consider the following situation. There are 2 routers and these
routers connects with iBGP session. These routers have two VRF, vrf10
and vrf20, and RD 0:10, 0:20 is configured as the route distinguisher
of vrf10 and vrf20 respectively.

    +- R1 --------+    +- R2 --------+
    | +---------+ |    | +---------+ |
    | |  VRF10  | |    | |  VRF10  | |
    | | RD 0:10 +--------+ RD 0:10 | |
    | +---------+ |    | +---------+ |
    | +---------+ |    | +---------+ |
    | |  VRF20  +--------+  VRF20  | |
    | | RD 0:20 | |    | | RD 0:20 | |
    | +---------+ |    | +---------+ |
    +-------------+    +-------------+

In this situation, the VPN routes from R1's VRF10 should be imported to
R2's VRF10 and the VPN routes from R2's VRF10 should be imported to R2's
VRF20. However, the current implementation of ACCEPT_OWN will always
reject routes if the RD of VPN routes are matched with the RD of VRF.

Similar issues will happen in local VRF2VRF route leaks. In such cases,
the route reaked from VRF10 should be imported to VRF20. However, the
current implementation of ACCEPT_OWN will not permit them.

    +- R1 ---------------------+
    |      +------------+      |
    | +----v----+  +----v----+ |
    | |  VRF10  |  |  VRF20  | |
    | | RD 0:10 |  | RD 0:10 | |
    | +---------+  +---------+ |
    +--------------------------+

So, this commit add additional condition in RD match. If the route
doesn't have ACCEPT_OWN extended community, source VRF check will be
skipped.

[RFC7611]: https://datatracker.ietf.org/doc/html/rfc7611

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
17 months agotests: Add test to check importing routes to VRF
Ryoga Saito [Thu, 19 Jan 2023 11:51:33 +0000 (20:51 +0900)]
tests: Add test to check importing routes to VRF

After implementing ACCEPT_OWN extended community, bgpd can't import VPN
routes to the VRFs whose RD is matched with that of VPN routes. This
commit adds new test to check the effect of the next commit.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
17 months agoMerge pull request #12350 from kuldeepkash/pim6_fixes
Donald Sharp [Thu, 19 Jan 2023 18:27:32 +0000 (13:27 -0500)]
Merge pull request #12350 from kuldeepkash/pim6_fixes

tests: Fix for multicast_pim6_static_rp tests failure

17 months agoMerge pull request #12651 from opensourcerouting/fix/revert_bgp_orr
Donald Sharp [Thu, 19 Jan 2023 17:24:17 +0000 (12:24 -0500)]
Merge pull request #12651 from opensourcerouting/fix/revert_bgp_orr

Revert BGP Optimal route reflector feature

17 months agobgpd: Input Queue does not belong under `router bgp`
Donald Sharp [Thu, 19 Jan 2023 16:49:30 +0000 (11:49 -0500)]
bgpd: Input Queue does not belong under `router bgp`

The input queue limit does not belong under router bgp.  This
is a dev escape and should just be removed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agobgpd: Limit peer output queue length like input queue length
Donald Sharp [Thu, 19 Jan 2023 16:43:12 +0000 (11:43 -0500)]
bgpd: Limit peer output queue length like input queue length

Consider this scenario:

Lots of peers with a bunch of route information that is changing
fast.  One of the peers happens to be really slow for whatever
reason.  The way the output queue is filled is that bgpd puts
64 packets at a time and then reschedules itself to send more
in the future.  Now suppose that peer has hit it's input Queue
limit and is slow.  As such bgp will continue to add data to
the output Queue, irrelevant if the other side is receiving
this data.

Let's limit the Output Queue to the same limit as the Input
Queue.  This should prevent bgp eating up large amounts of
memory as stream data when under severe network trauma.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agoMerge pull request #12655 from donaldsharp/pim_basic_cleanups
Christian Hopps [Thu, 19 Jan 2023 16:41:44 +0000 (11:41 -0500)]
Merge pull request #12655 from donaldsharp/pim_basic_cleanups

tests: pim_basic fails in micronet

17 months agoMerge pull request #12665 from opensourcerouting/cs-misc
Mark Stapp [Thu, 19 Jan 2023 16:28:58 +0000 (11:28 -0500)]
Merge pull request #12665 from opensourcerouting/cs-misc

lib,zebra: fix null dereference and remove dead code

17 months agopimd: fix mtracebis tool warning
Rafael Zalamena [Thu, 19 Jan 2023 15:09:29 +0000 (12:09 -0300)]
pimd: fix mtracebis tool warning

Use `getpid()` to initialize the sequence number. This change silences
Coverity Scan warning about truncated use of `time()` which in this case
is not a problem.

Found by Coverity Scan (CID 1519828)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agolib: remove dead logic code
Rafael Zalamena [Thu, 19 Jan 2023 13:42:01 +0000 (10:42 -0300)]
lib: remove dead logic code

If we got inside the condition of `vrfp->status == VRF_ACTIVE` then
don't make the same check again.

Found by Coverity Scan (CID 1519760)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agoMerge pull request #12492 from kuldeepkash/update_assert_msg
Donatas Abraitis [Thu, 19 Jan 2023 13:33:19 +0000 (15:33 +0200)]
Merge pull request #12492 from kuldeepkash/update_assert_msg

tests: [topojson] Update assert/error messages

17 months agozebra: fix possible null dereference
Rafael Zalamena [Thu, 19 Jan 2023 13:32:18 +0000 (10:32 -0300)]
zebra: fix possible null dereference

Don't attempt to dereference `ifp` directly if it might be null: there
is a check right before this usage: `ifp ? ifp->info : NULL`.

In this context it should be safe to assume `ifp` is not NULL because
the only caller of this function checks that for this `ifindex`. For
consistency we'll check for null anyway in case this ever changes (and
with this the coverity scan warning gets silenced).

Found by Coverity Scan (CID 1519776)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agotests: fix for test_pim6_multiple_groups_different_RP_address_p2 failure
Kuldeep Kashyap [Mon, 9 Jan 2023 17:06:28 +0000 (09:06 -0800)]
tests: fix for test_pim6_multiple_groups_different_RP_address_p2 failure

Testcase: test_pim6_multiple_groups_different_RP_address_p2
was failing because of a bug in framework, Fixed the
bug in this commit.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
17 months agotests: Fix for multicast_pim6_static_rp tests failure
Kuldeep Kashyap [Mon, 21 Nov 2022 07:47:33 +0000 (23:47 -0800)]
tests: Fix for multicast_pim6_static_rp tests failure

Multicast pim6 static RP tests are failing
when run in parallel using micronet. There
are APIs to clean mcast traffic before
starting new test but these cleanups
are not needed when socat is used.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
17 months agoMerge pull request #12657 from anlancs/fix/lib-debug-empty-ip
Donatas Abraitis [Thu, 19 Jan 2023 07:12:04 +0000 (09:12 +0200)]
Merge pull request #12657 from anlancs/fix/lib-debug-empty-ip

lib: show "(null)" for empty IP address

17 months agolib: show "(null)" for empty IP address
anlan_cs [Wed, 11 Jan 2023 00:44:46 +0000 (08:44 +0800)]
lib: show "(null)" for empty IP address

Use "(null)" for empty IP address.

One example in `bgp_zebra_send_remote_macip()` to install mac:

Before:
```
2023/01/18 02:09:09 BGP: [SCHS5-AK960] Tx ADD MACIP, VNI 200 MAC 06:6b:7c:db:83:72 IP  flags 0x0 seq 0 remote VTEP 88.88.88.88 esi -
```

After:
```
2023/01/18 20:19:57 BGP: [SCHS5-AK960] Tx ADD MACIP, VNI 200 MAC 06:6b:7c:db:83:72 IP (null) flags 0x0 seq 0 remote VTEP 88.88.88.88 esi -
```

Signed-off-by: anlan_cs <vic.lan@pica8.com>
17 months agoMerge pull request #12659 from opensourcerouting/fpm-cs
Donald Sharp [Thu, 19 Jan 2023 01:20:45 +0000 (20:20 -0500)]
Merge pull request #12659 from opensourcerouting/fpm-cs

zebra: fix fpm netlink encode out of bounds read

17 months agoMerge pull request #12604 from donaldsharp/distance_metric_offload_fixes
Russ White [Wed, 18 Jan 2023 20:57:48 +0000 (15:57 -0500)]
Merge pull request #12604 from donaldsharp/distance_metric_offload_fixes

Distance/metric offload fixes

17 months agotests: zebra_netlink only gives 10 seconds to install all routes
Donald Sharp [Wed, 18 Jan 2023 20:24:17 +0000 (15:24 -0500)]
tests: zebra_netlink only gives 10 seconds to install all routes

Under really heavily loaded systems this is insufficient.  Looking
at the run output we have this:

  "2.1.3.22\/32":[
    {
      "installed":true,
    }
  ],
  "2.1.3.23\/32":[
    {
      "queued":true,
            }
           ],

So after 10 seconds on the micronet system only 30 of the 100 routes are installed.
Give it more time.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agotests: pim_basic fails in micronet
Donald Sharp [Wed, 18 Jan 2023 01:40:50 +0000 (20:40 -0500)]
tests: pim_basic fails in micronet

Looks like under heavy load, the test is not giving enough
time to come to steady state.  Do this:

a) send more udp packets and for longer
b) Increase time spent waiting

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: fix fpm netlink encode out of bounds read
Rafael Zalamena [Wed, 18 Jan 2023 18:53:10 +0000 (15:53 -0300)]
zebra: fix fpm netlink encode out of bounds read

Don't attempt to encode the pointer address instead pass the pointer
directly so the real contents can be accessed.

(`ri->pref_src` type is `union g_addr *`)

Found by Coverity Scan (CID 1482162)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agoMerge pull request #12653 from opensourcerouting/netns-cs
Mark Stapp [Wed, 18 Jan 2023 12:32:15 +0000 (07:32 -0500)]
Merge pull request #12653 from opensourcerouting/netns-cs

zebra: make sure string is null terminated

17 months agoMerge pull request #12648 from opensourcerouting/gmtime-fix
Mark Stapp [Tue, 17 Jan 2023 21:25:35 +0000 (16:25 -0500)]
Merge pull request #12648 from opensourcerouting/gmtime-fix

lib: fix gmtime_assafe potential issues

17 months agoMerge pull request #12588 from LabNConsulting/chopps/unet-aflags
Donald Sharp [Tue, 17 Jan 2023 20:55:31 +0000 (15:55 -0500)]
Merge pull request #12588 from LabNConsulting/chopps/unet-aflags

tests: replace -a (all) with individual flags for nsenter

17 months agozebra: make sure string is null terminated
Rafael Zalamena [Tue, 17 Jan 2023 19:32:08 +0000 (16:32 -0300)]
zebra: make sure string is null terminated

Do extra inotify data structure checks and copy the file name to a stack
buffer making sure it is null byte terminated.

Found by Coverity Scan (CID 1465494)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agotests: replace -a (all) with individual flags for nsenter
Christian Hopps [Tue, 3 Jan 2023 14:08:50 +0000 (09:08 -0500)]
tests: replace -a (all) with individual flags for nsenter

- required for old OSs like centos 7
- fixes #11924

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agoMerge pull request #12449 from chiragshah6/mdev1
Donatas Abraitis [Tue, 17 Jan 2023 16:25:01 +0000 (18:25 +0200)]
Merge pull request #12449 from chiragshah6/mdev1

zebra: vrf-id support for show vrf vni json cmd

17 months agoRevert "lib: BGP registration with IGP for BGP ORR rSPF calc"
Donatas Abraitis [Tue, 17 Jan 2023 16:15:56 +0000 (18:15 +0200)]
Revert "lib: BGP registration with IGP for BGP ORR rSPF calc"

This reverts commit a5dd4bf47d1d24cfc5e916ff29f5124792e85a53.

17 months agoRevert "doc: Add documentation for BGP ORR support"
Donatas Abraitis [Tue, 17 Jan 2023 16:15:50 +0000 (18:15 +0200)]
Revert "doc: Add documentation for BGP ORR support"

This reverts commit 2b55ff400f6d6fcb471310286f07843bfc5e0b37.

17 months agoRevert "bgpd: optimal router reflection cli and fsm changes"
Donatas Abraitis [Tue, 17 Jan 2023 16:14:27 +0000 (18:14 +0200)]
Revert "bgpd: optimal router reflection cli and fsm changes"

This reverts commit 70cd87ca02125616e9f61f97ab504248c935bd83.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoRevert "ospfd: rSPF calc and messaging for optimal route reflection"
Donatas Abraitis [Tue, 17 Jan 2023 16:11:56 +0000 (18:11 +0200)]
Revert "ospfd: rSPF calc and messaging for optimal route reflection"

This reverts commit a3d3a14c09cf212c7d402670247c4d518b99d8b7.

17 months agoRevert "bgpd, ospfd: BGP ORR CI warning fixes"
Donatas Abraitis [Tue, 17 Jan 2023 16:10:04 +0000 (18:10 +0200)]
Revert "bgpd, ospfd: BGP ORR CI warning fixes"

This reverts commit d6b2761134352ad22acac6cc39acd70bd0c21ad4.

17 months agoRevert "ospfd: few fixes in rSPF calc when LSA received from non root node"
Donatas Abraitis [Tue, 17 Jan 2023 16:09:55 +0000 (18:09 +0200)]
Revert "ospfd: few fixes in rSPF calc when LSA received from non root node"

This reverts commit 9f2984d97c2e23198db47d39a725f3c50d2ee0ed.

17 months agoRevert "bgpd: fix for crash when no neighbor A.B.C.D remote-as AS_NUM with orr config"
Donatas Abraitis [Tue, 17 Jan 2023 16:07:46 +0000 (18:07 +0200)]
Revert "bgpd: fix for crash when no neighbor A.B.C.D remote-as AS_NUM with orr config"

This reverts commit 5fcf01c9ae0b9c595c883ad1ca80ccb0c4516b1d.

17 months agoRevert "bgpd, ospfd: update BGP when routes are removed from OSPF routing table"
Donatas Abraitis [Tue, 17 Jan 2023 16:07:41 +0000 (18:07 +0200)]
Revert "bgpd, ospfd: update BGP when routes are removed from OSPF routing table"

This reverts commit bba9435157515689cb752e1ff9ac18a44f08b73a.

17 months agoRevert "bgpd: code review comments addressed"
Donatas Abraitis [Tue, 17 Jan 2023 16:07:36 +0000 (18:07 +0200)]
Revert "bgpd: code review comments addressed"

This reverts commit 80f6ea8b99188b9d8e79fe4fc1740cc92375d7bc.

17 months agoMerge pull request #12584 from pguibert6WIND/bgp_imported_distance
Russ White [Tue, 17 Jan 2023 15:16:46 +0000 (10:16 -0500)]
Merge pull request #12584 from pguibert6WIND/bgp_imported_distance

bgpd: imported vpn entries get appropriate distance