Connection timeouts under SMB2 and Samba 3.6.12

Richard Sharpe realrichardsharpe at gmail.com
Mon May 6 07:47:01 MDT 2013


On Sun, May 5, 2013 at 11:39 AM, Richard Sharpe
<realrichardsharpe at gmail.com> wrote:
> On Sun, May 5, 2013 at 9:27 AM, Richard Sharpe
> <realrichardsharpe at gmail.com> wrote:
>> On Sat, May 4, 2013 at 11:05 PM, Volker Lendecke
>> <Volker.Lendecke at sernet.de> wrote:
>>> On Sat, May 04, 2013 at 08:46:16PM -0700, Richard Sharpe wrote:
>>>> Hi folks,
>>>>
>>>> We are seeing smbds hanging around for a long time after the client
>>>> has rebooted. The timeout on the receive is around 1900 seconds.
>>>>
>>>> Has anyone used TCP-level keep-alives to reap smbds for clients that
>>>> have rebooted?
>>>
>>> Yes, sure. Under Linux, it's the TCP_KEEP* options.
>>
>> These appear to be the constants under FreeBSD:
>>
>> #define TCPTV_KEEP_INIT ( 75*hz)                /* initial connect keepalive */
>> #define TCPTV_KEEP_IDLE (120*60*hz)             /* dflt time before probing */
>> #define TCPTV_KEEPINTVL ( 75*hz)                /* default probe interval */
>> #define TCPTV_KEEPCNT   8                       /* max probes before drop */
>>
>> There seems to be no support for these under Samba, but the simplest
>> way to support them would be to map the Samba defined ones to these at
>> the constant level. Eg,
>>
>> #ifdef _FREEBSD_ /* or whatever */
>> #define TCP_KEEPINTVL TCPTV_KEEPINTVL
>> #endif
>>
>> On the other hand, configure should probably search for these as well
>> and add the remappings to config.h.
>
> This would appear to work, although we will get conflicting entries if
> both sets are defined for any reason:
>
> diff --git a/lib/util/util_net.c b/lib/util/util_net.c
> index 83afda4..f6a46a9 100644
> --- a/lib/util/util_net.c
> +++ b/lib/util/util_net.c
> @@ -778,12 +778,21 @@ static const smb_socket_option socket_options[] = {
>  #ifdef TCP_KEEPCNT
>    {"TCP_KEEPCNT", IPPROTO_TCP, TCP_KEEPCNT, 0, OPT_INT},
>  #endif
> +#ifdef TCPTV_KEEPCNT
> +  {"TCP_KEEPCNT", IPPROTO_TCP, TCPTV_KEEPCNT, 0, OPT_INT},
> +#endif
>  #ifdef TCP_KEEPIDLE
>    {"TCP_KEEPIDLE", IPPROTO_TCP, TCP_KEEPIDLE, 0, OPT_INT},
>  #endif
> +#ifdef TCPTV_KEEP_IDLE
> +  {"TCP_KEEPIDLE", IPPROTO_TCP, TCPTV_KEEP_IDLE, 0, OPT_INT},
> +#endif
>  #ifdef TCP_KEEPINTVL
>    {"TCP_KEEPINTVL", IPPROTO_TCP, TCP_KEEPINTVL, 0, OPT_INT},
>  #endif
> +#ifdef TCPTV_KEEPINTVL
> +  {"TCP_KEEPINTVL", IPPROTO_TCP, TCPTV_KEEPINVTL, 0, OPT_INT},
> +#endif
>  #ifdef IPTOS_LOWDELAY
>    {"IPTOS_LOWDELAY", IPPROTO_IP, IP_TOS, IPTOS_LOWDELAY, OPT_ON},
>  #endif

OK, ignore all this. In FreeBSD 9.1 (and maybe earlier, I dunno) these
symbols have the same names as in Linux.

In FreeBSD 8.0, where I currently work, the kernel does not support
these socket options.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list