summaryrefslogtreecommitdiff
path: root/ospf6d
AgeCommit message (Collapse)Author
2025-04-08ospf6: clean up -Wshadow warningsMark Stapp
Clean up various "shadow" warnings. Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-03-26ospf6d: Fix LSA memory leaks related to graceful restartMartin Buck
Fixes leaks reported by ospf6_gr_topo1 topotest. Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2025-03-14 ospf6d: Disable and delete OSPFv3 areas that no longer have interfaces or ↵Acee Lindem
configuration. This fix will delete an OSPFv3 area when all the interfaces and configuration (ranges, NSSA ranges, stub area, NSSA area, filter-list, import-list and export-list) have been removed. The changes provides a general solution to https://github.com/FRRouting/frr/issues/18324. Signed-off-by: Acee Lindem <acee@lindem.com>
2025-02-26Merge pull request #18254 from ↵Donald Sharp
LabNConsulting/aceelindem/ospf6-abr-calc-addr-sanity ospf6d: Fix use after free of router in OSPFv3 ABR route calculation.
2025-02-24ospf6d: Fix use after free of router in OSPFv3 ABR route calculation.Acee Lindem
This PR fixes FRR issue https://github.com/FRRouting/frr/issues/18040. The OSPFv3 route is locked during the ABR calculation since there are scenarios under which it is freed. The OSPFv3 ABR computation is sub-optimal and this PR doesn't attempt to rework it. Signed-off-by: Acee Lindem <acee@lindem.com>
2025-02-20*: Remove unneeded IPV6_JOIN|LEAVE_GROUPDonald Sharp
Headers include this stuff now. No need for it in our code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-09ospf6d: guard a couple of debugsJafar Al-Gharaibeh
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-11-06Merge pull request #17363 from ↵Donatas Abraitis
acooks-at-bda/fix-redundant-null-ptr-check-CID-1599962 ospf6d: remove redundant null ptr check
2024-11-06ospf6d: remove redundant null ptr checkAndrew Cooks
Fix defect flagged by Coverity: *** CID 1599957: Null pointer dereferences (REVERSE_INULL) /ospf6d/ospf6_intra.c: 581 in ospf6_link_lsa_get_prefix_str() 575 int buflen, int pos) 576 { 577 struct ospf6_link_lsa *link_lsa = lsa_after_header(lsa->header); 578 struct ospf6_prefix *prefix = nth_prefix(lsa->header, pos); 579 struct in6_addr in6 = { 0 }; 580 >>> CID 1599957: Null pointer dereferences (REVERSE_INULL) >>> Null-checking "lsa" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 581 if (!lsa || !prefix || !buf || buflen < (1 + INET6_ADDRSTRLEN)) 582 return NULL; 583 584 /* position zero is used for the lladdr in the body of the LSA */ 585 if (pos == 0) { 586 inet_ntop(AF_INET6, &link_lsa->linklocal_addr, buf, buflen); The check for lsa being not-null happens in ospf6_lsdb_show() and first dereference happens in ospf6_lsa_show_summary() Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-11-06ospf6d: remove redundant null ptr checkAndrew Cooks
Fix defect flagged by Coverity: *** CID 1599962: Null pointer dereferences (REVERSE_INULL) /ospf6d/ospf6_intra.c: 775 in ospf6_intra_prefix_lsa_get_prefix_str() 769 { 770 struct ospf6_prefix *prefix = nth_prefix(lsa->header, pos); 771 struct in6_addr in6 = { 0 }; 772 char tbuf[16]; 773 774 /* ensure buflen >= INET6_ADDRSTRLEN + '/128\0' */ >>> CID 1599962: Null pointer dereferences (REVERSE_INULL) >>> Null-checking "lsa" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 775 if (!lsa || !prefix || !buf || buflen < (5 + INET6_ADDRSTRLEN)) 776 return NULL; 777 778 memcpy(&in6, OSPF6_PREFIX_BODY(prefix), 779 OSPF6_PREFIX_SPACE(prefix->prefix_length)); 780 inet_ntop(AF_INET6, &in6, buf, buflen); The check for lsa being not-null happens in ospf6_lsdb_show() and first dereference happens in ospf6_lsa_show_summary() Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-24Merge pull request #16908 from donaldsharp/ospf6_snmp_specialJafar Al-Gharaibeh
ospf6d: Remove unguarded debugs in ospf6_snmp.c
2024-09-24ospf6d: Remove unguarded debugs in ospf6_snmp.cDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-16ospf6d: apply CI style suggestionsAndrew Cooks
Apply formatting changes suggested by CI frrbot. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: use nth_prefix() in ospf6_intra_prefix_lsa_get_prefix_str()Andrew Cooks
Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: use nth_prefix() in ospf6_link_lsa_get_prefix_str()Andrew Cooks
Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: add nth_prefix()Andrew Cooks
Add utility function to find the Nth prefix in a link LSA or Intra Prefix LSA. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: use nth_lsdesc() in ospf6_router_lsa_get_nbr_id()Andrew Cooks
Improves code readability by reducing pointer casting and arithmetic, and intendation. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: use nth_lsdesc() in ospf6_network_lsa_get_ar_id()Andrew Cooks
Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: add nth_lsdesc()Andrew Cooks
Add utility function to find the Nth router lsdesc or network lsdesc in an LSA. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: replace TLV_HDR_TOP macro with lsdesc_start functionAndrew Cooks
The original TLV_HDR_TOP implementation only worked for Graceful Restart LSAs, because they had no "LSA body". This change introduces a body size lookup table and changes the macro to a function that accounts for the LSA body for all LSA types, and provides type checking on the provided pointer before arithmetic. It also removes the open type casting and pointer arithmetic. The introduced lsdesc_start() is used to find the start of a descriptor, and will be used for TLVs in E-LSAs as well as old LSA. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: use lsa_after_header pointer arithmeticAndrew Cooks
Replaces open type casting and pointer arithmetic for readability. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
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: cleanup Router-LSAs Options bit orderAndrew Cooks
Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: add space between multi-line macrosAndrew Cooks
For readability Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: move lsa structs to ospf6_lsa.hAndrew Cooks
It will be cleaner to have the LSAs in a single header and the future TLVs in a single 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-06-11Merge pull request #16050 from rgirada/ospfv3_helperRuss White
ospf6d: Handling Topo Change in GR-HELPER mode for max-age lsas
2024-06-06ospf6d: Handling Topo Change in GR-HELPER mode for max-age lsasRajesh Girada
Description: OSPF6 GR HELPER router should consider as TOPOCHANGE when it receives lsas with max age and should exit from Helper. But, it is not exiting from helper because this max age lsa is considered as duplicated lsa since the sender uses same seq number for max age lsa from the previous lsa update. Currently, topo change is not considered for duplicated lsas. So removed the duplicated check when validating TOPOCHNAGE. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2024-06-04 ospf6d: OSPFv3 manual key authentication neglects checking the SA ID.Acee Lindem
Also, add topotest variation to verify checking. This corrects https://github.com/FRRouting/frr/issues/16100. Signed-off-by: Acee Lindem <acee@lindem.com>
2024-05-30ospf6d: Prevent heap-buffer-overflow with unknown typeIggy Frankovic
When parsing a osf6 grace lsa field and we receive an unknown tlv type, ospf6d was not incrementing the pointer to get beyond the tlv. Leaving a situation where ospf6d would parse the packet incorrectly. Signed-off-by: Iggy Frankovic <iggy07@gmail.com>
2024-05-29Merge pull request #16098 from ↵Donald Sharp
LabNConsulting/aceelindem/ospfv3-route-asbr-change ospf6d: OSPFv3 route change comparision fixed for ASBR-only change
2024-05-28ospf6d: OSPFv3 route change comparision fixed for ASBR-only changeAcee
When a router route already exists in the area border routers table as an ABR and it solely changes its ABR or ASBR status, the change was missed and border route is not updated. This fixes the comparison for the router_bits in the ospf6_path structure. This fixes issue https://github.com/FRRouting/frr/issues/16053 although the actual problem is not the computing router (r2) and not the OSPFv3 redistribution (r3). Signed-off-by: Acee <aceelindem@gmail.com>
2024-05-28ospf6d: replace OSPF6_LSA_SIZE with ospf6_lsa_sizeAndrew Cooks
Dropping the macro enables better compiler type checking. The macro was not used consistently when reading the lsa size from the header, so this change also aims to use the replacement inline function consistently. Keeping the inline function has (marginal) utility in that it ensures that the endian conversion is consistently performed. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-05-28ospf6d: replace OSPF6_LSA_END with ospf6_lsa_endAndrew Cooks
Replacing the macro with an inline function enables better type checking. No functional change. 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-10*: Modify agentx to be allowed to be calledDonald Sharp
If you had a situation where an operator turned on ospfd with snmp but not ospf6d and agentx was configured then you get into a situation where ospf6d would complain that the config for agentx did not exist. Let's modify the code to allow this situation to happen. Fixes: #15896 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-07Merge pull request #15627 from Max-Mustermann33/ospf6d_metric_for_type5_lsaRuss White
ospf6d: Fix metric when sending AS-external LSAs
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>
2024-05-03ospf6d: Fix nexthop computation for inter-area multi-ABR ECMPMartin Buck
Pre-b74e965, we always merged nexthops of old (existing) and new (newly generated, based on a LSA update) routes, making it impossible to remove individual nexthops from a route. b74e965 replaced this by copying nexthops from the new route to the old route. This works as long as the old and new route are derived from the same LSA (e.g. multiple ECMP paths to the same ABR). However, in case of multiple parallel ABRs, each of them originates a LSA and the nexthops derived from them need to be combined to get the proper route nexthops. So instead of trying to incrementally update the route nexthops based on the old and new route nexthops, always recompute the route nexthops by merging all of its path nexthops (which we're already updating based on the LSA being processed). Fixes #15777. Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2024-04-25ospf6d: accept CLI `no` for point-to-multipointDavid Lamparter
`point-to-multipoint` was missing on the removal variant of this CLI command. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-25ospf6d: force recalculate on interface_upDavid Lamparter
interface_up also handles changes to the interface type, i.e. broadcast to ptp to ptmp. Connected routes for these are different and must be readvertised, which is done in ospf6_interface_recalculate_cost() - but only if the cost changed. Use the force variant here. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-25ospf6d: fix loopback/ptp/ptmp conn. route checksDavid Lamparter
The code emitting connected routes was checking against the interface state (which can also be lo/ptp/ptmp) rather than the interface type. This was causing wrong IA prefixes for connected routes getting put up out if the interface was down intermittently. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-25ospf6d: fix DEFUN formatting wrecked by clangDavid Lamparter
clang-format doesn't understand `DEFUN` and formats it rather ugly. Standard approach was to skip these in clang-format, which hasn't happened here sadly. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-11ospfd, ospf6d: Remove deprecated JSON fieldsDonatas Abraitis
restartSupoort Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-13eigrpd, mgmtd, ospf6d: frr_fini is lastDonald Sharp
I noticed that ospf6d always had a linked list memory leak. Tracking it down shows that frr_fini() shuts down the memory system and prints out memory not cleaned up. eigrpd, mgmtd and ospf6d all called cleanup functions after frr_fini leaving memory leaked that was not really leaked. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-08Merge pull request #15469 from LabNConsulting/chopps/keychain-yangDonald Sharp
add ietf-key-chain YANG module support
2024-03-07ospf6d: add localLinkLocalAddress fieldFrancois Dumontet
add localIfaceAdress field in show ipv6 ospf6 neighbor detail json command. Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-03-04lib: add keychain northbound supportChristian Hopps
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-04*: use af-specific autocompletion for prefix-lists when possibleIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-02Merge pull request #10151 from pguibert6WIND/ensure_routing_protocols_good_bwDonald Sharp
zebra: avoid having speed set to UINT32_MAX