The following commit has been merged in the master branch: commit 276f0536dbd34401bfa4ee5024b378eb50525c6b Author: Al Viro viro@ZenIV.linux.org.uk Date: Sun Apr 22 07:47:50 2012 +0100
batman-adv: trivial endianness annotations
Signed-off-by: Al Viro viro@zeniv.linux.org.uk
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c index 2a5f631..8bb274b 100644 --- a/bridge_loop_avoidance.c +++ b/bridge_loop_avoidance.c @@ -258,7 +258,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, struct net_device *soft_iface; uint8_t *hw_src; struct bla_claim_dst local_claim_dest; - uint32_t zeroip = 0; + __be32 zeroip = 0;
primary_if = primary_if_get_selected(bat_priv); if (!primary_if) @@ -506,7 +506,7 @@ static void bla_send_announce(struct bat_priv *bat_priv, struct backbone_gw *backbone_gw) { uint8_t mac[ETH_ALEN]; - uint16_t crc; + __be16 crc;
memcpy(mac, announce_mac, 4); crc = htons(backbone_gw->crc); @@ -627,7 +627,7 @@ static int handle_announce(struct bat_priv *bat_priv,
/* handle as ANNOUNCE frame */ backbone_gw->lasttime = jiffies; - crc = ntohs(*((uint16_t *)(&an_addr[4]))); + crc = ntohs(*((__be16 *)(&an_addr[4])));
bat_dbg(DBG_BLA, bat_priv, "handle_announce(): ANNOUNCE vid %d (sent by %pM)... CRC = %04x\n", diff --git a/distributed-arp-table.c b/distributed-arp-table.c index 76e23f1..31699a4 100644 --- a/distributed-arp-table.c +++ b/distributed-arp-table.c @@ -203,7 +203,7 @@ static void choose_next_candidate(struct bat_priv *bat_priv, * return an array of size DHT_CANDIDATES_NUM */ static struct dht_candidate *dht_select_candidates(struct bat_priv *bat_priv, - uint32_t ip_dst) + __be32 ip_dst) { int select; dat_addr_t last_max = DAT_ADDR_MAX, ip_key; @@ -236,7 +236,7 @@ static struct dht_candidate *dht_select_candidates(struct bat_priv *bat_priv, * function returns true */ static bool dht_send_data(struct bat_priv *bat_priv, struct sk_buff *skb, - uint32_t ip, int packet_subtype) + __be32 ip, int packet_subtype) { int i; bool ret = false; @@ -283,8 +283,7 @@ out: * the hw address hw. If the neighbour entry doesn't exists, then it will be * created */ -static void arp_neigh_update(struct bat_priv *bat_priv, uint32_t ip, - uint8_t *hw) +static void arp_neigh_update(struct bat_priv *bat_priv, __be32 ip, uint8_t *hw) { struct neighbour *n = NULL; struct hard_iface *primary_if = primary_if_get_selected(bat_priv); @@ -313,7 +312,7 @@ static uint16_t arp_get_type(struct bat_priv *bat_priv, struct sk_buff *skb, { struct arphdr *arphdr; struct ethhdr *ethhdr; - uint32_t ip_src, ip_dst; + __be32 ip_src, ip_dst; uint16_t type = 0;
/* pull the ethernet header */ @@ -367,7 +366,7 @@ bool dat_snoop_outgoing_arp_request(struct bat_priv *bat_priv, struct sk_buff *skb) { uint16_t type = 0; - uint32_t ip_dst, ip_src; + __be32 ip_dst, ip_src; uint8_t *hw_src; bool ret = false; struct neighbour *n = NULL; @@ -433,7 +432,7 @@ bool dat_snoop_incoming_arp_request(struct bat_priv *bat_priv, struct sk_buff *skb, int hdr_size) { uint16_t type; - uint32_t ip_src, ip_dst; + __be32 ip_src, ip_dst; uint8_t *hw_src; struct hard_iface *primary_if = NULL; struct sk_buff *skb_new; @@ -492,7 +491,7 @@ bool dat_snoop_outgoing_arp_reply(struct bat_priv *bat_priv, struct sk_buff *skb) { uint16_t type; - uint32_t ip_src, ip_dst; + __be32 ip_src, ip_dst; uint8_t *hw_src, *hw_dst; bool ret = false;
@@ -529,7 +528,7 @@ bool dat_snoop_incoming_arp_reply(struct bat_priv *bat_priv, struct sk_buff *skb, int hdr_size) { uint16_t type; - uint32_t ip_src, ip_dst; + __be32 ip_src, ip_dst; uint8_t *hw_src, *hw_dst; bool ret = false;
diff --git a/distributed-arp-table.h b/distributed-arp-table.h index 5e23577..12cedd5 100644 --- a/distributed-arp-table.h +++ b/distributed-arp-table.h @@ -33,10 +33,10 @@
#define ARP_HW_SRC(skb, hdr_size) ((uint8_t *)(skb->data + hdr_size) + \ ETH_HLEN + sizeof(struct arphdr)) -#define ARP_IP_SRC(skb, hdr_size) (*(uint32_t *)(ARP_HW_SRC(skb, hdr_size) + \ +#define ARP_IP_SRC(skb, hdr_size) (*(__be32 *)(ARP_HW_SRC(skb, hdr_size) + \ ETH_ALEN)) #define ARP_HW_DST(skb, hdr_size) (ARP_HW_SRC(skb, hdr_size) + ETH_ALEN + 4) -#define ARP_IP_DST(skb, hdr_size) (*(uint32_t *)(ARP_HW_SRC(skb, hdr_size) + \ +#define ARP_IP_DST(skb, hdr_size) (*(__be32 *)(ARP_HW_SRC(skb, hdr_size) + \ ETH_ALEN * 2 + 4))
bool dat_snoop_outgoing_arp_request(struct bat_priv *bat_priv, diff --git a/packet.h b/packet.h index 307dbb3..1df6210 100644 --- a/packet.h +++ b/packet.h @@ -113,7 +113,7 @@ enum bla_claimframe { struct bla_claim_dst { uint8_t magic[3]; /* FF:43:05 */ uint8_t type; /* bla_claimframe */ - uint16_t group; /* group id */ + __be16 group; /* group id */ } __packed;
struct batman_header { @@ -142,7 +142,7 @@ struct icmp_packet { uint8_t msg_type; /* see ICMP message types above */ uint8_t dst[ETH_ALEN]; uint8_t orig[ETH_ALEN]; - uint16_t seqno; + __be16 seqno; uint8_t uid; uint8_t reserved; } __packed; @@ -156,7 +156,7 @@ struct icmp_packet_rr { uint8_t msg_type; /* see ICMP message types above */ uint8_t dst[ETH_ALEN]; uint8_t orig[ETH_ALEN]; - uint16_t seqno; + __be16 seqno; uint8_t uid; uint8_t rr_cur; uint8_t rr[BAT_RR_LEN][ETH_ALEN]; @@ -181,20 +181,20 @@ struct unicast_frag_packet { uint8_t flags; uint8_t align; uint8_t orig[ETH_ALEN]; - uint16_t seqno; + __be16 seqno; } __packed;
struct bcast_packet { struct batman_header header; uint8_t reserved; - uint32_t seqno; + __be32 seqno; uint8_t orig[ETH_ALEN]; } __packed;
struct vis_packet { struct batman_header header; uint8_t vis_type; /* which type of vis-participant sent this? */ - uint32_t seqno; /* sequence number */ + __be32 seqno; /* sequence number */ uint8_t entries; /* number of entries behind this struct */ uint8_t reserved; uint8_t vis_orig[ETH_ALEN]; /* originator reporting its neighbors */