summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_neighbor.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ospfd: rework BFD integrationRafael Zalamena2021-03-231-3/+5
| | | | | | Use new BFD API to integrate with OSPFv2. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* ospfd: replace inet_ntoaMark Stapp2020-10-221-9/+8
| | | | | | Stop using inet_ntoa, use %pI4 etc or inet_ntop instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: Create/Use accessor functions for lock countDonald Sharp2020-10-171-1/+2
| | | | | | | | Create appropriate accessor functions for the rn->lock data. We should be accessing this data through accessor functions since it is private data to the data structure. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ospfd: ospf GR helper initializationrgirada2020-09-221-0/+11
| | | | | | | | Description: 1. Graceful restart helper init/de-init. 2. Defining dedicated memory for helper. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
* ospfd: nbr->oi is never nullDonald Sharp2019-11-221-1/+3
| | | | | | | | | | We test nbr->oi in a couple of places for null, but in the majority of places of the nbr->oi data is being used we just access it. Touch up code to trust this assertion and make the code more consistent in others. Found in Coverity. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd,eigrpd: don't take address of packed struct memberMark Stapp2019-11-111-1/+3
| | | | | | | | Use a local variable to avoid trying to take the address of a packed struct member - an address from the ip header in these cases. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: style for flog_warn conversionsQuentin Young2018-09-061-2/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* ospfd: Fix warn -> debug for neighbor addDonald Sharp2018-09-061-3/+4
| | | | | | | | If we detect we already have a neighbor, no need to re-add so no need to warn since we do not do anything with the data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-5/+5
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* ospfd: Fix conflict router-id, memory leaksChirag Shah2017-08-111-1/+2
| | | | | | | | | | | Remove assert in path of router_id_update: Upon configuring same router-id as neighbor's assert would cause a crash. Log a warning message and neighborship would not come up. Address memory leaks Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-2/+3
| | | | | | | | | This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindent pt. 2whitespace / reindent2017-07-171-3/+2
| | | | | | | | w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-383/+358
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-5/+4
| | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ospfd: Remove HAVE_OPAQUE_LSADonald Sharp2016-08-161-2/+0
| | | | | | | | | HAVE_OPAQUE_LSA is used by default and you have to actively turn it off except that OPAQUE_LSA is an industry standard and used pretty much everywhere. There is no need to have special #defines for this anymore. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit 36fef5708d074a3ef41f34d324c309c45bae119b)
* ospfd: Ensure correct handling of router-id changevivek2016-07-201-4/+4
| | | | | | | | | | | | | | | | | | | | | Upon router-id change, one object that needs to be updated is the "nbr_self" structure that is created to contain information about the local router and is used during DR election, among other things. In the past, the code used to just change the router-id field of this structure. This is actually not sufficient - the neighbor has to be deleted and re-added into the tree. This was fixed upstream and the fix is now available in our tree, but those changes don't work well with prior Cumulus changes to defer updating the router-id in the OSPF instance until other cleanup has happened. Fixed code to update the "nbr_self" structure correctly while continuing to defer the router_id update in the OSPF structure. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-11861 Reviewed By: CCR-4980 Testing Done: Manual, failed test
* ospfd: Fix oi->nbr_self pointer dereferenceDonald Sharp2016-06-101-0/+3
| | | | | | | | | | With commit 1b31375427008aaf980f68d95f50007f600c8ae1 we have a situation where it is possible that the oi->nbr_self has not been properly set. When calling the function that sets the nbr_self data make sure that we have a pointer that works for it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: fix - correct neighbor index on changing/p2p/virtual linksJafar Al-Gharaibeh2016-06-101-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ospfd keeps a list of neighbor routers for each configured interface. This list is indexed using the neighbor router id in case of point-to-point and virtual link types, otherwise the list is indexed using the neighbor's source IP (RFC 2328, page 96). The router adds itself as a "pseudo" neighbor on each link, and also keeps a pointer called (nbr_self) to the neighbor structure. This takes place when the interface is first configured. Currently ospfd adds this pseudo neighbor before the link parameters are fully configure, including whether the link type is point-to-point or virtual link. This causes the pseudo neighbor to be always indexed using the source IP address regardless of th link type. For point-to-point and virtual links, this causes the lookup for the pseudo neighbor to always fail because the lookup is done using the router id whereas the neighbor was added using its source IP address. This becomes really problematic if there is a state change that requires a rebuild of nbr_self, changing the router id for example. When resetting nbr_self, the router first tries to remove the pseudo neighbor form its neighbor list on each link by looking it up and resetting any references to it before freeing the neighbor structure. since the lookup fails to retrieve any references in the case of point-to-point and virtual links the neighbor structure is freed leaving dangling references to it. Any access to the neighbor list after that is bound to stumble over this dangling pointer causing ospfd to crash. Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com> Tested-by: NetDEF CI System <cisystem@netdef.org> (cherry picked from commit bb01bdd740339b0c07d8ed0786811801b2a79192)
* ospfd: PointToPoint neighbors are identified by router IDJoakim Tjernlund2016-05-261-8/+11
| | | | | | | | According to RFC 2328, section 10.5 PointToPoint neighbors should be identified by router ID instead of source IP address. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> (cherry picked from commit 5c1791f28e2e831e4e9b92c3c2f7d8ed832cb968)
* ospfd: Fix bug in 94266fa822ba, nbr_self rebuild didn't add valid nbr_selfPaul Jakma2016-05-261-0/+9
| | | | | | | | | | | | | | * 94266fa822ba "ospfd: Self nbrs needs to be rebuilt when router ID changes." deleted the nbr_self, and added it back, but ospf_nbr_add_self doesn't actually create the nbr_self - it assumes it's already there. Leading to use after free and crashes after a router-id change. * ospfd/ospf_neighbor.{c,h}: (ospf_nbr_self_reset) Little helper to reset the nbr_self correctly. * ospf_interface.c: (ospf_if_cleanup) moved code to ospf_nbr_self_reset * ospfd.c: (ospf_router_id_update) Use ospf_nbr_self_reset instead of doing the reset badly, fixing 94266fa822ba. (cherry picked from commit c920e510d09c6c4ab63a3da5375009442a950f82)
* Support of BFD status in Quaggaradhika2015-08-311-0/+4
| | | | | | | | | | | | | | | | Ticket:CM-6802, CM-6952 Reviewed By: Donald, Kanna Testing Done: Double commit of b76943235e09472ec174edcf7204fc82d27fe966 from br2.5. But, manually resolved all the compilation errors. Also, modified the shows to support the json format which was not supported in br2.5. CM-6802 – Currently, BFD session status can be monitored only through ptmctl. There is no way to check the BFD status of a peer/neighbor through Quagga. Debugging becomes easier if BFD status is shown in Quagga too. BFD status is relevant when it is shown against the BGP peer/OSPF neighbor. For, this following code changes have been done: - Only down messages from PTM were being propagated from Zebra daemon to clients (bgpd, ospfd and ospf6d). Now, both up and down messages are redistributed to the clients from zebra. BFD status field has been added to the messaging. Handling of BFD session up messages has been added to the client code. BGP/OSPF neighbor is brought down only if the old BFD session status is ‘Up’ to handle extra/initial down messages. - BFD status and last update timestamp fields have been added to the common BFD info structure. Also, common show functions for showing BFD information have been added to BFD lib. - Modified the BGP neighbor show functions to call common BFD lib functions. - For ospf and ospf6, BFD information was maintained only at interface level. To show BFD status per neighbor, BFD information has been added at neighbor level too. “show ip ospf interface”, “show ip ospf neighbor detail”, “show ipv6 ospf6 interface” and “show ipv6 ospf6 neighbor detail” output have been modified to show BFD information. CM-6952 - IBGP peers were always assumed to be multi-hop since there was no easy way to determine whether an IBGP peer was single hop or multihop unlike EBGP. But, this is causing problem with IBGP link local peers since BFD doesn't allow multihop BFD session with link local IP addresses. Link local peers were discovered when the interface peering was enabled. Interface peering is always singlehop. So, added checks to treat all interface based peers as single hop irrespective of whether the peer is IBGP or EBGP.
* [cleanup] Convert XMALLOC/memset to XCALLOCStephen Hemminger2009-06-121-2/+1
| | | | Simple conversion of XMALLOC/memset to XCALLOC
* [ospfd] Fix virtual-link handling in nbrs route-table, exposed by bug#234 fixPaul Jakma2006-04-031-26/+48
| | | | | | | | | | | | | | | | | | | 2006-04-03 Paul Jakma <paul.jakma@sun.com> * (general) Fix issues with handling of Vlinks and entries in the nbrs route-table which were highlighted by the nsm/nbr_self fixes from bug #234. Many thanks to Juergen Kammer for his help and efforts in testing out debug patches to pinpoint the issue. * ospf_interface.c: (ospf_vl_new) Add nbr_self for Vlink. * ospf_neighbor.c: (ospf_nbr_key) new static function, helper to create key in nbrs table for a given nbr. (ospf_nbr_delete) Use ospf_nbr_key. Add an assert() to document an expected state. (ospf_nbr_add_self) Ditto. (ospf_nbr_lookup_by_addr) Add an assert. * ospf_nsm.c: (nsm_kill_nbr) Can never kill the nbr_self psuedo-neighbour.
* [ospfd] Bug #234. Fix nbr_self reinitialisation after down/up.paul2006-01-111-0/+21
| | | | | | | | | | | | | | | | | 2006-01-10 Len Sorensen <lennartsorensen@ruggedcom.com> * (general) Bug #234, see also [quagga-dev 3902]. Fix problem with nbr_self not being properly reinitialised when an interface comes up, after having been down. Some re-arrangement done by Paul Jakma, any bugs introduced on top of Len's suggested changes are his. * ospf_neighbor.c: (ospf_nbr_add_self) centralise initialisation of nbr_self parameters here. * ospf_interface.c: (ospf_if_new) deleting initialisation of parameters of nbr_self, just rely on call to ospf_nbr_add_self. (ospf_if_cleanup) ditto. * ospfd.c: (ospf_network_run) ditto.
* 2005-05-06 Paul Jakma <paul.jakma@sun.com>paul2005-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * (general) extern and static qualifiers added. unspecified arguments in definitions fixed, typically they should be 'void'. function casts added for callbacks. Guards added to headers which lacked them. Proper headers included rather than relying on incomplete definitions. gcc noreturn function attribute where appropriate. * ospf_opaque.c: remove the private definition of ospf_lsa's ospf_lsa_refresh_delay. * ospf_lsa.h: export ospf_lsa_refresh_delay * ospf_packet.c: (ospf_make_md5_digest) make *auth_key const, correct thing to do - removes need for the casts later. * ospf_vty.c: Use vty.h's VTY_GET_INTEGER rather than ospf_vty's home-brewed versions, shuts up several warnings. * ospf_vty.h: remove VTY_GET_UINT32. VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX moved to lib/vty.h. * ospf_zebra.c: (ospf_distribute_list_update_timer) hacky overloading of the THREAD_ARG pointer should at least use uintptr_t.
* 2005-04-07 Paul Jakma <paul.jakma@sun.com>paul2005-04-071-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * (global): Fix up list loops to match changes in lib/linklist, and some basic auditing of usage. * configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES * HACKING: Add notes about deprecating interfaces and commands. * lib/linklist.h: Add usage comments. Rename getdata macro to listgetdata. Rename nextnode to listnextnode and fix its odd behaviour to be less dangerous. Make listgetdata macro assert node is not null, NULL list entries should be bug condition. ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use with for loop, Suggested by Jim Carlson of Sun. Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the "safety" of previous macro. LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to distinguish from the similarly named functions, and reflect their effect better. Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section with the old defines which were modified above, for backwards compatibility - guarded to prevent Quagga using it.. * lib/linklist.c: fix up for linklist.h changes. * ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single scan of the area list, rather than scanning all areas first for INTER_ROUTER and then again for INTER_NETWORK. According to 16.2, the scan should be area specific anyway, and further ospf6d does not seem to implement 16.3 anyway.
* 2004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-12-081-2/+2
| | | | * *.c: Change level of debug messages to LOG_DEBUG.
* Remove usage of evil list and listnode typedefs.hasso2004-09-231-2/+2
|
* 2004-05-05 Paul Jakma <paul@dishone.st>paul2004-05-051-0/+105
| | | | | | | | | | | | | | | * ospf_packet.c: (ospf_associate_packet_vl) cleanup, move some of the checks up to ospf_read, return either a virtual link oi, or NULL. (ospf_read) Cleanup, make it responsible for checks. Remove the nbr lookup - moved to ospf_neighbor. Adjust all nbr lookups to use new wrappers exported by ospf_neighbor. * ospf_neighbor.h: Add ospf_neigbour_get and ospf_nbr_lookup. * ospf_neighbor.c: (ospf_neigbour_get) Index ospf_interface neighbour table by router-id for virtual-link ospf_interfaces, not by peer_addr (which breaks for asymmetric vlinks) (ospf_nbr_lookup) add a wrapper for nbr lookups to deal with above.
* 2003-03-25 Paul Jakma <paul@dishone.st>paul2003-03-251-23/+13
| | | | | | | | * sync to latest zebra CVS * spec file: updated and added define for ospf-api/client NB: OSPF-API has been broken by the zebra.org changes, which has added struct ospf * as a new arg to many functions
* From endo@suri.co.jp Fri Jan 17 23:36:30 2003paul2003-01-181-0/+329
Date: Fri, 20 Dec 2002 17:58:43 +0900 From: Masahiko Endo <endo@suri.co.jp> Reply-To: zebra@zebra.org To: zebra@zebra.org Cc: kunihiro@zebra.org Subject: [zebra 16824] [PATCH] nsm_kill_neighbor [ The following text is in the "ISO-2022-JP" character set. ] [ Your display is set for the "ISO-8859-1" character set. ] [ Some characters may be displayed incorrectly. ] Hi Ishiguro-san, Here is my problem analysis against the case that the ospfd crashes when an interface is brought down. When the ospfd receives a ZEBRA message "ZEBRA_INTERFACE_DOWN" from zebra daemon, the ospfd performs bunch of ospf-interface cleanup for the notified zebra-interface. There are cases that neighbor instance "nbr", which will be removed afterward, may scheduled in the NSM thread event queue. And when the NSM event thread is fired, dereference for this already freed "nbr" pointer causes SIGSEGV. Please take a look at following timeline of processing sequences.