Re: Problem about libnet on FreeBSD 6.0

2006-01-03 Thread Gilbert Fernandes
 The problem is that libnet defines ether_addr without regard for the fact
 that it's defined in our system headers.  This is a bug in libnet, not
 FreeBSD.

Very interesting information :)

Thanks for your reply (and happy new year !)

--
unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ;
fsck ; umount ; sleep
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problem about libnet on FreeBSD 6.0

2006-01-01 Thread ari edelkind
[EMAIL PROTECTED] wrote:

  http://lists.freebsd.org/pipermail/freebsd-hackers/2005-December/014986.html
 
 The problem is that libnet defines ether_addr without regard for the fact
 that it's defined in our system headers.  This is a bug in libnet, not
 FreeBSD.

No one claimed otherwise -- hence the 'BROKEN_LIBNET' tag in my post.

 In particular, libnet/libnet-headers.h has this code, which is very
 Linux-centric and works around the duplicate definition problem on Linux,
 but doesn't help anyone on other platforms.
 
 391 #if (!__GLIBC__)

This is typical for libnet, and it has run into compatibility problems
of this sort in the past on systems other than freebsd.  Search for
edelkind libnet or redefinition libnet on google for some of these.

ari

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problem about libnet on FreeBSD 6.0

2005-12-31 Thread prime
On 12/31/05, Gilbert Fernandes [EMAIL PROTECTED] 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?

 Could you show us the include line you use ?

 #include blabla and
 #include blabla

 will produce very different results as you know :)

 You do use #include net/ethernet.h ?

 --
 unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ;
 fsck ; umount ; sleep

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'


Thanks.
--
Three passions, simple but overwhelmingly strong, have governed my life:
the longing for love, the search for knowledge, and unbearable pity for
the suffering of mankind.
 -Bertrand Russell
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problem about libnet on FreeBSD 6.0

2005-12-31 Thread ari edelkind
[EMAIL PROTECTED] wrote:

 On 12/31/05, Gilbert Fernandes [EMAIL PROTECTED] 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

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problem about libnet on FreeBSD 6.0

2005-12-31 Thread Gilbert Fernandes
 - Message from [EMAIL PROTECTED] -
 Date: Sat, 31 Dec 2005 20:55:38 +0800
 From: prime [EMAIL PROTECTED]
 Reply-To: prime [EMAIL PROTECTED]
  Subject: Re: Problem about libnet on FreeBSD 6.0
   To: Gilbert Fernandes [EMAIL PROTECTED]

 On 12/31/05, Gilbert Fernandes [EMAIL PROTECTED] 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?
 
  Could you show us the include line you use ?
 
  #include blabla and
  #include blabla
 
  will produce very different results as you know :)
 
  You do use #include net/ethernet.h ?
 
  --
  unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ;
  fsck ; umount ; sleep
 
 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'


 Thanks.
 --
 Three passions, simple but overwhelmingly strong, have governed my life:
 the longing for love, the search for knowledge, and unbearable pity for
 the suffering of mankind.
  -Bertrand Russell


 - End message from [EMAIL PROTECTED] -

Redefinition means that you have two declarations of the same
function.

One of the files you are including IS already including net/ethernet
probably.

Can you check ? :)

--
unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ;
fsck ; umount ; sleep
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problem about libnet on FreeBSD 6.0

2005-12-31 Thread prime
On 12/31/05, Gilbert Fernandes [EMAIL PROTECTED] wrote:

  - Message from [EMAIL PROTECTED] -
  Date: Sat, 31 Dec 2005 20:55:38 +0800
  From: prime [EMAIL PROTECTED] 
  Reply-To: prime [EMAIL PROTECTED]
   Subject: Re: Problem about libnet on FreeBSD 6.0
To: Gilbert Fernandes  [EMAIL PROTECTED]
 
  On 12/31/05, Gilbert Fernandes [EMAIL PROTECTED] 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?
  
   Could you show us the include line you use ?
  
   #include blabla and
   #include blabla
  
   will produce very different results as you know :)
  
   You do use #include net/ethernet.h ?
  
   --
   unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ;
   fsck ; umount ; sleep
  
  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'
 
 
  Thanks.
  --
  Three passions, simple but overwhelmingly strong, have governed my life:

  the longing for love, the search for knowledge, and unbearable pity for
  the suffering of mankind.
   -Bertrand Russell
 
 
  - End message from [EMAIL PROTECTED] -

 Redefinition means that you have two declarations of the same
 function.

 One of the files you are including IS already including net/ethernet
 probably.

 Can you check ? :)

 --
 unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ;
 fsck ; umount ; sleep


