Commit 98a4a861 authored by Al Viro's avatar Al Viro Committed by David S. Miller

[NETFILTER]: trivial annotations

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0e11c91e
...@@ -78,7 +78,7 @@ struct nfattr ...@@ -78,7 +78,7 @@ struct nfattr
struct nfgenmsg { struct nfgenmsg {
u_int8_t nfgen_family; /* AF_xxx */ u_int8_t nfgen_family; /* AF_xxx */
u_int8_t version; /* nfnetlink version */ u_int8_t version; /* nfnetlink version */
u_int16_t res_id; /* resource id */ __be16 res_id; /* resource id */
}; };
#define NFNETLINK_V0 0 #define NFNETLINK_V0 0
......
...@@ -16,20 +16,20 @@ enum nfulnl_msg_types { ...@@ -16,20 +16,20 @@ enum nfulnl_msg_types {
}; };
struct nfulnl_msg_packet_hdr { 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 hook; /* netfilter hook */
u_int8_t _pad; u_int8_t _pad;
}; };
struct nfulnl_msg_packet_hw { struct nfulnl_msg_packet_hw {
u_int16_t hw_addrlen; __be16 hw_addrlen;
u_int16_t _pad; u_int16_t _pad;
u_int8_t hw_addr[8]; u_int8_t hw_addr[8];
}; };
struct nfulnl_msg_packet_timestamp { struct nfulnl_msg_packet_timestamp {
aligned_u64 sec; aligned_be64 sec;
aligned_u64 usec; aligned_be64 usec;
}; };
#define NFULNL_PREFIXLEN 30 /* just like old log target */ #define NFULNL_PREFIXLEN 30 /* just like old log target */
...@@ -67,7 +67,7 @@ struct nfulnl_msg_config_cmd { ...@@ -67,7 +67,7 @@ struct nfulnl_msg_config_cmd {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct nfulnl_msg_config_mode { struct nfulnl_msg_config_mode {
u_int32_t copy_range; __be32 copy_range;
u_int8_t copy_mode; u_int8_t copy_mode;
u_int8_t _pad; u_int8_t _pad;
} __attribute__ ((packed)); } __attribute__ ((packed));
......
...@@ -13,20 +13,20 @@ enum nfqnl_msg_types { ...@@ -13,20 +13,20 @@ enum nfqnl_msg_types {
}; };
struct nfqnl_msg_packet_hdr { struct nfqnl_msg_packet_hdr {
u_int32_t packet_id; /* unique ID of packet in queue */ __be32 packet_id; /* unique ID of packet in queue */
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 hook; /* netfilter hook */
} __attribute__ ((packed)); } __attribute__ ((packed));
struct nfqnl_msg_packet_hw { struct nfqnl_msg_packet_hw {
u_int16_t hw_addrlen; __be16 hw_addrlen;
u_int16_t _pad; u_int16_t _pad;
u_int8_t hw_addr[8]; u_int8_t hw_addr[8];
}; };
struct nfqnl_msg_packet_timestamp { struct nfqnl_msg_packet_timestamp {
aligned_u64 sec; aligned_be64 sec;
aligned_u64 usec; aligned_be64 usec;
}; };
enum nfqnl_attr_type { enum nfqnl_attr_type {
...@@ -47,8 +47,8 @@ enum nfqnl_attr_type { ...@@ -47,8 +47,8 @@ enum nfqnl_attr_type {
#define NFQA_MAX (__NFQA_MAX - 1) #define NFQA_MAX (__NFQA_MAX - 1)
struct nfqnl_msg_verdict_hdr { struct nfqnl_msg_verdict_hdr {
u_int32_t verdict; __be32 verdict;
u_int32_t id; __be32 id;
}; };
...@@ -63,7 +63,7 @@ enum nfqnl_msg_config_cmds { ...@@ -63,7 +63,7 @@ enum nfqnl_msg_config_cmds {
struct nfqnl_msg_config_cmd { struct nfqnl_msg_config_cmd {
u_int8_t command; /* nfqnl_msg_config_cmds */ u_int8_t command; /* nfqnl_msg_config_cmds */
u_int8_t _pad; 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 { enum nfqnl_config_mode {
...@@ -73,7 +73,7 @@ enum nfqnl_config_mode { ...@@ -73,7 +73,7 @@ enum nfqnl_config_mode {
}; };
struct nfqnl_msg_config_params { struct nfqnl_msg_config_params {
u_int32_t copy_range; __be32 copy_range;
u_int8_t copy_mode; /* enum nfqnl_config_mode */ u_int8_t copy_mode; /* enum nfqnl_config_mode */
} __attribute__ ((packed)); } __attribute__ ((packed));
......
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
struct ip_conntrack_old_tuple struct ip_conntrack_old_tuple
{ {
struct { struct {
__u32 ip; __be32 ip;
union { union {
__u16 all; __u16 all;
} u; } u;
} src; } src;
struct { struct {
__u32 ip; __be32 ip;
union { union {
__u16 all; __u16 all;
} u; } u;
......
...@@ -39,7 +39,7 @@ struct xt_policy_elem ...@@ -39,7 +39,7 @@ struct xt_policy_elem
union xt_policy_addr smask; union xt_policy_addr smask;
union xt_policy_addr daddr; union xt_policy_addr daddr;
union xt_policy_addr dmask; union xt_policy_addr dmask;
u_int32_t spi; __be32 spi;
u_int32_t reqid; u_int32_t reqid;
u_int8_t proto; u_int8_t proto;
u_int8_t mode; u_int8_t mode;
......
...@@ -128,6 +128,8 @@ typedef __s64 int64_t; ...@@ -128,6 +128,8 @@ typedef __s64 int64_t;
/* this is a special 64bit data type that is 8-byte aligned */ /* this is a special 64bit data type that is 8-byte aligned */
#define aligned_u64 unsigned long long __attribute__((aligned(8))) #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. * The type used for indexing onto a disc or disc partition.
......
...@@ -414,7 +414,7 @@ __build_packet_message(struct nfulnl_instance *inst, ...@@ -414,7 +414,7 @@ __build_packet_message(struct nfulnl_instance *inst,
struct nfulnl_msg_packet_hdr pmsg; struct nfulnl_msg_packet_hdr pmsg;
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
struct nfgenmsg *nfmsg; struct nfgenmsg *nfmsg;
u_int32_t tmp_uint; __be32 tmp_uint;
UDEBUG("entered\n"); UDEBUG("entered\n");
...@@ -508,11 +508,9 @@ __build_packet_message(struct nfulnl_instance *inst, ...@@ -508,11 +508,9 @@ __build_packet_message(struct nfulnl_instance *inst,
if (indev && skb->dev && skb->dev->hard_header_parse) { if (indev && skb->dev && skb->dev->hard_header_parse) {
struct nfulnl_msg_packet_hw phw; struct nfulnl_msg_packet_hw phw;
int len = skb->dev->hard_header_parse((struct sk_buff *)skb,
phw.hw_addrlen =
skb->dev->hard_header_parse((struct sk_buff *)skb,
phw.hw_addr); phw.hw_addr);
phw.hw_addrlen = htons(phw.hw_addrlen); phw.hw_addrlen = htons(len);
NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw); NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw);
} }
...@@ -529,7 +527,7 @@ __build_packet_message(struct nfulnl_instance *inst, ...@@ -529,7 +527,7 @@ __build_packet_message(struct nfulnl_instance *inst,
if (skb->sk) { if (skb->sk) {
read_lock_bh(&skb->sk->sk_callback_lock); read_lock_bh(&skb->sk->sk_callback_lock);
if (skb->sk->sk_socket && skb->sk->sk_socket->file) { 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 */ /* need to unlock here since NFA_PUT may goto */
read_unlock_bh(&skb->sk->sk_callback_lock); read_unlock_bh(&skb->sk->sk_callback_lock);
NFA_PUT(inst->skb, NFULA_UID, sizeof(uid), &uid); NFA_PUT(inst->skb, NFULA_UID, sizeof(uid), &uid);
...@@ -882,15 +880,15 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ...@@ -882,15 +880,15 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
} }
if (nfula[NFULA_CFG_TIMEOUT-1]) { if (nfula[NFULA_CFG_TIMEOUT-1]) {
u_int32_t timeout = __be32 timeout =
*(u_int32_t *)NFA_DATA(nfula[NFULA_CFG_TIMEOUT-1]); *(__be32 *)NFA_DATA(nfula[NFULA_CFG_TIMEOUT-1]);
nfulnl_set_timeout(inst, ntohl(timeout)); nfulnl_set_timeout(inst, ntohl(timeout));
} }
if (nfula[NFULA_CFG_NLBUFSIZ-1]) { if (nfula[NFULA_CFG_NLBUFSIZ-1]) {
u_int32_t nlbufsiz = __be32 nlbufsiz =
*(u_int32_t *)NFA_DATA(nfula[NFULA_CFG_NLBUFSIZ-1]); *(__be32 *)NFA_DATA(nfula[NFULA_CFG_NLBUFSIZ-1]);
nfulnl_set_nlbufsiz(inst, ntohl(nlbufsiz)); nfulnl_set_nlbufsiz(inst, ntohl(nlbufsiz));
} }
...@@ -903,8 +901,8 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ...@@ -903,8 +901,8 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
} }
if (nfula[NFULA_CFG_FLAGS-1]) { if (nfula[NFULA_CFG_FLAGS-1]) {
u_int16_t flags = __be16 flags =
*(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]); *(__be16 *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]);
nfulnl_set_flags(inst, ntohs(flags)); nfulnl_set_flags(inst, ntohs(flags));
} }
......
...@@ -349,7 +349,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, ...@@ -349,7 +349,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
struct sk_buff *entskb = entry->skb; struct sk_buff *entskb = entry->skb;
struct net_device *indev; struct net_device *indev;
struct net_device *outdev; struct net_device *outdev;
unsigned int tmp_uint; __be32 tmp_uint;
QDEBUG("entered\n"); QDEBUG("entered\n");
...@@ -489,10 +489,9 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, ...@@ -489,10 +489,9 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
&& entskb->dev->hard_header_parse) { && entskb->dev->hard_header_parse) {
struct nfqnl_msg_packet_hw phw; struct nfqnl_msg_packet_hw phw;
phw.hw_addrlen = int len = entskb->dev->hard_header_parse(entskb,
entskb->dev->hard_header_parse(entskb,
phw.hw_addr); phw.hw_addr);
phw.hw_addrlen = htons(phw.hw_addrlen); phw.hw_addrlen = htons(len);
NFA_PUT(skb, NFQA_HWADDR, sizeof(phw), &phw); NFA_PUT(skb, NFQA_HWADDR, sizeof(phw), &phw);
} }
...@@ -835,7 +834,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb, ...@@ -835,7 +834,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
} }
if (nfqa[NFQA_MARK-1]) if (nfqa[NFQA_MARK-1])
entry->skb->nfmark = ntohl(*(u_int32_t *) entry->skb->nfmark = ntohl(*(__be32 *)
NFA_DATA(nfqa[NFQA_MARK-1])); NFA_DATA(nfqa[NFQA_MARK-1]));
issue_verdict(entry, verdict); issue_verdict(entry, verdict);
......
...@@ -104,7 +104,7 @@ match(const struct sk_buff *skb, ...@@ -104,7 +104,7 @@ match(const struct sk_buff *skb,
unsigned int protoff, unsigned int protoff,
int *hotdrop) int *hotdrop)
{ {
u16 _ports[2], *pptr; __be16 _ports[2], *pptr;
const struct xt_multiport *multiinfo = matchinfo; const struct xt_multiport *multiinfo = matchinfo;
if (offset) if (offset)
...@@ -135,7 +135,7 @@ match_v1(const struct sk_buff *skb, ...@@ -135,7 +135,7 @@ match_v1(const struct sk_buff *skb,
unsigned int protoff, unsigned int protoff,
int *hotdrop) int *hotdrop)
{ {
u16 _ports[2], *pptr; __be16 _ports[2], *pptr;
const struct xt_multiport_v1 *multiinfo = matchinfo; const struct xt_multiport_v1 *multiinfo = matchinfo;
if (offset) if (offset)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment