[Devel] tcp keepalive question

Klaus Darilion klaus.mailinglists at pernau.at
Mon Dec 18 00:21:11 CET 2006


On Fri, December 15, 2006 19:31, Juha Heinanen said:
> in case registrar module tcp_persistent_flag is set, openser keeps tcp
> connection open to the registered UA for the duration of the
> registration by setting lifetime of tcp connection to suitable value.
> does this mean that the such connection remains idle and that no tcp
> keepalive probes are send to the the registered phone?
>
> if there are no keepalives isn't there possibility that nat binding from
> tcp UA will expire and requests to the UA will fail?

this will happen if there is no keep-alive.

> looking at tcp(7) man page, there are tcp socket related variables such
> as:
>
>       tcp_keepalive_intvl (integer; default: 75)
>               The number of seconds between TCP keep-alive probes.
>
>        tcp_keepalive_probes (integer; default: 9)
>               The  maximum number of TCP keep-alive probes to send before
> giv-
>               ing up and killing the connection if  no  response  is
> obtained
>               from the other end.
>
>        tcp_keepalive_time (integer; default: 7200)
>               The  number  of seconds a connection needs to be idle before
> TCP
>               begins sending out keep-alive probes.  Keep-alives are only
> sent
>               when  the  SO_KEEPALIVE  socket  option is enabled.  The
> default
>               value is 7200 seconds (2 hours).  An idle connection  is
> termi-
>               nated  after approximately an additional 11 minutes (9
> probes an
>               interval of 75 seconds apart) when keep-alive is enabled.

I think there was a discussion on sip-implementors discussing this topic
and the conclusion was, that this is different an every OS and often not
configurable (or least only per system, not per application/connection).
Thus it is to unreliable.

> i didn't find openser tcp source code using them, however.  is there
> some other strategy in place for keeping nat bindings open to tcp UAs?

If the client sends keep-alive (like eyebeam) there wont be a problem. IMO
a client should do this. Of course there should be also an option at the
server.

One workaround would be to set expire to small values forcing keep-alive
with REGISTER.

I wonder if the keep-alive from nathelper module can be used to send keep
alive (CRLF or OPTIONS). I have not tested it yet - maybe it already
works. IMO there is no reason why the UDP mechanisms should not work with
TCP/TLS too.

regards
klaus




More information about the Devel mailing list