Skip to content

Commit

Permalink
[NETFILTER]: trivial annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Al Viro authored and David S. Miller committed Dec 3, 2006
1 parent 0e11c91 commit 98a4a86
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 37 deletions.
2 changes: 1 addition & 1 deletion include/linux/netfilter/nfnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct nfattr
struct nfgenmsg {
u_int8_t nfgen_family; /* AF_xxx */
u_int8_t version; /* nfnetlink version */
u_int16_t res_id; /* resource id */
__be16 res_id; /* resource id */
};

#define NFNETLINK_V0 0
Expand Down
10 changes: 5 additions & 5 deletions include/linux/netfilter/nfnetlink_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ enum nfulnl_msg_types {
};

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

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

struct nfulnl_msg_packet_timestamp {
aligned_u64 sec;
aligned_u64 usec;
aligned_be64 sec;
aligned_be64 usec;
};

#define NFULNL_PREFIXLEN 30 /* just like old log target */
Expand Down Expand Up @@ -67,7 +67,7 @@ struct nfulnl_msg_config_cmd {
} __attribute__ ((packed));

struct nfulnl_msg_config_mode {
u_int32_t copy_range;
__be32 copy_range;
u_int8_t copy_mode;
u_int8_t _pad;
} __attribute__ ((packed));
Expand Down
18 changes: 9 additions & 9 deletions include/linux/netfilter/nfnetlink_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ enum nfqnl_msg_types {
};

struct nfqnl_msg_packet_hdr {
u_int32_t packet_id; /* unique ID of packet in queue */
u_int16_t hw_protocol; /* hw protocol (network order) */
__be32 packet_id; /* unique ID of packet in queue */
__be16 hw_protocol; /* hw protocol (network order) */
u_int8_t hook; /* netfilter hook */
} __attribute__ ((packed));

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

struct nfqnl_msg_packet_timestamp {
aligned_u64 sec;
aligned_u64 usec;
aligned_be64 sec;
aligned_be64 usec;
};

