Commit Graph

30591 Commits

Author SHA1 Message Date
Donatas Abraitis
13bcc010e3 lib: Return 0 as remaining msec if the thread is not scheduled
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-18 16:43:44 +03:00
Donald Sharp
5f5b29862f
Merge pull request #11626 from opensourcerouting/fix/avoid_buffer_overflow
zebra: Avoid buffer overflow using netlink_parse_rtattr_nested()
2022-07-18 09:20:11 -04:00
Donald Sharp
5ac90e032a
Merge pull request #11631 from opensourcerouting/fix/crash_for_checking_thread_remaining
ldpd: Check if the thread is scheduled before calling for remained time
2022-07-18 09:19:50 -04:00
Francois Dumontet
64541ffa8f bgp:change in showing neighbor description
currently "show bgp summary" and "sho bgp summary wide" commands
provide a description string until a whitespace is occuring this
respectively with size limits of 20 and 60 chars

now theses two commands are providing strings with all
characters until the last witespace before size limit

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2022-07-18 14:12:23 +02:00
Donatas Abraitis
912b6a5b5c zebra: Cleanup the memory from the hash for MPLS stuff
==1595641== 280 (80 direct, 200 indirect) bytes in 1 blocks are definitely lost in loss record 30 of 38
==1595641== at 0x483AB65: calloc (vg_replace_malloc.c:760)
==1595641== by 0x493C89C: qcalloc (memory.c:116)
==1595641== by 0x1E8426: lsp_alloc (zebra_mpls.c:1116)
==1595641== by 0x49147F1: hash_get (hash.c:162)
==1595641== by 0x1EC880: mpls_lsp_install (zebra_mpls.c:3192)
==1595641== by 0x1C51BB: zread_vrf_label (zapi_msg.c:3197)
==1595641== by 0x1C6F11: zserv_handle_commands (zapi_msg.c:3863)
==1595641== by 0x24D0F4: zserv_process_messages (zserv.c:523)
==1595641== by 0x498F4CC: thread_call (thread.c:2002)
==1595641== by 0x49253A2: frr_run (libfrr.c:1198)
==1595641== by 0x1A28BA: main (main.c:475)
==1595641==
==1595641== 1,400 (400 direct, 1,000 indirect) bytes in 5 blocks are definitely lost in loss record 35 of 38
==1595641== at 0x483AB65: calloc (vg_replace_malloc.c:760)
==1595641== by 0x493C89C: qcalloc (memory.c:116)
==1595641== by 0x1E8426: lsp_alloc (zebra_mpls.c:1116)
==1595641== by 0x49147F1: hash_get (hash.c:162)
==1595641== by 0x1EBD7C: mpls_zapi_labels_process (zebra_mpls.c:2915)
==1595641== by 0x1C35D9: zread_mpls_labels_add (zapi_msg.c:2513)
==1595641== by 0x1C6F11: zserv_handle_commands (zapi_msg.c:3863)
==1595641== by 0x24D0F4: zserv_process_messages (zserv.c:523)
==1595641== by 0x498F4CC: thread_call (thread.c:2002)
==1595641== by 0x49253A2: frr_run (libfrr.c:1198)
==1595641== by 0x1A28BA: main (main.c:475)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-18 14:26:29 +03:00
Donatas Abraitis
fad64d02e4
Merge pull request #11627 from qlyoung/update-alpine-build
Update Alpine packaging foo + change docker images back over to Alpine-provided libyang
2022-07-18 11:50:35 +03:00
Donatas Abraitis
e02478f3b5
Merge pull request #11629 from mobash-rasool/fixes2
pimd: Remove the api from .h file since there is no definition of it
2022-07-18 11:43:49 +03:00
Mobashshera Rasool
6fe9b9d600 pim6d: clear interface stats on interface shutdown
The clear was happening only for PIMv4. Removed the PIMv4
check.

Fixes: #11628

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-07-18 01:18:16 -07:00
Donatas Abraitis
00e6edb97d bgpd: Add constants for some repetitive CLI strings
"Address Family\n"
"Address Family modifier\n"

Before:

```
donatas-laptop(config-router)# address-family ipv4
  <cr>
  flowspec         Address Family Modifier
  labeled-unicast  Address Family modifier
  multicast        Address Family modifier
  unicast          Address Family Modifier
  vpn              Address Family modifier
```

After:

