batman-adv: don't bother flipping ->tt_crc
authorAl Viro <viro@ZenIV.linux.org.uk>
Sun, 22 Apr 2012 06:45:29 +0000 (07:45 +0100)
committerAntonio Quartulli <ordex@autistici.org>
Mon, 18 Jun 2012 16:01:04 +0000 (18:01 +0200)
Keep it net-endian

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/packet.h

index 896287e62df9368c5472d61a65e59bfeaaf75c6e..ec3542c3bf0ca026ba0b6673d1da44e198a5d40f 100644 (file)
@@ -547,8 +547,6 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node,
                "Forwarding packet: tq: %i, ttl: %i\n",
                batman_ogm_packet->tq, batman_ogm_packet->header.ttl);
 
-       batman_ogm_packet->tt_crc = htons(batman_ogm_packet->tt_crc);
-
        /* switch of primaries first hop flag when forwarding */
        batman_ogm_packet->flags &= ~PRIMARIES_FIRST_HOP;
        if (is_single_hop_neigh)
@@ -724,7 +722,7 @@ update_tt:
                tt_update_orig(bat_priv, orig_node, tt_buff,
                               batman_ogm_packet->tt_num_changes,
                               batman_ogm_packet->ttvn,
-                              batman_ogm_packet->tt_crc);
+                              ntohs(batman_ogm_packet->tt_crc));
 
        if (orig_node->gw_flags != batman_ogm_packet->gw_flags)
                gw_node_update(bat_priv, orig_node,
@@ -972,7 +970,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
                ethhdr->h_source, if_incoming->net_dev->name,
                if_incoming->net_dev->dev_addr, batman_ogm_packet->orig,
                batman_ogm_packet->prev_sender, ntohl(batman_ogm_packet->seqno),
-               batman_ogm_packet->ttvn, batman_ogm_packet->tt_crc,
+               batman_ogm_packet->ttvn, ntohs(batman_ogm_packet->tt_crc),
                batman_ogm_packet->tt_num_changes, batman_ogm_packet->tq,
                batman_ogm_packet->header.ttl,
                batman_ogm_packet->header.version, has_directlink_flag);
@@ -1219,10 +1217,6 @@ static int bat_iv_ogm_receive(struct sk_buff *skb,
 
        /* unpack the aggregated packets and process them one by one */
        do {
-               /* network to host order for our 32bit seqno and the
-                  orig_interval */
-               batman_ogm_packet->tt_crc = ntohs(batman_ogm_packet->tt_crc);
-
                tt_buff = packet_buff + buff_pos + BATMAN_OGM_HLEN;
 
                bat_iv_ogm_process(ethhdr, batman_ogm_packet,
index 372fc889832a2a28da65448cf04150cd33b78033..033d99490e820e807c4d769d2b87e3b59e277d7f 100644 (file)
@@ -124,7 +124,7 @@ struct batman_ogm_packet {
        uint8_t  tq;
        uint8_t  tt_num_changes;
        uint8_t  ttvn; /* translation table version number */
-       uint16_t tt_crc;
+       __be16   tt_crc;
 } __packed;
 
 #define BATMAN_OGM_HLEN sizeof(struct batman_ogm_packet)