* ipset: make header files usable from userspace
@ 2011-08-28 14:30 Jan Engelhardt
2011-08-28 14:30 ` [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types Jan Engelhardt
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jan Engelhardt @ 2011-08-28 14:30 UTC (permalink / raw)
To: kadlec; +Cc: netfilter-devel, davem
While refreshing iptables's header files with new ones from the
kernel, libxt_SET fails to compile because some definitions were
locked away in __KERNEL__ sections when they should not have been.
This should therefore go into the current -rc.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types
2011-08-28 14:30 ipset: make header files usable from userspace Jan Engelhardt
@ 2011-08-28 14:30 ` Jan Engelhardt
2011-08-28 14:30 ` [PATCH 2/2] netfilter: ipset: expose userspace-relevant parts in ip_set.h Jan Engelhardt
2011-08-30 7:41 ` ipset: make header files usable from userspace Jozsef Kadlecsik
2 siblings, 0 replies; 4+ messages in thread
From: Jan Engelhardt @ 2011-08-28 14:30 UTC (permalink / raw)
To: kadlec; +Cc: netfilter-devel, davem
When using the xt_set.h header in userspace, one will get these gcc
reports:
ipset/ip_set.h:184:1: error: unknown type name "u16"
In file included from libxt_SET.c:21:0:
netfilter/xt_set.h:61:2: error: unknown type name "u32"
netfilter/xt_set.h:62:2: error: unknown type name "u32"
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
include/linux/netfilter/xt_set.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h
index c0405ac..e3a9978 100644
--- a/include/linux/netfilter/xt_set.h
+++ b/include/linux/netfilter/xt_set.h
@@ -58,8 +58,8 @@ struct xt_set_info_target_v1 {
struct xt_set_info_target_v2 {
struct xt_set_info add_set;
struct xt_set_info del_set;
- u32 flags;
- u32 timeout;
+ __u32 flags;
+ __u32 timeout;
};
#endif /*_XT_SET_H*/
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] netfilter: ipset: expose userspace-relevant parts in ip_set.h
2011-08-28 14:30 ipset: make header files usable from userspace Jan Engelhardt
2011-08-28 14:30 ` [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types Jan Engelhardt
@ 2011-08-28 14:30 ` Jan Engelhardt
2011-08-30 7:41 ` ipset: make header files usable from userspace Jozsef Kadlecsik
2 siblings, 0 replies; 4+ messages in thread
From: Jan Engelhardt @ 2011-08-28 14:30 UTC (permalink / raw)
To: kadlec; +Cc: netfilter-devel, davem
iptables's libxt_SET.c depends on these.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
include/linux/netfilter/ipset/ip_set.h | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 3540c6e..c5092de 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -11,6 +11,8 @@
* published by the Free Software Foundation.
*/
+#include <linux/types.h>
+
/* The protocol version */
#define IPSET_PROTOCOL 6
@@ -168,6 +170,13 @@ enum ipset_adt {
IPSET_CADT_MAX,
};
+/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
+ * and IPSET_INVALID_ID if you want to increase the max number of sets.
+ */
+typedef __u16 ip_set_id_t;
+
+#define IPSET_INVALID_ID 65535
+
#ifdef __KERNEL__
#include <linux/ip.h>
#include <linux/ipv6.h>
@@ -176,13 +185,7 @@ enum ipset_adt {
#include <linux/netfilter/x_tables.h>
#include <linux/vmalloc.h>
#include <net/netlink.h>
-
-/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
- * and IPSET_INVALID_ID if you want to increase the max number of sets.
- */
-typedef u16 ip_set_id_t;
-
-#define IPSET_INVALID_ID 65535
+#endif /* __KERNEL__ */
enum ip_set_dim {
IPSET_DIM_ZERO = 0,
@@ -195,6 +198,7 @@ enum ip_set_dim {
IPSET_DIM_MAX = 6,
};
+#ifdef __KERNEL__
/* Option flags for kernel operations */
enum ip_set_kopt {
IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO),
@@ -450,6 +454,8 @@ bitmap_bytes(u32 a, u32 b)
return 4 * ((((b - a + 8) / 8) + 3) / 4);
}
+#endif /* __KERNEL__ */
+
/* Interface to iptables/ip6tables */
#define SO_IP_SET 83
@@ -475,6 +481,4 @@ struct ip_set_req_version {
unsigned version;
};
-#endif /* __KERNEL__ */
-
#endif /*_IP_SET_H */
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: ipset: make header files usable from userspace
2011-08-28 14:30 ipset: make header files usable from userspace Jan Engelhardt
2011-08-28 14:30 ` [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types Jan Engelhardt
2011-08-28 14:30 ` [PATCH 2/2] netfilter: ipset: expose userspace-relevant parts in ip_set.h Jan Engelhardt
@ 2011-08-30 7:41 ` Jozsef Kadlecsik
2 siblings, 0 replies; 4+ messages in thread
From: Jozsef Kadlecsik @ 2011-08-30 7:41 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel, davem
Hi Jan,
On Sun, 28 Aug 2011, Jan Engelhardt wrote:
> While refreshing iptables's header files with new ones from the
> kernel, libxt_SET fails to compile because some definitions were
> locked away in __KERNEL__ sections when they should not have been.
In the second patch please move the type id and the ip_set_dim enum
together outside of the __KERNEL__ section. Thus a single #ifdef section
suffices. Thanks!
Best regards,
Jozsef
-
E-mail : kadlec@blackhole.kfki.hu, kadlec@mail.kfki.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-30 7:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-28 14:30 ipset: make header files usable from userspace Jan Engelhardt
2011-08-28 14:30 ` [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types Jan Engelhardt
2011-08-28 14:30 ` [PATCH 2/2] netfilter: ipset: expose userspace-relevant parts in ip_set.h Jan Engelhardt
2011-08-30 7:41 ` ipset: make header files usable from userspace Jozsef Kadlecsik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).