Bug 1723 - Name clash in ipv4-header.h with defines from <termios.h>
Name clash in ipv4-header.h with defines from <termios.h>
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: internet
ns-3-dev
All Mac OS
: P5 normal
Assigned To: George Riley
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-28 15:22 UTC by Alex Afanasyev
Modified: 2013-08-16 14:07 UTC (History)
2 users (show)

See Also:


Attachments
patch to fix (6.59 KB, patch)
2013-07-12 17:49 UTC, Tom Henderson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Afanasyev 2013-06-28 15:22:04 UTC
Hi guys,

On some systems, macros defined in <termios.h> clash with some DscpType enums defined in ipv4-header.h.

Here is an error:

[ 987/2043] cxx: src/internet/model/ipv4-raw-socket-factory-impl.cc -> build/src/internet/model/ipv4-raw-socket-factory-impl.cc.1.o
In file included from ./ns3/ipv4-routing-protocol.h:25,
                 from ./ns3/ipv4-list-routing.h:23,
                 from ./ns3/ipv4-routing-helper.h:26,
                 from ./ns3/ipv4-nix-vector-helper.h:25,
                 from ./ns3/nix-vector-routing-module.h:10,
                 from src/nix-vector-routing/bindings/ns3module.h:63,
                 from src/nix-vector-routing/bindings/ns3module.cc:1:
./ns3/ipv4-header.h:88: error: expected identifier before numeric constant
./ns3/ipv4-header.h:88: error: expected `}' before numeric constant
./ns3/ipv4-header.h:88: error: expected unqualified-id before numeric constant
./ns3/ipv4-header.h:99: error: variable or field ‘SetDscp’ declared void


<termios.h> is included in pyport.h, which is included in Python.h, which is included when python bindings are enabled.

The interesting fact is that the problem does not appear on all systems, so I'm not sure what exactly caused the error or how to reproduce it.


I would highly suggest that we rename constants defined in DscpType enum to include some prefix, so it makes them unique.  As far as I checked, these constants are used just in ipv4-header.h|cc and test file.
Comment 1 Tom Henderson 2013-07-12 17:49:23 UTC
Created attachment 1631 [details]
patch to fix
Comment 2 Tommaso Pecorella 2013-07-12 18:16:41 UTC
Comment on attachment 1631 [details]
patch to fix

+1. go for it.

The offending part in termios.h is:

The c_cflag field describes the hardware control of the terminal; not all values specified are required to be supported by the underlying hardware:
CSIZE
Character size:
CS5 5 bits.
CS6 6 bits.
CS7 7 bits.
CS8 8 bits.

Completely unrelated to DSCP.
Comment 3 Tom Henderson 2013-08-16 14:07:38 UTC
changeset 897a43e0f9b8