Go to file
Quentin Young 32d86f8b7a lib: safely check & set thread pointers
When scheduling a thread, the scheduling function returns a pointer to
the struct thread that was placed on one of the scheduling queues in the
associated thread master. This pointer is used to check whether or not
the thread is scheduled, and is passed to thread_cancel() should the
daemon need to cancel that particular task.

The thread_fetch() function is called to retrieve the next thread to
execute. However, when it returns, the aforementioned pointer is not
updated. As a result, in order for the above use cases to work, every
thread handler function must set the associated pointer to NULL. This is
bug prone, and moreover, not thread safe.

This patch changes the thread scheduling functions to return void. If
the caller needs a reference to the scheduled thread, it must pass in a
pointer to store the pointer to the thread struct in. Subsequent calls
to thread_cancel(), thread_cancel_event() or thread_fetch() will result
in that pointer being nulled before return. These operations occur
within the thread_master critical sections.

Overall this should avoid bugs introduced by thread handler funcs
forgetting to null the associated pointer, double-scheduling caused by
overwriting pointers to currently scheduled threads without performing a
nullity check, and the introduction of true kernel threads causing race
conditions within the userspace threading world.

Also removes the return value for thread_execute since it always returns
null...

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:22 +00:00
bgpd *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
debian *: Rename debian.conf -> daemons.conf 2017-05-04 12:45:01 -04:00
doc Merge pull request #454 from dwalton76/hide-router-bgp-peer-ipv4-unicast-commands 2017-05-09 11:54:33 -04:00
eigrpd eigrpd: Switch u_int64_t -> uint64_t 2017-04-26 22:10:33 -04:00
fpm *: Convert libfpm -> libfrrfpm 2017-02-03 08:43:09 -05:00
gdb gdb: Add a directory of files with gdb macros 2016-05-26 15:33:30 +00:00
init build: delete .cvsignore files 2011-12-13 14:27:01 +04:00
isisd *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
ldpd *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
lib lib: safely check & set thread pointers 2017-05-09 20:44:22 +00:00
m4 build: find & use threading library 2017-03-31 17:59:48 +02:00
nhrpd *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
ospf6d *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
ospfclient *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
ospfd *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
pimd *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
pkgsrc eigrp: Initial Commit 2017-03-08 23:07:46 -05:00
ports pimd: merge pimd as of 2015-01-19 2016-05-25 20:38:32 -04:00
qpb Protobuf: Update library name to reflect name change to FRR 2017-01-20 02:59:10 +07:00
redhat *: Rename debian.conf -> daemons.conf 2017-05-04 12:45:01 -04:00
ripd *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
ripngd *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
snapcraft snapcraft: Clean up old no longer used configure flags 2017-04-28 03:11:51 -07:00
solaris Rename: freerangerouting --> frrouting 2017-03-30 14:24:05 -04:00
tests *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
tools Merge pull request #468 from qlyoung/fix-list-perm 2017-05-09 17:54:22 +02:00
vtysh Merge pull request #409 from donaldsharp/EIGRP 2017-05-07 19:48:33 -04:00
watchfrr *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
zebra *: remove THREAD_ON macros, add nullity check 2017-05-09 20:44:19 +00:00
.gitignore *: ignore libtool library anotation files 2017-05-08 17:25:29 +02:00
AUTHORS Initial revision 2002-12-13 20:15:29 +00:00
bootstrap.sh autoreconf -i 2007-02-06 19:28:28 +00:00
buildtest.sh buildtest.sh: Change name from quagga to frr 2017-01-20 00:36:29 +07:00
ChangeLog Rename: freerangerouting --> frrouting 2017-03-30 14:24:05 -04:00
common.am *: Convert libfpm -> libfrrfpm 2017-02-03 08:43:09 -05:00
COMMUNITY.md COMMUNITY.md: update CodingStyle & branching 2017-03-25 10:37:57 +01:00
configure.ac Merge remote-tracking branch 'origin/stable/3.0' 2017-05-08 16:51:21 -04:00
COPYING *: nuke ^L (page feed) 2014-06-04 06:58:02 +02:00
COPYING-LGPLv2.1 build: remove LGPL v2.0, add LGPL v2.1 2016-11-15 17:19:38 +09:00
defaults.h *: Add --enable-datacenter to turn on datacenter defaults 2017-05-04 11:52:45 -04:00
Makefile.am Merge remote-tracking branch 'origin/master' into datacenter 2017-05-08 14:44:25 -04:00
NEWS release: 0.99.24 2016-06-03 15:56:44 -04:00
README *: Clean up some wrong references 2017-04-04 20:18:24 -04:00
README.NetBSD build: remove $Format tags 2016-12-20 17:54:03 +01:00
render_md.py build: number sections in COMMUNITY.md HTML 2016-12-05 19:08:00 +01:00
REPORTING-BUGS Rename: freerangerouting --> frrouting 2017-03-30 14:24:05 -04:00
SERVICES nhrpd: implement next hop resolution protocol 2017-03-07 16:20:29 +01:00
stamp-h.in Initial revision 2002-12-13 20:15:29 +00:00
update-autotools * README.NetBSD: use update-autotools instead of autoreconf 2007-02-02 16:52:38 +00:00

FRRouting is free software that manages various IPv4 and IPv6 routing
protocols.

Currently FRRouting supports BGP4, BGP4+, OSPFv2, OSPFv3, RIPv1,
RIPv2, RIPng, PIM-SM/MSDP and LDP as well as very early support for IS-IS.

See the file REPORTING-BUGS to report bugs.

Free RRRouting is free software. See the file COPYING for copying conditions.

Public email discussion can be found at https://lists.frrouting.org/listinfo

Our public slack channel is at https://frrouting.slack.com