bugzilla-daemon at netfilter.org
2013-Jun-02 14:10 UTC
[Bug 826] New: libiptc/libip6tc.h doesn't specify C linkage
https://bugzilla.netfilter.org/show_bug.cgi?id=826
Summary: libiptc/libip6tc.h doesn't specify C linkage
Product: iptables
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P5
Component: libiptc
AssignedTo: netfilter-buglog at lists.netfilter.org
ReportedBy: quentin at armitage.org.uk
Estimated Hours: 0.0
libiptc/libiptc.h specifies extern "C", and although libip6tc.h
includes a test
for __cplusplus at the beginning, it doesn't specify C linkage.
--
Configure bugmail: https://bugzilla.netfilter.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
bugzilla-daemon at netfilter.org
2013-Jun-20 01:23 UTC
[Bug 826] libiptc/libip6tc.h doesn't specify C linkage
https://bugzilla.netfilter.org/show_bug.cgi?id=826
Phil Oester <netfilter at linuxace.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |netfilter at linuxace.com
--- Comment #1 from Phil Oester <netfilter at linuxace.com> 2013-06-20
03:23:12 CEST ---
And this is a problem for you why, exactly? Please explain why this deficiency
should be corrected.
Also, patches are welcomed.
--
Configure bugmail: https://bugzilla.netfilter.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
bugzilla-daemon at netfilter.org
2013-Jun-20 08:57 UTC
[Bug 826] libiptc/libip6tc.h doesn't specify C linkage
https://bugzilla.netfilter.org/show_bug.cgi?id=826
--- Comment #2 from Quentin Armitage <quentin at armitage.org.uk>
2013-06-20 10:57:57 CEST ---
If I want to include libiptc/libip6tc.h in a C++ program, I have to wrap the
#include in a extern "C" section, i.e.
extern "C" {
#include <libiptc/libip6tc.h>
}
On the other hand, this is not necessary for libiptc/libiptc.h since it already
includes the extern "C" section in the header file.
Since libiptc/libip6tc.h already includes a check for #ifdef __cplusplus, it is
clearly attempting to be compatible with C++, but without the extern
"C"
statement, it isn't fully. This mean that in my C++ code, which uses both
IPv4
and IPv6, the way I have to include the headers is inconsistent:
#include <libiptc/libiptc.h>
extern "C" {
#include <libiptc/libip6tc.h>
}
I have tested nested extern "C" sections, e.g.
extern "C" {
// Some code
extern "C" {
// some more code
}
}
and that compiles without a problem, so adding extern "C" to
libip6tc.h
shouldn't break any code that already includes includes it within an extern
"C"
section.
Finally, libiptc/libiptc.h and libiptc/libip6tc.h are so similar that it seems
inconsistent that one should have the external linkage statement and not the
other.
This isn't really a problem for me now, since I have added the necessary
externs to my code, but I thought that it would be helpful to point out the
inconsistency and may help others in the future.
I will attach a patch.
--
Configure bugmail: https://bugzilla.netfilter.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
bugzilla-daemon at netfilter.org
2013-Jun-20 08:59 UTC
[Bug 826] libiptc/libip6tc.h doesn't specify C linkage
https://bugzilla.netfilter.org/show_bug.cgi?id=826 --- Comment #3 from Quentin Armitage <quentin at armitage.org.uk> 2013-06-20 10:59:36 CEST --- Created attachment 402 --> https://bugzilla.netfilter.org/attachment.cgi?id=402 Patch to add extern "C" linkage section to libiptc/libip6tc.h This patch makes libiptc/libip6tc.h consistent with libiptc/libiptc.h and standardises inclusion of the two headers in C++ programs. -- Configure bugmail: https://bugzilla.netfilter.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
bugzilla-daemon at netfilter.org
2013-Jun-20 10:15 UTC
[Bug 826] libiptc/libip6tc.h doesn't specify C linkage
https://bugzilla.netfilter.org/show_bug.cgi?id=826
Pablo Neira Ayuso <pablo at netfilter.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pablo at netfilter.org
--- Comment #4 from Pablo Neira Ayuso <pablo at netfilter.org> 2013-06-20
12:15:09 CEST ---
I suggest you to keep a cached copy of that file (plus the changes to make it
compile with C++) in your source tree.
We do so in most of the existing netfilter utilities. Relying on the installed
Linux kernel headers is not a good idea, as your utility would break
compilation if they are not installed.
That library was not ever intended to be used for third party applications.
--
Configure bugmail: https://bugzilla.netfilter.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
bugzilla-daemon at netfilter.org
2013-Jun-21 21:35 UTC
[Bug 826] libiptc/libip6tc.h doesn't specify C linkage
https://bugzilla.netfilter.org/show_bug.cgi?id=826 --- Comment #5 from Phil Oester <netfilter at linuxace.com> 2013-06-21 23:35:54 CEST --- Quentin - is Pablo's suggestion to maintain a copy of this header going to work for you? It sounds as though this change is not going to be added to the official header file. -- Configure bugmail: https://bugzilla.netfilter.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
bugzilla-daemon at netfilter.org
2013-Jul-01 15:19 UTC
[Bug 826] libiptc/libip6tc.h doesn't specify C linkage
https://bugzilla.netfilter.org/show_bug.cgi?id=826
Phil Oester <netfilter at linuxace.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
--- Comment #6 from Phil Oester <netfilter at linuxace.com> 2013-07-01
17:19:49 CEST ---
Closing, as it does not appear changes to support C++ compiling of headers is
going to be accepted.
--
Configure bugmail: https://bugzilla.netfilter.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
Apparently Analagous Threads
- [Bug 1067] New: Compilation failure on Linux 4.5.x when including libiptc/libiptc.h
- [Bug 875] New: iptables -m conntrack --ctstatus NONE, EXPECTED is not consistent with --ctstatus SEEN_REPLY,EXPECTED
- [Bug 1289] New: iptables build fails with kernel 4.20-rc1 - gnu_inline attributes
- [Bug 638] New: make libiptc a public interface
- [Bug 102] New: ipv6_prefix_length works only on LITTLE_ENDIAN and prefix_length % 8 == 0