Hi,

On Tue, Dec 22, 2009 at 01:16:06PM +0100, Lars Ellenberg wrote:
> On Tue, Dec 22, 2009 at 07:01:54PM +1100, Simon Horman wrote:
> > On Tue, Dec 22, 2009 at 12:43:09AM +0800, Jiaju Zhang wrote:
> 
> 
> I'd add the "borrowed from ctdb.samba.org" (attribution,
> and hint for further maintenance, in case they improve upon
> their code...) and a onliner "this is GPL"
> to the source code, to make it explicit.
> 
> I see that the tickle_ack binary supports ipv6,
> yet:
> 
> > [snip]
> > 
> > > +save_tcp_connections() {
> > > + mydir=$OCF_RESKEY_tickle_dir/`hostname`
> > > + rm -f $mydir/*
> > > + netstat -tn |egrep 
> > > '^tcp[[:space:]]+[0-9]+[[:space:]]+[0-9]+[[:space:]]+[0-9\.]+:[0-9]+.*ESTABLISHED'
> > >  |
> 
> ... you specifically grep only for tcp (ipv4).
> 
> which is correct, since netstat in general truncates ipv6 addresses in
> its output, see e.g.  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=254243
> 
> so maybe add the -W option, if supported by the respective netstat in use,
> and also grep for tcp6 ?

The SUSE distribution has actually the -T (--notrim) option which
seems to serve the same purpose and which has been copied from
CentOS (see https://bugzilla.novell.com/show_bug.cgi?id=530196).

I'd suggest sth like this:

netstat -h 2>&1 | grep -qs notrim && wide_opt="--notrim"
netstat -h 2>&1 | grep -qs wide && wide_opt="--wide"

> > > +         awk '{print $4" "$5}' |
> > > +         while read server client; do
> > > +                 ip=${server%:*}
> > > +                 echo $client $server >> $mydir/$ip
> > > +         done
> > > +}
> > 
> > 
> > Can the filtering being done be egrep be rolled into the awk script?
> 
> It sure can, but it would not necessarily be faster.

I don't have preference for either, but the expression should
perhaps be simplified (tcp.*ESTABLISHED?).

> > > +
> > > +run_tickle_tcp() {
> > > + for f in $OCF_RESKEY_tickle_dir/*/$OCF_RESKEY_ip; do
> > > +         [ -f $f ] && cat $f | while read client server; do
> > > +                 for i in `seq 1 3`; do
> > > +                         $TICKLETCP $client $server
> > > +                 done
> > > +         done
> > > + done    
> > > +}
> > > +
> > 
> > Would it be worth allowing $TICKLETCP to tickle multiple connections
> > in a single invocation - for instance by reading $client $server from stdin?
> > I'm concerned about a situation where there are lots of connections,
> > it might take a while to spawn $TICKLETCP lots of times.
> 
> Yes please.
> That would be a very important improvement.

I guess that would also make a number of packets as option:

[ -f $f ] && cat $f | $TICKLETCP -n 3

> Thank you for stepping forward!

Jiaju, many thanks for the contribution. Any chance to also
implement the suggested improvements?

Cheers,

Dejan

> -- 
> : Lars Ellenberg
> : LINBIT | Your Way to High Availability
> : DRBD/HA support and consulting http://www.linbit.com
> 
> DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to