提交 47c183fa 编写于 作者: A Al Viro 提交者: David S. Miller

[BRIDGE]: Annotations.

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 30d492da
...@@ -64,7 +64,7 @@ static inline int nf_bridge_pad(const struct sk_buff *skb) ...@@ -64,7 +64,7 @@ static inline int nf_bridge_pad(const struct sk_buff *skb)
struct bridge_skb_cb { struct bridge_skb_cb {
union { union {
__u32 ipv4; __be32 ipv4;
} daddr; } daddr;
}; };
......
...@@ -28,21 +28,21 @@ struct hdr_ui { ...@@ -28,21 +28,21 @@ struct hdr_ui {
uint8_t ssap; uint8_t ssap;
uint8_t ctrl; uint8_t ctrl;
uint8_t orig[3]; uint8_t orig[3];
uint16_t type; __be16 type;
}; };
struct hdr_ni { struct hdr_ni {
uint8_t dsap; uint8_t dsap;
uint8_t ssap; uint8_t ssap;
uint16_t ctrl; __be16 ctrl;
uint8_t orig[3]; uint8_t orig[3];
uint16_t type; __be16 type;
}; };
struct ebt_802_3_hdr { struct ebt_802_3_hdr {
uint8_t daddr[6]; uint8_t daddr[6];
uint8_t saddr[6]; uint8_t saddr[6];
uint16_t len; __be16 len;
union { union {
struct hdr_ui ui; struct hdr_ui ui;
struct hdr_ni ni; struct hdr_ni ni;
...@@ -61,7 +61,7 @@ static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) ...@@ -61,7 +61,7 @@ static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
struct ebt_802_3_info struct ebt_802_3_info
{ {
uint8_t sap; uint8_t sap;
uint16_t type; __be16 type;
uint8_t bitmask; uint8_t bitmask;
uint8_t invflags; uint8_t invflags;
}; };
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
struct ebt_mac_wormhash_tuple struct ebt_mac_wormhash_tuple
{ {
uint32_t cmp[2]; uint32_t cmp[2];
uint32_t ip; __be32 ip;
}; };
struct ebt_mac_wormhash struct ebt_mac_wormhash
......
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
struct ebt_arp_info struct ebt_arp_info
{ {
uint16_t htype; __be16 htype;
uint16_t ptype; __be16 ptype;
uint16_t opcode; __be16 opcode;
uint32_t saddr; __be32 saddr;
uint32_t smsk; __be32 smsk;
uint32_t daddr; __be32 daddr;
uint32_t dmsk; __be32 dmsk;
unsigned char smaddr[ETH_ALEN]; unsigned char smaddr[ETH_ALEN];
unsigned char smmsk[ETH_ALEN]; unsigned char smmsk[ETH_ALEN];
unsigned char dmaddr[ETH_ALEN]; unsigned char dmaddr[ETH_ALEN];
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
/* the same values are used for the invflags */ /* the same values are used for the invflags */
struct ebt_ip_info struct ebt_ip_info
{ {
uint32_t saddr; __be32 saddr;
uint32_t daddr; __be32 daddr;
uint32_t smsk; __be32 smsk;
uint32_t dmsk; __be32 dmsk;
uint8_t tos; uint8_t tos;
uint8_t protocol; uint8_t protocol;
uint8_t bitmask; uint8_t bitmask;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
struct ebt_vlan_info { struct ebt_vlan_info {
uint16_t id; /* VLAN ID {1-4095} */ uint16_t id; /* VLAN ID {1-4095} */
uint8_t prio; /* VLAN User Priority {0-7} */ uint8_t prio; /* VLAN User Priority {0-7} */
uint16_t encap; /* VLAN Encapsulated frame code {0-65535} */ __be16 encap; /* VLAN Encapsulated frame code {0-65535} */
uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg,
bit 2=1 User-Priority arg, bit 3=1 encap*/ bit 2=1 User-Priority arg, bit 3=1 encap*/
uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg,
......
...@@ -141,7 +141,7 @@ struct ebt_entry { ...@@ -141,7 +141,7 @@ struct ebt_entry {
/* this needs to be the first field */ /* this needs to be the first field */
unsigned int bitmask; unsigned int bitmask;
unsigned int invflags; unsigned int invflags;
uint16_t ethproto; __be16 ethproto;
/* the physical in-dev */ /* the physical in-dev */
char in[IFNAMSIZ]; char in[IFNAMSIZ];
/* the logical in-dev */ /* the logical in-dev */
......
...@@ -381,7 +381,7 @@ static int check_hbh_len(struct sk_buff *skb) ...@@ -381,7 +381,7 @@ static int check_hbh_len(struct sk_buff *skb)
case IPV6_TLV_JUMBO: case IPV6_TLV_JUMBO:
if (skb->nh.raw[off + 1] != 4 || (off & 3) != 2) if (skb->nh.raw[off + 1] != 4 || (off & 3) != 2)
goto bad; goto bad;
pkt_len = ntohl(*(u32 *) (skb->nh.raw + off + 2)); pkt_len = ntohl(*(__be32 *) (skb->nh.raw + off + 2));
if (pkt_len <= IPV6_MAXPLEN || if (pkt_len <= IPV6_MAXPLEN ||
skb->nh.ipv6h->payload_len) skb->nh.ipv6h->payload_len)
goto bad; goto bad;
......
...@@ -17,7 +17,7 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device * ...@@ -17,7 +17,7 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *
{ {
struct ebt_802_3_info *info = (struct ebt_802_3_info *)data; struct ebt_802_3_info *info = (struct ebt_802_3_info *)data;
struct ebt_802_3_hdr *hdr = ebt_802_3_hdr(skb); struct ebt_802_3_hdr *hdr = ebt_802_3_hdr(skb);
uint16_t type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type; __be16 type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type;
if (info->bitmask & EBT_802_3_SAP) { if (info->bitmask & EBT_802_3_SAP) {
if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP)) if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP))
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/module.h> #include <linux/module.h>
static int ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh, static int ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh,
const char *mac, uint32_t ip) const char *mac, __be32 ip)
{ {
/* You may be puzzled as to how this code works. /* You may be puzzled as to how this code works.
* Some tricks were used, refer to * Some tricks were used, refer to
...@@ -70,7 +70,7 @@ static int ebt_mac_wormhash_check_integrity(const struct ebt_mac_wormhash ...@@ -70,7 +70,7 @@ static int ebt_mac_wormhash_check_integrity(const struct ebt_mac_wormhash
return 0; return 0;
} }
static int get_ip_dst(const struct sk_buff *skb, uint32_t *addr) static int get_ip_dst(const struct sk_buff *skb, __be32 *addr)
{ {
if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) { if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) {
struct iphdr _iph, *ih; struct iphdr _iph, *ih;
...@@ -81,16 +81,16 @@ static int get_ip_dst(const struct sk_buff *skb, uint32_t *addr) ...@@ -81,16 +81,16 @@ static int get_ip_dst(const struct sk_buff *skb, uint32_t *addr)
*addr = ih->daddr; *addr = ih->daddr;
} else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) { } else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
struct arphdr _arph, *ah; struct arphdr _arph, *ah;
uint32_t buf, *bp; __be32 buf, *bp;
ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph); ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
if (ah == NULL || if (ah == NULL ||
ah->ar_pln != sizeof(uint32_t) || ah->ar_pln != sizeof(__be32) ||
ah->ar_hln != ETH_ALEN) ah->ar_hln != ETH_ALEN)
return -1; return -1;
bp = skb_header_pointer(skb, sizeof(struct arphdr) + bp = skb_header_pointer(skb, sizeof(struct arphdr) +
2 * ETH_ALEN + sizeof(uint32_t), 2 * ETH_ALEN + sizeof(__be32),
sizeof(uint32_t), &buf); sizeof(__be32), &buf);
if (bp == NULL) if (bp == NULL)
return -1; return -1;
*addr = *bp; *addr = *bp;
...@@ -98,7 +98,7 @@ static int get_ip_dst(const struct sk_buff *skb, uint32_t *addr) ...@@ -98,7 +98,7 @@ static int get_ip_dst(const struct sk_buff *skb, uint32_t *addr)
return 0; return 0;
} }
static int get_ip_src(const struct sk_buff *skb, uint32_t *addr) static int get_ip_src(const struct sk_buff *skb, __be32 *addr)
{ {
if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) { if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) {
struct iphdr _iph, *ih; struct iphdr _iph, *ih;
...@@ -109,15 +109,15 @@ static int get_ip_src(const struct sk_buff *skb, uint32_t *addr) ...@@ -109,15 +109,15 @@ static int get_ip_src(const struct sk_buff *skb, uint32_t *addr)
*addr = ih->saddr; *addr = ih->saddr;
} else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) { } else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
struct arphdr _arph, *ah; struct arphdr _arph, *ah;
uint32_t buf, *bp; __be32 buf, *bp;
ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph); ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
if (ah == NULL || if (ah == NULL ||
ah->ar_pln != sizeof(uint32_t) || ah->ar_pln != sizeof(__be32) ||
ah->ar_hln != ETH_ALEN) ah->ar_hln != ETH_ALEN)
return -1; return -1;
bp = skb_header_pointer(skb, sizeof(struct arphdr) + bp = skb_header_pointer(skb, sizeof(struct arphdr) +
ETH_ALEN, sizeof(uint32_t), &buf); ETH_ALEN, sizeof(__be32), &buf);
if (bp == NULL) if (bp == NULL)
return -1; return -1;
*addr = *bp; *addr = *bp;
...@@ -133,7 +133,7 @@ static int ebt_filter_among(const struct sk_buff *skb, ...@@ -133,7 +133,7 @@ static int ebt_filter_among(const struct sk_buff *skb,
struct ebt_among_info *info = (struct ebt_among_info *) data; struct ebt_among_info *info = (struct ebt_among_info *) data;
const char *dmac, *smac; const char *dmac, *smac;
const struct ebt_mac_wormhash *wh_dst, *wh_src; const struct ebt_mac_wormhash *wh_dst, *wh_src;
uint32_t dip = 0, sip = 0; __be32 dip = 0, sip = 0;
wh_dst = ebt_among_wh_dst(info); wh_dst = ebt_among_wh_dst(info);
wh_src = ebt_among_wh_src(info); wh_src = ebt_among_wh_src(info);
......
...@@ -35,10 +35,10 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in ...@@ -35,10 +35,10 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in
return EBT_NOMATCH; return EBT_NOMATCH;
if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP)) { if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP)) {
uint32_t _addr, *ap; __be32 _addr, *ap;
/* IPv4 addresses are always 4 bytes */ /* IPv4 addresses are always 4 bytes */
if (ah->ar_pln != sizeof(uint32_t)) if (ah->ar_pln != sizeof(__be32))
return EBT_NOMATCH; return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_SRC_IP) { if (info->bitmask & EBT_ARP_SRC_IP) {
ap = skb_header_pointer(skb, sizeof(struct arphdr) + ap = skb_header_pointer(skb, sizeof(struct arphdr) +
...@@ -53,7 +53,7 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in ...@@ -53,7 +53,7 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in
if (info->bitmask & EBT_ARP_DST_IP) { if (info->bitmask & EBT_ARP_DST_IP) {
ap = skb_header_pointer(skb, sizeof(struct arphdr) + ap = skb_header_pointer(skb, sizeof(struct arphdr) +
2*ah->ar_hln+sizeof(uint32_t), 2*ah->ar_hln+sizeof(__be32),
sizeof(_addr), &_addr); sizeof(_addr), &_addr);
if (ap == NULL) if (ap == NULL)
return EBT_NOMATCH; return EBT_NOMATCH;
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
#include <linux/module.h> #include <linux/module.h>
struct tcpudphdr { struct tcpudphdr {
uint16_t src; __be16 src;
uint16_t dst; __be16 dst;
}; };
static int ebt_filter_ip(const struct sk_buff *skb, const struct net_device *in, static int ebt_filter_ip(const struct sk_buff *skb, const struct net_device *in,
......
...@@ -38,8 +38,8 @@ static int ebt_log_check(const char *tablename, unsigned int hookmask, ...@@ -38,8 +38,8 @@ static int ebt_log_check(const char *tablename, unsigned int hookmask,
struct tcpudphdr struct tcpudphdr
{ {
uint16_t src; __be16 src;
uint16_t dst; __be16 dst;
}; };
struct arppayload struct arppayload
...@@ -130,7 +130,7 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum, ...@@ -130,7 +130,7 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum,
* then log the ARP payload */ * then log the ARP payload */
if (ah->ar_hrd == htons(1) && if (ah->ar_hrd == htons(1) &&
ah->ar_hln == ETH_ALEN && ah->ar_hln == ETH_ALEN &&
ah->ar_pln == sizeof(uint32_t)) { ah->ar_pln == sizeof(__be32)) {
struct arppayload _arpp, *ap; struct arppayload _arpp, *ap;
ap = skb_header_pointer(skb, sizeof(_arph), ap = skb_header_pointer(skb, sizeof(_arph),
......
...@@ -55,7 +55,7 @@ ebt_filter_vlan(const struct sk_buff *skb, ...@@ -55,7 +55,7 @@ ebt_filter_vlan(const struct sk_buff *skb,
unsigned short id; /* VLAN ID, given from frame TCI */ unsigned short id; /* VLAN ID, given from frame TCI */
unsigned char prio; /* user_priority, given from frame TCI */ unsigned char prio; /* user_priority, given from frame TCI */
/* VLAN encapsulated Type/Length field, given from orig frame */ /* VLAN encapsulated Type/Length field, given from orig frame */
unsigned short encap; __be16 encap;
fp = skb_header_pointer(skb, 0, sizeof(_frame), &_frame); fp = skb_header_pointer(skb, 0, sizeof(_frame), &_frame);
if (fp == NULL) if (fp == NULL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册