summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_zebra.c
AgeCommit message (Collapse)Author
2023-11-20ospf6d: use `zclient->nexthop_update`David Lamparter
Same as before. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-06-26*: Rearrange vrf_bitmap_X api to reduce memory footprintDonald Sharp
When running all daemons with config for most of them, FRR has sharpd@janelle:~/frr$ vtysh -c "show debug hashtable" | grep "VRF BIT HASH" | wc -l 3570 3570 hashes for bitmaps associated with the vrf. This is a very large number of hashes. Let's do two things: a) Reduce the created size of the actually created hashes to 2 instead of 32. b) Delay generation of the hash *until* a set operation happens. As that no hash directly implies a unset value if/when checked. This reduces the number of hashes to 61 in my setup for normal operation. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-08ospfd, ospf6d: log when GR messages are sent to zebraRenato Westphal
This should be useful to troubleshoot possible GR problems in the future. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-08ospf6d: add support for unplanned graceful restartRenato Westphal
In practical terms, unplanned GR refers to the act of recovering from a software crash without affecting the forwarding plane. Unplanned GR and Planned GR work virtually the same, except for the following difference: on planned GR, the router sends the Grace-LSAs *before* restarting, whereas in unplanned GR the router sends the Grace-LSAs immediately *after* restarting. For unplanned GR to work, ospf6d was modified to send a ZEBRA_CLIENT_GR_CAPABILITIES message to zebra as soon as GR is enabled. This causes zebra to freeze the OSPF routes in the RIB as soon as the ospf6d daemon dies, for as long as the configured grace period (the defaults is 120 seconds). Similarly, ospf6d now stores in non-volatile memory that GR is enabled as soon as GR is configured. Those two things are no longer done during the GR preparation phase, which only happens for planned GRs. Unplanned GR will only take effect when the daemon is killed abruptly (e.g. SIGSEGV, SIGKILL), otherwise all OSPF routes will be uninstalled while ospf6d is exiting. Once ospf6d starts, it will check whether GR is enabled and enter in the GR mode if necessary, sending Grace-LSAs out all operational interfaces. One disadvantage of unplanned GR is that the neighboring routers might time out their corresponding adjacencies if ospf6d takes too long to come back up. This is especially the case when short dead intervals are used (or BFD). For this and other reasons, planned GR should be preferred whenever possible. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-24*: Convert `struct event_master` to `struct event_loop`Donald Sharp
Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert struct thread_master to struct event_master and it's ilkDonald Sharp
Convert the `struct thread_master` to `struct event_master` across the code base. 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-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-06-17ospf6: permit route delete without nexthopsMark Stapp
It's possible for ospf6 to decide to delete a route after it's removed all of the route's nexthops. It's ok to delete a prefix alone - be a little more forgiving when preparing a route delete. Signed-off-by: Mark Stapp <mstapp@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-03-27*: add SAFI argument to zclient_send_rnhDavid Lamparter
Just pushing that SAFI_UNICAST up 1 level to the caller. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-12*: When matching against a nexthop send and process what it matched againstDonald Sharp
Currently the nexthop tracking code is only sending to the requestor what it was requested to match against. When the nexthop tracking code was simplified to not need an import check and a nexthop check in b8210849b8ac1abe2d5d9a5ab2459abfde65efa5 for bgpd. It was not noticed that a longer prefix could match but it would be seen as a match because FRR was not sending up both the resolved route prefix and the route FRR was asked to match against. This code change causes the nexthop tracking code to pass back up the matched requested route (so that the calling protocol can figure out which one it is being told about ) as well as the actual prefix that was matched to. Fixes: #10766 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-31ospf6d: Fix memory leak for `show ipv6 ospf6 zebra json`Donatas Abraitis
$ for x in $(seq 1 10000); do vtysh -c 'show ipv6 ospf6 zebra json' >/dev/null; done Before: ``` $ vtysh -c 'show memory ospf6d' | grep 'Total heap allocated' Total heap allocated: 26 MiB ``` After: ``` $ vtysh -c 'show memory ospf6d' | grep 'Total heap allocated' Total heap allocated: 2256 KiB ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-15lib, ospfd, ospf6d, zebra: add OSPF opaque route attributesRenato Westphal
Update ospfd and ospf6d to send opaque route attributes to zebra. Those attributes are stored in the RIB and can be viewed using the "show ip[v6] route" commands (other than that, they are completely ignored by zebra). Example: ``` debian# show ip route 192.168.1.0/24 Routing entry for 192.168.1.0/24 Known via "ospf", distance 110, metric 20, best Last update 01:57:08 ago * 10.0.1.2, via eth-rt2, weight 1 OSPF path type : External-2 OSPF tag : 0 debian# debian# show ip route 192.168.1.0/24 json { "192.168.1.0\/24":[ { "prefix":"192.168.1.0\/24", "prefixLen":24, "protocol":"ospf", "vrfId":0, "vrfName":"default", "selected":true, [snip] "ospfPathType":"External-2", "ospfTag":"0" } ] } ``` Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-10-20*: convert zclient callbacks to tableDavid Lamparter
This removes a giant `switch { }` block from lib/zclient.c and harmonizes all zclient callback function types to be the same (some had a subset of the args, some had a void return, now they all have ZAPI_CALLBACK_ARGS and int return.) Apart from getting rid of the giant switch, this is a minor security benefit since the function pointers are now in a `const` array, so they can't be overwritten by e.g. heap overflows for code execution anymore. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-09-27ospf6d: Make ospfv3 use normal address resolution instead of import routeDonald Sharp
OSPFv3 recently introduced the usage of import route. Switch it back to using the normal ZEBRA_NEXTHOP_REGISTER command. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27*: Add resolve via default flagDonald Sharp
2021-09-24Merge pull request #9585 from opensourcerouting/ospf6d-nssa-dflt-originateRuss White
ospf6d: add a knob to generate Type-7 default routes
2021-09-23Merge pull request #9084 from louis-oui/fix-ospf6-router-idIgor Ryzhov
ospf6d: fix LSAs remain in LSDB with an old router-id value
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 update router-id if at least one adjacency is FullLouis Scalbert
When a router-id change is notified by zebra to ospf6d, we only take into account the change if no adjacencies are in Full state. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-09-16ospf6d: introduce support for Graceful Restart (restarting mode)Renato Westphal
RFC 5187 specifies the Graceful Restart enhancement to the OSPFv3 routing protocol. This commit implements support for the GR restarting mode. Here's a quick summary of how the GR restarting mode works: * GR can be enabled on a per-instance basis using the `graceful-restart [grace-period (1-1800)]` command; * To perform a graceful shutdown, the `graceful-restart prepare ipv6 ospf` EXEC-level command needs to be issued before restarting the ospf6d daemon (there's no specific requirement on how the daemon should be restarted); * `graceful-restart prepare ospf` will initiate the graceful restart for all GR-enabled instances by taking the following actions: o Flooding Grace-LSAs over all interfaces o Freezing the OSPF routes in the RIB o Saving the end of the grace period in non-volatile memory (a JSON file stored in `$frr_statedir`) * Once ospf6d is started again, it will follow the procedures described in RFC 3623 until it detects it's time to exit the graceful restart (either successfully or unsuccessfully). Testing done: * New topotest featuring a multi-area OSPF topology (including stub and NSSA areas); * Successful interop tests against IOS-XR routers acting as helpers. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-07-27Merge pull request #8944 from opensourcerouting/ospf6-mtu-revertIgor Ryzhov
ospf6d: revert PR #8622
2021-07-09lib,ospfd,ospf6d: remove duplicated functionRafael Zalamena
Move `is_default_prefix` variations to `lib/prefix.h` and make the code use the library version instead of implementing it again. NOTE ---- The function was split into per family versions to cover all types. Using `union prefixconstptr` is not possible due to static analyzer warnings which cause CI to fail. The specific cases that would cause this failure were: - Caller used `struct prefix_ipv4` and called the generic function. - `is_default_prefix` with signature using `const struct prefix *` or `union prefixconstptr`. The compiler would complain about reading bytes outside of the memory bounds even though it did not take into account the `prefix->family` part. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-07-02Revert "ospf6d: fix LSAs remain in LSDB with an old router-id value"revert-8795-fix-ospf6-router-idDonald Sharp
2021-07-01ospf6d: factorize router-id updateLouis Scalbert
ospf6_router_id_update function is used by ospf6_router_id_update_zebra to update the running the ospf6 router-id. This patches makes the functions to (un)configure ospf6 router-id use the same function as ospf6_router_id_update_zebra. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> ---
2021-07-01ospf6d: don't update router-id if at least one adjacency is FullLouis Scalbert
When a router-id change is notified by zebra to ospf6d, we only take into account the change if no adjacencies are in Full state. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-06-29ospf6d: use per-vrf router id instead of one globalIgor Ryzhov
This code was not fully completed when adding support for VRFs. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-29Revert "ospf6d: Limit the number of interface addresses being supported"David Lamparter
This reverts commit f85b76195aeeb80b6f834da32459a05e297a0a78.
2021-05-11ospf6d: Limit the number of interface addresses being supportedlynne
The code had no limits on addresses configured on an interface running ospf6d. The code would crash when more than 100 addresses were added. This change limits the number of interface address to 100 if mtu is set to the default value. If the mtu is set to a jumbo packet size or larger we will support 200 interface addresses. Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-03-29ospf6d: Add CLI and logic for default-information originate commandYash Ranjan
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-03-17*: require semicolon after DEFINE_MTYPE & coDavid Lamparter
Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-14ospf6d: Convert to use builtin printf functionalityDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-01ospf6d: add CLI to control maximum paths for routes.Mobashshera Rasool
CLI added: maximum-paths (1-64) Issue: #7961 Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2020-11-30ospf6: fix crash on shutdownIgor Ryzhov
The crash is sometimes reproduced by all_protocol_startup topotest. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-11-18Merge pull request #7478 from donaldsharp/bufferMark Stapp
Buffer
2020-11-16ospf6d: Json support added for command "show ipv6 ospf6 zebra [json]"github login name
Modify code to add JSON format output in show command "show ipv6 ospf6 zebra" with proper formating Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2020-11-15bgpd, lib, sharpd: Add enum for zclient_send_message returnDonald Sharp
Add a `enum zclient_send_status` for appropriate handling of return codes from zclient_send_message. Touch all the places where we handle this. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-03Merge pull request #7261 from Niral-Networks/niral_dev_vrf_ospf6Rafael Zalamena
ospf6d : Transformation changes for ospf6 vrf support.
2020-10-30ospf6d : Transformation changes for ospf6 vrf support.harios_niral
1. All the changes are related to handle ospf6 with different vrf. 2. The dependancy of global ospf6 is removed. Co-authored-by: Kaushik <kaushik@niralnetworks.com> Signed-off-by: harios_niral <hari@niralnetworks.com>
2020-10-22:* Convert prefix2str to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-17ospf6d: Convert to using %pFXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-09-01ospf6d : Preparing for ospf6d VRF support.Kaushik
1. Removed the VRF_DEFAULT dependency from ospf6d. 2. The dependency on show command still exist will be fixed when the ospf6 master is available. Co-authored-by: Harios <hari@niralnetworks.com> Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-04-08*: Do not cast to the same typeDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-13ospf6d: Fix spelling mistakes found by debian packagingDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-05*: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis
Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-02*: Convert connected_free to a double pointerDonald Sharp
Set the connected pointer to set the pointer to NULL. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19*: Convert zapi->interface_delete to ifp callbackDonald Sharp
Convert the callback of the interface_delete to the new ifp callback. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19*: Convert interface_down to interface down callbackDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>