```
donatas-laptop(config-router)# address-family
  ipv4   Address Family
  ipv6   Address Family
  l2vpn  Address Family
donatas-laptop(config-router)# address-family ipv4
  <cr>
  flowspec         Address Family modifier
  labeled-unicast  Address Family modifier
  multicast        Address Family modifier
  unicast          Address Family modifier
  vpn              Address Family modifier
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-18 10:12:57 +03:00
Philippe Guibert
943bfc4e82 topotests: add bgp retain test
This test checks that when retain functionality is disabled,
some prefixes are removed from the BGP ipv4 vpn RIB.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-07-18 08:57:26 +02:00
Philippe Guibert
a486300b26 bgpd: implement retain route-target all behaviour
A new command is available under SAFI_MPLS_VPN:

With this command, the BGP vpnvx prefixes received are
not kept, if there are no VRF interested in importing
those vpn entries.

A soft refresh is performed if there is a change of
configuration: retain cmd, vrf import settings, or
route-map change.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-07-18 08:57:19 +02:00
Donatas Abraitis
f8e44af8c9 ldpd: Check if the thread is scheduled before calling for remained time
LDPD crashes when hold time is configured to 65535:
(gdb) bt
0  0x00007f8c3fc224bb in raise () from /lib64/libpthread.so.0
1  0x00007f8c4138a3dd in core_handler () from /lib64/libfrr.so.0
2  <signal handler called>
3  0x00007f8c3fc1ccc0 in pthread_mutex_lock () from /lib64/libpthread.so.0
4  0x00007f8c4139914b in thread_timer_remain_msec () from /lib64/libfrr.so.0
5  0x00007f8c41399209 in thread_timer_remain_second () from /lib64/libfrr.so.0
6  0x000000000040eb19 in adj_to_ctl ()
7  0x0000000000427b38 in ldpe_nbr_ctl ()
8  0x000000000042fd68 in control_dispatch_imsg ()
9  0x00007f8c4139a628 in thread_call () from /lib64/libfrr.so.0
10 0x00000000004265fc in ldpe ()
11 0x000000000040a68f in main ()

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-18 09:54:16 +03:00
Donatas Abraitis
67f05be318
Merge pull request #11601 from fdumontet6WIND/FMJA/L3VPN
bmp add L3VPN support
2022-07-18 09:14:56 +03:00
Mobashshera Rasool
3f3a6cc53c pimd: Remove the api from .h file since there is no definition of it
Removing the api pim_scan_individual_oil from .h since there is
no definition of it.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-07-17 23:01:52 -07:00
Quentin Young
0bbc787cd3 docker: use Alpine-provided libyang
looks like libyang(2) is back in the upstream alpine repos, so we can
use that instead

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-07-17 19:14:28 -04:00
Quentin Young
d782b117d0 alpine, docker: Update APKBUILD for libyang
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-07-17 19:14:28 -04:00
Donatas Abraitis
ce39ca16dd zebra: Avoid buffer overflow using netlink_parse_rtattr_nested()
memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); in netlink_parse_rtattr()
seems a good candidate to buffer overflow.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-17 22:31:48 +03:00
Donatas Abraitis
77b2c28e6f
Merge pull request #11622 from donaldsharp/valgrind_issues
Valgrind issues
2022-07-17 21:58:48 +03:00
Donald Sharp
26b2fbf479
Merge pull request #11605 from LabNConsulting/improve-valgrind
Improve valgrind
2022-07-16 21:13:54 -04:00
Donald Sharp
f97ff95bda
Merge pull request #11610 from opensourcerouting/fix/treat-as-withdraw_otc
bgpd: OTC attribute should be treated as withdrawal
2022-07-16 20:59:32 -04:00
Donald Sharp
2e4e3ba10b zebra: Delete the malloced memory under show zebra
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-16 19:01:12 -04:00
Donald Sharp
9d1fec4c7e zebra: When deleting nexthop group entries ensure the thread is off
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-16 19:00:43 -04:00
Donald Sharp
05a95ab8ad lib: Prevent Uninitialized usage of data
Valgrind is reporting that prefix is being used uninitialized.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-16 18:59:51 -04:00
Jafar Al-Gharaibeh
3adfa0ce55
Merge pull request #11615 from opensourcerouting/fix/memory_leak_for_community
bgpd: Fix memory leak for community stuff
2022-07-16 16:03:51 -05:00
Jafar Al-Gharaibeh
a3fef414b6
Merge pull request #11604 from LabNConsulting/working/lb/ospf-parallel-nets
ospfd: free unreachable router LSA node so that it is not left unreachable
2022-07-16 15:52:06 -05:00
Jafar Al-Gharaibeh
4b0c476eeb
Merge pull request #11614 from opensourcerouting/fix/memory_leak_community_alias
bgpd: Fix memory leak for community alias
2022-07-16 15:51:48 -05:00
Lou Berger
b976af1b09 ospfd: free unreachable router LSA node so that it is not left unreachable
allows for an LSA to be unreachable via one link and reachable via another

Signed-off-by: Lou Berger <lberger@labn.net>
2022-07-16 10:28:42 -04:00
Donatas Abraitis
9571a61a12 bgpd: Fix memory leak for community stuff
Do not forget to cleanup after we are done:

==395247== 8,268 (32 direct, 8,236 indirect) bytes in 1 blocks are definitely lost in loss record 199 of 205
==395247==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==395247==    by 0x492EB8E: qcalloc (in /usr/local/lib/libfrr.so.0.0.0)
==395247==    by 0x490BB12: hash_get (in /usr/local/lib/libfrr.so.0.0.0)
==395247==    by 0x1FBF63: community_intern (in /usr/lib/frr/bgpd)
==395247==    by 0x1FC0C5: community_parse (in /usr/lib/frr/bgpd)
==395247==    by 0x1F0B66: bgp_attr_community (in /usr/lib/frr/bgpd)
==395247==    by 0x1F4185: bgp_attr_parse (in /usr/lib/frr/bgpd)
==395247==    by 0x26BC29: bgp_update_receive (in /usr/lib/frr/bgpd)
==395247==    by 0x26E887: bgp_process_packet (in /usr/lib/frr/bgpd)
==395247==    by 0x4985380: thread_call (in /usr/local/lib/libfrr.so.0.0.0)
==395247==    by 0x491D521: frr_run (in /usr/local/lib/libfrr.so.0.0.0)
==395247==    by 0x1EBEE8: main (in /usr/lib/frr/bgpd)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-16 16:41:31 +03:00
Donatas Abraitis
176d7beabc bgpd: Fix memory leak for community alias
==361630== 24,780 (96 direct, 24,684 indirect) bytes in 3 blocks are definitely lost in loss record 94 of 97
==361630==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==361630==    by 0x492EB8E: qcalloc (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x490BB12: hash_get (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x1FD3CC: bgp_ca_alias_insert (in /usr/lib/frr/bgpd)
==361630==    by 0x2CF8E5: bgp_community_alias_magic (in /usr/lib/frr/bgpd)
==361630==    by 0x2C980B: bgp_community_alias (in /usr/lib/frr/bgpd)
==361630==    by 0x48E3556: cmd_execute_command_real (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E384B: cmd_execute_command_strict (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E3D41: command_config_read_one_line (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E3EBA: config_from_file (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x499065C: vty_read_file (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x4990FF4: vty_read_config (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x491CB95: frr_config_read_in (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x4985380: thread_call (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x491D521: frr_run (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x1EBEE8: main (in /usr/lib/frr/bgpd)
==361630==
==361630== 24,780 (96 direct, 24,684 indirect) bytes in 3 blocks are definitely lost in loss record 95 of 97
==361630==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==361630==    by 0x492EB8E: qcalloc (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x490BB12: hash_get (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x1FD39C: bgp_ca_community_insert (in /usr/lib/frr/bgpd)
==361630==    by 0x2CF8F4: bgp_community_alias_magic (in /usr/lib/frr/bgpd)
==361630==    by 0x2C980B: bgp_community_alias (in /usr/lib/frr/bgpd)
==361630==    by 0x48E3556: cmd_execute_command_real (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E384B: cmd_execute_command_strict (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E3D41: command_config_read_one_line (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E3EBA: config_from_file (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x499065C: vty_read_file (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x4990FF4: vty_read_config (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x491CB95: frr_config_read_in (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x4985380: thread_call (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x491D521: frr_run (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x1EBEE8: main (in /usr/lib/frr/bgpd)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-16 16:18:07 +03:00
anlan_cs
0ef63eb5cc zebra: correctly display one debug flag about ES Peer
Since the `mac->flags` with `ZEBRA_MAC_ES_PEER_ACTIVE` is about ES Peer,
it should be displayed as `PEER Active`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-07-15 19:24:24 -04:00
Jafar Al-Gharaibeh
f8ac2afb53
Merge pull request #11564 from kuldeepkash/multicast_pim_bsm
tests: Fix multicast_pim_bsm_topo2 static route issue
2022-07-15 16:01:13 -05:00
Donatas Abraitis
adc1c459b1 bgpd: OTC attribute should be treated as withdrawal
According to RFC9234:

An UPDATE message with a malformed OTC Attribute SHALL be handled
   using the approach of "treat-as-withdraw".

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-14 23:44:27 +03:00
Jafar Al-Gharaibeh
4ffd62f09b
Merge pull request #11606 from LabNConsulting/zebra-nbr-memleak
zebra: free neighbor state before exit to avoid memleaks
2022-07-14 15:04:22 -05:00
Donatas Abraitis
bdcf91e0a2
Merge pull request #11603 from Chromico/master
topotests: Remove typo (extra dot on the IP)
2022-07-14 22:01:51 +03:00
Jafar Al-Gharaibeh
6286ce45bc
Merge pull request #11536 from mobash-rasool/temp1
pimd: During prune pending, behave as NOINFO state (conformance issue)
2022-07-14 12:24:35 -05:00
Christian Hopps
160910ec08 tests: analyze: handle list of strings being returned
Signed-off-by: Christian Hopps <chopps@labn.net>
2022-07-14 13:16:01 -04:00
Christian Hopps
1623dc4c9c tests: check memleaks end of module and ignore daemonizing parent
- ignore parent from daemonize valgrind files these allocations will be
checked in the child.
- check for memleaks at end of module/file not just after tests.

Signed-off-by: Christian Hopps <chopps@labn.net>
2022-07-14 13:16:01 -04:00
Christian Hopps
11c9ab3202
zebra: free neighbor state before exit to avoid memleaks
Signed-off-by: Christian Hopps <chopps@labn.net>
2022-07-14 12:20:01 -04:00
Chromico Rek
3aaf96aafb topotests: Remove typo on IP
Signed-off-by: Nathan Mangar <nathan@thundergear.io>

topotests: Remove static route

Signed-off-by: Nathan Mangar <nathan@thundergear.io>
2022-07-14 19:07:48 +04:00
Francois Dumontet
5dde29654e bmp: add L3VPN support
Support for BMP L3VPN monitoring messages through SAFI_MPLS_VPN address
family.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2022-07-13 17:28:37 +02:00
David Lamparter
1004137bf3
Merge pull request #11598 from patrasar/pim_get_instance 2022-07-13 16:54:39 +02:00
David Lamparter
c9aa57dcf1
Merge pull request #11585 from patrasar/sg_str 2022-07-13 16:51:10 +02:00
David Lamparter
69de2a1c88
Merge pull request #11593 from mobash-rasool/fixes 2022-07-13 16:49:27 +02:00
mobash-rasool
9d8dc1b901
Merge pull request #11597 from opensourcerouting/pimd-packed-member
pimd: fix unaligned accesses
2022-07-13 17:29:30 +05:30
Punith Kumar S
f3e93dc535 ospf6d: fix test_ospf6_gr_topo1 topotest
1. topo test failure seen in below mentioned step of execution with
routes not synced with ABR
ospf6_gr_topo1/test_ospf6_gr_topo1.py::test_gr_rt3 - AssertionError:
"rt1" JSON output mismatches the expected result.

2. as experimental, increasing the sleep interval(21),
cleared the above step but failed in the step
FAILED ospf6_gr_topo1/test_ospf6_gr_topo1.py::test_gr_rt5 -
AssertionError: "rt2" JSON output mismatches the expected result

fix:
tuning retry parameter in check_routers cleared the topotest.
so, changing default value of ospf6 ABR task delay to 5 seconds.

Signed-off-by: Punith Kumar S <punith.shivakumar@sophos.com>
2022-07-13 10:01:11 +00:00
Punith Kumar S
a7c1a27f0e ospf6d: routes are not synced by ABR.
topology: C1--R1---R2---R3--C2
client C1 connected to router node R1
client C2 connected to router node R3
router nodes R1,R2 and R3 are back to back connected

area 0 configured between R1 and R2
R1: all routes of area 0 are learnt successfully
R2: all routes of area 0 are learnt successfully

area 1 configured between R2 and R3
R2: all routes are learnt from R3
R3: routes learnt from C1 on ABR router R2 does not get forward to R3

root cause: on interface start, ABR schedule task is missing.

fix: handle ABR schedule during interface start event

Signed-off-by: Punith Kumar S <punith.shivakumar@sophos.com>
2022-07-13 09:51:16 +00:00
Mobashshera Rasool
c6c615c12b pimd,pim6d: Set RP to true if the address matches, ignore prefix-length
The API pim_rp_check_interface_addrs checks if the RP address matches
with the primary address then it returns true.
In case of PIMv4 this condition is true, therefore the router becomes RP.
But in case of PIMv6, this condition does not pass because primary address
for PIMv6 is link-local address.

Also PIMv4 allows secondary addresses to be used as RP
if it is a host route in case primary does not match.

Fixing it by only checking the configured
RP address with the interface address and ignoring the prefix
length since it does not matter.

Fixes: #11335

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-07-12 22:51:27 -07:00
mobash-rasool
b343e3a00c
Merge pull request #11576 from anlancs/fix/minor-5
zebra: remove redundant flags assignment
2022-07-13 09:42:07 +05:30
anlan_cs
9faf4e426c zebra: remove redundant flags assignment
The assignment of neigh flags on ES peers is set twice. Just clean it.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-07-12 14:18:18 -04:00
Donatas Abraitis
4c316f2b00
Merge pull request #11566 from louis-6wind/rename-mplsvpn
bgpd: rename "struct bgp" variables in mplsvpn and cleanup
2022-07-12 19:09:32 +03:00