summaryrefslogtreecommitdiffstats
path: root/ospfd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: explicitly print "exit" at the end of every node configIgor Ryzhov2021-08-231-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Merge pull request #9408 from mobash-rasool/ospfv2-bug-fixes-03Igor Ryzhov2021-08-182-0/+4
|\ | | | | ospfd: Summarised External LSA is not flushed in one scenario
| * ospfd: Summarised External LSA is not flushed in one scenarioMobashshera Rasool2021-08-172-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix CI Failure test_ospf_type5_summary_tc45_p0 Problem Statement: ================== Summarised LSA is not flushed in OSPFv2 in below scenario: 1. Configure summary-address in ospfv2 2. redistribute static and connected. 3. Check the LSAs are received on neighbor. 4. Now remove all OSPFv2 configs, so neighbor will still have the summarised LSA. 5. Configure router ospf with redistribute static and connected. 6. Check the DB, summarised LSA is present although the configuration is not present. 7. Now configure the summary-address and remove the configuration after sometime. 8. The summarised LSA will be still present. RCA: ================== When self originated LSA is received from the neighbor and that LSA is summarised one, the LSA is refreshed but a flag is not set due to which it was not able to remove it later. Fix: ================== Set the originated flag when refreshing summarised LSA. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
* | ospfd: fix initialization when vrf doesn't exist yetIgor Ryzhov2021-08-121-35/+27
|/ | | | | | | | | | | | | There are a couple of things that are not initialized if the OSPF router is created in a non-existent VRF: - ospf_lsa_maxage_walker - ospf_lsa_refresh_walker - ospf_opaque_type11_lsa_init Rearrange some code to always initialize them and make it easier to find similar problems in the future. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* ospfd: ospf redistribute originating LSA internal connected routesMobashshera Rasool2021-08-101-4/+4
| | | | | | | | | When OSPF is disabled on interface and enabled again, the IP which is not matching the prefix-list is getting originated as External LSA. Fixes: #9362 Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
* Merge pull request #9300 from donaldsharp/ospf_headerRuss White2021-08-101-56/+60
|\ | | | | ospfd: Cleanup ospf_interface.h to work with our standards
| * ospfd: Cleanup ospf_interface.h to work with our standardsDonald Sharp2021-08-061-56/+60
| | | | | | | | | | | | | | When declaring functions we must name the variables as part of our standard. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | ospfd: fix coverity warning of one field initializationanlan_cs2021-08-051-0/+1
|/ | | | | | Add the initialization of prefixlen field in struct prefix. Signed-off-by: anlan_cs <anlan_cs@tom.com>
* Merge pull request #9092 from rgirada/rmapDonald Sharp2021-08-043-3/+67
|\ | | | | ospfd: OSPF hello packets not sent with configured hello timer
| * ospfd: OSPF hello packets not sent with configured hello timerrgirada2021-07-223-3/+67
| | | | | | | | | | | | | | | | Description : ospf hello timer is not getting refelcted upon changing the hello interval. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
* | Merge pull request #9239 from idryzhov/ospf-passive-fixRuss White2021-08-031-28/+29
|\ \ | | | | | | ospfd: fix "no ip ospf passive" command
| * | ospfd: fix "no ip ospf passive" commandIgor Ryzhov2021-07-301-28/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This command is currently always treated as an "unset" command, assuming that active is the default type of the interface. In reality, the default type of the interface can be changed using "passive-interface default" command. Both "no" and regular commands can be "set" commands, depending on the default value. They are treated as an "unset" when there's already a config of the opposite type. All this logic is in ospf_passive_interface_update. Fixes #9240. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | | *: cleanup interface node installationIgor Ryzhov2021-07-291-12/+1
|/ / | | | | | | | | | | | | | | | | The only difference in daemons' interface node definition is the config write function. No need to define the node in every daemon, just pass the callback as an argument to a library function and define the node there. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | Merge pull request #9189 from idryzhov/ospf-dont-exitDonald Sharp2021-07-281-1/+1
|\ \ | | | | | | ospfd: don't exit when socket is not created
| * | ospfd: don't exit when socket is not createdIgor Ryzhov2021-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Let's be less radical. There's no reason to stop the whole daemon when there's a socket creation error in a single VRF. The user can always restart this single VRF to retry to create a socket. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | | ospfd: remove gratuitous non-ascii quotation marksChristian Hopps2021-07-271-3/+3
|/ / | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* | build: fix `AM_LDFLAGS` usage (and gcov)David Lamparter2021-07-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | like the other automake variables, setting `xyz_LDFLAGS` causes `AM_LDFLAGS` to be ignored for `xyz`. For some reason I had in my mind that automake doesn't do this for LDFLAGS, but... it does. (Which is consistent with `_CFLAGS` and co.) So, all the libraries and modules have been ignoring `AM_LDFLAGS` (which includes `SAN_FLAGS` too). Set up new `LIB_LDFLAGS` and `MODULE_LDFLAGS` to handle all of this correctly (and move these bits to a central location.) Fixes: #9034 Fixes: 0c4285d77eb ("build: properly split CFLAGS from AC_CFLAGS") Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | ospfd: ospfd crash while giving 'clear ip ospf neighbor'rgirada2021-07-201-0/+5
|/ | | | | | | | | | | Description: Ospf process crashes upon giving 'clear ip ospf neighbor' with self routerId. It is asserting if it is a self neighbor in ospf neighbour kill event processing. Added a check to validate the provided router-id is self router-id. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
* Merge pull request #8767 from opensourcerouting/ospfd-grRuss White2021-07-1324-100/+1145
|\ | | | | ospfd: introduce support for Graceful Restart (restarting mode)
| * ospfd: introduce support for Graceful Restart (restarting mode)Renato Westphal2021-07-0519-15/+1064
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC 3623 specifies the Graceful Restart enhancement to the OSPF routing protocol. This PR implements support for the restarting mode, whereas the helper mode was implemented by #6811. This work is based on #6782, which implemented the pre-restart part and settled the foundations for the post-restart part (behavioral changes, GR exit conditions, and on-exit actions). 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 ospf` EXEC-level command needs to be issued before restarting the ospfd 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 ospfd 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. Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ospfd: rename the graceful restart headerRenato Westphal2021-07-057-10/+11
| | | | | | | | | | | | | | | | | | Both the GR helper code and the upcoming GR restarting code are going to share a lot of definitions. As such, rename ospf_gr_helper.h to ospf_gr.h, which will be the central point of all GR definitions and prototypes. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ospfd: adjust log config for GRGalaxyGorilla2021-07-056-51/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove previous log config debug ospf graceful-restart helper and just use debug ospf graceful-restart for everything related to OSPF GR. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
| * ospfd: print extra LSA information in some log messagesRenato Westphal2021-07-055-24/+26
| | | | | | | | | | | | | | | | | | | | | | | | Log the LSA advertising router in addition to the LSA type and ID in the places where that information is necessary to uniquely identify the LSA in the LSDB. This is useful, for example, to know exactly which LSA has changed when the router is exiting from the GR helper mode when a topology change was detected. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | lib,ospfd,ospf6d: remove duplicated functionRafael Zalamena2021-07-096-36/+23
|/ | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge pull request #8955 from mobash-rasool/ospfv2-fixesMark Stapp2021-07-021-0/+6
|\ | | | | ospfd: show ip ospf route json does not shown metric and tag
| * ospfd: show ip ospf route json does not shown metric and tagMobashshera Rasool2021-06-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem Statement: ================== [FRR OSPF] show ip ospf route json does not shown metric and tag. Root Cause Analysis: =================== In function show_ip_ospf_route_external, type 2 cost is not added in json. Hence it is not displayed. Fix: ================= 1. Add type2cost in the json display 2. Tag was also missing, added that as well Issue: #8729 Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
* | *: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-011-1/+1
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | *: Replace IPV4_MAX_PREFIXLEN to IPV4_MAX_BITLENDonatas Abraitis2021-07-015-15/+15
|/ | | | | | Just drop IPV4_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* isisd, ospfd: update interface_link_params callback to check for changeKaren Schoener2021-06-282-2/+10
| | | | | | | Adding defensive code to the interface_link_params zebra callback to check if the link params changed before taking action. Signed-off-by: Karen Schoener <karen@voltanet.io>
* Merge pull request #8891 from idryzhov/no-vrf-interfaceRuss White2021-06-221-0/+2
|\ | | | | lib: remove vrf-interface config when removing the VRF
| * lib: remove vrf-interface config when removing the VRFIgor Ryzhov2021-06-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we have the following configuration: ``` vrf red smth exit-vrf ! interface red vrf red smth ``` And we delete the VRF using "no vrf red" command, we end up with: ``` interface red smth ``` Interface config is preserved but moved to the default VRF. This is not an expected behavior. We should remove the interface config when the VRF is deleted. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | ospfd: External lsa handling in opaque capabilities enable/disablergirada2021-06-212-7/+36
|/ | | | | | | | | | | | Description: When opaque capability disabled/enabled , all the self-originated lsa will be flushed and it will make the neighbours to renegotiate. But here, external lsas are not being re-originated after negotiation Fix: Refresh/re-originate external lsas(Type-5 and Type-7) explicitly after re-negotiation. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
* ospfd: fix routemap updateIgor Ryzhov2021-06-171-13/+8
| | | | | | | | Currently, if the routemap already exists, we delete the pointer to it when it is updated. We should delete the pointer only if the route-map is actually deleted. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Merge pull request #8815 from idryzhov/fix-ospf-aggrDonald Sharp2021-06-091-1/+2
|\ | | | | ospfd: fix memory leaks in summarization
| * ospfd: fix memory leaks in summarizationIgor Ryzhov2021-06-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To reproduce the issue: 1. Create summary-address: `summary-address 1.1.1.0/24`. 2. Try to delete it with the wrong tag: `no summary-address 1.1.1.0/24 tag 1`. Each time this command is executed, route_node_lookup is called which locks route node one more time. As the tag is wrong, the function return immediately without unlock. 3. Finally delete the summary-address: `no summary-address 1.1.1.0/24`. The route node won't be deleted. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | Merge pull request #8798 from opensourcerouting/ospfd-fixesOlivier Dugeon2021-06-0910-101/+177
|\ \ | | | | | | ospfd: assorted fixes
| * | ospfd: fix crash when displaying neighbor data in JSONRenato Westphal2021-06-081-11/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a null check to protect against the case where the neighbor inactive timer is disabled. That can happen when the router is acting as a helper for another router that is attempting to restart gracefully. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | lib, ospfd, ospf6d: fix logging of pointer addressesRenato Westphal2021-06-081-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The %p printf format specifier does already print the pointer address with a leading "0x" prefix (indicating a hexadecimal number). There's no need to add that prefix manually. While here, replace explicit function names in log messages by __func__. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ospfd: fix wrong NSSA debug guardsRenato Westphal2021-06-082-5/+4
| | | | | | | | | | | | | | | | | | | | | Fix usage of NSSA debug guards in code paths that have nothing to do with NSSA areas. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | zebra, ospfd: fix typos in the graceful restart codeRenato Westphal2021-06-082-19/+19
| | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ospfd: fix logging of what triggered the SPF runRenato Westphal2021-06-081-7/+7
| | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ospfd: fix cleanup of MaxAge LSAs on exitRenato Westphal2021-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During shutdown, the ospf->maxage_lsa table is iterated over to clean up all existing entries. While doing that, route_unlock_node() should be called only for the nodes that have an associated entry, otherwise the table will get corrupted and ospfd will crash. As a side note, using a routing table to store MaxAge LSAs was a very poor choice of a data structure, considering that a simple rb-tree or hash table would get the job done with a much simpler (and less error-prone) API. Something to cleanup in the future... Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ospfd: fix null pointer dereference when flushing an opaque LSARenato Westphal2021-06-081-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Call ospf_lsa_flush() before free_opaque_info_per_id() since the latter can deallocate the LSA that is going to be flushed. Also, there's no need to set the LSA MaxAge to OSPF_LSA_MAXAGE manually as the ospf_lsa_flush() function already takes care of that. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ospfd: fix dangling pointer when exiting from the helper modeRenato Westphal2021-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When exiting from the helper mode for a given router after an unsuccessful graceful restart, removing the neighborship to that router straight away leads to a dangling pointer in the associated interface, which inevitably leads to a crash. To solve this problem, schedule the removal of the neighbor instead of removing it immediately. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ospfd: fix crash when logging a Grace-LSARenato Westphal2021-06-081-27/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the "show_ospf_grace_lsa_info" callback to account for the fact that the "vty" parameter can be null. This fixes a crash that happens when "debug ospf packet ls-update detail" is configured and a Grace-LSA is sent or received. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ospfd: fix small issue when exiting from the GR helper modeRenato Westphal2021-06-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When exiting from the GR helper mode, recalculate the DR only for interfaces of the appropriate types (broadcast and NMBA). This fixes a problem where the state of a neighbor reachable over a p2p interface was changing from Full/DROther to Full/Backup across a graceful restart. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ospfd: fix GR helper initialization and terminationRenato Westphal2021-06-084-13/+43
| |/ | | | | | | | | | | | | | | Since a single ospfd process can have multiple OSPF interfaces configured, we need to separate the global GR initialization and termination from per-instance initialization and termination. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | Merge pull request #8796 from idryzhov/ospf-passiveRuss White2021-06-082-146/+167
|\ \ | |/ |/| ospfd: fix passive interface configuration
| * ospfd: fix passive interface configurationIgor Ryzhov2021-06-052-146/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, passive interface flag is configured from the router node using "passive-interface IFNAME". There are multiple problems with this command: - it is not in line with all other interface-related commands - other parameters are configured from the interface node using "ip ospf" prefix - it is not in line with OSPFv3 - passive flag is configured from the interface node using "ipv6 ospf6 passive" command - most importantly, it doesn't work correctly when the interface is in a different VRF - when using VRF-lite, it incorrectly changes the vrf_id of the interface and it becomes desynced with the actual state; when using netns, it creates a new fake interface and configures it instead of configuring the necessary interface To fix all the problems, this commit adds a new command to the interface configuration node - "ip ospf passive". The purpose of the command is completely the same, but it works correctly in a multi-VRF environment. The old command is preserved for the backward compatibility, but the warning is added that it is deprecated because it doesn't work correctly with VRFs. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | ospfd, doc, tests: combined SRGB/SRLB commandEmanuele Di Pascale2021-06-042-193/+178
|/ | | | | | | | | | | | | | | | | similarly to what was done for IS-IS in commit 01d43141, combine the SRGB and SRLB commands for OSPF-SR, so that we can replace overlapping ranges in one sweep change. Also allow the range configuration to be stored before SR is enabled. There is no reason why we should not - in fact that constraint meant that we were always requesting the default label ranges regardless of what we actually wanted to use. Finally, update the topotests now that we do not need to refresh the SRGB/SRLB/MSD after disabling SR. Note that the prefix-sid still needs to be re-added. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>