I can't agree more.Header files usually use #ifndef XXX_H
 #define XXX_H
 .
 #endif
to avoid  being  included  more than once.net/ethernet.h is not different.
it use
#ifndef _NET_ETHERNET_H_
 #define _NET_ETHERNET_H_
 ..
 #endif
to avoid more than once include.

In my opinion,struct ether_addr is defined both in
net/ethernet.h and libnet-headers.h,and we need
include these two header files at the same time.

And here is my include lines

#include stdio.h
#include stdlib.h
#include limits.h
#include errno.h
#include signal.h
#include sys/types.h
#include sys/socket.h
#include net/if_arp.h
#include netinet/in.h
#include arpa/inet.h
#include unistd.h
#include net/ethernet.h
#include pcap.h
#include libnet.h

--
Three passions, simple but overwhelmingly strong, have governed my life:
the longing for love, the search for knowledge, and unbearable pity for
the suffering of mankind.
 -Bertrand Russell
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problem about libnet on FreeBSD 6.0

2005-12-31 Thread prime
On 1/1/06, ari edelkind [EMAIL PROTECTED] wrote:

 Did you read my post?
 Or are you not on the list?  I sent my response directly to the list,
 not including you specifically.

 ari

 [EMAIL PROTECTED] wrote:

 [...]
  In my opinion,struct ether_addr is defined both in
  net/ethernet.h and libnet-headers.h,and we need
  include these two header files at the same time.
 
  And here is my include lines
 [...]

I am on the list,and I don't receive your post.
I think you can send post specifically to me and cc
to the list :-).
Thanks.


--
Three passions, simple but overwhelmingly strong, have governed my life:
the longing for love, the search for knowledge, and unbearable pity for
the suffering of mankind.
 -Bertrand Russell
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problem about libnet on FreeBSD 6.0

2005-12-31 Thread ari edelkind
[EMAIL PROTECTED] wrote:

  Did you read my post?
  Or are you not on the list?  I sent my response directly to the list,
  not including you specifically.
[...]
 I am on the list,and I don't receive your post.
 I think you can send post specifically to me and cc
 to the list :-).
 Thanks.

In the future, please respond to personal mails personally.  Neither my
direct e-mail address nor this mail were intended for public viewing.

The post to which i was referring is:
http://lists.freebsd.org/pipermail/freebsd-hackers/2005-December/014986.html

ari

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problem about libnet on FreeBSD 6.0

2005-12-31 Thread Matt Emmerton
 [EMAIL PROTECTED] wrote:

   Did you read my post?
   Or are you not on the list?  I sent my response directly to the list,
   not including you specifically.
 [...]
  I am on the list,and I don't receive your post.
  I think you can send post specifically to me and cc
  to the list :-).
  Thanks.

 In the future, please respond to personal mails personally.  Neither my
 direct e-mail address nor this mail were intended for public viewing.

 The post to which i was referring is:

http://lists.freebsd.org/pipermail/freebsd-hackers/2005-December/014986.html

The problem is that libnet defines ether_addr without regard for the fact
that it's defined in our system headers.  This is a bug in libnet, not
FreeBSD.

In particular, libnet/libnet-headers.h has this code, which is very
Linux-centric and works around the duplicate definition problem on Linux,
but doesn't help anyone on other platforms.

391 #if (!__GLIBC__)
392 struct ether_addr
393 {
394 u_char  ether_addr_octet[6];
395 };
396 #endif

The problem has been properly fixed in the current development version of
libnet (net/libnet-devel), by renaming the ether_addr structure to
libnet_ether_addr.

The net/libnet port should be marked BROKEN because of this issue (I've
opened a PR) and folks should use libnet-devel instead, until the net/libnet
port is updated to a newer version.  The net/libnet maintainer has been
notified of this problem.

Regards,
--
Matt Emmerton

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]