All of lore.kernel.org
 help / color / mirror / Atom feed
* ipset: make header files usable from userspace (v2)
@ 2011-08-31 12:10 Jan Engelhardt
  2011-08-31 12:10 ` [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types Jan Engelhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jan Engelhardt @ 2011-08-31 12:10 UTC (permalink / raw)
  To: kadlec; +Cc: netfilter-devel


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!

done so now.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types
  2011-08-31 12:10 ipset: make header files usable from userspace (v2) Jan Engelhardt
@ 2011-08-31 12:10 ` Jan Engelhardt
  2011-08-31 12:10 ` [PATCH 2/2] netfilter: ipset: expose userspace-relevant parts in ip_set.h Jan Engelhardt
  2011-08-31 14:01 ` ipset: make header files usable from userspace (v2) Jozsef Kadlecsik
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2011-08-31 12:10 UTC (permalink / raw)
  To: kadlec; +Cc: netfilter-devel

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] 5+ messages in thread

* [PATCH 2/2] netfilter: ipset: expose userspace-relevant parts in ip_set.h
  2011-08-31 12:10 ipset: make header files usable from userspace (v2) Jan Engelhardt
  2011-08-31 12:10 ` [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types Jan Engelhardt
@ 2011-08-31 12:10 ` Jan Engelhardt
  2011-08-31 14:01 ` ipset: make header files usable from userspace (v2) Jozsef Kadlecsik
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2011-08-31 12:10 UTC (permalink / raw)
  To: kadlec; +Cc: netfilter-devel

iptables's libxt_SET.c depends on these.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 include/linux/netfilter/ipset/ip_set.h |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 3540c6e..c853158 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,19 +170,10 @@ enum ipset_adt {
 	IPSET_CADT_MAX,
 };
 
-#ifdef __KERNEL__
-#include <linux/ip.h>
-#include <linux/ipv6.h>
-#include <linux/netlink.h>
-#include <linux/netfilter.h>
-#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;
+typedef __u16 ip_set_id_t;
 
 #define IPSET_INVALID_ID		65535
 
@@ -203,6 +196,15 @@ enum ip_set_kopt {
 	IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
 };
 
+#ifdef __KERNEL__
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/netlink.h>
+#include <linux/netfilter.h>
+#include <linux/netfilter/x_tables.h>
+#include <linux/vmalloc.h>
+#include <net/netlink.h>
+
 /* Set features */
 enum ip_set_feature {
 	IPSET_TYPE_IP_FLAG = 0,
@@ -450,6 +452,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 +479,4 @@ struct ip_set_req_version {
 	unsigned version;
 };
 
-#endif	/* __KERNEL__ */
-
 #endif /*_IP_SET_H */
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: ipset: make header files usable from userspace (v2)
  2011-08-31 12:10 ipset: make header files usable from userspace (v2) Jan Engelhardt
  2011-08-31 12:10 ` [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types Jan Engelhardt
  2011-08-31 12:10 ` [PATCH 2/2] netfilter: ipset: expose userspace-relevant parts in ip_set.h Jan Engelhardt
@ 2011-08-31 14:01 ` Jozsef Kadlecsik
  2 siblings, 0 replies; 5+ messages in thread
From: Jozsef Kadlecsik @ 2011-08-31 14:01 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter-devel

Hi Jan,

On Wed, 31 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!
> 
> done so now.

Thanks, the patches are applied.

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] 5+ 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
  0 siblings, 0 replies; 5+ 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] 5+ messages in thread

end of thread, other threads:[~2011-08-31 14:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-31 12:10 ipset: make header files usable from userspace (v2) Jan Engelhardt
2011-08-31 12:10 ` [PATCH 1/2] netfilter: ipset: avoid use of kernel-only types Jan Engelhardt
2011-08-31 12:10 ` [PATCH 2/2] netfilter: ipset: expose userspace-relevant parts in ip_set.h Jan Engelhardt
2011-08-31 14:01 ` ipset: make header files usable from userspace (v2) Jozsef Kadlecsik
  -- strict thread matches above, loose matches on Subject: below --
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.