Date: Mon, 17 May 2004 12:17:44 +0900 From: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= <jinmei@isl.rdc.toshiba.co.jp> To: "George V. Neville-Neil" <gnn@neville-neil.com> Cc: net@freebsd.org Subject: Re: RFC 2292 CMSG_FIRSTHDR macro... Message-ID: <y7vzn872147.wl@ocean.jinmei.org> In-Reply-To: <87r7u7wsp1.wl@jchurch.neville-neil.com.neville-neil.com> References: <87r7u7wsp1.wl@jchurch.neville-neil.com.neville-neil.com>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> On Wed, 28 Apr 2004 17:09:30 -0700, >>>>> "George V. Neville-Neil" <gnn@neville-neil.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?y7vzn872147.wl>