Commit Graph

29108 Commits

Author SHA1 Message Date
Donald Sharp
1af6e82b81 bgpd: Remove newlines from zlog, they are not allowed
commit: a486300b26
introduced newlines in zlog_XX messaging.  Not allowed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-26 10:06:38 -04:00
Russ White
2ade1c0059
Merge pull request #11582 from liwg06/master
bgpd: Fixup some MAC address token cli syntax
2022-07-26 09:20:45 -04:00
Russ White
3bf3144517
Merge pull request #11523 from pguibert6WIND/bgp_no_retain
Bgp no retain
2022-07-26 08:50:59 -04:00
Donald Sharp
749cf3c23d
Merge pull request #11674 from opensourcerouting/fix/cleanup_subgrpoup_hash_on_update_group_delete
bgpd: Cleanup subgroup hash when we delete/merge a subgroup
2022-07-25 16:50:03 -04:00
Donatas Abraitis
4d28080cb1 bgpd: Rename baa_new/baa_free/etc functions to be human-readable
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-25 16:45:06 +03:00
Donatas Abraitis
e92cf867a6 bgpd: Cleanup subgroup hash when we delete/merge a subgroup
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-25 10:20:28 +03:00
Donald Sharp
9c24c1580a
Merge pull request #11666 from opensourcerouting/fix/memory_leak_for_regexp_bgp_aspath
bgpd: Free memory for as-path filter if regexp is wrong
2022-07-23 07:40:30 -04:00
Donatas Abraitis
8fc5cba9f8
Merge pull request #11661 from donaldsharp/bnc_debugs
bgpd: LL peers need bnc's per peer
2022-07-23 13:11:32 +03:00
Donatas Abraitis
3a3a57cb8c
Merge pull request #11656 from donaldsharp/some_memory
Some memory
2022-07-23 13:10:59 +03:00
Donatas Abraitis
f4837b4bf8
Merge pull request #11669 from Chromico/master
topotests: Drop static route
2022-07-23 13:10:43 +03:00
Chromico
668289897b topotests: Drop static route
Signed-off-by: Nathan Mangar <nathan@thundergear.io>
2022-07-23 01:47:26 +04:00
Donald Sharp
ff6db1027f bgpd: Make sure hdr length is at a minimum of what is expected
Ensure that if the capability length specified is enough data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-22 13:56:54 -04:00
Donald Sharp
81e6f2c376
Merge pull request #11652 from pguibert6WIND/path_fini
pathd: add a zebra stop handler
2022-07-22 13:22:37 -04:00
Donald Sharp
49efc80d34 isisd: Ensure rcap is freed in error case
unpack_tlv_router_cap allocates memory that in the error
case is not being freed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-22 13:17:58 -04:00
Donald Sharp
d2aeac3870 ospfclient: Ensure ospf_apiclient_lsa_originate cannot accidently write into stack
Even though OSPF_MAX_LSA_SIZE is quite large and holds the upper bound
on what can be written into a lsa, let's add a small check to ensure
it is not possible to do a bad thing.

This wins one of the long standing bug awards.  2003!

Fixes: #11602
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-22 13:17:58 -04:00
Donatas Abraitis
e88307cf3c bgpd: Free memory for as-path filter if regexp is wrong
Before:

```
$ vtysh -c 'sh memory bgpd | include Temporary'; echo ; for x in $(seq 1 1000); do vtysh -c 'conf' -c 'bgp as-path access-list belekas permit wrong' >/dev/null; done; vtysh -c 'sh memory bgpd | include Temporary'
Temporary memory              :       19 variable       504       22       656
Temporary memory              :     1019 variable     24504     1023     24656
```

After:

