From owner-freebsd-net@FreeBSD.ORG Sun May 16 20:17:31 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B2D3D16A4CE for ; Sun, 16 May 2004 20:17:31 -0700 (PDT) Received: from shuttle.wide.toshiba.co.jp (shuttle.wide.toshiba.co.jp [202.249.10.124]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2DAE143D2D for ; Sun, 16 May 2004 20:17:31 -0700 (PDT) (envelope-from jinmei@isl.rdc.toshiba.co.jp) Received: from ocean.jinmei.org (unknown [3ffe:501:100f:1048:4103:5074:9c90:4e33]) by shuttle.wide.toshiba.co.jp (Postfix) with ESMTP id CF44615263; Mon, 17 May 2004 12:17:26 +0900 (JST) Date: Mon, 17 May 2004 12:17:44 +0900 Message-ID: From: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= To: "George V. Neville-Neil" In-Reply-To: <87r7u7wsp1.wl@jchurch.neville-neil.com.neville-neil.com> References: <87r7u7wsp1.wl@jchurch.neville-neil.com.neville-neil.com> User-Agent: Wanderlust/2.10.1 (Watching The Wheels) Emacs/21.3 Mule/5.0 (SAKAKI) Organization: Research & Development Center, Toshiba Corp., Kawasaki, Japan. MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII cc: net@freebsd.org Subject: Re: RFC 2292 CMSG_FIRSTHDR macro... X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 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, 17 May 2004 03:17:31 -0000 >>>>> On Wed, 28 Apr 2004 17:09:30 -0700, >>>>> "George V. Neville-Neil" said: > This should be a minor nit but, is there any reason we > implement this this way: > #define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) > instead of this way: > #define CMSG_FIRSTHDR(mhdr) \ > ( (mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ > (struct cmsghdr *)(mhdr)->msg_control : \ > (struct cmsghdr *)NULL ) > as suggested in RFC 2292? > A coworker of mine asked about this and then I got to wondering > myself. I see no special reason. In fact, KAME snapshots have this check as suggested in RFC2292 (or 3542): /* * RFC 2292 requires to check msg_controllen, in case that the kernel returns * an empty list for some reasons. */ #define CMSG_FIRSTHDR(mhdr) \ ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ (struct cmsghdr *)(mhdr)->msg_control : \ (struct cmsghdr *)NULL) JINMEI, Tatuya Communication Platform Lab. Corporate R&D Center, Toshiba Corp. jinmei@isl.rdc.toshiba.co.jp