summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_asbr.c
AgeCommit message (Collapse)Author
2024-09-16ospf6d: replace ospf6_lsa_header_end()Andrew Cooks
The void * return type of the replacement enables the removal of a cast at every point of use, and the name no longer suggests that it points to the last byte of the header. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: factor out generic TLV handlingAndrew Cooks
In preperation for Extended LSA types and their TLVs, factor out the TLV handling from the Gracefull Restart functionality. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-05-28ospf6d: replace OSPF6_LSA_HEADER_END macroAndrew Cooks
Replacing the macro with an inline function allows the compiler to check the parameter type. Use the replacement function consistently to reduce the number of open coded pointer cast plus offset calculations. use tools/indent.py to reformat all occurences of its use. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-05-06ospf6d: Redistribute metric for AS-external routeAlexander Rose
When ospf6d originates an AS-external route that has been read from a kernel routing table, then the metric of that route was ignored until now. If a routemap is configured, then this metric will be redistributed from now on. Using metric increment and decrement in routemaps is supported by ospf6d now. Signed-off-by: Alexander Rose <alexander.rose@secunet.com>
2023-11-22*: convert `struct interface->connected` to DLISTDavid Lamparter
Replace `struct list *` with `DLIST(if_connected, ...)`. NB: while converting this, I found multiple places using connected prefixes assuming they were IPv4 without checking: - vrrpd/vrrp.c: vrrp_socket() - zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(), irdp_advert_off() (these fixes are really hard to split off into separate commits as that would require going back and reapplying the change but with the old list handling) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-13ospf6d: fix setting of the forwarding address in AS-External LSAsRenato Westphal
When redistributing a local route, ensure the forwarding address field of AS-External LSAs is only set when the associated nexthop interface is OSPF-enabled. This is necessary because the OSPF RFC requires that the AS-External LSA forwarding address should be resolvable using an intra-area or inter-area path. Fixes #14462. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-24*: Convert event.h to frrevent.hDonald Sharp
We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert a bunch of thread_XX to event_XXDonald Sharp
Convert these functions: thread_getrusage thread_cmd_init thread_consumed_time thread_timer_to_hhmmss thread_is_scheduled thread_ignore_late_timer Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_add_XXX functions to event_add_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
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>
2023-03-24*: Rename thread.[ch] to event.[ch]Donald Sharp
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>
2023-03-21*: Add a hash_clean_and_free() functionDonald Sharp
Add a hash_clean_and_free() function as well as convert the code to use it. This function also takes a double pointer to the hash to set it NULL. Also it cleanly does nothing if the pointer is NULL( as a bunch of code tested for ). Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-02ospf6d: handle redistributed routes without nexthop addressesRenato Westphal
Do not assume that all redistributed routes have a nexthop address, otherwise blackhole nexthops can be misinterpreted as IPv6 addresses, leading to inconsistencies. Also, change the signature of a few functions to allow const nexthop addresses, such that in6addr_any can be used without type casts. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-02ospf6d: originate AS-External LSAs with a forwarding addressRenato Westphal
Originate AS-External LSAs with forwarding addresses whenever the corresponding redistributed routes have a global nexthop address. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-12-19ospf6d: Fixing memory leak in ospf6_summary_add_aggr_route_and_blackhole.Manoj Naragund
Problem Statement: ================= Memory leak in ospf6d. 2022-11-15 02:15:11,569 - ERROR: ==30108== 440 (280 direct, 160 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 17 2022-11-15 02:15:11,569 - ERROR: ==30108== at 0x4C31FAC: calloc (vg_replace_malloc.c:762) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x4E8A1BF: qcalloc (memory.c:111) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x14337A: ospf6_route_create (ospf6_route.c:462) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x11EE27: ospf6_summary_add_aggr_route_and_blackhole (ospf6_asbr.c:2779) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x11EEDA: ospf6_originate_new_aggr_lsa (ospf6_asbr.c:2816) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x120053: ospf6_handle_external_lsa_origination (ospf6_asbr.c:3659) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x12041E: ospf6_asbr_redistribute_add (ospf6_asbr.c:1547) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x14F3CC: ospf6_zebra_read_route (ospf6_zebra.c:253) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x4EC9B73: zclient_read (zclient.c:2727) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x4EB741B: thread_call (thread.c:1692) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x4E85B17: frr_run (libfrr.c:1068) 2022-11-15 02:15:11,569 - ERROR: ==30108== by 0x119585: main (ospf6_main.c:228) 2022-11-15 02:15:11,569 - ERROR: ==30108== RCA: ==== blackhole route was not freed before adding a new one. Fix: ==== Added a check before allocating new route, to free the old one. Also, added ospf6_asbr_summary_config_delete in ospf6_delet before freeing the aggregate route. Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2022-11-03Merge pull request #12196 from opensourcerouting/xref-vtyshDonald Sharp
*: rewrite `extract.pl` using `xref` infra
2022-10-26ospfd, ospf6d: align CLI help stringsDavid Lamparter
ospfd and ospf6d define the same metric-type route-map commands. Make them have the same help string too. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
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>
2022-10-25ospf6d: Fix for memory leak issues in ospf6.Manoj Naragund
Problem: Multiple memory leaks in ospf6. 260 ==6637== 32 bytes in 1 blocks are definitely lost in loss record 5 of 24 261 ==6637== at 0x4C31FAC: calloc (vg_replace_malloc.c:762) 262 ==6637== by 0x4E8A1BF: qcalloc (memory.c:111) 263 ==6637== by 0x11EE27: ospf6_summary_add_aggr_route_and_blackhole (ospf6_asbr.c:2779) 264 ==6637== by 0x11EEBA: ospf6_originate_new_aggr_lsa (ospf6_asbr.c:2811) 265 ==6637== by 0x4E7C6A7: hash_clean (hash.c:325) 266 ==6637== by 0x11FA93: ospf6_handle_external_aggr_update (ospf6_asbr.c:3164) 267 ==6637== by 0x11FA93: ospf6_asbr_summary_process (ospf6_asbr.c:3386) 268 ==6637== by 0x4EB739B: thread_call (thread.c:1692) 269 ==6637== by 0x4E85B17: frr_run (libfrr.c:1068) 270 ==6637== by 0x119535: main (ospf6_main.c:228) 356 ==6637== 240 bytes in 12 blocks are indirectly lost in loss record 13 of 24 357 ==6637== at 0x4C2FE96: malloc (vg_replace_malloc.c:309) 358 ==6637== by 0x4E8A0DA: qmalloc (memory.c:106) 359 ==6637== by 0x13545C: ospf6_lsa_alloc (ospf6_lsa.c:724) 360 ==6637== by 0x1354E3: ospf6_lsa_create_headeronly (ospf6_lsa.c:756) 361 ==6637== by 0x1355F2: ospf6_lsa_copy (ospf6_lsa.c:790) 362 ==6637== by 0x13B58B: ospf6_dbdesc_recv_slave (ospf6_message.c:976) 363 ==6637== by 0x13B58B: ospf6_dbdesc_recv (ospf6_message.c:1038) 364 ==6637== by 0x13B58B: ospf6_read_helper (ospf6_message.c:1838) 365 ==6637== by 0x13B58B: ospf6_receive (ospf6_message.c:1875) 366 ==6637== by 0x4EB739B: thread_call (thread.c:1692) 367 ==6637== by 0x4E85B17: frr_run (libfrr.c:1068) 368 ==6637== by 0x119535: main (ospf6_main.c:228) RCA: 1. when the ospf6 area is being deleted, the neighbor related information was not being cleaned up. 2. when aggr route gets deleted from rt_aggr_tbl the corrsponding summary route attched to the aggr route was not being deleted. Fix: Added the ospf6_neighbor_delete in ospf6_area_delete to free the neighbor related information and added ospf6_route_delete while freeing external aggr route to free the summary route. Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2022-06-13*: Use autocomplete for route-maps under commands that require itDonatas Abraitis
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>
2022-05-20ospf6d: Clean up thread interfaceDonald Sharp
a) Remove setting of thread pointer to NULL after thread invocation, this is already done. b) Use thread_is_scheduled() Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-11*: Properly use memset() when zeroingDonatas Abraitis
Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-03*: remove the checking returned value for hash_get()anlan_cs
Firstly, *keep no change* for `hash_get()` with NULL `alloc_func`. Only focus on cases with non-NULL `alloc_func` of `hash_get()`. Since `hash_get()` with non-NULL `alloc_func` parameter shall not fail, just ignore the returned value of it. The returned value must not be NULL. So in this case, remove the unnecessary checking NULL or not for the returned value and add `void` in front of it. Importantly, also *keep no change* for the two cases with non-NULL `alloc_func` - 1) Use `assert(<returned_data> == <searching_data>)` to ensure it is a created node, not a found node. Refer to `isis_vertex_queue_insert()` of isisd, there are many examples of this case in isid. 2) Use `<returned_data> != <searching_data>` to judge it is a found node, then free <searching_data>. Refer to `aspath_intern()` of bgpd, there are many examples of this case in bgpd. Here, <returned_data> is the returned value from `hash_get()`, and <searching_data> is the data, which is to be put into hash table. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-03-29ospf6d: fix crash when applying a route-map on a temporary routeIgor Ryzhov
ospf6_routemap_rule_match_interface uses route->ospf6 field for matching so we must fill the field in our temporary variable. Fixes #10911. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2022-02-23*: Change thread->func to return void instead of intDonald Sharp
The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-14ospf6d: Fix spelling mistakesDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-01-28ospf6d: adjust type of "aggr_delay_interval"anlan_cs
Adjust type of "aggr_delay_interval": Just replace `unsigned int` with `uint16_t` for range is (50..1800). Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-01-13Merge pull request #10314 from ckishimo/ospf6d_extstubDonald Sharp
ospf6d: do not send Type-5 into stub area
2022-01-12Merge pull request #10315 from ckishimo/ospf6d_cleaningIgor Ryzhov
ospf6d: some cleaning
2022-01-12Merge pull request #9285 from anlancs/fix-ospf6d-cli-with-nonexist-vrfIgor Ryzhov
ospf6d: add prompt for commands with non-exist vrf
2022-01-11ospf6d: give error information for commands with non-exist vrfsanlan_cs
Currently the ospf6d's commands with non-exist vrfs can't give the error informations to users. This commit adds a macro "OSPF6_CMD_CHECK_VRF" to give error information if with non-exist vrfs. As usual, skip the checking process in the case of json. So one command can call this macro to do the checking process in its end. At that time it need know json style or not, so add "json" parameter for several related functions. BTW, suppress the build warning of the macro `OSPF6_FIND_VRF_ARGS`: "Macros starting with if should be enclosed by a do - while loop to avoid possible if/else logic defects." Signed-off-by: anlan_cs <anlan_cs@tom.com>
2022-01-10ospfd,ospf6d: make clear the comparison of routemap nameanlan_cs
Comparison of the two pointer is confusing, they have no relevance except the time both of them are empty. Additionly modify one variable name and correct some comment words, they are same in both ospfd and ospf6d. Signed-off-by: anlan_cs <anlan_cs@tom.com>
2022-01-10ospf6d: remove duplicated logckishimo
When running topotest ospf6_topo2 we can see a log message with wrong lsa id 2021/12/20 23:14:40.330 OSPF6: [V8P0C-HB5Z2] ASBR[default:Status:3]: Update 2021/12/20 23:14:40.330 OSPF6: [Z489N-JAJ6P] ASBR[default:Status:3]: Already ASBR 2021/12/20 23:14:40.330 OSPF6: [Z9D0B-12SBJ] Redistribute 2001:db8:2::/64 (connected) 2021/12/20 23:14:40.330 OSPF6: [N66XP-ANN4G] Advertise as AS-External Id:8.70.41.177 prefix 2001:db8:2::/64 metric 2 (**) 2021/12/20 23:14:40.330 OSPF6: [K4Y9R-C22T6] Advertise new AS-External Id:0.0.0.3 prefix 2001:db8:2::/64 metric 2 2021/12/20 23:14:40.330 OSPF6: [PKX0N-KNRQR] Originate AS-External-LSA for 2001:db8:2::/64 This PR removes the log (instead of fixing it) as same information is printed in the following entry Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2022-01-10ospf6d: do not send Type-5 into stub areackishimo
When running the topotest ospf6_topo2, we see the ABR r2 sending type 5 LSA into the stub area 0.0.0.1 which are not acknowledged and the ABR keeps trying forever 2022/01/07 15:51:57.953 LSUpdate to neighbor 10.254.254.1%r2-eth0 2022/01/07 15:51:57.953 LSUpdate send on r2-eth0 2022/01/07 15:51:57.953 src: fe80::5808:2aff:fe79:bb63 2022/01/07 15:51:57.953 dst: fe80::785f:7aff:feee:82d6 2022/01/07 15:51:57.953 OSPFv3 Type:4 Len:156 Router-ID:10.254.254.2 2022/01/07 15:51:57.953 Area-ID:0.0.0.1 Cksum:0 Instance-ID:0 2022/01/07 15:51:57.953 Number of LSA: 4 2022/01/07 15:51:57.953 [AS-External Id:0.0.0.1 Adv:10.254.254.2] 2022/01/07 15:51:57.953 Age: 198 SeqNum: 0x80000001 Cksum: 3959 Len: 28 2022/01/07 15:51:57.953 [AS-External Id:0.0.0.2 Adv:10.254.254.2] 2022/01/07 15:51:57.953 Age: 197 SeqNum: 0x80000001 Cksum: d5f2 Len: 36 2022/01/07 15:51:57.953 [AS-External Id:0.0.0.3 Adv:10.254.254.2] 2022/01/07 15:51:57.953 Age: 197 SeqNum: 0x80000001 Cksum: ebd9 Len: 36 2022/01/07 15:51:57.953 [AS-External Id:0.0.0.4 Adv:10.254.254.2] 2022/01/07 15:51:57.953 Age: 196 SeqNum: 0x80000001 Cksum: d1f3 Len: 36 2022/01/07 15:52:02.953 LSUpdate to neighbor 10.254.254.1%r2-eth0 2022/01/07 15:52:02.953 LSUpdate send on r2-eth0 2022/01/07 15:52:02.953 src: fe80::5808:2aff:fe79:bb63 2022/01/07 15:52:02.953 dst: fe80::785f:7aff:feee:82d6 2022/01/07 15:52:02.953 OSPFv3 Type:4 Len:156 Router-ID:10.254.254.2 2022/01/07 15:52:02.953 Area-ID:0.0.0.1 Cksum:0 Instance-ID:0 2022/01/07 15:52:02.953 Number of LSA: 4 2022/01/07 15:52:02.953 [AS-External Id:0.0.0.1 Adv:10.254.254.2] 2022/01/07 15:52:02.953 Age: 203 SeqNum: 0x80000001 Cksum: 3959 Len: 28 2022/01/07 15:52:02.954 [AS-External Id:0.0.0.2 Adv:10.254.254.2] 2022/01/07 15:52:02.954 Age: 202 SeqNum: 0x80000001 Cksum: d5f2 Len: 36 2022/01/07 15:52:02.954 [AS-External Id:0.0.0.3 Adv:10.254.254.2] 2022/01/07 15:52:02.954 Age: 202 SeqNum: 0x80000001 Cksum: ebd9 Len: 36 2022/01/07 15:52:02.954 [AS-External Id:0.0.0.4 Adv:10.254.254.2] 2022/01/07 15:52:02.954 Age: 201 SeqNum: 0x80000001 Cksum: d1f3 Len: 36 This PR prevents the ABR of sending type 5 lsa into a stub area Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2021-11-25ospf6d: Convert vty_out to vty_json for JSONDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-23ospf6d: Remove ospf6->external_id_tableDonald Sharp
The external_id_table was only ever used to store pointers to data and was never used for lookup during the course of normal operations. However it did lead to crashes because somewhere along the way external routes stored in the external_table never had their id associated into the external_id_table and we would assert on the node lookup failing. Since this code was never used for anything other than storing data and it was never retrieved for anything useful let's just remove it from ospf6d. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-28Merge pull request #9831 from manojvn/379909_383518Igor Ryzhov
ospf6d: minor code enhancements.
2021-10-27Merge pull request #9837 from idryzhov/cleanup-if-by-name-vrf-allRuss White
*: fix usage of if_lookup_by_name_all_vrf
2021-10-26ospf6d: minor code enhancements.Manoj Naragund
Description: code changes involve removal of increment and decrement operators during function calls. These expressions make code less readable. Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2021-10-15ospf6d: don't use if_lookup_by_name_all_vrfIgor Ryzhov
if_lookup_by_name_all_vrf doesn't work correctly with netns VRF backend as the same index may be used in multiple netns simultaneously. Use the appropriate VRF when looking for the interface. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-14ospf6d: remove no-opIgor Ryzhov
ospf6_route_create already sets route->ospf6. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-08ospf6d: Do not explicitly set the thread pointer to NULLDonatas Abraitis
FRR should only ever use the appropriate THREAD_ON/THREAD_OFF semantics. This is espacially true for the functions we end up calling the thread for. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-06Merge pull request #9699 from manojvn/379032-devRuss White
ospf6d: minor struct compare issues.
2021-10-06ospf6d: code cleanup.Manoj Naragund
removal of some of the deadcode in ospf6d. Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2021-10-04ospf6d: Do not explicitly set the thread pointer to NULLDonatas Abraitis
FRR should only ever use the appropriate THREAD_ON/THREAD_OFF semantics. This is espacially true for the functions we end up calling the thread for. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-09-30ospf6d: minor struct compare issues.Manoj Naragund
Problem Statement: Multiple struct compare using memcmp, which might result in issue due to structure padding/alignment. Fix: The code changes involve structure member by member comparison to remove any issues related to padding/alignment. Signed-off-by: Manoj Naragund <mnaragund@vmware.com> (cherry picked from commit 67db821a1d6d68b19862d50b68ed19278c5f2422)
2021-09-21ospf6d: implement Type-7 default routes for NSSA areasRenato Westphal
Add the "default-information-originate" option to the "area X nssa" command. That option allows the origination of Type-7 default routes on NSSA ABRs and ASBRs. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21ospf6d: don't generate Type-7 LSA for route created by ↵Renato Westphal
"default-information-originate" The route created by the "default-information-originate" command isn't a regular external route. As such, an NSSA ABR shouldn't originate a corresponding Type-7 LSA for it (there's a separate configuration knob to generate Type-7 default routes). While here, fix a small issue in ospf6_asbr_redistribute_add() where routes created by "default-information-originate" were being displayed with an incorrect "unknown" type. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>