aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/unicast.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/unicast.c')
-rw-r--r--net/batman-adv/unicast.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index c4603552f9d8..8a2a3df17fff 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -34,13 +34,13 @@ batadv_frag_merge_packet(struct list_head *head,
34 struct frag_packet_list_entry *tfp, 34 struct frag_packet_list_entry *tfp,
35 struct sk_buff *skb) 35 struct sk_buff *skb)
36{ 36{
37 struct unicast_frag_packet *up = 37 struct batadv_unicast_frag_packet *up;
38 (struct unicast_frag_packet *)skb->data;
39 struct sk_buff *tmp_skb; 38 struct sk_buff *tmp_skb;
40 struct unicast_packet *unicast_packet; 39 struct batadv_unicast_packet *unicast_packet;
41 int hdr_len = sizeof(*unicast_packet); 40 int hdr_len = sizeof(*unicast_packet);
42 int uni_diff = sizeof(*up) - hdr_len; 41 int uni_diff = sizeof(*up) - hdr_len;
43 42
43 up = (struct batadv_unicast_frag_packet *)skb->data;
44 /* set skb to the first part and tmp_skb to the second part */ 44 /* set skb to the first part and tmp_skb to the second part */
45 if (up->flags & BATADV_UNI_FRAG_HEAD) { 45 if (up->flags & BATADV_UNI_FRAG_HEAD) {
46 tmp_skb = tfp->skb; 46 tmp_skb = tfp->skb;
@@ -65,7 +65,8 @@ batadv_frag_merge_packet(struct list_head *head,
65 kfree_skb(tmp_skb); 65 kfree_skb(tmp_skb);
66 66
67 memmove(skb->data + uni_diff, skb->data, hdr_len); 67 memmove(skb->data + uni_diff, skb->data, hdr_len);
68 unicast_packet = (struct unicast_packet *)skb_pull(skb, uni_diff); 68 unicast_packet = (struct batadv_unicast_packet *)skb_pull(skb,
69 uni_diff);
69 unicast_packet->header.packet_type = BATADV_UNICAST; 70 unicast_packet->header.packet_type = BATADV_UNICAST;
70 71
71 return skb; 72 return skb;
@@ -80,8 +81,9 @@ static void batadv_frag_create_entry(struct list_head *head,
80 struct sk_buff *skb) 81 struct sk_buff *skb)
81{ 82{
82 struct frag_packet_list_entry *tfp; 83 struct frag_packet_list_entry *tfp;
83 struct unicast_frag_packet *up = 84 struct batadv_unicast_frag_packet *up;
84 (struct unicast_frag_packet *)skb->data; 85
86 up = (struct batadv_unicast_frag_packet *)skb->data;
85 87
86 /* free and oldest packets stand at the end */ 88 /* free and oldest packets stand at the end */
87 tfp = list_entry((head)->prev, typeof(*tfp), list); 89 tfp = list_entry((head)->prev, typeof(*tfp), list);
@@ -115,10 +117,10 @@ static int batadv_frag_create_buffer(struct list_head *head)
115 117
116static struct frag_packet_list_entry * 118static struct frag_packet_list_entry *
117batadv_frag_search_packet(struct list_head *head, 119batadv_frag_search_packet(struct list_head *head,
118 const struct unicast_frag_packet *up) 120 const struct batadv_unicast_frag_packet *up)
119{ 121{
120 struct frag_packet_list_entry *tfp; 122 struct frag_packet_list_entry *tfp;
121 struct unicast_frag_packet *tmp_up = NULL; 123 struct batadv_unicast_frag_packet *tmp_up = NULL;
122 uint16_t search_seqno; 124 uint16_t search_seqno;
123 125
124 if (up->flags & BATADV_UNI_FRAG_HEAD) 126 if (up->flags & BATADV_UNI_FRAG_HEAD)
@@ -134,7 +136,7 @@ batadv_frag_search_packet(struct list_head *head,
134 if (tfp->seqno == ntohs(up->seqno)) 136 if (tfp->seqno == ntohs(up->seqno))
135 goto mov_tail; 137 goto mov_tail;
136 138
137 tmp_up = (struct unicast_frag_packet *)tfp->skb->data; 139 tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data;
138 140
139 if (tfp->seqno == search_seqno) { 141 if (tfp->seqno == search_seqno) {
140 142
@@ -179,9 +181,9 @@ int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
179 struct orig_node *orig_node; 181 struct orig_node *orig_node;
180 struct frag_packet_list_entry *tmp_frag_entry; 182 struct frag_packet_list_entry *tmp_frag_entry;
181 int ret = NET_RX_DROP; 183 int ret = NET_RX_DROP;
182 struct unicast_frag_packet *unicast_packet = 184 struct batadv_unicast_frag_packet *unicast_packet;
183 (struct unicast_frag_packet *)skb->data;
184 185
186 unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;
185 *new_skb = NULL; 187 *new_skb = NULL;
186 188
187 orig_node = batadv_orig_hash_find(bat_priv, unicast_packet->orig); 189 orig_node = batadv_orig_hash_find(bat_priv, unicast_packet->orig);
@@ -220,10 +222,10 @@ out:
220int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, 222int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
221 struct hard_iface *hard_iface, const uint8_t dstaddr[]) 223 struct hard_iface *hard_iface, const uint8_t dstaddr[])
222{ 224{
223 struct unicast_packet tmp_uc, *unicast_packet; 225 struct batadv_unicast_packet tmp_uc, *unicast_packet;
224 struct hard_iface *primary_if; 226 struct hard_iface *primary_if;
225 struct sk_buff *frag_skb; 227 struct sk_buff *frag_skb;
226 struct unicast_frag_packet *frag1, *frag2; 228 struct batadv_unicast_frag_packet *frag1, *frag2;
227 int uc_hdr_len = sizeof(*unicast_packet); 229 int uc_hdr_len = sizeof(*unicast_packet);
228 int ucf_hdr_len = sizeof(*frag1); 230 int ucf_hdr_len = sizeof(*frag1);
229 int data_len = skb->len - uc_hdr_len; 231 int data_len = skb->len - uc_hdr_len;
@@ -239,7 +241,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
239 goto dropped; 241 goto dropped;
240 skb_reserve(frag_skb, ucf_hdr_len); 242 skb_reserve(frag_skb, ucf_hdr_len);
241 243
242 unicast_packet = (struct unicast_packet *)skb->data; 244 unicast_packet = (struct batadv_unicast_packet *)skb->data;
243 memcpy(&tmp_uc, unicast_packet, uc_hdr_len); 245 memcpy(&tmp_uc, unicast_packet, uc_hdr_len);
244 skb_split(skb, frag_skb, data_len / 2 + uc_hdr_len); 246 skb_split(skb, frag_skb, data_len / 2 + uc_hdr_len);
245 247
@@ -247,8 +249,8 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
247 batadv_skb_head_push(frag_skb, ucf_hdr_len) < 0) 249 batadv_skb_head_push(frag_skb, ucf_hdr_len) < 0)
248 goto drop_frag; 250 goto drop_frag;
249 251
250 frag1 = (struct unicast_frag_packet *)skb->data; 252 frag1 = (struct batadv_unicast_frag_packet *)skb->data;
251 frag2 = (struct unicast_frag_packet *)frag_skb->data; 253 frag2 = (struct batadv_unicast_frag_packet *)frag_skb->data;
252 254
253 memcpy(frag1, &tmp_uc, sizeof(tmp_uc)); 255 memcpy(frag1, &tmp_uc, sizeof(tmp_uc));
254 256
@@ -287,7 +289,7 @@ out:
287int batadv_unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv) 289int batadv_unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
288{ 290{
289 struct ethhdr *ethhdr = (struct ethhdr *)skb->data; 291 struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
290 struct unicast_packet *unicast_packet; 292 struct batadv_unicast_packet *unicast_packet;
291 struct orig_node *orig_node; 293 struct orig_node *orig_node;
292 struct neigh_node *neigh_node; 294 struct neigh_node *neigh_node;
293 int data_len = skb->len; 295 int data_len = skb->len;
@@ -317,7 +319,7 @@ find_router:
317 if (batadv_skb_head_push(skb, sizeof(*unicast_packet)) < 0) 319 if (batadv_skb_head_push(skb, sizeof(*unicast_packet)) < 0)
318 goto out; 320 goto out;
319 321
320 unicast_packet = (struct unicast_packet *)skb->data; 322 unicast_packet = (struct batadv_unicast_packet *)skb->data;
321 323
322 unicast_packet->header.version = BATADV_COMPAT_VERSION; 324 unicast_packet->header.version = BATADV_COMPAT_VERSION;
323 /* batman packet type: unicast */ 325 /* batman packet type: unicast */