From owner-freebsd-net@FreeBSD.ORG Mon May 6 13:15:13 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1FA6E601; Mon, 6 May 2013 13:15:13 +0000 (UTC) (envelope-from realrichardsharpe@gmail.com) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) by mx1.freebsd.org (Postfix) with ESMTP id 88B14311; Mon, 6 May 2013 13:15:12 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id hm14so2525957wib.5 for ; Mon, 06 May 2013 06:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=w/xcEf2NfdALhYEKgX5VMynyYjlKbWN0h/8DyYw4EjU=; b=tgB2Ph9W5UC1PDz1HGFNNkfZAYluSaSy5zIeD2ud4NQl2t8zXjitUrrwJNuBYZNwaZ 9PtSk9bb9w6EaAnJhYuLkouf9AS6kp8hqD5GNlmX72aT23ymiHxNKrkbXbrV1hwFQVuZ VYSNkDB8RdPoGHFXwuodpeL8ng1HhSO7S6xg25aIZGG8skzVy8lV8frxX3MpEtm7gYOw DmNedTc0rYdGr3Wqmd9llxa9455+uyr9DOzDK6u3TWynQUM4Ai5ZVHq5UgRrcL3qlCW8 o4M+bP6KAkzNdhQ+JEQbo/4cHFYhiYcdJQQ61SgGR+gP9oMEGvF9mjJSIbmi/D5eEhmt DegQ== MIME-Version: 1.0 X-Received: by 10.195.13.75 with SMTP id ew11mr12703413wjd.25.1367846111321; Mon, 06 May 2013 06:15:11 -0700 (PDT) Received: by 10.194.179.194 with HTTP; Mon, 6 May 2013 06:15:11 -0700 (PDT) In-Reply-To: <20130506082235.GV15182@FreeBSD.org> References: <20130506082235.GV15182@FreeBSD.org> Date: Mon, 6 May 2013 06:15:11 -0700 Message-ID: Subject: Re: TCP_KEEPIDLE vs TCPTV_KEEP_IDLE From: Richard Sharpe To: Gleb Smirnoff Content-Type: text/plain; charset=Big5 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 May 2013 13:15:13 -0000 On Mon, May 6, 2013 at 1:22 AM, Gleb Smirnoff wrote: > On Sun, May 05, 2013 at 09:40:42AM -0700, Richard Sharpe wrote: > R> Samba currently has a way to set socket parameters from the smb.conf. > R> > R> This works fine for things like SO_SNDBUF etc, but not so well for the > R> TCP KeepAlive parameters. > R> > R> In this area Samba has a Linux bias. > R> > R> I am looking at adding support for this under FreeBSD. > R> > R> The simplest way, it seems to me, is to enhance configure to find the > R> appropriate symbols under FreeBSD (and it might be extendable to > R> NetBSD etc) and then map them to the Linux symbols: > R> > R> #ifdef THIS_IS_SOME_SORT_OF_BSD > R> #define TCP_KEEPIDLE TCPTV_KEEP_IDLE > R> #endif > R> > R> However, that does mean that *BSD types would have to know that this > R> happening because the names you would use in the smb.conf file would > R> be Linux-specific, and documentation is often woefully incomplete. > R> > R> Is there a better method? > > I don't see the problem you are describing. AFAIK, these socket options > have same names in FreeBSD and Linux. > > For example in Samba 3.6.14 sources it just checks for value defined > and if defined compiles support in. See source3/lib/util_sock.c: Yes, I know that. However, when I do a find and grep over /usr/include looking for files where TCP_KEEPIDLE is defined, I find nothing. When I do the same for TCPTV_KEEP_IDLE I find /usr/include/netinet/tcp_timer.h. This seems to mean that the symbols Samba is using are not defined on FreeB= SD. These appear to be the symbols defined in FreeBSD 8,0: * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of = time, * is established, if the connection is idle for TCPTV_KEEP_IDLE time #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 */ Then, a strings over the smbd produced in one of my recent builds fails to turn up TCP_KEEP*, supporting my contention that the TCP_KEEP* versions of the symbols are not defined. So, at this stage I am terribly confused. > #ifdef TCP_KEEPCNT > {"TCP_KEEPCNT", IPPROTO_TCP, TCP_KEEPCNT, 0, OPT_INT}, > #endif > #ifdef TCP_KEEPIDLE > {"TCP_KEEPIDLE", IPPROTO_TCP, TCP_KEEPIDLE, 0, OPT_INT}, > #endif > #ifdef TCP_KEEPINTVL > {"TCP_KEEPINTVL", IPPROTO_TCP, TCP_KEEPINTVL, 0, OPT_INT}, > #endif > > P.S. > Since you mention TCPTV_KEEP_IDLE, I've tried to grep samba sources > for this definition getting zero results. > > -- > Totus tuus, Glebius. --=20 Regards, Richard Sharpe (=A6=F3=A5H=B8=D1=BC~=A1H=B0=DF=A6=B3=A7=F9=B1d=A1C--=B1=E4=BE=DE)