Skip to contentSkip to conversation

libip6tc.h: Add extern "C" wrapping for C++ linking.

PATCH In review Chris PeBenito 2 participants 2 messages Jul 15, 2019 – Jul 30, 2019 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libip6tc.h: Add extern "C" wrapping for C++ linking.

---
 include/libiptc/libip6tc.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/libiptc/libip6tc.h +8 -0
index 9aed80a0..eaf34d65 100644
@@ -12,6 +12,10 @@
 #include <linux/netfilter_ipv6/ip6_tables.h>
 #include <libiptc/xtcshared.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define ip6tc_handle xtc_handle
 #define ip6t_chainlabel xt_chainlabel
 
@@ -158,4 +162,8 @@ extern void dump_entries6(struct xtc_handle *const);
 
 extern const struct xtc_ops ip6tc_ops;
 
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
 #endif /* _LIBIP6TC_H */
Signature · 1 line
2.21.0
#1 lore raw

Hi Chris,

On Mon, Jul 15, 2019 at 11:58:55AM -0400, Chris PeBenito wrote:
[...]

include/libiptc/libip6tc.h line 17

Quoted 11 lines
include/libiptc/libip6tc.h +3 -0
index 9aed80a0..eaf34d65 100644
@@ -12,6 +12,10 @@
 #include <linux/netfilter_ipv6/ip6_tables.h>
 #include <libiptc/xtcshared.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif

This patch is very small, it does not harm anyone I think.

However, please note that we've been discouraging people to use the iptables blob interface for years.

This interface is prone to races (see the userspace lock and the -w option in iptables) and the binary layout is obscure.

Not sure how advance you're in developing a userspace program using this interface, if in early stage, I'd suggest you go for command (in string format) pipe them to iptables-restore, which is what most people do to implement third party software that generates rules for iptables.

Thanks.