From owner-freebsd-net@freebsd.org Fri Mar 1 23:35:22 2019 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D1481505CFC for ; Fri, 1 Mar 2019 23:35:22 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670055.outbound.protection.outlook.com [40.107.67.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C9656680FE; Fri, 1 Mar 2019 23:35:19 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from QB1PR01MB3537.CANPRD01.PROD.OUTLOOK.COM (52.132.89.15) by QB1PR01MB3554.CANPRD01.PROD.OUTLOOK.COM (52.132.89.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.16; Fri, 1 Mar 2019 23:35:13 +0000 Received: from QB1PR01MB3537.CANPRD01.PROD.OUTLOOK.COM ([fe80::609b:1ecd:c908:d44c]) by QB1PR01MB3537.CANPRD01.PROD.OUTLOOK.COM ([fe80::609b:1ecd:c908:d44c%6]) with mapi id 15.20.1643.022; Fri, 1 Mar 2019 23:35:13 +0000 From: Rick Macklem To: "Rodney W. Grimes" CC: "Bjoern A. Zeeb" , FreeBSD Net , "rgrimes@freebsd.org" , "hrs@freebsd.org" Subject: Re: use of #ifdef INET and #ifdef INET6 in the kernel sources Thread-Topic: use of #ifdef INET and #ifdef INET6 in the kernel sources Thread-Index: AQHUzwGwHmKnVmR//0yzd/zC2ycfBaX0bvqAgAGlN+2AAJ/pAIAAuLZy Date: Fri, 1 Mar 2019 23:35:13 +0000 Message-ID: References: , <201903011219.x21CJkIE061223@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201903011219.x21CJkIE061223@pdx.rh.CN85.dnsmgr.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f077d027-1b0e-49a3-14e0-08d69e9e8d76 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:QB1PR01MB3554; x-ms-traffictypediagnostic: QB1PR01MB3554: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; QB1PR01MB3554; 23:FjOrvg/Bn36zAZCliuJZ/uMS9DElLbnDrFKHeMf?= =?iso-8859-1?Q?RLxzsLYBVwYpooHmYjz3mtbydpe7ajJZNWdced1cYYGwus5CmHUIqiPzIy?= =?iso-8859-1?Q?6HZ/BhOrcnUWO7c0sxXOf70qkkmA3WWZkdnGLuBmZ/YvvSPu51rDZP5DQo?= =?iso-8859-1?Q?5Z9vKLdst5HCSz/DU1cKwGcxr+uv7OkOQLteKAtgCggGzymVWcDPennz94?= =?iso-8859-1?Q?U7sONV8N616/bVsrnSbeeG0IDmmh1YUtylJyX+2oNSuAYiF/BjeeFst0po?= =?iso-8859-1?Q?xrw6LHZNaKbnzjLXSgEHLitYJJcOWv6UPAv8MXX5EWe+LojvmJXhzs0oib?= =?iso-8859-1?Q?9vCWULE/w1xN/KgB1yHtqvpxtbU+7aUPoprJwHY4MoY7+qnmxqx1JsaSgm?= =?iso-8859-1?Q?lxF91Qnyam7L7GaVGdLAtZNjaGjMJZO9OXaCMMEVDzB/iEpxLYgPCnkZYe?= =?iso-8859-1?Q?yqqo8IpO8BELQVfgncvUM77J4eixEPwc/0bd6y8Nx0FJdqfnv/Wl0AcB01?= =?iso-8859-1?Q?LPAiN6qU8qqZ6pX83UMRTNPVmBeLFwWqiFf/pDgMM5QFPscL8g5Nww9C/m?= =?iso-8859-1?Q?nKCD8U/F547T5+Ie17RL327MpGpfhak1qGcHDjaGzpUc0yGxBtj9BJo35J?= =?iso-8859-1?Q?wqG6ee+sF2rKtFHNYX4a33h25hW+LHaqFLqqYpNeriI8dUAmcwSoKYjDCD?= =?iso-8859-1?Q?OV9o57z9hzQ6OTBMMFW2NH3wNSmyaLaunDw0e2n7x8bLkb3fMXLUozE/Zr?= =?iso-8859-1?Q?8LYZ4e58t4lsOXEdvoBtvo9fU8jWZhpdKz+40ORVX+DD5pdiLn+Db2YOvh?= =?iso-8859-1?Q?mntrtsKvJ/4Sf1pFhJGT9Z43W+NpBVdqYbPa0NPzzQw1BH3WvyPkXwkk5T?= =?iso-8859-1?Q?SZN6J4INIonKlxBJhtG2rlqgaHrrEXeSnEmAvchm7YrHgGkPhpN2lN2fOD?= =?iso-8859-1?Q?x1qS9fRpgkXe5GIB2e63+iH8jHz+zoD9i7Ur9HvxZDAWqD7mnTDXc6YKlw?= =?iso-8859-1?Q?ZCY+uVfYpzX6PJTNiBTKd0R6uLHk+MFFAPkFbiX3nUUi9aYkE4QpvuL+zg?= =?iso-8859-1?Q?rGVlruaXfS+ro5b0CPBGW+dX+ppYxIc+pcgPf5m0/qAgoiyuQJiBgtqzBU?= =?iso-8859-1?Q?gwy/zkF4UM5ZkoPVb8mi0WpmzTqCjo99SsaAq45ljvjdWZEnMS8Nx8OPQn?= =?iso-8859-1?Q?2i3gTDaRlG75b+fI3HOMJu5vZkQwCBlLN1VQwv5HNkwWSUOp1ZmsL0=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09634B1196 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(396003)(346002)(366004)(136003)(199004)(189003)(174864002)(68736007)(81156014)(102836004)(81166006)(97736004)(8676002)(26005)(316002)(786003)(105586002)(11346002)(33656002)(446003)(99286004)(186003)(76176011)(106356001)(54906003)(7696005)(486006)(74482002)(6506007)(74316002)(6916009)(8936002)(476003)(71190400001)(71200400001)(478600001)(4326008)(55016002)(6436002)(2906002)(229853002)(14444005)(6246003)(9686003)(256004)(53936002)(305945005)(14454004)(86362001)(25786009)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:QB1PR01MB3554; H:QB1PR01MB3537.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: yNzawJv7pW/X1+9Fz6S9nuxJDLV87hYCVatALxWGziJ1c29StINECLEyPm9hsW2j4YfUtGeUnxC6SqpPfk/FrBrMOGYuU7KTQ/f9hOcZw9//NtjobJKT8e5uXWyvq+nL/sBJy0A/44kBondeeEmBXh/0ZVxI26NC80QNTvRQWdbm2AdxWGEILOnjX1Sn92WYqx8WVYRL2NxzSETvDxXU23EbYjmQQJIJDaM1dC9paTE5YvDlG5/W7LwHoPWddV2eJDtSAgpI4auVkngIrhMJwaMWMrRGVupeJ2K0mRGD1GmzH27ZXvwcaTV5bzCLz0ebNl24bn+osqBhTxt4cSb3SWSnCC6F2Po6h+CuElKM/NZLRcKHhz7B8yBS3+rEvASEPrWt+aX3ZPaP7Z8OhNBXUg+3sc0sVDX99eWgteXlrxg= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: f077d027-1b0e-49a3-14e0-08d69e9e8d76 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 23:35:13.3720 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: QB1PR01MB3554 X-Rspamd-Queue-Id: C9656680FE X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.67.55 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-0.84 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.35)[-0.347,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; NEURAL_HAM_LONG(-0.93)[-0.935,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[uoguelph.ca]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.75)[0.752,0]; MX_GOOD(-0.01)[cached: mx2.hc184-76.ca.iphmx.com]; RCVD_IN_DNSWL_NONE(0.00)[55.67.107.40.list.dnswl.org : 127.0.3.0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Mar 2019 23:35:22 -0000 Rodney W. Grimes wrote: >Rick Macklem wrote: >> I doubt NFS gets squeezed into such devices and, yes, it is a small amou= nt. >> Using source line counts via "wc" (ir includes comments, etc): >> - This will reduce the # of lines by about 6 for a module of about 7700 = lines >> which is loaded when either the nfscl or nfsserver modules are loaded= . >> (These are both about 25000 lines and require the krpc, which is anot= her 10000. >> I haven't included the Kerberos stuff, because I can't remember if = that gets loaded >> unless Kerberos mounts get used.) >> --> A savings of 6 lines in something like 43000. > >That means that nfsusrd is an extremly well behaved ipv4/ipv6 >agnostic deamon that only takes a small change to make it able >to run as either v4/v6 as a single stack or dual stacked, at a cost >that also sounds minial, even if it took an #ifdef for each of these >lines that is only 6 in 43000 lines of code, which is a small cost. Just fyi, the above referred to the kernel changes and not nfsuserd.c, but = it doesn't really matter. I accept the argument that it documents where INET and INET6 code is . >The same analysis on other code probably comes out no place near >this. > >Also didnt this use to use a unix domain? Could the unix domain >be put back and knobbed so that I could actually run this without >it doing the localnet thing at all? I know that it had issues >as the socket is in /tmp and if /tmp isnt a right type file system, >etc... But some of us do know that and do run with a /tmp that >would support AF_UNIX type nfsusrd. > >If it takes 6 lines of ifdef to do v4 vs v6, how many lines of >ifdef is it to add AF_UNIX back and make it run time choice? > >(Goes looking for more Nomex clothing :-) The AF_LOCAL code was in head for a short period of time before a vnode loc= k panic() issue was reported and I reverted the patch. Here is the commit log message for that reversion: PR#230752 shows a panic where an nfsd thread tries to do soconnect() on the AF_LOCAL socket used by the nfsuserd while already holding an exclusive lock on it. I am not 100% sure how this happens, but since an AF_LOCAL socket is in the file system namespace it is conceivable that it could lock it and then attempt an upcall to the nfsuserd. However, reverting r320757 stops the nfsuserd from using an AF_LOCAL socket, so it should avoid any such panic(). r320757 did fix a problem with running the nfsuserd when jails were enabled, but that can be dealt with less elegantly by allowing the use of an alternate address instead of 127.0.0.1. The gssd daemon also uses an AF_LOCAL socket, but it will do upcalls before the nfsd thread processes the RPC, so I think it should not be suseptible to this problem. As you can see from the above, I wasn't 100% sure what caused the vnode loc= k panic(). It might only occur for the AF_LOCAL socket being on an NFS mount, but I am= not sure. I also don't like the idea of code that depends on the kind of underlying f= ile system to function correctly. (The VFS/VOP interface is meant to make "type of file s= ystem" transparent to userland as far as possible, as I see it.) So, I don't feel comfortable with enabling AF_LOCAL for certain file system= types, since I know using an INET/INET6 socket address avoids the problem. I could make an argument for some other "namespace" for local sockets other= than the file system directory structure, but that sounds like way too much work= for me... rick ps: I think the above answers hrs@'s comment about AF_LOCAL as well.