diff mbox

[libnetfilter_log,2/3] Convert kernel to stdint types

Message ID 20150516113828.GR14201@euler
State Not Applicable
Delegated to: Pablo Neira
Headers show

Commit Message

Felix Janda May 16, 2015, 11:41 a.m. UTC
Signed-off-by: Felix Janda <felix.janda@posteo.de>
---
 include/libnetfilter_log/linux_nfnetlink_log.h | 42 +++++++++++++-------------
 1 file changed, 21 insertions(+), 21 deletions(-)

Comments

Pablo Neira Ayuso May 27, 2015, 12:22 p.m. UTC | #1
On Sat, May 16, 2015 at 01:41:49PM +0200, Felix Janda wrote:
> Signed-off-by: Felix Janda <felix.janda@posteo.de>
> ---
>  include/libnetfilter_log/linux_nfnetlink_log.h | 42 +++++++++++++-------------
>  1 file changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/include/libnetfilter_log/linux_nfnetlink_log.h b/include/libnetfilter_log/linux_nfnetlink_log.h
> index 9f38277..c647581 100644
> --- a/include/libnetfilter_log/linux_nfnetlink_log.h
> +++ b/include/libnetfilter_log/linux_nfnetlink_log.h
> @@ -20,31 +20,31 @@ enum nfulnl_msg_types {
>  };
>  
>  struct nfulnl_msg_packet_hdr {
> -	__be16		hw_protocol;	/* hw protocol (network order) */
> -	__u8	hook;		/* netfilter hook */
> -	__u8	_pad;
> +	uint16_t		hw_protocol;	/* hw protocol (network order) */
> +	uint8_t	hook;		/* netfilter hook */
> +	uint8_t	_pad;
>  };

I have skipped this patch in this series. It is mangling a cached
header from the kernel, I guess there must be a way to make musl happy
without this change given that we follow the same approach in other
libraries.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felix Janda June 14, 2015, 6:43 p.m. UTC | #2
Pablo Neira Ayuso wrote:
> On Sat, May 16, 2015 at 01:41:49PM +0200, Felix Janda wrote:
> > Signed-off-by: Felix Janda <felix.janda@posteo.de>
> > ---
> >  include/libnetfilter_log/linux_nfnetlink_log.h | 42 +++++++++++++-------------
> >  1 file changed, 21 insertions(+), 21 deletions(-)
> > 
> > diff --git a/include/libnetfilter_log/linux_nfnetlink_log.h b/include/libnetfilter_log/linux_nfnetlink_log.h
> > index 9f38277..c647581 100644
> > --- a/include/libnetfilter_log/linux_nfnetlink_log.h
> > +++ b/include/libnetfilter_log/linux_nfnetlink_log.h
> > @@ -20,31 +20,31 @@ enum nfulnl_msg_types {
> >  };
> >  
> >  struct nfulnl_msg_packet_hdr {
> > -	__be16		hw_protocol;	/* hw protocol (network order) */
> > -	__u8	hook;		/* netfilter hook */
> > -	__u8	_pad;
> > +	uint16_t		hw_protocol;	/* hw protocol (network order) */
> > +	uint8_t	hook;		/* netfilter hook */
> > +	uint8_t	_pad;
> >  };
> 
> I have skipped this patch in this series. It is mangling a cached
> header from the kernel, I guess there must be a way to make musl happy
> without this change given that we follow the same approach in other
> libraries.
> 
> Thanks.

Yes, the conversion of types is not strictly necessary. As long as
<linux/types.h> is included, everything is fine for musl. I have likely
misunderstood your previous mail. Feel free to ignore patches mangling
kernel headers after updating them.

Thanks for your review and pushing of patches so far!

Felix
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira Ayuso June 16, 2015, 4:47 p.m. UTC | #3
On Sun, Jun 14, 2015 at 08:43:51PM +0200, Felix Janda wrote:
> Pablo Neira Ayuso wrote:
> > On Sat, May 16, 2015 at 01:41:49PM +0200, Felix Janda wrote:
> > > Signed-off-by: Felix Janda <felix.janda@posteo.de>
> > > ---
> > >  include/libnetfilter_log/linux_nfnetlink_log.h | 42 +++++++++++++-------------
> > >  1 file changed, 21 insertions(+), 21 deletions(-)
> > > 
> > > diff --git a/include/libnetfilter_log/linux_nfnetlink_log.h b/include/libnetfilter_log/linux_nfnetlink_log.h
> > > index 9f38277..c647581 100644
> > > --- a/include/libnetfilter_log/linux_nfnetlink_log.h
> > > +++ b/include/libnetfilter_log/linux_nfnetlink_log.h
> > > @@ -20,31 +20,31 @@ enum nfulnl_msg_types {
> > >  };
> > >  
> > >  struct nfulnl_msg_packet_hdr {
> > > -	__be16		hw_protocol;	/* hw protocol (network order) */
> > > -	__u8	hook;		/* netfilter hook */
> > > -	__u8	_pad;
> > > +	uint16_t		hw_protocol;	/* hw protocol (network order) */
> > > +	uint8_t	hook;		/* netfilter hook */
> > > +	uint8_t	_pad;
> > >  };
> > 
> > I have skipped this patch in this series. It is mangling a cached
> > header from the kernel, I guess there must be a way to make musl happy
> > without this change given that we follow the same approach in other
> > libraries.
> > 
> > Thanks.
> 
> Yes, the conversion of types is not strictly necessary. As long as
> <linux/types.h> is included, everything is fine for musl. I have likely
> misunderstood your previous mail. Feel free to ignore patches mangling
> kernel headers after updating them.