enum nfqnl_attr_type {
Expand All @@ -47,8 +47,8 @@ enum nfqnl_attr_type {
#define NFQA_MAX (__NFQA_MAX - 1)

struct nfqnl_msg_verdict_hdr {
u_int32_t verdict;
u_int32_t id;
__be32 verdict;
__be32 id;
};


Expand All @@ -63,7 +63,7 @@ enum nfqnl_msg_config_cmds {
struct nfqnl_msg_config_cmd {
u_int8_t command; /* nfqnl_msg_config_cmds */
u_int8_t _pad;
u_int16_t pf; /* AF_xxx for PF_[UN]BIND */
__be16 pf; /* AF_xxx for PF_[UN]BIND */
};

enum nfqnl_config_mode {
Expand All @@ -73,7 +73,7 @@ enum nfqnl_config_mode {
};

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

Expand Down
4 changes: 2 additions & 2 deletions include/linux/netfilter/xt_conntrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
struct ip_conntrack_old_tuple
{
struct {
__u32 ip;
__be32 ip;
union {
__u16 all;
} u;
} src;

struct {
__u32 ip;
__be32 ip;
union {
__u16 all;
} u;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/netfilter/xt_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct xt_policy_elem
union xt_policy_addr smask;
union xt_policy_addr daddr;
union xt_policy_addr dmask;
u_int32_t spi;
__be32 spi;
u_int32_t reqid;
u_int8_t proto;
u_int8_t mode;
Expand Down
2 changes: 2 additions & 0 deletions include/linux/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ typedef __s64 int64_t;

/* this is a special 64bit data type that is 8-byte aligned */
#define aligned_u64 unsigned long long __attribute__((aligned(8)))
#define aligned_be64 __be64 __attribute__((aligned(8)))
#define aligned_le64 __le64 __attribute__((aligned(8)))

/**
* The type used for indexing onto a disc or disc partition.
Expand Down
22 changes: 10 additions & 12 deletions net/netfilter/nfnetlink_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ __build_packet_message(struct nfulnl_instance *inst,
struct nfulnl_msg_packet_hdr pmsg;
struct nlmsghdr *nlh;
struct nfgenmsg *nfmsg;
u_int32_t tmp_uint;
__be32 tmp_uint;

UDEBUG("entered\n");

Expand Down Expand Up @@ -508,11 +508,9 @@ __build_packet_message(struct nfulnl_instance *inst,

if (indev && skb->dev && skb->dev->hard_header_parse) {
struct nfulnl_msg_packet_hw phw;

phw.hw_addrlen =
skb->dev->hard_header_parse((struct sk_buff *)skb,
int len = skb->dev->hard_header_parse((struct sk_buff *)skb,
phw.hw_addr);
phw.hw_addrlen = htons(phw.hw_addrlen);
phw.hw_addrlen = htons(len);
NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw);
}

Expand All @@ -529,7 +527,7 @@ __build_packet_message(struct nfulnl_instance *inst,
if (skb->sk) {
read_lock_bh(&skb->sk->sk_callback_lock);
if (skb->sk->sk_socket && skb->sk->sk_socket->file) {
u_int32_t uid = htonl(skb->sk->sk_socket->file->f_uid);
__be32 uid = htonl(skb->sk->sk_socket->file->f_uid);
/* need to unlock here since NFA_PUT may goto */
read_unlock_bh(&skb->sk->sk_callback_lock);
NFA_PUT(inst->skb, NFULA_UID, sizeof(uid), &uid);
Expand Down Expand Up @@ -882,15 +880,15 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
}

if (nfula[NFULA_CFG_TIMEOUT-1]) {
u_int32_t timeout =
*(u_int32_t *)NFA_DATA(nfula[NFULA_CFG_TIMEOUT-1]);
__be32 timeout =
*(__be32 *)NFA_DATA(nfula[NFULA_CFG_TIMEOUT-1]);

nfulnl_set_timeout(inst, ntohl(timeout));
}

if (nfula[NFULA_CFG_NLBUFSIZ-1]) {
u_int32_t nlbufsiz =
*(u_int32_t *)NFA_DATA(nfula[NFULA_CFG_NLBUFSIZ-1]);
__be32 nlbufsiz =
*(__be32 *)NFA_DATA(nfula[NFULA_CFG_NLBUFSIZ-1]);

nfulnl_set_nlbufsiz(inst, ntohl(nlbufsiz));
}
Expand All @@ -903,8 +901,8 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
}

if (nfula[NFULA_CFG_FLAGS-1]) {
u_int16_t flags =
*(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]);
__be16 flags =
*(__be16 *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]);
nfulnl_set_flags(inst, ntohs(flags));
}

Expand Down
9 changes: 4 additions & 5 deletions net/netfilter/nfnetlink_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
struct sk_buff *entskb = entry->skb;
struct net_device *indev;
struct net_device *outdev;
unsigned int tmp_uint;
__be32 tmp_uint;

QDEBUG("entered\n");

Expand Down Expand Up @@ -489,10 +489,9 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
&& entskb->dev->hard_header_parse) {
struct nfqnl_msg_packet_hw phw;

phw.hw_addrlen =
entskb->dev->hard_header_parse(entskb,
int len = entskb->dev->hard_header_parse(entskb,
phw.hw_addr);
phw.hw_addrlen = htons(phw.hw_addrlen);
phw.hw_addrlen = htons(len);
NFA_PUT(skb, NFQA_HWADDR, sizeof(phw), &phw);
}

Expand Down Expand Up @@ -835,7 +834,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
}

if (nfqa[NFQA_MARK-1])
entry->skb->nfmark = ntohl(*(u_int32_t *)
entry->skb->nfmark = ntohl(*(__be32 *)
NFA_DATA(nfqa[NFQA_MARK-1]));

issue_verdict(entry, verdict);
Expand Down
4 changes: 2 additions & 2 deletions net/netfilter/xt_multiport.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ match(const struct sk_buff *skb,
unsigned int protoff,
int *hotdrop)
{
u16 _ports[2], *pptr;
__be16 _ports[2], *pptr;
const struct xt_multiport *multiinfo = matchinfo;

if (offset)
Expand Down Expand Up @@ -135,7 +135,7 @@ match_v1(const struct sk_buff *skb,
unsigned int protoff,
int *hotdrop)
{
u16 _ports[2], *pptr;
__be16 _ports[2], *pptr;
const struct xt_multiport_v1 *multiinfo = matchinfo;

if (offset)
Expand Down

0 comments on commit 98a4a86

Please sign in to comment.