summaryrefslogtreecommitdiff
path: root/ospfd/ospf_interface.c
AgeCommit message (Collapse)Author
2021-04-06ospfd: Support use of ospf with DMVPNAmol Lad
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-03-30ospfd: fix counting of "ip ospf area" commandsIgor Ryzhov
Instead of trying to maintain if_ospf_cli_count, let's directly count the number of configured interfaces when it is needed. Current approach sometimes leads to an incorrect counter. Fixes #8321. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-23ospfd: rework BFD integrationRafael Zalamena
Use new BFD API to integrate with OSPFv2. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-03-17*: require semicolon after DEFINE_QOBJ & co.David Lamparter
Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17*: require semicolon after DEFINE_HOOK & co.David Lamparter
See previous commit. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-12-02ospfd: Set Curr_mtu to when we get the mtuDonald Sharp
Currently if you start ospfd, bring up neighbors and then issue a tcpdump on a interface ospf is peering over, this causes the neighbor relationship to be restarted: root@spectrum301(mlx-4600c-01):mgmt:~# tcpdump -i vlan402 2020-11-13T21:25:38.059671+00:00 spectrum301 ospfd[29953]: AdjChg: Nbr 202.0.0.3(default) on vlan402:200.0.3.1: Full -> Deleted (KillNbr) 2020-11-13T21:25:38.065520+00:00 spectrum301 ospfd[29953]: ospfTrapNbrStateChange: trap sent: 200.0.3.2 now Deleted/DROther 2020-11-13T21:25:38.065922+00:00 spectrum301 ospfd[29953]: ospfTrapIfStateChange: trap sent: 200.0.3.1 now Down tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on vlan402, link-type EN10MB (Ethernet), capture size 262144 bytes 21:25:38.072330 IP 200.0.3.1 > igmp.mcast.net: igmp v3 report, 1 group record(s) 2020-11-13T21:25:38.080430+00:00 spectrum301 ospfd[29953]: ospfTrapIfStateChange: trap sent: 200.0.3.1 now Point-To-Point 2020-11-13T21:25:38.080654+00:00 spectrum301 ospfd[29953]: SPF Processing Time(usecs): 9734 2020-11-13T21:25:38.080829+00:00 spectrum301 ospfd[29953]: SPF Time: 6422 2020-11-13T21:25:38.080991+00:00 spectrum301 ospfd[29953]: InterArea: 1572 2020-11-13T21:25:38.081152+00:00 spectrum301 ospfd[29953]: Prune: 67 2020-11-13T21:25:38.081329+00:00 spectrum301 ospfd[29953]: RouteInstall: 1396 2020-11-13T21:25:38.081548+00:00 spectrum301 ospfd[29953]: Reason(s) for SPF: N, S, ABR, ASBR 21:25:38.092510 IP 200.0.3.1 > ospf-all.mcast.net: OSPFv2, Hello, length 44 This is happening because the curr_mtu is not being properly stored. It was being set on interface creation( but we have not actually read in the mtu part of the interface data, so it is still 0 ). Modify the code to store the curr_mtu at a point in interface creation *After* we have read in interface data. Ticket: CM-32276 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-28Merge pull request #7301 from idryzhov/ospf-fixesSantosh P K
many ospfd fixes
2020-10-22ospfd: replace inet_ntoaMark Stapp
Stop using inet_ntoa, use %pI4 etc or inet_ntop instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-14ospfd: correctly process interface creation/destructionIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-13ospfd: fix missing initialization and check for if_area paramIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-13ospfd: fix freeing of if_params structIgor Ryzhov
Freeing of configuration structure should not depend on operational variable. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-09-22ospfd: GR helper exit scenariosrgirada
Description: The follwoing helper exit scenarios are handled. 1. Recv Max age grace LSA from RESTARTER. 2. Grace timer expiry. 3. Due to topo change if lsa check is enabled. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-19ospfd : Fix for ospf dead interval and hello due.Kaushik
1. Ospf dead-interval will be set as 4 times of hello-interval, incase if it is not set by using "ip ospf dead-interval <dead-val>". 2. On resetting hello-interval using "no ip ospf hello-interval" the dead interval and hello due will be changed accordingly. Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-09-11Merge pull request #6789 from volta-networks/feat_ldp_igp_syncRenato Westphal
ldpd: Add support for LDP-IGP Synchronization
2020-09-09ospfd: ldp-igp-sync feature: adding ospf supportlynne
Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-08-18ospfd: introduce a 'dry run' into SPF codeGalaxyGorilla
in OSPF interface data is used for the nexthop resolution during the SPF algorithm, see RFC2328 16.1.1. However, for certain technologies like TI-LFA it is desirable to be able to calculate SPFs for arbitrary root nodes, not just the calculating node. Since interface data is not available for other nodes it is necessary to remove this dependency and make its usage optional, depending on the intent of changing the RIB with the generated tree (or not). To signal that a SPF run is used without the intent to change the RIB an additional flag `spf_dry_run` is introduced to the ospf_area struct. This flag is currently only used within the pure SPF code but will be extended to the SPF postprocessing later on. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-07-14*: un-split strings across linesDavid Lamparter
Remove mid-string line breaks, cf. workflow doc: .. [#tool_style_conflicts] For example, lines over 80 characters are allowed for text strings to make it possible to search the code for them: please see `Linux kernel style (breaking long lines and strings) <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_ and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
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>
2020-02-06*: Replace s_addr 0 => INADDR_ANYDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-03*: don't null after XFREE; XFREE does this itselfQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-12-18ospfd: Prevent use after free on shutdownDonald Sharp
Address Sanitizer is reporting this issue: ==26177==ERROR: AddressSanitizer: heap-use-after-free on address 0x6120000238d8 at pc 0x7f88f7c4fa93 bp 0x7fff9a641830 sp 0x7fff9a641820 READ of size 8 at 0x6120000238d8 thread T0 #0 0x7f88f7c4fa92 in if_delete lib/if.c:290 #1 0x42192e in ospf_vl_if_delete ospfd/ospf_interface.c:912 #2 0x42192e in ospf_vl_delete ospfd/ospf_interface.c:990 #3 0x4a6208 in no_ospf_area_vlink ospfd/ospf_vty.c:1227 #4 0x7f88f7c1553d in cmd_execute_command_real lib/command.c:1073 #5 0x7f88f7c19b1e in cmd_execute_command lib/command.c:1132 #6 0x7f88f7c19e8e in cmd_execute lib/command.c:1288 #7 0x7f88f7cd7523 in vty_command lib/vty.c:516 #8 0x7f88f7cd79ff in vty_execute lib/vty.c:1285 #9 0x7f88f7cde4f9 in vtysh_read lib/vty.c:2119 #10 0x7f88f7ccb845 in thread_call lib/thread.c:1549 #11 0x7f88f7c5d6a7 in frr_run lib/libfrr.c:1093 #12 0x412976 in main ospfd/ospf_main.c:221 #13 0x7f88f73b082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #14 0x413c78 in _start (/usr/local/master/sbin/ospfd+0x413c78) Effectively we are in a shutdown phase and as part of shutdown we delete the ospf interface pointer ( ifp->info ). The interface deletion code was modified in the past year to pass in the address of operator to allow us to NULL out the holding pointer. The catch here is that we free the oi and then delete the interface passing in the address of the oi->ifp pointer, causing a use after free. Fixes: #5555 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-04eigrpd, ospfd, pimd: Fix assumption that interface may not be upDonald Sharp
Commit: ddbf3e60604019d4b38d51226700e2244cc531b6 This commit modified the interface up handling code in ZAPI such that the zclient handled the decoding for you. Prior to this commit ospf assumed that it could use the old ifp pointer to know state before reading the stream. This lead to a situation where ospf would `smartly` track and do the right thing in this situation. This commit changed this assumption and in certain scenarios, say a interface was changed after it was already up would lead to situations where ospf would not properly handle the new interface up. Modify ospf to track data that is important to it in it's interface->info pointer. This code pattern was followed in both eigrp and pim. In eigrp's case it was just behaving weirdly in any event so fixing this pattern is not a big deal. In pim's case it was not properly using this so it's a no-op to fix. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-19ospfd: Add/fix some debugs to handle vrfDonald Sharp
This commit has: The received packet path in ospf, had absolutely no debugs associated with it. This makes it extremely hard to know when we receive packets for consumption. Add some breadcrumbs to this end. Large chunks of commands have no ability to debug what is happening in what vrf. With ip overlap X vrf this becomes a bit of a problem Add some breadcrumbs here. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02lib, ospfd, zebra: Convert interface_delete to take double pointerDonald Sharp
When free'ing the interface pointer, set it to NULL. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-09*: Cleanup interface creation apisStephen Worley
Cleanup the interface creation apis to make it more clear what they are doing. Make it explicit that the creation via name/ifindex will only add it to the appropriate list. Signed-off-by: Stephen Worley <sworley@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>
2019-09-19*: Convert from ->interface_up to the interface callbackDonald Sharp
For all the places we have a zclient->interface_up convert them to use the interface ifp_up callback instead. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19*: Switch all zclient->interface_add to interface create callbackDonald Sharp
Switch the zclient->interface_add functionality to have everyone use the interface create callback in lib/if.c Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19*: Add infrastructure to support zapi interface callbacksDonald Sharp
Start the conversion to allow zapi interface callbacks to be controlled like vrf creation/destruction/change callbacks. This will allow us to consolidate control into the interface.c instead of having each daemon read the stream and react accordingly. This will hopefully reduce a bunch of cut-n-paste stuff Create 4 new callback functions that will be controlled by lib/if.c create -> A upper level protocol receives an interface creation event The ifp is brand spanking newly created in the system. up -> A upper level protocol receives a interface up event This means the interface is up and ready to go. down -> A upper level protocol receives a interface down destroy -> A upper level protocol receives a destroy event This means to delete the pointers associated with it. At this point this is just boilerplate setup for future commits. There is no new functionality. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-30ospfd: Cleanup oi->obuf to always be createdDonald Sharp
This looks like a finish up of the partial cleanup that ocurred at some point in time in the past. When we alloc oi also always alloc the oi->obuf. When we delete oi always delete the oi->obuf right before. This cleans up a bunch of code to be simpler and hopefully easier to follow. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-23Revert "Ospf missing interface handling 2"Donald Sharp
2019-06-12*: change interface structure, from vrf_id to vrfPhilippe Guibert
Field vrf_id is replaced by the pointer of the struct vrf *. For that all other code referencing to (interface)->vrf_id is replaced. This work should not change the behaviour. It is just a continuation work toward having an interface API handling vrf pointer only. some new generic functions are created in vrf: vrf_to_id, vrf_to_name, a zebra function is also created: zvrf_info_lookup an ospf function is also created: ospf_lookup_by_vrf it is to be noted that now that interface has a vrf pointer, some more optimisations could be thought through all the rest of the code. as example, many structure store the vrf_id. those structures could get the exact vrf structure if inherited from an interface vrf context. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-11lib, ospfd, pimd, zebra: change if_create() api with vrfPhilippe Guibert
if_create() takes as input a vrf poiter instead of the vrf_id parameter. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-01-24Treewide: use ANSI function definitionsRuben Kerkhof
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2018-10-25ospfd: do not remove area structure, while vls are configuredPhilippe Guibert
when adding/removing virtual links per interface, sometimes, the ospf virtual link can not be removed, whereas the associated area is already removed. Do not remove the area while a virtual link is yet configured. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-10-02*: list_delete_and_null() -> list_delete()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-06ospfd: Cleanup some warnings that were not warningsDonald Sharp
1) stream allocation cannot fail 2) some warnings were removed when functions safely ignored the calling parameters being wrong. 3) some warnings were removed when functions did not consider the state as an error since we did not return an error code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-11*: ALLOC calls cannot failDonald Sharp
There is no need to check for failure of a ALLOC call as that any failure to do so will result in a assert happening. So we can safely remove all of this code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-18babeld, lib, ospfd, tests: fmt fixes (cppcheck)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-05-10ospfd: packet fifo init in interface createChirag Shah
Currently, interface packet transmit queue is created/deleted as part of Interface UP/Down event. This results in a rare condition where port came up but queue was not created. The creation of queue occupies only few bytes. Moving fifo queue creation to interface create would add few bytes of fifo creation but at least it guaranteed to be available during Up/down -->Up event. Initialize ospf packet fifo queue during ospf interface creation. Drain queue during interface down event. Drained and free the queue as part of the interface delete/cleanup. Ticket:CM-20744 Testing Done: Bring up ospfv2 topology with multiple neighbors. 1) Trigger multiple shut/no shut events and validate all queues are freed. 2) configure/deconfigure router ospf and validate all ospf instance and interface underneath are freed. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-08ospfd: Treat vrf interface as loopback typeChirag Shah
Ticket:CM-19914 Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-01-20ospfd: show ip ospf neighbor json output formatChirag Shah
Current json output does not differentiate start of neighbor ip object. Adding "neighbors" keyword at the beginning of neighbor list. This is useful when displaying vrf level output along with neighbors list. Ticket:CM-19097 Testing Done: show ip ospf neighbor json show ip ospf vrf all neighbor json Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-23ospfd: reset ospf interface protocol statsChirag Shah
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-10lib: nuke the if_*_by_name_len() functionsRenato Westphal
Make use of strnlen() and strlcpy() so we can get rid of these convoluted if_*_by_name_len() functions. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-05*: Convert list_free usage to list_deleteDonald Sharp
list_free is occassionally being used to delete the list and accidently not deleting all the nodes. We keep running across this usage pattern. Let's remove the temptation and only allow list_delete to handle list deletion. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05*: Convert list_delete(struct list *) to ** to allow nullingDonald Sharp
Convert the list_delete(struct list *) function to use struct list **. This is to allow the list pointer to be nulled. I keep running into uses of this list_delete function where we forget to set the returned pointer to NULL and attempt to use it and then experience a crash, usually after the developer has long since left the building. Let's make the api explicit in it setting the list pointer to null. Cynical Prediction: This code will expose a attempt to use the NULL'ed list pointer in some obscure bit of code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-03ospfd: OSPFv2 VRF remove iflist from masterChirag Shah
Remove instances of ospf master's iflist and use vrf_list with ospf vrf_id. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>