[NETFILTER]: trivial annotations
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 8 Nov 2006 08:26:51 +0000 (00:26 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:21:25 +0000 (21:21 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netfilter/nfnetlink.h
include/linux/netfilter/nfnetlink_log.h
include/linux/netfilter/nfnetlink_queue.h
include/linux/netfilter/xt_conntrack.h
include/linux/netfilter/xt_policy.h
include/linux/types.h
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c
net/netfilter/xt_multiport.c

index 6d8e3e5a80e90194d01a055235d4946fd89cfda5..1e9c821f152d5063b0a2267efd9c38ff682d27c2 100644 (file)
@@ -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
index 87b92f8b988fb30315c2ff62dde356a186857194..55a2a2b814ed824ad5b795fd3a14259e6c72fe53 100644 (file)
@@ -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 */
@@ -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));
index 36af0360b56d7492e5a3cf2bea83f0f18c3d32e1..4beea3d6fda8492af67765e58de97e6087b2a093 100644 (file)
@@ -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 {
@@ -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;
 };
 
 
@@ -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 {
@@ -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));
 
index 4c2d9945ca54a50034d488ce8e472e404bafed9b..70b6f718cf4cbe5fa48d51725a7d00f4fdf55054 100644 (file)
 struct ip_conntrack_old_tuple
 {
        struct {
-               __u32 ip;
+               __be32 ip;
                union {
                        __u16 all;
                } u;
        } src;
 
        struct {
-               __u32 ip;
+               __be32 ip;
                union {
                        __u16 all;
                } u;
index a8132ec076fb80656f845f1344ebde9ffcb4663a..45654d359a68c39653af02d832e2f7b2a2eec3de 100644 (file)
@@ -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;
index 750f085fa564f75a0547a7ddcc38176cb63d4571..9f11fdd2bd72868f122d04b508189f2b9d514481 100644 (file)
@@ -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.
index 1e5207b80fe54413cc3bd802574b16daafa55ffc..856ed0d1997418d8f4312bc87717c255b98a4026 100644 (file)
@@ -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");
                
@@ -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);
        }
 
@@ -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);
@@ -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));
        }
@@ -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));
        }
 
index e815a9aa6e95dfbffd7b04a28bd944d0cd27101b..4ab7b1416bb578b7d7fd6e68effc9075b7278504 100644 (file)
@@ -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");
 
@@ -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);
        }
 
@@ -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);
index d3aefd38093042f6d12b85f11b807544ffb597ee..b4293058c6ff722fed9e4e8d017ad5481337e1b6 100644 (file)
@@ -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)
@@ -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)