Subject: lib/11021: net/if_ether.h not usable standalone
To: None <gnats-bugs@gnats.netbsd.org>
From: None <wiz@danbala.tuwien.ac.at>
List: netbsd-bugs
Date: 09/14/2000 16:54:14
>Number:         11021
>Category:       lib
>Synopsis:       net/if_ether.h not usable standalone
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 14 16:55:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Wiz
>Release:        NetBSD-1.5E/i386, from 2000/08/12
>Organization:
Thomas Klausner - wiz@danbala.tuwien.ac.at
>Environment:
	
System: NetBSD hiro 1.5E NetBSD 1.5E (HIRO) #0: Sat Sep 2 19:51:10 CEST 2000 wiz@hiro:/archive/cvs/src/sys-i4b/arch/i386/compile/HIRO i386


>Description:
You can't #include net/if_ether.h on its own.
>How-To-Repeat:
Read ethers(3), find description of some functions called ether_*, and
try to compile the following program:

#include <net/if_ether.h>

int
main(int argc, char *argv[])
{
	struct ether_addr addr;
	addr.ether_addr_octet[0] = 0x1;
	addr.ether_addr_octet[1] = 0x23;
	addr.ether_addr_octet[2] = 0x4f;
	addr.ether_addr_octet[3] = 0x5a;
	addr.ether_addr_octet[4] = 0xd;
	addr.ether_addr_octet[5] = 0x99;

	printf("ether_ntoa output: %s\n", ether_ntoa(&addr));

	return 0;
}

It fails with:
In file included from test.c:6:
/usr/include/net/if_ether.h:56: syntax error before `u_int8_t'
/usr/include/net/if_ether.h:63: syntax error before `u_int8_t'
In file included from test.c:6:
/usr/include/net/if_ether.h:129: field `ec_if' has incomplete type
/usr/include/net/if_ether.h:130: syntax error before `LIST_HEAD'
/usr/include/net/if_ether.h:151: syntax error before `u_int8_t'
/usr/include/net/if_ether.h:154: syntax error before `u_int'
test.c: In function `main':
test.c:12: structure has no member named `ether_addr_octet'
test.c:13: structure has no member named `ether_addr_octet'
test.c:14: structure has no member named `ether_addr_octet'
test.c:15: structure has no member named `ether_addr_octet'
test.c:16: structure has no member named `ether_addr_octet'
test.c:17: structure has no member named `ether_addr_octet'

>Fix:
None provided.

Workaround:
Also include sys/types.h, sys/socket.h, and net/if.h.
>Release-Note:
>Audit-Trail:
>Unformatted: