Skip to content

Commit

Permalink
make netfilter use strict integer types
Browse files Browse the repository at this point in the history
Netfilter traditionally uses BSD integer types in its
interface headers. This changes it to use the Linux
strict integer types, like everyone else.

Cc: netfilter-devel@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Arnd Bergmann authored and Ingo Molnar committed Mar 26, 2009
1 parent 1d7f83d commit 60c195c
Show file tree
Hide file tree
Showing 39 changed files with 260 additions and 190 deletions.
6 changes: 4 additions & 2 deletions include/linux/netfilter/nf_conntrack_tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define _NF_CONNTRACK_TCP_H
/* TCP tracking. */

#include <linux/types.h>

/* This is exposed to userspace (ctnetlink) */
enum tcp_conntrack {
TCP_CONNTRACK_NONE,
Expand Down Expand Up @@ -34,8 +36,8 @@ enum tcp_conntrack {
#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10

struct nf_ct_tcp_flags {
u_int8_t flags;
u_int8_t mask;
__u8 flags;
__u8 mask;
};

#ifdef __KERNEL__
Expand Down
4 changes: 2 additions & 2 deletions include/linux/netfilter/nfnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ enum nfnetlink_groups {
/* General form of address family dependent message.
*/
struct nfgenmsg {
u_int8_t nfgen_family; /* AF_xxx */
u_int8_t version; /* nfnetlink version */
__u8 nfgen_family; /* AF_xxx */
__u8 version; /* nfnetlink version */
__be16 res_id; /* resource id */
};

Expand Down
7 changes: 5 additions & 2 deletions include/linux/netfilter/nfnetlink_compat.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#ifndef _NFNETLINK_COMPAT_H
#define _NFNETLINK_COMPAT_H

#include <linux/types.h>

#ifndef __KERNEL__
/* Old nfnetlink macros for userspace */

Expand All @@ -20,8 +23,8 @@

struct nfattr
{
u_int16_t nfa_len;
u_int16_t nfa_type; /* we use 15 bits for the type, and the highest
__u16 nfa_len;
__u16 nfa_type; /* we use 15 bits for the type, and the highest
* bit to indicate whether the payload is nested */
};

Expand Down
32 changes: 16 additions & 16 deletions include/linux/netfilter/nfnetlink_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ enum nfulnl_msg_types {

struct nfulnl_msg_packet_hdr {
__be16 hw_protocol; /* hw protocol (network order) */
u_int8_t hook; /* netfilter hook */
u_int8_t _pad;
__u8 hook; /* netfilter hook */
__u8 _pad;
};

struct nfulnl_msg_packet_hw {
__be16 hw_addrlen;
u_int16_t _pad;
u_int8_t hw_addr[8];
__u16 _pad;
__u8 hw_addr[8];
};

struct nfulnl_msg_packet_timestamp {
Expand All @@ -35,12 +35,12 @@ struct nfulnl_msg_packet_timestamp {
enum nfulnl_attr_type {
NFULA_UNSPEC,
NFULA_PACKET_HDR,
NFULA_MARK, /* u_int32_t nfmark */
NFULA_MARK, /* __u32 nfmark */
NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */
NFULA_IFINDEX_INDEV, /* u_int32_t ifindex */
NFULA_IFINDEX_OUTDEV, /* u_int32_t ifindex */
NFULA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */
NFULA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */
NFULA_IFINDEX_INDEV, /* __u32 ifindex */
NFULA_IFINDEX_OUTDEV, /* __u32 ifindex */
NFULA_IFINDEX_PHYSINDEV, /* __u32 ifindex */
NFULA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */
NFULA_HWADDR, /* nfulnl_msg_packet_hw */
NFULA_PAYLOAD, /* opaque data payload */
NFULA_PREFIX, /* string prefix */
Expand All @@ -65,23 +65,23 @@ enum nfulnl_msg_config_cmds {
};

struct nfulnl_msg_config_cmd {
u_int8_t command; /* nfulnl_msg_config_cmds */
__u8 command; /* nfulnl_msg_config_cmds */
} __attribute__ ((packed));

struct nfulnl_msg_config_mode {
__be32 copy_range;
u_int8_t copy_mode;
u_int8_t _pad;
__u8 copy_mode;
__u8 _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, /* u_int32_t buffer size */
NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */
NFULA_CFG_QTHRESH, /* u_int32_t */
NFULA_CFG_FLAGS, /* u_int16_t */
NFULA_CFG_NLBUFSIZ, /* __u32 buffer size */
NFULA_CFG_TIMEOUT, /* __u32 in 1/100 s */
NFULA_CFG_QTHRESH, /* __u32 */
NFULA_CFG_FLAGS, /* __u16 */
__NFULA_CFG_MAX
};
#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
Expand Down
24 changes: 12 additions & 12 deletions include/linux/netfilter/nfnetlink_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ enum nfqnl_msg_types {
struct nfqnl_msg_packet_hdr {
__be32 packet_id; /* unique ID of packet in queue */
__be16 hw_protocol; /* hw protocol (network order) */
u_int8_t hook; /* netfilter hook */
__u8 hook; /* netfilter hook */
} __attribute__ ((packed));

struct nfqnl_msg_packet_hw {
__be16 hw_addrlen;
u_int16_t _pad;
u_int8_t hw_addr[8];
__u16 _pad;
__u8 hw_addr[8];
};

struct nfqnl_msg_packet_timestamp {
Expand All @@ -33,12 +33,12 @@ enum nfqnl_attr_type {
NFQA_UNSPEC,
NFQA_PACKET_HDR,
NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */
NFQA_MARK, /* u_int32_t nfmark */
NFQA_MARK, /* __u32 nfmark */
NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */
NFQA_IFINDEX_INDEV, /* u_int32_t ifindex */
NFQA_IFINDEX_OUTDEV, /* u_int32_t ifindex */
NFQA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */
NFQA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */
NFQA_IFINDEX_INDEV, /* __u32 ifindex */
NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */
NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */
NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */
NFQA_HWADDR, /* nfqnl_msg_packet_hw */
NFQA_PAYLOAD, /* opaque data payload */

Expand All @@ -61,8 +61,8 @@ enum nfqnl_msg_config_cmds {
};

struct nfqnl_msg_config_cmd {
u_int8_t command; /* nfqnl_msg_config_cmds */
u_int8_t _pad;
__u8 command; /* nfqnl_msg_config_cmds */
__u8 _pad;
__be16 pf; /* AF_xxx for PF_[UN]BIND */
};

Expand All @@ -74,15 +74,15 @@ enum nfqnl_config_mode {

struct nfqnl_msg_config_params {
__be32 copy_range;
u_int8_t copy_mode; /* enum nfqnl_config_mode */
__u8 copy_mode; /* enum nfqnl_config_mode */
} __attribute__ ((packed));


enum nfqnl_attr_config {
NFQA_CFG_UNSPEC,
NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */
NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */
NFQA_CFG_QUEUE_MAXLEN, /* u_int32_t */
NFQA_CFG_QUEUE_MAXLEN, /* __u32 */
__NFQA_CFG_MAX
};
#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
Expand Down
30 changes: 16 additions & 14 deletions include/linux/netfilter/x_tables.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
#ifndef _X_TABLES_H
#define _X_TABLES_H

#include <linux/types.h>

#define XT_FUNCTION_MAXNAMELEN 30
#define XT_TABLE_MAXNAMELEN 32

struct xt_entry_match
{
union {
struct {
u_int16_t match_size;
__u16 match_size;

/* Used by userspace */
char name[XT_FUNCTION_MAXNAMELEN-1];

u_int8_t revision;
__u8 revision;
} user;
struct {
u_int16_t match_size;
__u16 match_size;

/* Used inside the kernel */
struct xt_match *match;
} kernel;

/* Total length */
u_int16_t match_size;
__u16 match_size;
} u;

unsigned char data[0];
Expand All @@ -33,22 +35,22 @@ struct xt_entry_target
{
union {
struct {
u_int16_t target_size;
__u16 target_size;

/* Used by userspace */
char name[XT_FUNCTION_MAXNAMELEN-1];

u_int8_t revision;
__u8 revision;
} user;
struct {
u_int16_t target_size;
__u16 target_size;

/* Used inside the kernel */
struct xt_target *target;
} kernel;

/* Total length */
u_int16_t target_size;
__u16 target_size;
} u;

unsigned char data[0];
Expand All @@ -74,7 +76,7 @@ struct xt_get_revision
{
char name[XT_FUNCTION_MAXNAMELEN-1];

u_int8_t revision;
__u8 revision;
};

/* CONTINUE verdict for targets */
Expand All @@ -90,10 +92,10 @@ struct xt_get_revision
*/
struct _xt_align
{
u_int8_t u8;
u_int16_t u16;
u_int32_t u32;
u_int64_t u64;
__u8 u8;
__u16 u16;
__u32 u32;
__u64 u64;
};

#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \
Expand All @@ -109,7 +111,7 @@ struct _xt_align

struct xt_counters
{
u_int64_t pcnt, bcnt; /* Packet and byte counters */
__u64 pcnt, bcnt; /* Packet and byte counters */
};

/* The argument to IPT_SO_ADD_COUNTERS. */
Expand Down
4 changes: 3 additions & 1 deletion include/linux/netfilter/xt_CLASSIFY.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#ifndef _XT_CLASSIFY_H
#define _XT_CLASSIFY_H

#include <linux/types.h>

struct xt_classify_target_info {
u_int32_t priority;
__u32 priority;
};

#endif /*_XT_CLASSIFY_H */
8 changes: 5 additions & 3 deletions include/linux/netfilter/xt_CONNMARK.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _XT_CONNMARK_H_target
#define _XT_CONNMARK_H_target

#include <linux/types.h>

/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
* by Henrik Nordstrom <hno@marasystems.com>
*
Expand All @@ -19,12 +21,12 @@ enum {
struct xt_connmark_target_info {
unsigned long mark;
unsigned long mask;
u_int8_t mode;
__u8 mode;
};

struct xt_connmark_tginfo1 {
u_int32_t ctmark, ctmask, nfmask;
u_int8_t mode;
__u32 ctmark, ctmask, nfmask;
__u8 mode;
};

#endif /*_XT_CONNMARK_H_target*/
4 changes: 3 additions & 1 deletion include/linux/netfilter/xt_CONNSECMARK.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#ifndef _XT_CONNSECMARK_H_target
#define _XT_CONNSECMARK_H_target

#include <linux/types.h>

enum {
CONNSECMARK_SAVE = 1,
CONNSECMARK_RESTORE,
};

struct xt_connsecmark_target_info {
u_int8_t mode;
__u8 mode;
};

#endif /*_XT_CONNSECMARK_H_target */
7 changes: 4 additions & 3 deletions include/linux/netfilter/xt_DSCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
#ifndef _XT_DSCP_TARGET_H
#define _XT_DSCP_TARGET_H
#include <linux/netfilter/xt_dscp.h>
#include <linux/types.h>

/* target info */
struct xt_DSCP_info {
u_int8_t dscp;
__u8 dscp;
};

struct xt_tos_target_info {
u_int8_t tos_value;
u_int8_t tos_mask;
__u8 tos_value;
__u8 tos_mask;
};

#endif /* _XT_DSCP_TARGET_H */
6 changes: 4 additions & 2 deletions include/linux/netfilter/xt_MARK.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _XT_MARK_H_target
#define _XT_MARK_H_target

#include <linux/types.h>

/* Version 0 */
struct xt_mark_target_info {
unsigned long mark;
Expand All @@ -15,11 +17,11 @@ enum {

struct xt_mark_target_info_v1 {
unsigned long mark;
u_int8_t mode;
__u8 mode;
};

struct xt_mark_tginfo2 {
u_int32_t mark, mask;
__u32 mark, mask;
};

#endif /*_XT_MARK_H_target */
Loading

0 comments on commit 60c195c

Please sign in to comment.