diff options
Diffstat (limited to 'net/batman-adv/unicast.c')
-rw-r--r-- | net/batman-adv/unicast.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index 00164645b3f7..f39723281ca1 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -39,6 +39,7 @@ batadv_frag_merge_packet(struct list_head *head, | |||
39 | struct batadv_unicast_packet *unicast_packet; | 39 | struct batadv_unicast_packet *unicast_packet; |
40 | int hdr_len = sizeof(*unicast_packet); | 40 | int hdr_len = sizeof(*unicast_packet); |
41 | int uni_diff = sizeof(*up) - hdr_len; | 41 | int uni_diff = sizeof(*up) - hdr_len; |
42 | uint8_t *packet_pos; | ||
42 | 43 | ||
43 | up = (struct batadv_unicast_frag_packet *)skb->data; | 44 | up = (struct batadv_unicast_frag_packet *)skb->data; |
44 | /* set skb to the first part and tmp_skb to the second part */ | 45 | /* set skb to the first part and tmp_skb to the second part */ |
@@ -65,8 +66,8 @@ batadv_frag_merge_packet(struct list_head *head, | |||
65 | kfree_skb(tmp_skb); | 66 | kfree_skb(tmp_skb); |
66 | 67 | ||
67 | memmove(skb->data + uni_diff, skb->data, hdr_len); | 68 | memmove(skb->data + uni_diff, skb->data, hdr_len); |
68 | unicast_packet = (struct batadv_unicast_packet *)skb_pull(skb, | 69 | packet_pos = skb_pull(skb, uni_diff); |
69 | uni_diff); | 70 | unicast_packet = (struct batadv_unicast_packet *)packet_pos; |
70 | unicast_packet->header.packet_type = BATADV_UNICAST; | 71 | unicast_packet->header.packet_type = BATADV_UNICAST; |
71 | 72 | ||
72 | return skb; | 73 | return skb; |
@@ -121,6 +122,7 @@ batadv_frag_search_packet(struct list_head *head, | |||
121 | { | 122 | { |
122 | struct batadv_frag_packet_list_entry *tfp; | 123 | struct batadv_frag_packet_list_entry *tfp; |
123 | struct batadv_unicast_frag_packet *tmp_up = NULL; | 124 | struct batadv_unicast_frag_packet *tmp_up = NULL; |
125 | int is_head_tmp, is_head; | ||
124 | uint16_t search_seqno; | 126 | uint16_t search_seqno; |
125 | 127 | ||
126 | if (up->flags & BATADV_UNI_FRAG_HEAD) | 128 | if (up->flags & BATADV_UNI_FRAG_HEAD) |
@@ -128,6 +130,8 @@ batadv_frag_search_packet(struct list_head *head, | |||
128 | else | 130 | else |
129 | search_seqno = ntohs(up->seqno)-1; | 131 | search_seqno = ntohs(up->seqno)-1; |
130 | 132 | ||
133 | is_head = !!(up->flags & BATADV_UNI_FRAG_HEAD); | ||
134 | |||
131 | list_for_each_entry(tfp, head, list) { | 135 | list_for_each_entry(tfp, head, list) { |
132 | 136 | ||
133 | if (!tfp->skb) | 137 | if (!tfp->skb) |
@@ -139,9 +143,8 @@ batadv_frag_search_packet(struct list_head *head, | |||
139 | tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data; | 143 | tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data; |
140 | 144 | ||
141 | if (tfp->seqno == search_seqno) { | 145 | if (tfp->seqno == search_seqno) { |
142 | 146 | is_head_tmp = !!(tmp_up->flags & BATADV_UNI_FRAG_HEAD); | |
143 | if ((tmp_up->flags & BATADV_UNI_FRAG_HEAD) != | 147 | if (is_head_tmp != is_head) |
144 | (up->flags & BATADV_UNI_FRAG_HEAD)) | ||
145 | return tfp; | 148 | return tfp; |
146 | else | 149 | else |
147 | goto mov_tail; | 150 | goto mov_tail; |
@@ -334,8 +337,7 @@ find_router: | |||
334 | /* copy the destination for faster routing */ | 337 | /* copy the destination for faster routing */ |
335 | memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); | 338 | memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); |
336 | /* set the destination tt version number */ | 339 | /* set the destination tt version number */ |
337 | unicast_packet->ttvn = | 340 | unicast_packet->ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn); |
338 | (uint8_t)atomic_read(&orig_node->last_ttvn); | ||
339 | 341 | ||
340 | /* inform the destination node that we are still missing a correct route | 342 | /* inform the destination node that we are still missing a correct route |
341 | * for this client. The destination will receive this packet and will | 343 | * for this client. The destination will receive this packet and will |