tcpdump mailing list archives

Re: ETHERMTU


From: Saikiran Madugula <hummerbliss () gmail com>
Date: Wed, 05 Sep 2007 17:17:08 -0400

Guy Harris wrote:
Saikiran Madugula wrote:
I ran into this problem when I was trying to compile libpcap with a package which has support for a custom interface in Linux. I get a warning message about redefining ETHERMTU while compiling that package as the package uses net/ethernet.h.

Do you get a warning message *when gencode.c is compiled*?

Yes, I get warning when gencode.c gets compiled with the custom package.
(ofcourse standalone libpcap compiles fine).

gcc -O2 -I. -I<path to custom package's include files> -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -D<XXX_ONLY> -fPIC -DPIC -c ./gencode.c
./gencode.c:87:1: warning: "ETHERMTU" redefined
In file included from /usr/include/netinet/if_ether.h:61,
                 from /usr/include/netinet/ether.h:26,
from /pathtocustompackage/customheader.h from ./pcap-int.h:55,
                 from ./gencode.c:65:

the customheader includes net/ethernet.h. Which has ETHERMTU defined.


If not, then there isn't a problem with gencode.c.

if gencode.c (or any other code) is indeed intended for use across several operating systems then it should be careful not pollute name space of the platforms it intends to be used on.

gencode.c isn't polluting the name space. Source files don't pollute the name space - header files, such as ethernet.h, do. It's impossible to avoid using names that *might* be defined by *some* header file on a system - even if you manage to avoid every name defined by the header files in one release of a system, the next release might add a new symbol.
-

My apologies for loose terminology. I understand it is impossible to predict what symbols might prop up. But to my surprise something like ETHERMTU has been defined in that way and *I wish to only know the reason behind this* and about the consequences.

If a package supports a OS such as Linux, is it not clean way of being cautious of symbols that OS uses ?

Saikiran.


This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: