summaryrefslogtreecommitdiffstats
path: root/ripd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: remove ZEBRA_INTERFACE_VRF_UPDATEanlan_cs2023-10-072-26/+0
| | | | | | | | | | | | | | | | | | | | | | | | Currently when one interface changes its VRF, zebra will send these messages to all daemons in *order*: 1) `ZEBRA_INTERFACE_DELETE` ( notify them delete from old VRF ) 2) `ZEBRA_INTERFACE_VRF_UPDATE` ( notify them move from old to new VRF ) 3) `ZEBRA_INTERFACE_ADD` ( notify them added into new VRF ) When daemons deal with `VRF_UPDATE`, they use `zebra_interface_vrf_update_read()->if_lookup_by_name()` to check the interface exist or not in old VRF. This check will always return *NULL* because `DELETE` ( deleted from old VRF ) is already done, so can't find this interface in old VRF. Send `VRF_UPDATE` is redundant and unuseful. `DELETE` and `ADD` are enough, they will deal with RB tree, so don't send this `VRF_UPDATE` message when vrf changes. Since all daemons have good mechanism to deal with changing vrf, and don't use this `VRF_UPDATE` mechanism. So, it is safe to completely remove all the code with `VRF_UPDATE`. Signed-off-by: anlan_cs <anlan_cs@tom.com>
* Revert "ripd: Cleanup memory allocations on shutdown"Igor Ryzhov2023-06-151-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 3d1588d8ed537e3dbf120e1b2a5ad5b3c00c7897. This commit introduced a crash. When the VRF is deleted, the RIP instance should not be freed, because the NB infrastructure still stores the pointer to it. The instance should be deleted only when it's actually deleted from the configuration. To reproduce the crash: ``` frr# conf t frr(config)# vrf vrf1 frr(config-vrf)# exit frr(config)# router rip vrf vrf1 frr(config-router)# exit frr(config)# no vrf vrf1 frr(config)# no router rip vrf vrf1 vtysh: error reading from ripd: Resource temporarily unavailable (11)Warning: closing connection to ripd because of an I/O error! frr(config)# ``` Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* ripd: embed BFD YANG modelsDavid Lamparter2023-05-251-0/+1
| | | | | | The frr-ripd model has a dependency on frr-bfdd, so include it in build. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge pull request #13548 from ↵Russ White2023-05-234-2/+6
|\ | | | | | | | | opensourcerouting/fix/use_min_value_of_cli_zebra_cap_ecmp ripd: Make sure we do not overuse higher values for ECMP count
| * ripd: Make sure we do not overuse higher values for ECMP countDonatas Abraitis2023-05-184-2/+6
| | | | | | | | | | | | Use a minimum value of a CLI version and a value of Zebra capabilities. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | ripd: Use argv_find to avoid buffer overflow when parsing allow-ecmp argsDonatas Abraitis2023-05-231-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ==13211==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000af158 at pc 0x55d48c5f1e38 bp 0x7fffd8a713d0 sp 0x7fffd8a713c0 READ of size 8 at 0x6020000af158 thread T0 #0 0x55d48c5f1e37 in rip_allow_ecmp ripd/rip_cli.c:98 #1 0x7f2ec125aa0f in cmd_execute_command_real lib/command.c:990 #2 0x7f2ec125ae90 in cmd_execute_command lib/command.c:1049 #3 0x7f2ec125b406 in cmd_execute lib/command.c:1217 #4 0x7f2ec137ca36 in vty_command lib/vty.c:551 #5 0x7f2ec137ce52 in vty_execute lib/vty.c:1314 #6 0x7f2ec1384f9e in vtysh_read lib/vty.c:2223 #7 0x7f2ec137041b in event_call lib/event.c:1995 #8 0x7f2ec12b54bf in frr_run lib/libfrr.c:1204 #9 0x55d48c5f0f32 in main ripd/rip_main.c:171 #10 0x7f2ec0ad9c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) #11 0x55d48c5f1349 in _start (/usr/lib/frr/ripd+0x3b349) 0x6020000af158 is located 0 bytes to the right of 8-byte region [0x6020000af150,0x6020000af158) allocated by thread T0 here: #0 0x7f2ec18ccb40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40) #1 0x7f2ec12d2e41 in qmalloc lib/memory.c:100 #2 0x7f2ec125a815 in cmd_execute_command_real lib/command.c:955 #3 0x7f2ec125ae90 in cmd_execute_command lib/command.c:1049 #4 0x7f2ec125b406 in cmd_execute lib/command.c:1217 #5 0x7f2ec137ca36 in vty_command lib/vty.c:551 #6 0x7f2ec137ce52 in vty_execute lib/vty.c:1314 #7 0x7f2ec1384f9e in vtysh_read lib/vty.c:2223 #8 0x7f2ec137041b in event_call lib/event.c:1995 #9 0x7f2ec12b54bf in frr_run lib/libfrr.c:1204 #10 0x55d48c5f0f32 in main ripd/rip_main.c:171 #11 0x7f2ec0ad9c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) SUMMARY: AddressSanitizer: heap-buffer-overflow ripd/rip_cli.c:98 in rip_allow_ecmp Shadow bytes around the buggy address: 0x0c048000ddd0: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fa 0x0c048000dde0: fa fa fd fa fa fa fd fd fa fa fd fa fa fa fd fd 0x0c048000ddf0: fa fa fd fa fa fa fd fd fa fa fd fd fa fa fd fd 0x0c048000de00: fa fa fd fa fa fa fd fd fa fa 00 03 fa fa fd fa 0x0c048000de10: fa fa fd fa fa fa 00 00 fa fa fd fa fa fa 00 03 =>0x0c048000de20: fa fa 00 03 fa fa fd fa fa fa 00[fa]fa fa fa fa 0x0c048000de30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c048000de40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c048000de50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c048000de60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c048000de70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==13211==ABORTING Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* Merge pull request #13430 from opensourcerouting/feature/rip_allow-ecmp_limitDonald Sharp2023-05-125-14/+111
|\ | | | | ripd: Implement allow-ecmp X command
| * ripd: Do not overrun with more ECMP paths than Zebra supportsDonatas Abraitis2023-05-051-2/+9
| | | | | | | | | | | | | | Let's say FRR is compiled with ECMP max 16, we enter `allow-ecmp 10`, but Zebra supports only 4. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
| * ripd: Implement `allow-ecmp X` commandDonatas Abraitis2023-05-044-12/+102
| | | | | | | | | | | | Allow setting an arbitrary number of paths to be installed instead of ALL. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | ripd: fix another memtype mismatchRenato Westphal2023-05-081-1/+2
| | | | | | | | | | | | Fixes #13447. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | ripd: use correct memory type when freeing BFD profileRenato Westphal2023-05-034-3/+6
| | | | | | | | | | | | Fixes #13415. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | ripd: fix null-pointer dereferenceRenato Westphal2023-05-031-2/+3
|/ | | | | | Fixes #13416. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* Merge pull request #13366 from zmw12306/rte_tagDonatas Abraitis2023-05-021-0/+6
|\ | | | | ripd: add non-zero check for RIPv1 reserved field
| * ripd: add non-zero check for RIPv1 reserved field,zmw123062023-04-251-0/+6
| | | | | | | | | | According to RFC2453 3.6, the tag of a RIP-1 entry should be zero Signed-off-by: zmw12306 <zmw12306@gmail.com>
* | Merge pull request #13246 from opensourcerouting/rip-bfdRuss White2023-04-2513-38/+549
|\ \ | | | | | | ripd: support BFD integration
| * | ripd: support BFD integrationRenato Westphal2023-04-1913-38/+549
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement RIP peer monitoring with BFD. RFC 5882 Generic Application of Bidirectional Forwarding Detection (BFD), Section 10.3 Interactions with RIP. Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* | | Merge pull request #13326 from ↵Russ White2023-04-251-2/+2
|\ \ \ | |_|/ |/| | | | | | | | opensourcerouting/feature/rip_topotest_distribute_list ripd: Create non default passive interface if defined so
| * | ripd: Create non default passive interface if defined soDonatas Abraitis2023-04-181-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this patch, it's never get non-passive and even listed under status: Configuration: ``` router rip network 192.168.1.0/24 network 10.10.10.1/32 passive-interface default no passive-interface r2-eth0 timers basic 5 15 10 exit ``` ``` r2# do sh ip rip status Routing Protocol is "rip" Sending updates every 5 seconds with +/-50%, next due in 4 seconds Timeout after 15 seconds, garbage collect after 10 seconds Outgoing update filter list for all interface is not set Incoming update filter list for all interface is not set Default redistribution metric is 1 Redistributing: Default version control: send version 2, receive any version Interface Send Recv Key-chain lo 2 1 2 r2-eth0 2 1 2 Routing for Networks: 10.10.10.1/32 192.168.1.0/24 Passive Interface(s): lo r2-eth0 Routing Information Sources: Gateway BadPackets BadRoutes Distance Last Update 192.168.1.3 0 0 120 00:00:04 Distance: (default is 120) r2# ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* / ripd: Align show ip rip status output for sourcesDonatas Abraitis2023-04-181-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` Routing Protocol is "rip" Sending updates every 5 seconds with +/-50%, next due in 0 seconds Timeout after 15 seconds, garbage collect after 10 seconds Outgoing update filter list for all interface is not set Incoming update filter list for all interface is not set Default redistribution metric is 1 Redistributing: Default version control: send version 2, receive any version Interface Send Recv Key-chain r1-eth0 2 1 2 Routing for Networks: 192.168.1.0/24 Routing Information Sources: Gateway BadPackets BadRoutes Distance Last Update 192.168.1.2 0 0 120 00:00:05 192.168.1.3 0 0 120 00:00:04 Distance: (default is 120) ``` After: ``` Routing Protocol is "rip" Sending updates every 5 seconds with +/-50%, next due in 4 seconds Timeout after 15 seconds, garbage collect after 10 seconds Outgoing update filter list for all interface is not set Incoming update filter list for all interface is not set Default redistribution metric is 1 Redistributing: Default version control: send version 2, receive any version Interface Send Recv Key-chain r1-eth0 2 1 2 Routing for Networks: 192.168.1.0/24 Routing Information Sources: Gateway BadPackets BadRoutes Distance Last Update 192.168.1.2 0 0 120 00:00:00 192.168.1.3 0 0 120 00:00:04 Distance: (default is 120) ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* lib: convert if_rmap config output to northboundIgor Ryzhov2023-04-122-3/+2
| | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* ripd: adapt to new YANG NB if_rmap conversionChristian Hopps2023-04-113-0/+123
| | | | | | - uses YANG grouping and calls if_rmap library code to implement. Signed-off-by: Christian Hopps <chopps@labn.net>
* Merge pull request #13245 from anlancs/cleanup/ripd-1Donatas Abraitis2023-04-111-9/+4
|\ | | | | ripd: Cosmetic changes for ripd
| * ripd: Simplify code for distanceanlan_cs2023-04-101-8/+3
| | | | | | | | | | | | Simplify the code for `rip_distance_apply()`. Signed-off-by: anlan_cs <vic.lan@pica8.com>
| * ripd: Correct one debug loganlan_cs2023-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Correct one debug log, which wrongly mixed address and port. Before: ``` ripd[469497]: [NDAGH-Z85V7] rip_send_packet 3.3.3.4 > 224.0.0.9 (enp1s0) ripd[469497]: [VEJY5-67P5X] SEND to 224.0.0.9520 ``` After: ``` ripd[471330]: [NDAGH-Z85V7] rip_send_packet 3.3.3.4 > 224.0.0.9 (enp1s0) ripd[471330]: [T8DFR-P09JH] SEND to 224.0.0.9 port 520 ``` Signed-off-by: anlan_cs <vic.lan@pica8.com>
* | ripd: implement new YANG operational stateChristian Hopps2023-04-071-20/+70
| | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* | ripd: yang: extend nexthops functionality in YANG model - skeletonChristian Hopps2023-04-073-0/+202
|/ | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* *: Fixup formatting issues due to reorderingDonald Sharp2023-03-241-1/+1
| | | | | | | | All the event changes exposed a bunch of places where we were not properly following our standards. Just clean them up in one big fell swoop. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert event.h to frrevent.hDonald Sharp2023-03-244-4/+4
| | | | | | | We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-244-6/+6
| | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp2023-03-244-38/+38
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-244-6/+6
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_timer_remain_XXX to event_timer_remain_XXXDonald Sharp2023-03-241-3/+3
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-244-15/+15
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-244-18/+18
| | | | | | | | | Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename thread.[ch] to event.[ch]Donald Sharp2023-03-244-4/+4
| | | | | | | | | | | This is a first in a series of commits, whose goal is to rename the thread system in FRR to an event system. There is a continual problem where people are confusing `struct thread` with a true pthread. In reality, our entire thread.c is an event system. In this commit rename the thread.[ch] files to event.[ch]. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-0921-316/+21
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ripd: Add missin enum's to switch statementDonald Sharp2023-01-311-2/+12
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* build, vtysh: extract vtysh commands from .xrefDavid Lamparter2022-10-262-7/+0
| | | | | | | | | | | | | | | | | | | Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ripd: Cleanup memory allocations on shutdownDonald Sharp2022-10-121-0/+8
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Create and use infrastructure to show debugs in libDonald Sharp2022-10-071-0/+2
| | | | | | | | | There are lib debugs being set but never show up in `show debug` commands because there was no way to show that they were being used. Add a bit of infrastructure to allow this and then use it for `debug route-map` Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #11898 from sri-mohan1/sri-rip-dbg1Donatas Abraitis2022-09-041-11/+9
|\ | | | | ripd: changes for code maintainability
| * ripd: changes for code maintainabilitysri-mohan12022-09-021-11/+9
| | | | | | | | | | | | these changes are for improving the code maintainability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
* | ripd: Use a sequence number instead of timeDonald Sharp2022-08-241-1/+2
|/ | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ripd: Convert thread_cancel to THREAD_OFFDonald Sharp2022-07-213-3/+3
| | | | | | Just convert all uses of thread_cancel to THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ripd: Remove various macros that overlap THREAD_OFFDonald Sharp2022-07-214-28/+25
| | | | | | | | 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>
* *: Use autocomplete for route-maps under commands that require itDonatas Abraitis2022-06-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | For example: ``` donatas-laptop# show bgp ipv4 unicast neighbors 127.0.0.2 advertised-routes route-map ? RMAP_NAME Name of the route map testas2 testas donatas-laptop(config)# router bgp donatas-laptop(config-router)# address-family ipv4 donatas-laptop(config-router-af)# redistribute connected route-map ? RMAP_NAME Pointer to route-map entries testas2 testas donatas-laptop(config-router-af)# network 192.168.0.0/23 route-map ? RMAP_NAME Name of the route map testas2 testas ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Properly use memset() when zeroingDonatas Abraitis2022-05-114-10/+10
| | | | | | | Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* ripd: Use correct usage of memcpy() when zeroing structDonatas Abraitis2022-05-111-4/+3
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Fix spelling of modifedDonald Sharp2022-04-191-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Fix spelling of strucutreDonald Sharp2022-04-191-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>