This is what I did. I mangled the patches to skip the chunks that
modify the kernel headers that we cache in the trees.

> Thanks for your review and pushing of patches so far!

Thanks for confirming and for the rather large patchset to address the
musl problems.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felix Janda June 16, 2015, 7:22 p.m. UTC | #4
Pablo Neira Ayuso wrote:
[..]
> > Thanks for your review and pushing of patches so far!
> 
> Thanks for confirming and for the rather large patchset to address the
> musl problems.

Sorry for the spam...

Now everything non-historical on netfilter.org builds fine except for:
- ulogd2 (patches have not been applied yet)
- libnetfilter_queue (small oversight of mine, patch will follow)
- nft-sync (not tested before, patch will follow)
- iptables (previous patches solve only some problems, more patches
    will follow)
- libnl-nft (is this still in use?)
- conntrack rpc helper (musl lacks rpc headers, I would like to add a
    configure test to make it conditional on the presence of rpc headers)

Felix
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/libnetfilter_log/linux_nfnetlink_log.h b/include/libnetfilter_log/linux_nfnetlink_log.h
index 9f38277..c647581 100644
--- a/include/libnetfilter_log/linux_nfnetlink_log.h
+++ b/include/libnetfilter_log/linux_nfnetlink_log.h
@@ -20,31 +20,31 @@  enum nfulnl_msg_types {
 };
 
 struct nfulnl_msg_packet_hdr {
-	__be16		hw_protocol;	/* hw protocol (network order) */
-	__u8	hook;		/* netfilter hook */
-	__u8	_pad;
+	uint16_t		hw_protocol;	/* hw protocol (network order) */
+	uint8_t	hook;		/* netfilter hook */
+	uint8_t	_pad;
 };
 
 struct nfulnl_msg_packet_hw {
-	__be16		hw_addrlen;
-	__u16	_pad;
-	__u8	hw_addr[8];
+	uint16_t		hw_addrlen;
+	uint16_t	_pad;
+	uint8_t	hw_addr[8];
 };
 
 struct nfulnl_msg_packet_timestamp {
-	__aligned_be64	sec;
-	__aligned_be64	usec;
+	aligned_u64	sec;
+	aligned_u64	usec;
 };
 
 enum nfulnl_attr_type {
 	NFULA_UNSPEC,
 	NFULA_PACKET_HDR,
-	NFULA_MARK,			/* __u32 nfmark */
+	NFULA_MARK,			/* uint32_t nfmark */
 	NFULA_TIMESTAMP,		/* nfulnl_msg_packet_timestamp */
-	NFULA_IFINDEX_INDEV,		/* __u32 ifindex */
-	NFULA_IFINDEX_OUTDEV,		/* __u32 ifindex */
-	NFULA_IFINDEX_PHYSINDEV,	/* __u32 ifindex */
-	NFULA_IFINDEX_PHYSOUTDEV,	/* __u32 ifindex */
+	NFULA_IFINDEX_INDEV,		/* uint32_t ifindex */
+	NFULA_IFINDEX_OUTDEV,		/* uint32_t ifindex */
+	NFULA_IFINDEX_PHYSINDEV,	/* uint32_t ifindex */
+	NFULA_IFINDEX_PHYSOUTDEV,	/* uint32_t ifindex */
 	NFULA_HWADDR,			/* nfulnl_msg_packet_hw */
 	NFULA_PAYLOAD,			/* opaque data payload */
 	NFULA_PREFIX,			/* string prefix */
@@ -69,23 +69,23 @@  enum nfulnl_msg_config_cmds {
 };
 
 struct nfulnl_msg_config_cmd {
-	__u8	command;	/* nfulnl_msg_config_cmds */
+	uint8_t	command;	/* nfulnl_msg_config_cmds */
 } __attribute__ ((packed));
 
 struct nfulnl_msg_config_mode {
-	__be32		copy_range;
-	__u8	copy_mode;
-	__u8	_pad;
+	uint32_t		copy_range;
+	uint8_t	copy_mode;
+	uint8_t	_pad;
 } __attribute__ ((packed));
 
 enum nfulnl_attr_config {
 	NFULA_CFG_UNSPEC,
 	NFULA_CFG_CMD,			/* nfulnl_msg_config_cmd */
 	NFULA_CFG_MODE,			/* nfulnl_msg_config_mode */
-	NFULA_CFG_NLBUFSIZ,		/* __u32 buffer size */
-	NFULA_CFG_TIMEOUT,		/* __u32 in 1/100 s */
-	NFULA_CFG_QTHRESH,		/* __u32 */
-	NFULA_CFG_FLAGS,		/* __u16 */
+	NFULA_CFG_NLBUFSIZ,		/* uint32_t buffer size */
+	NFULA_CFG_TIMEOUT,		/* uint32_t in 1/100 s */
+	NFULA_CFG_QTHRESH,		/* uint32_t */
+	NFULA_CFG_FLAGS,		/* uint16_t */
 	__NFULA_CFG_MAX
 };
 #define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)