Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Aug 2000 10:33:59 +1000 (EST)
From:      Mark.Andrews@nominum.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/20530: CMSG_DATA requires additional header file to be included
Message-ID:  <200008110033.KAA20407@drugs.dv.isc.org>

next in thread | raw e-mail | index | archive | help

>Number:         20530
>Category:       misc
>Synopsis:       CMSG_DATA requires additional header file to be included
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 10 17:40:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Mark Andrews
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
Nominum
>Environment:


FreeBSD drugs.dv.isc.org 4.1-STABLE FreeBSD 4.1-STABLE #0: Tue Aug  8 18:01:02 EST 2000     marka@drugs.dv.isc.org:/usr/obj/usr/src/sys/DRUGS  i386

>Description:

	The CMSG_* macros use macros not defined in <sys/types.h> and
	<sys/socket.h> causing linkage failures.  CMSG_* macros manipulate
	data returned / sent by recvmsg() / sendmsg().  The only header
	files that should be required by a application are <sys/types.h>
	and <sys/socket.h>.

	FreeBSD is currently gratuitously differnet in its requirements
	w.r.t. the CMSG_* macros.

>How-To-Repeat:

	The following compiles and links on all platforms except FreeBSD,
	it is not expected to run without errors.

#include <sys/types.h>
#include <sys/socket.h>

int
main() {

        struct msghdr *msghdr = (struct msghdr *)0;
        struct cmsghdr *cmsghdr;
        unsigned char *data;

        cmsghdr = CMSG_FIRSTHDR(msghdr);
        data = CMSG_DATA(cmsghdr);
}


>Fix:

	Add #include <sys/param.h> to <sys/socket.h> or redefine relevent
	CMSG_* macros to use things only defined in <sys/types.h> and
	<sys/socket.h>.


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008110033.KAA20407>