```
$ vtysh -c 'sh memory bgpd | include Temporary'; echo ; for x in $(seq 1 1000); do vtysh -c 'conf' -c 'bgp as-path access-list belekas permit wrong' >/dev/null; done; vtysh -c 'sh memory bgpd | include Temporary'
Temporary memory              :       19 variable       504       22       656
Temporary memory              :       19 variable       504       24       680
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-22 17:43:45 +03:00
Rafael Zalamena
b8443f7ad3
Merge pull request #11565 from pguibert6WIND/bfd_vrf_lite_support
bfdd: allow l3vrf bfd sessions without udp leaking
2022-07-22 14:12:17 +00:00
Donald Sharp
efb6140a9b
Merge pull request #11662 from opensourcerouting/fix/call_hooks_when_replacing_asfilter
bgpd: Call a hook when as-path filter is replaced
2022-07-22 09:48:25 -04:00
Donald Sharp
35aae5c9bc bgpd: LL peers need bnc's per peer
FRR should create a bnc per peer.  Not have
one's that write over others.  Currently when
FRR has multiple Interface based peering, BGP wa
creating a single BNC.  This is insufficient in that
we were accidently overwriting the one LL with other
data.  This causes issues when there are multiple and
there is weird starting issues with those interfaces
that you are peering over.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-22 09:09:39 -04:00
Donatas Abraitis
f709b31b88 bgpd: Call a hook when as-path filter is replaced
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-22 14:16:02 +03:00
Philippe Guibert
97413ed778 topotests: add bfd_vrflite_topo1 test
This tests checks that there are no errors when receiving BFD
packets over the various linux vrf interfaces. For example, if
an incoming packet is received by the wrong socket, a VRF
mismatch error would occur, and BFD flapping would be observed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-07-22 08:49:52 +02:00
Philippe Guibert
e6d4113660 pathd: add a zebra stop handler
This handler code is used to stop zebra related contexts.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-07-22 08:39:06 +02:00
Donatas Abraitis
fcc48b4f9e
Merge pull request #11658 from Jafaral/up-rel8.3
debian, redhat: updating changelog for new release
2022-07-22 08:26:23 +03:00
Donatas Abraitis
eed5b70f94
Merge pull request #11657 from donaldsharp/why_timer
convert thread_cancel to THREAD_OFF
2022-07-22 08:26:08 +03:00
Jafar Al-Gharaibeh
4ca513bb8a debian, redhat: updating changelog for new release
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2022-07-21 18:11:04 -05:00
mobash-rasool
cb6c39645f
Merge pull request #11654 from donaldsharp/fixup_macros
*: frr_with_mutex change to follow our standard
2022-07-21 19:10:41 +05:30
Donald Sharp
2783a6921c ldpd: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:30:50 -04:00
Donald Sharp
fa935aa7e8 isisd: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:30:50 -04:00
Donald Sharp
146bcb9b92 zebra: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:30:50 -04:00
Donald Sharp
b8551584ee lib, vrrpd: Use THREAD_ARG
Don't auto set the thread->arg pointer.  It is private
and should be only accessed through the THREAD_ARG pointer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:30:50 -04:00
Donald Sharp
c3aaa89a44 bgpd: Convert thread_cancel to THREAD_OFF and use THREAD_ARG
Just convert all uses of thread_cancel to THREAD_OFF.  Additionally
use THREAD_ARG instead of t->arg to get the arguement.  Individual
files should never be accessing thread private data like this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:30:49 -04:00
Donald Sharp
fa5806c318 bgpd: Remove various macros that overlap THREAD_OFF
Let's just use THREAD_OFF consistently in the code base
instead of each daemon having a special macro that needs to
be looked at and remembered what it does.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:36 -04:00
Donald Sharp
69ec2ecbea ripngd: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:35 -04:00
Donald Sharp
546c8d78e7 ripngd: Remove various macros that overlap THREAD_OFF
Let's just use THREAD_OFF consistently in the code base
instead of each daemon having a special macro that needs to
be looked at and remembered what it does.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:35 -04:00
Donald Sharp
f6499a7608 ripd: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:35 -04:00
Donald Sharp
580e37a3fa ripd: Remove various macros that overlap THREAD_OFF
Let's just use THREAD_OFF consistently in the code base
instead of each daemon having a special macro that needs to
be looked at and remembered what it does.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:35 -04:00
Donald Sharp
bc1f09de73 ospfd: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:35 -04:00
Donald Sharp
cccd44f3b1 ospfd: Remove various macros that overlap THREAD_OFF
Let's just use THREAD_OFF consistently in the code base
instead of each daemon having a special macro that needs to
be looked at and remembered what it does.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:35 -04:00
Donald Sharp
87af90a765
Merge pull request #11653 from louis-6wind/fix-isis-sr-php
isisd: fix prefix-sid last-hop-behavior
2022-07-21 08:04:18 -04:00
Donald Sharp
7f74014f99
Merge pull request #11655 from opensourcerouting/fix/vtysh_end_parsing
vtysh: Ignore `end` when parsing frr.conf
2022-07-21 08:02:30 -04:00
Donatas Abraitis
ce2e1a0ed8 vtysh: Ignore end when parsing frr.conf
If we have `end` at the end of the frr.conf, then we never execute
XFRR_end_configuration command, and start/end markers do not work.

This leads to for example waiting BGP configuration parsing thread to hang,
and the peers are in shutdown state until the timer expires.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-20 22:57:33 +03:00
Donald Sharp
cb1991af8c *: frr_with_mutex change to follow our standard
convert:
	frr_with_mutex(..)

to:
	frr_with_mutex (..)

To make all our code agree with what clang-format is going to produce

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-20 15:50:32 -04:00
Louis Scalbert
4c94922c4b isisd: fix prefix-sid last-hop-behavior
The php value is defined in yang but not properly set.

Fixes: 8f6c893629 ("isisd: add segment-routing CLI commands")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-07-20 19:25:52 +02:00
mobash-rasool
efa98761d2
Merge pull request #11651 from anlancs/fix/minor-7
ospfd: correct one debug info for lsa
2022-07-20 21:48:35 +05:30
Donatas Abraitis
b6754b74ef
Merge pull request #11643 from ARShreenidhi/df_or_ntw_auto
tests: bgp default orignate behaviour on network commands
2022-07-20 11:43:10 +03:00
Donatas Abraitis
e6a380161c
Merge pull request #11648 from donaldsharp/snmp_testing
Bunch of stuff found during testing.
2022-07-20 10:08:20 +03:00
Donatas Abraitis
a484327fe1
Merge pull request #11638 from alirezaarzehgar/docfix_typo
doc: Remove extra "in" from document
2022-07-20 09:56:30 +03:00
anlan_cs
5cf2f9a7ea ospfd: correct one debug info for lsa
The index about slots should be displayed as `slot`. Additionally, adjust format.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-07-20 02:34:59 -04:00
Donald Sharp
a9b4458f61
Merge pull request #11649 from rampxxxx/bfd_cleanup_warning
BFDD: Cleanup warning
2022-07-19 20:25:26 -04:00
Philippe Guibert
edc3f63167 bfdd: allow l3vrf bfd sessions without udp leaking
Until now, when in vrf-lite mode, the BFD implementation
creates a single UDP socket and relies on the following
sysctl value to 1:

echo 1 > /proc/sys/net/ipv4/udp_l3mdev_accept

With this setting, the incoming BFD packets from a given
vrf, would leak to the default vrf, and would match the
UDP socket.

The drawback of this solution is that udp packets received
on a given vrf may leak to an other vrf. This may be a
security concern.

The commit addresses this issue by avoiding this leak
mechanism. An UDP socket is created for each vrf, and each
socket uses new setsockopt option: SO_REUSEADDR + SO_REUSEPORT.

With this option, the incoming UDP packets are distributed on
the available sockets. The impact of those options with l3mdev
devices is unknown. It has been observed that this option is not
needed, until the default vrf sockets are created.

To ensure the BFD packets are correctly routed to the appropriate
socket, a BPF filter has been put in place and attached to the
sockets : SO_ATTACH_REUSEPORT_CBPF. This option adds a criterium
to force the packet to choose a given socket. If initial criteria
from the default distribution algorithm were not good, at least
two sockets would be available, and the CBPF would force the
selection to the same socket. This would come to the situation
where an incoming packet would be processed on a different vrf.

The bpf code is the following one:

struct sock_filter code[] = {
 { BPF_RET | BPF_K, 0, 0, 0 },
};

struct sock_fprog p = {
          .len = sizeof(code)/sizeof(struct sock_filter),
          .filter = code,
};

if (setsockopt(sd, SOL_SOCKET, SO_ATTACH_REUSEPORT_CBPF, &p, sizeof(p))) {
        zlog_warn("unable to set SO_ATTACH_REUSEPORT_CBPF on socket: %s",
                  strerror(errno));
        return -1;
}

Some tests have been done with by creating vrf contexts, and by using
the below vtysh configuration:

ip route 2.2.2.2/32 10.126.0.2
vrf vrf2
 ip route 2.2.2.2/32 10.126.0.2
!
interface ntfp2
 ip address 10.126.0.1/24
!
interface ntfp3 vrf vrf4
 ip address 10.126.0.1/24
!
interface ntfp2 vrf vrf1
 ip address 10.126.0.1/24
!
interface ntfp2.100 vrf vrf2
 ip address 10.126.0.1/24
!
interface ntfp2.200 vrf vrf3
 ip address 10.126.0.1/24
!
line vty
!
bfd
 peer 10.126.0.2 vrf vrf2
 !
 peer 10.126.0.2 vrf vrf3
 !
 peer 10.126.0.2
 !
 peer 10.126.0.2 vrf vrf4
 !
 peer 2.2.2.2 multihop local-address 1.1.1.1
 !
 peer 2.2.2.2 multihop local-address 1.1.1.1 vrf vrf2
  transmit-interval 1500
  receive-interval 1500
 !

The results showed no issue related to packets received by
the wrong vrf. Even changing the udp_l3mdev_accept flag to
1 did not change the test results.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-07-19 21:35:23 +02:00