Ronnie Sahlberg [Wed, 15 Aug 2007 04:44:03 +0000 (14:44 +1000)]
call the service specific event scripts directly from the forked child
instead for from /etc/ctdb/events so that we can get better debugging
output in the logs when something fails in the scripts
Ronnie Sahlberg [Wed, 15 Aug 2007 00:01:00 +0000 (10:01 +1000)]
add a wrapper function to create the key used to insert/lookup a certain
tcp connection in the tree that stores the tcp connections to kill by
sending an RST
add a define that specified the keylength instead of hardcoding it as 4
Ronnie Sahlberg [Thu, 9 Aug 2007 04:08:59 +0000 (14:08 +1000)]
change the mem hierarchy for trees. let the node be owned by the data
we store in the tree and use a node destructor so that when the data is
talloc_free()d we also remove the node from the tree.
Ronnie Sahlberg [Wed, 8 Aug 2007 05:09:19 +0000 (15:09 +1000)]
when we want to kill a tcp connection we stored the connection
description (src + dst sockaddr_in) in a linked list.
everytime we receive a captured packet from the network we had to walk
this list in linear time to see if the packet matched a connection we
wanted to RST.
which wouldnt scale very well.
replace the linked list with a redblack tree that is indexed by
src address, src port, dst address, dst port
to make checking whether the packet belongs to a connection we want to
RST very fast and scalable
the reason we need to capture packets when we want to kill a TCP
connection is because we must wait for an ACK coming back from the
remote host so that we can learn which sequence number to use in the
RST.
Most tcp today will ingore any and all RST segments unless the
sequencenumber lies exactly on the right edge of the window to make
spoofing RST a little bit more difficult.
Ronnie Sahlberg [Wed, 8 Aug 2007 01:21:18 +0000 (11:21 +1000)]
add a tree insert function that takes a callback fucntion to populate
the data of the tree.
this callback makes it more convenient to manage cases where one might
want to insert multiple entries into the tree with the same key
rename the tree->tree pointer to tree->root since this is supposed to
point to the root of the tree
Ronnie Sahlberg [Tue, 7 Aug 2007 22:20:46 +0000 (08:20 +1000)]
when inserting data in the tree, if there was already a node with the
same key then replace the data in the node with the new data and return
the pointer to the previous data held in the node.
this allows a caller to avoid having to first check if a node already
exists before inserting a possibly duplicate/colliding entry and lets
the caller do whatever it needs to do after the fact.
Ronnie Sahlberg [Sat, 4 Aug 2007 01:23:04 +0000 (11:23 +1000)]
do not restart lockd/statd when we takeover an ip address this is
overkill since
1, we now kill the tcpconnections for lockd in 60.nfs
2, rpc.statd on linux sends out the notifications using the wrong
interface anyway which breaks a lot of clients including linux !
Ronnie Sahlberg [Mon, 30 Jul 2007 06:10:14 +0000 (16:10 +1000)]
after we have checked dest address that it is a public address
update addr to the source address so the rpintout in the log matches
the client that attached to samba
Ronnie Sahlberg [Wed, 25 Jul 2007 07:53:55 +0000 (17:53 +1000)]
there were situations where we were not guaranteed that a sibling had 2
child nodes which would cause a segv when trying to dereferencing those
two child nodes in order to read their color
Ronnie Sahlberg [Tue, 24 Jul 2007 22:03:58 +0000 (08:03 +1000)]
no need to have a separate assignment of the tcparray pointer followed
by a talloc_steal()
use the returned pointer in talloc_steal as the value to assign
Ronnie Sahlberg [Mon, 23 Jul 2007 21:46:51 +0000 (07:46 +1000)]
when we build the arp structure for sending gratious arp (and tcp
tickles) just talloc_steal the enture tcp_array into the arp
structure instead of copying each of the entries into a linked list
and then releasing the tcparray.
Ronnie Sahlberg [Fri, 20 Jul 2007 09:11:45 +0000 (19:11 +1000)]
set the tcp tickle update flag to true once we have done a takeover and
tickled all connections
othervise the other nodes will still remember this list until next time
we have had a connection/client closing.
Ronnie Sahlberg [Fri, 20 Jul 2007 05:05:55 +0000 (15:05 +1000)]
updated ctdb tickle management
there is an array for each node/public address that contains tcp tickles
we send a TCP_ADD as a broadcast to all nodes when a client is added
if tcp tickles are removed, they are only removed immediately from the
local node.
once every 20 seconds a node will push/broadcast out the tickle list for
all public addresses it manages. this will remove any deleted tickles
from the remote nodes
Ronnie Sahlberg [Sun, 15 Jul 2007 22:28:44 +0000 (08:28 +1000)]
change the way we pick/find a new node to takeover for a failed node
to keep a static that controls at which noide to start searching the
list for takeover candidates next time we need to find a node.
each time we find a node to takeover, reset the start variable to point
to the next node in the list
this makes the distribution of takeover nodes much more even
Ronnie Sahlberg [Fri, 13 Jul 2007 07:07:10 +0000 (17:07 +1000)]
add a private_data field to the killtcp structure and let the system
specific routines populate it as it see fit when creating a
capture socket.
pass this structure to read_tcp and close capture socket as parameter
Ronnie Sahlberg [Wed, 11 Jul 2007 23:22:06 +0000 (09:22 +1000)]
as an optimization for when we want to send multiple tickles at a time
let the caller create the sending socket and use a single socket instead
of one new one for each tickle.
pass a sending socket to ctdb_sys_send_tcp()
ctdb_sys_kill_tcp is not longer used so remove it
set the socketflags for close on exec and nonblocking in the helper that
creates the sockets instead of in the caller
add a helper to create a sending socket to send tickles from
Ronnie Sahlberg [Wed, 11 Jul 2007 22:52:24 +0000 (08:52 +1000)]
rename killtcp->fd to killtcp->capture_fd
we might want to have two sockets attached to the killtcp structure
one for capturing and a second one for sending so we dont have to
create a new socket for each tickle we want to send