Problem about libnet on FreeBSD 6.0

ari edelkind edelkind-freebsd-hackers at episec.com
Sat Dec 31 07:25:58 PST 2005


guomingyan at gmail.com wrote:

> On 12/31/05, Gilbert Fernandes <gilbert.fernandes at spamcop.net> wrote:
> >
> > > I find that I can't include <net/ethernet.h> when I programming
> > > with libnet,because $(CC) complains that "struct ether_addr redefined".
> > > But I need some definitions in <net/ethernet.h>,struct ether_header etc.
> > > Currently,I just copy the definitions I need from <net/ethernet.h>,but
> > > it seems very ugly.Any one has some good ideas?
> >
> Here is my include lines,
> #include ......
> #include <net/ethernet.h>
> #include <pcap.h>
> #include <libnet.h>
> ...........
> and this is the error,
> $(CC) said "/usr/local/include/./libnet/libnet-headers.h:393: error:
> redefinition of `struct ether_addr'"
> 

Assuming that either the practical contents of 'struct ether_addr' are
the same for both definitions or that it doesn't matter for any inline
functions you may be using within the header file (chances are, this
assumption is valid):

#include <net/ethernet.h>
#include <pcap.h>
#define ether_addr ether_addr_BROKEN_LIBNET
# include <libnet.h>
#undef ether_addr
....

ari



More information about the freebsd-hackers mailing list