>>>>> On Wed, 28 Apr 2004 17:09:30 -0700, 
>>>>> "George V. Neville-Neil" <[EMAIL PROTECTED]> 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.
                                        [EMAIL PROTECTED]
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to