aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bat_iv_ogm.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-06-05 16:31:30 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-07-01 16:47:21 -0400
commit96412690116afcc1b2705615b5a7c8dc6c5e905f (patch)
tree0eb2a1a557e2997175b27f3ab925bbdc29ece54d /net/batman-adv/bat_iv_ogm.c
parentb4d66b877bc21ce907938bfd027dfe016617fac0 (diff)
batman-adv: Prefix packet structs with batadv_
Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/bat_iv_ogm.c')
-rw-r--r--net/batman-adv/bat_iv_ogm.c258
1 files changed, 129 insertions, 129 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index f9981e608c13..a2bafd9e4fb7 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -56,7 +56,7 @@ out:
56 56
57static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface) 57static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface)
58{ 58{
59 struct batman_ogm_packet *batman_ogm_packet; 59 struct batadv_ogm_packet *batadv_ogm_packet;
60 uint32_t random_seqno; 60 uint32_t random_seqno;
61 int res = -ENOMEM; 61 int res = -ENOMEM;
62 62
@@ -70,14 +70,14 @@ static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface)
70 if (!hard_iface->packet_buff) 70 if (!hard_iface->packet_buff)
71 goto out; 71 goto out;
72 72
73 batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; 73 batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
74 batman_ogm_packet->header.packet_type = BATADV_IV_OGM; 74 batadv_ogm_packet->header.packet_type = BATADV_IV_OGM;
75 batman_ogm_packet->header.version = BATADV_COMPAT_VERSION; 75 batadv_ogm_packet->header.version = BATADV_COMPAT_VERSION;
76 batman_ogm_packet->header.ttl = 2; 76 batadv_ogm_packet->header.ttl = 2;
77 batman_ogm_packet->flags = BATADV_NO_FLAGS; 77 batadv_ogm_packet->flags = BATADV_NO_FLAGS;
78 batman_ogm_packet->tq = BATADV_TQ_MAX_VALUE; 78 batadv_ogm_packet->tq = BATADV_TQ_MAX_VALUE;
79 batman_ogm_packet->tt_num_changes = 0; 79 batadv_ogm_packet->tt_num_changes = 0;
80 batman_ogm_packet->ttvn = 0; 80 batadv_ogm_packet->ttvn = 0;
81 81
82 res = 0; 82 res = 0;
83 83
@@ -93,22 +93,22 @@ static void batadv_iv_ogm_iface_disable(struct hard_iface *hard_iface)
93 93
94static void batadv_iv_ogm_iface_update_mac(struct hard_iface *hard_iface) 94static void batadv_iv_ogm_iface_update_mac(struct hard_iface *hard_iface)
95{ 95{
96 struct batman_ogm_packet *batman_ogm_packet; 96 struct batadv_ogm_packet *batadv_ogm_packet;
97 97
98 batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; 98 batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
99 memcpy(batman_ogm_packet->orig, 99 memcpy(batadv_ogm_packet->orig,
100 hard_iface->net_dev->dev_addr, ETH_ALEN); 100 hard_iface->net_dev->dev_addr, ETH_ALEN);
101 memcpy(batman_ogm_packet->prev_sender, 101 memcpy(batadv_ogm_packet->prev_sender,
102 hard_iface->net_dev->dev_addr, ETH_ALEN); 102 hard_iface->net_dev->dev_addr, ETH_ALEN);
103} 103}
104 104
105static void batadv_iv_ogm_primary_iface_set(struct hard_iface *hard_iface) 105static void batadv_iv_ogm_primary_iface_set(struct hard_iface *hard_iface)
106{ 106{
107 struct batman_ogm_packet *batman_ogm_packet; 107 struct batadv_ogm_packet *batadv_ogm_packet;
108 108
109 batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; 109 batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
110 batman_ogm_packet->flags = BATADV_PRIMARIES_FIRST_HOP; 110 batadv_ogm_packet->flags = BATADV_PRIMARIES_FIRST_HOP;
111 batman_ogm_packet->header.ttl = BATADV_TTL; 111 batadv_ogm_packet->header.ttl = BATADV_TTL;
112} 112}
113 113
114/* when do we schedule our own ogm to be sent */ 114/* when do we schedule our own ogm to be sent */
@@ -162,7 +162,7 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
162 char *fwd_str; 162 char *fwd_str;
163 uint8_t packet_num; 163 uint8_t packet_num;
164 int16_t buff_pos; 164 int16_t buff_pos;
165 struct batman_ogm_packet *batman_ogm_packet; 165 struct batadv_ogm_packet *batadv_ogm_packet;
166 struct sk_buff *skb; 166 struct sk_buff *skb;
167 167
168 if (hard_iface->if_status != BATADV_IF_ACTIVE) 168 if (hard_iface->if_status != BATADV_IF_ACTIVE)
@@ -170,20 +170,20 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
170 170
171 packet_num = 0; 171 packet_num = 0;
172 buff_pos = 0; 172 buff_pos = 0;
173 batman_ogm_packet = (struct batman_ogm_packet *)forw_packet->skb->data; 173 batadv_ogm_packet = (struct batadv_ogm_packet *)forw_packet->skb->data;
174 174
175 /* adjust all flags and log packets */ 175 /* adjust all flags and log packets */
176 while (batadv_iv_ogm_aggr_packet(buff_pos, forw_packet->packet_len, 176 while (batadv_iv_ogm_aggr_packet(buff_pos, forw_packet->packet_len,
177 batman_ogm_packet->tt_num_changes)) { 177 batadv_ogm_packet->tt_num_changes)) {
178 178
179 /* we might have aggregated direct link packets with an 179 /* we might have aggregated direct link packets with an
180 * ordinary base packet 180 * ordinary base packet
181 */ 181 */
182 if ((forw_packet->direct_link_flags & (1 << packet_num)) && 182 if ((forw_packet->direct_link_flags & (1 << packet_num)) &&
183 (forw_packet->if_incoming == hard_iface)) 183 (forw_packet->if_incoming == hard_iface))
184 batman_ogm_packet->flags |= BATADV_DIRECTLINK; 184 batadv_ogm_packet->flags |= BATADV_DIRECTLINK;
185 else 185 else
186 batman_ogm_packet->flags &= ~BATADV_DIRECTLINK; 186 batadv_ogm_packet->flags &= ~BATADV_DIRECTLINK;
187 187
188 fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ? 188 fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ?
189 "Sending own" : 189 "Sending own" :
@@ -191,18 +191,18 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
191 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 191 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
192 "%s %spacket (originator %pM, seqno %u, TQ %d, TTL %d, IDF %s, ttvn %d) on interface %s [%pM]\n", 192 "%s %spacket (originator %pM, seqno %u, TQ %d, TTL %d, IDF %s, ttvn %d) on interface %s [%pM]\n",
193 fwd_str, (packet_num > 0 ? "aggregated " : ""), 193 fwd_str, (packet_num > 0 ? "aggregated " : ""),
194 batman_ogm_packet->orig, 194 batadv_ogm_packet->orig,
195 ntohl(batman_ogm_packet->seqno), 195 ntohl(batadv_ogm_packet->seqno),
196 batman_ogm_packet->tq, batman_ogm_packet->header.ttl, 196 batadv_ogm_packet->tq, batadv_ogm_packet->header.ttl,
197 (batman_ogm_packet->flags & BATADV_DIRECTLINK ? 197 (batadv_ogm_packet->flags & BATADV_DIRECTLINK ?
198 "on" : "off"), 198 "on" : "off"),
199 batman_ogm_packet->ttvn, hard_iface->net_dev->name, 199 batadv_ogm_packet->ttvn, hard_iface->net_dev->name,
200 hard_iface->net_dev->dev_addr); 200 hard_iface->net_dev->dev_addr);
201 201
202 buff_pos += BATADV_OGM_HLEN; 202 buff_pos += BATADV_OGM_HLEN;
203 buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes); 203 buff_pos += batadv_tt_len(batadv_ogm_packet->tt_num_changes);
204 packet_num++; 204 packet_num++;
205 batman_ogm_packet = (struct batman_ogm_packet *) 205 batadv_ogm_packet = (struct batadv_ogm_packet *)
206 (forw_packet->skb->data + buff_pos); 206 (forw_packet->skb->data + buff_pos);
207 } 207 }
208 208
@@ -223,12 +223,12 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet)
223 struct net_device *soft_iface; 223 struct net_device *soft_iface;
224 struct bat_priv *bat_priv; 224 struct bat_priv *bat_priv;
225 struct hard_iface *primary_if = NULL; 225 struct hard_iface *primary_if = NULL;
226 struct batman_ogm_packet *batman_ogm_packet; 226 struct batadv_ogm_packet *batadv_ogm_packet;
227 unsigned char directlink; 227 unsigned char directlink;
228 228
229 batman_ogm_packet = (struct batman_ogm_packet *) 229 batadv_ogm_packet = (struct batadv_ogm_packet *)
230 (forw_packet->skb->data); 230 (forw_packet->skb->data);
231 directlink = (batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0); 231 directlink = (batadv_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0);
232 232
233 if (!forw_packet->if_incoming) { 233 if (!forw_packet->if_incoming) {
234 pr_err("Error - can't forward packet: incoming iface not specified\n"); 234 pr_err("Error - can't forward packet: incoming iface not specified\n");
@@ -248,16 +248,16 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet)
248 /* multihomed peer assumed 248 /* multihomed peer assumed
249 * non-primary OGMs are only broadcasted on their interface 249 * non-primary OGMs are only broadcasted on their interface
250 */ 250 */
251 if ((directlink && (batman_ogm_packet->header.ttl == 1)) || 251 if ((directlink && (batadv_ogm_packet->header.ttl == 1)) ||
252 (forw_packet->own && (forw_packet->if_incoming != primary_if))) { 252 (forw_packet->own && (forw_packet->if_incoming != primary_if))) {
253 253
254 /* FIXME: what about aggregated packets ? */ 254 /* FIXME: what about aggregated packets ? */
255 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 255 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
256 "%s packet (originator %pM, seqno %u, TTL %d) on interface %s [%pM]\n", 256 "%s packet (originator %pM, seqno %u, TTL %d) on interface %s [%pM]\n",
257 (forw_packet->own ? "Sending own" : "Forwarding"), 257 (forw_packet->own ? "Sending own" : "Forwarding"),
258 batman_ogm_packet->orig, 258 batadv_ogm_packet->orig,
259 ntohl(batman_ogm_packet->seqno), 259 ntohl(batadv_ogm_packet->seqno),
260 batman_ogm_packet->header.ttl, 260 batadv_ogm_packet->header.ttl,
261 forw_packet->if_incoming->net_dev->name, 261 forw_packet->if_incoming->net_dev->name,
262 forw_packet->if_incoming->net_dev->dev_addr); 262 forw_packet->if_incoming->net_dev->dev_addr);
263 263
@@ -287,20 +287,20 @@ out:
287 287
288/* return true if new_packet can be aggregated with forw_packet */ 288/* return true if new_packet can be aggregated with forw_packet */
289static bool 289static bool
290batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet, 290batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet,
291 struct bat_priv *bat_priv, 291 struct bat_priv *bat_priv,
292 int packet_len, unsigned long send_time, 292 int packet_len, unsigned long send_time,
293 bool directlink, 293 bool directlink,
294 const struct hard_iface *if_incoming, 294 const struct hard_iface *if_incoming,
295 const struct forw_packet *forw_packet) 295 const struct forw_packet *forw_packet)
296{ 296{
297 struct batman_ogm_packet *batman_ogm_packet; 297 struct batadv_ogm_packet *batadv_ogm_packet;
298 int aggregated_bytes = forw_packet->packet_len + packet_len; 298 int aggregated_bytes = forw_packet->packet_len + packet_len;
299 struct hard_iface *primary_if = NULL; 299 struct hard_iface *primary_if = NULL;
300 bool res = false; 300 bool res = false;
301 unsigned long aggregation_end_time; 301 unsigned long aggregation_end_time;
302 302
303 batman_ogm_packet = (struct batman_ogm_packet *)forw_packet->skb->data; 303 batadv_ogm_packet = (struct batadv_ogm_packet *)forw_packet->skb->data;
304 aggregation_end_time = send_time; 304 aggregation_end_time = send_time;
305 aggregation_end_time += msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS); 305 aggregation_end_time += msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS);
306 306
@@ -330,8 +330,8 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
330 * are flooded through the net 330 * are flooded through the net
331 */ 331 */
332 if ((!directlink) && 332 if ((!directlink) &&
333 (!(batman_ogm_packet->flags & BATADV_DIRECTLINK)) && 333 (!(batadv_ogm_packet->flags & BATADV_DIRECTLINK)) &&
334 (batman_ogm_packet->header.ttl != 1) && 334 (batadv_ogm_packet->header.ttl != 1) &&
335 335
336 /* own packets originating non-primary 336 /* own packets originating non-primary
337 * interfaces leave only that interface 337 * interfaces leave only that interface
@@ -353,7 +353,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
353 * own secondary interface packets 353 * own secondary interface packets
354 * (= secondary interface packets in general) 354 * (= secondary interface packets in general)
355 */ 355 */
356 (batman_ogm_packet->flags & BATADV_DIRECTLINK || 356 (batadv_ogm_packet->flags & BATADV_DIRECTLINK ||
357 (forw_packet->own && 357 (forw_packet->own &&
358 forw_packet->if_incoming != primary_if))) { 358 forw_packet->if_incoming != primary_if))) {
359 res = true; 359 res = true;
@@ -475,12 +475,12 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv,
475 */ 475 */
476 struct forw_packet *forw_packet_aggr = NULL, *forw_packet_pos = NULL; 476 struct forw_packet *forw_packet_aggr = NULL, *forw_packet_pos = NULL;
477 struct hlist_node *tmp_node; 477 struct hlist_node *tmp_node;
478 struct batman_ogm_packet *batman_ogm_packet; 478 struct batadv_ogm_packet *batadv_ogm_packet;
479 bool direct_link; 479 bool direct_link;
480 unsigned long max_aggregation_jiffies; 480 unsigned long max_aggregation_jiffies;
481 481
482 batman_ogm_packet = (struct batman_ogm_packet *)packet_buff; 482 batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff;
483 direct_link = batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0; 483 direct_link = batadv_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0;
484 max_aggregation_jiffies = msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS); 484 max_aggregation_jiffies = msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS);
485 485
486 /* find position for the packet in the forward queue */ 486 /* find position for the packet in the forward queue */
@@ -489,7 +489,7 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv,
489 if ((atomic_read(&bat_priv->aggregated_ogms)) && (!own_packet)) { 489 if ((atomic_read(&bat_priv->aggregated_ogms)) && (!own_packet)) {
490 hlist_for_each_entry(forw_packet_pos, tmp_node, 490 hlist_for_each_entry(forw_packet_pos, tmp_node,
491 &bat_priv->forw_bat_list, list) { 491 &bat_priv->forw_bat_list, list) {
492 if (batadv_iv_ogm_can_aggregate(batman_ogm_packet, 492 if (batadv_iv_ogm_can_aggregate(batadv_ogm_packet,
493 bat_priv, packet_len, 493 bat_priv, packet_len,
494 send_time, direct_link, 494 send_time, direct_link,
495 if_incoming, 495 if_incoming,
@@ -526,7 +526,7 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv,
526 526
527static void batadv_iv_ogm_forward(struct orig_node *orig_node, 527static void batadv_iv_ogm_forward(struct orig_node *orig_node,
528 const struct ethhdr *ethhdr, 528 const struct ethhdr *ethhdr,
529 struct batman_ogm_packet *batman_ogm_packet, 529 struct batadv_ogm_packet *batadv_ogm_packet,
530 bool is_single_hop_neigh, 530 bool is_single_hop_neigh,
531 bool is_from_best_next_hop, 531 bool is_from_best_next_hop,
532 struct hard_iface *if_incoming) 532 struct hard_iface *if_incoming)
@@ -534,7 +534,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
534 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 534 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
535 uint8_t tt_num_changes; 535 uint8_t tt_num_changes;
536 536
537 if (batman_ogm_packet->header.ttl <= 1) { 537 if (batadv_ogm_packet->header.ttl <= 1) {
538 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "ttl exceeded\n"); 538 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "ttl exceeded\n");
539 return; 539 return;
540 } 540 }
@@ -547,32 +547,32 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
547 * simply drop the ogm. 547 * simply drop the ogm.
548 */ 548 */
549 if (is_single_hop_neigh) 549 if (is_single_hop_neigh)
550 batman_ogm_packet->flags |= BATADV_NOT_BEST_NEXT_HOP; 550 batadv_ogm_packet->flags |= BATADV_NOT_BEST_NEXT_HOP;
551 else 551 else
552 return; 552 return;
553 } 553 }
554 554
555 tt_num_changes = batman_ogm_packet->tt_num_changes; 555 tt_num_changes = batadv_ogm_packet->tt_num_changes;
556 556
557 batman_ogm_packet->header.ttl--; 557 batadv_ogm_packet->header.ttl--;
558 memcpy(batman_ogm_packet->prev_sender, ethhdr->h_source, ETH_ALEN); 558 memcpy(batadv_ogm_packet->prev_sender, ethhdr->h_source, ETH_ALEN);
559 559
560 /* apply hop penalty */ 560 /* apply hop penalty */
561 batman_ogm_packet->tq = batadv_hop_penalty(batman_ogm_packet->tq, 561 batadv_ogm_packet->tq = batadv_hop_penalty(batadv_ogm_packet->tq,
562 bat_priv); 562 bat_priv);
563 563
564 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 564 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
565 "Forwarding packet: tq: %i, ttl: %i\n", 565 "Forwarding packet: tq: %i, ttl: %i\n",
566 batman_ogm_packet->tq, batman_ogm_packet->header.ttl); 566 batadv_ogm_packet->tq, batadv_ogm_packet->header.ttl);
567 567
568 /* switch of primaries first hop flag when forwarding */ 568 /* switch of primaries first hop flag when forwarding */
569 batman_ogm_packet->flags &= ~BATADV_PRIMARIES_FIRST_HOP; 569 batadv_ogm_packet->flags &= ~BATADV_PRIMARIES_FIRST_HOP;
570 if (is_single_hop_neigh) 570 if (is_single_hop_neigh)
571 batman_ogm_packet->flags |= BATADV_DIRECTLINK; 571 batadv_ogm_packet->flags |= BATADV_DIRECTLINK;
572 else 572 else
573 batman_ogm_packet->flags &= ~BATADV_DIRECTLINK; 573 batadv_ogm_packet->flags &= ~BATADV_DIRECTLINK;
574 574
575 batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet, 575 batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batadv_ogm_packet,
576 BATADV_OGM_HLEN + batadv_tt_len(tt_num_changes), 576 BATADV_OGM_HLEN + batadv_tt_len(tt_num_changes),
577 if_incoming, 0, batadv_iv_ogm_fwd_send_time()); 577 if_incoming, 0, batadv_iv_ogm_fwd_send_time());
578} 578}
@@ -580,7 +580,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
580static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface) 580static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface)
581{ 581{
582 struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); 582 struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
583 struct batman_ogm_packet *batman_ogm_packet; 583 struct batadv_ogm_packet *batadv_ogm_packet;
584 struct hard_iface *primary_if; 584 struct hard_iface *primary_if;
585 int vis_server, tt_num_changes = 0; 585 int vis_server, tt_num_changes = 0;
586 586
@@ -593,29 +593,29 @@ static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface)
593 &hard_iface->packet_len, 593 &hard_iface->packet_len,
594 BATADV_OGM_HLEN); 594 BATADV_OGM_HLEN);
595 595
596 batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; 596 batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
597 597
598 /* change sequence number to network order */ 598 /* change sequence number to network order */
599 batman_ogm_packet->seqno = 599 batadv_ogm_packet->seqno =
600 htonl((uint32_t)atomic_read(&hard_iface->seqno)); 600 htonl((uint32_t)atomic_read(&hard_iface->seqno));
601 atomic_inc(&hard_iface->seqno); 601 atomic_inc(&hard_iface->seqno);
602 602
603 batman_ogm_packet->ttvn = atomic_read(&bat_priv->ttvn); 603 batadv_ogm_packet->ttvn = atomic_read(&bat_priv->ttvn);
604 batman_ogm_packet->tt_crc = htons(bat_priv->tt_crc); 604 batadv_ogm_packet->tt_crc = htons(bat_priv->tt_crc);
605 if (tt_num_changes >= 0) 605 if (tt_num_changes >= 0)
606 batman_ogm_packet->tt_num_changes = tt_num_changes; 606 batadv_ogm_packet->tt_num_changes = tt_num_changes;
607 607
608 if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC) 608 if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC)
609 batman_ogm_packet->flags |= BATADV_VIS_SERVER; 609 batadv_ogm_packet->flags |= BATADV_VIS_SERVER;
610 else 610 else
611 batman_ogm_packet->flags &= ~BATADV_VIS_SERVER; 611 batadv_ogm_packet->flags &= ~BATADV_VIS_SERVER;
612 612
613 if ((hard_iface == primary_if) && 613 if ((hard_iface == primary_if) &&
614 (atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER)) 614 (atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER))
615 batman_ogm_packet->gw_flags = 615 batadv_ogm_packet->gw_flags =
616 (uint8_t)atomic_read(&bat_priv->gw_bandwidth); 616 (uint8_t)atomic_read(&bat_priv->gw_bandwidth);
617 else 617 else
618 batman_ogm_packet->gw_flags = BATADV_NO_FLAGS; 618 batadv_ogm_packet->gw_flags = BATADV_NO_FLAGS;
619 619
620 batadv_slide_own_bcast_window(hard_iface); 620 batadv_slide_own_bcast_window(hard_iface);
621 batadv_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff, 621 batadv_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff,
@@ -630,7 +630,7 @@ static void
630batadv_iv_ogm_orig_update(struct bat_priv *bat_priv, 630batadv_iv_ogm_orig_update(struct bat_priv *bat_priv,
631 struct orig_node *orig_node, 631 struct orig_node *orig_node,
632 const struct ethhdr *ethhdr, 632 const struct ethhdr *ethhdr,
633 const struct batman_ogm_packet *batman_ogm_packet, 633 const struct batadv_ogm_packet *batadv_ogm_packet,
634 struct hard_iface *if_incoming, 634 struct hard_iface *if_incoming,
635 const unsigned char *tt_buff, 635 const unsigned char *tt_buff,
636 int is_duplicate) 636 int is_duplicate)
@@ -679,7 +679,7 @@ batadv_iv_ogm_orig_update(struct bat_priv *bat_priv,
679 neigh_node = batadv_iv_ogm_neigh_new(if_incoming, 679 neigh_node = batadv_iv_ogm_neigh_new(if_incoming,
680 ethhdr->h_source, 680 ethhdr->h_source,
681 orig_node, orig_tmp, 681 orig_node, orig_tmp,
682 batman_ogm_packet->seqno); 682 batadv_ogm_packet->seqno);
683 683
684 batadv_orig_node_free_ref(orig_tmp); 684 batadv_orig_node_free_ref(orig_tmp);
685 if (!neigh_node) 685 if (!neigh_node)
@@ -690,19 +690,19 @@ batadv_iv_ogm_orig_update(struct bat_priv *bat_priv,
690 690
691 rcu_read_unlock(); 691 rcu_read_unlock();
692 692
693 orig_node->flags = batman_ogm_packet->flags; 693 orig_node->flags = batadv_ogm_packet->flags;
694 neigh_node->last_seen = jiffies; 694 neigh_node->last_seen = jiffies;
695 695
696 spin_lock_bh(&neigh_node->lq_update_lock); 696 spin_lock_bh(&neigh_node->lq_update_lock);
697 batadv_ring_buffer_set(neigh_node->tq_recv, 697 batadv_ring_buffer_set(neigh_node->tq_recv,
698 &neigh_node->tq_index, 698 &neigh_node->tq_index,
699 batman_ogm_packet->tq); 699 batadv_ogm_packet->tq);
700 neigh_node->tq_avg = batadv_ring_buffer_avg(neigh_node->tq_recv); 700 neigh_node->tq_avg = batadv_ring_buffer_avg(neigh_node->tq_recv);
701 spin_unlock_bh(&neigh_node->lq_update_lock); 701 spin_unlock_bh(&neigh_node->lq_update_lock);
702 702
703 if (!is_duplicate) { 703 if (!is_duplicate) {
704 orig_node->last_ttl = batman_ogm_packet->header.ttl; 704 orig_node->last_ttl = batadv_ogm_packet->header.ttl;
705 neigh_node->last_ttl = batman_ogm_packet->header.ttl; 705 neigh_node->last_ttl = batadv_ogm_packet->header.ttl;
706 } 706 }
707 707
708 batadv_bonding_candidate_add(orig_node, neigh_node); 708 batadv_bonding_candidate_add(orig_node, neigh_node);
@@ -744,19 +744,19 @@ update_tt:
744 /* I have to check for transtable changes only if the OGM has been 744 /* I have to check for transtable changes only if the OGM has been
745 * sent through a primary interface 745 * sent through a primary interface
746 */ 746 */
747 if (((batman_ogm_packet->orig != ethhdr->h_source) && 747 if (((batadv_ogm_packet->orig != ethhdr->h_source) &&
748 (batman_ogm_packet->header.ttl > 2)) || 748 (batadv_ogm_packet->header.ttl > 2)) ||
749 (batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP)) 749 (batadv_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP))
750 batadv_tt_update_orig(bat_priv, orig_node, tt_buff, 750 batadv_tt_update_orig(bat_priv, orig_node, tt_buff,
751 batman_ogm_packet->tt_num_changes, 751 batadv_ogm_packet->tt_num_changes,
752 batman_ogm_packet->ttvn, 752 batadv_ogm_packet->ttvn,
753 ntohs(batman_ogm_packet->tt_crc)); 753 ntohs(batadv_ogm_packet->tt_crc));
754 754
755 if (orig_node->gw_flags != batman_ogm_packet->gw_flags) 755 if (orig_node->gw_flags != batadv_ogm_packet->gw_flags)
756 batadv_gw_node_update(bat_priv, orig_node, 756 batadv_gw_node_update(bat_priv, orig_node,
757 batman_ogm_packet->gw_flags); 757 batadv_ogm_packet->gw_flags);
758 758
759 orig_node->gw_flags = batman_ogm_packet->gw_flags; 759 orig_node->gw_flags = batadv_ogm_packet->gw_flags;
760 760
761 /* restart gateway selection if fast or late switching was enabled */ 761 /* restart gateway selection if fast or late switching was enabled */
762 if ((orig_node->gw_flags) && 762 if ((orig_node->gw_flags) &&
@@ -777,7 +777,7 @@ out:
777 777
778static int batadv_iv_ogm_calc_tq(struct orig_node *orig_node, 778static int batadv_iv_ogm_calc_tq(struct orig_node *orig_node,
779 struct orig_node *orig_neigh_node, 779 struct orig_node *orig_neigh_node,
780 struct batman_ogm_packet *batman_ogm_packet, 780 struct batadv_ogm_packet *batadv_ogm_packet,
781 struct hard_iface *if_incoming) 781 struct hard_iface *if_incoming)
782{ 782{
783 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 783 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
@@ -814,7 +814,7 @@ static int batadv_iv_ogm_calc_tq(struct orig_node *orig_node,
814 orig_neigh_node->orig, 814 orig_neigh_node->orig,
815 orig_neigh_node, 815 orig_neigh_node,
816 orig_neigh_node, 816 orig_neigh_node,
817 batman_ogm_packet->seqno); 817 batadv_ogm_packet->seqno);
818 818
819 if (!neigh_node) 819 if (!neigh_node)
820 goto out; 820 goto out;
@@ -862,20 +862,20 @@ static int batadv_iv_ogm_calc_tq(struct orig_node *orig_node,
862 inv_asym_penalty /= neigh_rq_max_cube; 862 inv_asym_penalty /= neigh_rq_max_cube;
863 tq_asym_penalty = BATADV_TQ_MAX_VALUE - inv_asym_penalty; 863 tq_asym_penalty = BATADV_TQ_MAX_VALUE - inv_asym_penalty;
864 864
865 combined_tq = batman_ogm_packet->tq * tq_own * tq_asym_penalty; 865 combined_tq = batadv_ogm_packet->tq * tq_own * tq_asym_penalty;
866 combined_tq /= BATADV_TQ_MAX_VALUE * BATADV_TQ_MAX_VALUE; 866 combined_tq /= BATADV_TQ_MAX_VALUE * BATADV_TQ_MAX_VALUE;
867 batman_ogm_packet->tq = combined_tq; 867 batadv_ogm_packet->tq = combined_tq;
868 868
869 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 869 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
870 "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i\n", 870 "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i\n",
871 orig_node->orig, orig_neigh_node->orig, total_count, 871 orig_node->orig, orig_neigh_node->orig, total_count,
872 neigh_rq_count, tq_own, 872 neigh_rq_count, tq_own,
873 tq_asym_penalty, batman_ogm_packet->tq); 873 tq_asym_penalty, batadv_ogm_packet->tq);
874 874
875 /* if link has the minimum required transmission quality 875 /* if link has the minimum required transmission quality
876 * consider it bidirectional 876 * consider it bidirectional
877 */ 877 */
878 if (batman_ogm_packet->tq >= BATADV_TQ_TOTAL_BIDRECT_LIMIT) 878 if (batadv_ogm_packet->tq >= BATADV_TQ_TOTAL_BIDRECT_LIMIT)
879 ret = 1; 879 ret = 1;
880 880
881out: 881out:
@@ -894,7 +894,7 @@ out:
894 */ 894 */
895static int 895static int
896batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, 896batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
897 const struct batman_ogm_packet *batman_ogm_packet, 897 const struct batadv_ogm_packet *batadv_ogm_packet,
898 const struct hard_iface *if_incoming) 898 const struct hard_iface *if_incoming)
899{ 899{
900 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 900 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
@@ -905,10 +905,10 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
905 int32_t seq_diff; 905 int32_t seq_diff;
906 int need_update = 0; 906 int need_update = 0;
907 int set_mark, ret = -1; 907 int set_mark, ret = -1;
908 uint32_t seqno = ntohl(batman_ogm_packet->seqno); 908 uint32_t seqno = ntohl(batadv_ogm_packet->seqno);
909 uint8_t *neigh_addr; 909 uint8_t *neigh_addr;
910 910
911 orig_node = batadv_get_orig_node(bat_priv, batman_ogm_packet->orig); 911 orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig);
912 if (!orig_node) 912 if (!orig_node)
913 return 0; 913 return 0;
914 914
@@ -963,7 +963,7 @@ out:
963} 963}
964 964
965static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, 965static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
966 struct batman_ogm_packet *batman_ogm_packet, 966 struct batadv_ogm_packet *batadv_ogm_packet,
967 const unsigned char *tt_buff, 967 const unsigned char *tt_buff,
968 struct hard_iface *if_incoming) 968 struct hard_iface *if_incoming)
969{ 969{
@@ -989,34 +989,34 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
989 * it as an additional length. 989 * it as an additional length.
990 * 990 *
991 * TODO: A more sane solution would be to have a bit in the 991 * TODO: A more sane solution would be to have a bit in the
992 * batman_ogm_packet to detect whether the packet is the last 992 * batadv_ogm_packet to detect whether the packet is the last
993 * packet in an aggregation. Here we expect that the padding 993 * packet in an aggregation. Here we expect that the padding
994 * is always zero (or not 0x01) 994 * is always zero (or not 0x01)
995 */ 995 */
996 if (batman_ogm_packet->header.packet_type != BATADV_IV_OGM) 996 if (batadv_ogm_packet->header.packet_type != BATADV_IV_OGM)
997 return; 997 return;
998 998
999 /* could be changed by schedule_own_packet() */ 999 /* could be changed by schedule_own_packet() */
1000 if_incoming_seqno = atomic_read(&if_incoming->seqno); 1000 if_incoming_seqno = atomic_read(&if_incoming->seqno);
1001 1001
1002 if (batman_ogm_packet->flags & BATADV_DIRECTLINK) 1002 if (batadv_ogm_packet->flags & BATADV_DIRECTLINK)
1003 has_directlink_flag = 1; 1003 has_directlink_flag = 1;
1004 else 1004 else
1005 has_directlink_flag = 0; 1005 has_directlink_flag = 0;
1006 1006
1007 if (batadv_compare_eth(ethhdr->h_source, batman_ogm_packet->orig)) 1007 if (batadv_compare_eth(ethhdr->h_source, batadv_ogm_packet->orig))
1008 is_single_hop_neigh = true; 1008 is_single_hop_neigh = true;
1009 1009
1010 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 1010 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
1011 "Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n", 1011 "Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n",
1012 ethhdr->h_source, if_incoming->net_dev->name, 1012 ethhdr->h_source, if_incoming->net_dev->name,
1013 if_incoming->net_dev->dev_addr, batman_ogm_packet->orig, 1013 if_incoming->net_dev->dev_addr, batadv_ogm_packet->orig,
1014 batman_ogm_packet->prev_sender, 1014 batadv_ogm_packet->prev_sender,
1015 ntohl(batman_ogm_packet->seqno), batman_ogm_packet->ttvn, 1015 ntohl(batadv_ogm_packet->seqno), batadv_ogm_packet->ttvn,
1016 ntohs(batman_ogm_packet->tt_crc), 1016 ntohs(batadv_ogm_packet->tt_crc),
1017 batman_ogm_packet->tt_num_changes, batman_ogm_packet->tq, 1017 batadv_ogm_packet->tt_num_changes, batadv_ogm_packet->tq,
1018 batman_ogm_packet->header.ttl, 1018 batadv_ogm_packet->header.ttl,
1019 batman_ogm_packet->header.version, has_directlink_flag); 1019 batadv_ogm_packet->header.version, has_directlink_flag);
1020 1020
1021 rcu_read_lock(); 1021 rcu_read_lock();
1022 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) { 1022 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
@@ -1030,11 +1030,11 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
1030 hard_iface->net_dev->dev_addr)) 1030 hard_iface->net_dev->dev_addr))
1031 is_my_addr = 1; 1031 is_my_addr = 1;
1032 1032
1033 if (batadv_compare_eth(batman_ogm_packet->orig, 1033 if (batadv_compare_eth(batadv_ogm_packet->orig,
1034 hard_iface->net_dev->dev_addr)) 1034 hard_iface->net_dev->dev_addr))
1035 is_my_orig = 1; 1035 is_my_orig = 1;
1036 1036
1037 if (batadv_compare_eth(batman_ogm_packet->prev_sender, 1037 if (batadv_compare_eth(batadv_ogm_packet->prev_sender,
1038 hard_iface->net_dev->dev_addr)) 1038 hard_iface->net_dev->dev_addr))
1039 is_my_oldorig = 1; 1039 is_my_oldorig = 1;
1040 1040
@@ -1043,10 +1043,10 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
1043 } 1043 }
1044 rcu_read_unlock(); 1044 rcu_read_unlock();
1045 1045
1046 if (batman_ogm_packet->header.version != BATADV_COMPAT_VERSION) { 1046 if (batadv_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
1047 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 1047 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
1048 "Drop packet: incompatible batman version (%i)\n", 1048 "Drop packet: incompatible batman version (%i)\n",
1049 batman_ogm_packet->header.version); 1049 batadv_ogm_packet->header.version);
1050 return; 1050 return;
1051 } 1051 }
1052 1052
@@ -1082,14 +1082,14 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
1082 */ 1082 */
1083 if (has_directlink_flag && 1083 if (has_directlink_flag &&
1084 batadv_compare_eth(if_incoming->net_dev->dev_addr, 1084 batadv_compare_eth(if_incoming->net_dev->dev_addr,
1085 batman_ogm_packet->orig)) { 1085 batadv_ogm_packet->orig)) {
1086 if_num = if_incoming->if_num; 1086 if_num = if_incoming->if_num;
1087 offset = if_num * BATADV_NUM_WORDS; 1087 offset = if_num * BATADV_NUM_WORDS;
1088 1088
1089 spin_lock_bh(&orig_neigh_node->ogm_cnt_lock); 1089 spin_lock_bh(&orig_neigh_node->ogm_cnt_lock);
1090 word = &(orig_neigh_node->bcast_own[offset]); 1090 word = &(orig_neigh_node->bcast_own[offset]);
1091 bit_pos = if_incoming_seqno - 2; 1091 bit_pos = if_incoming_seqno - 2;
1092 bit_pos -= ntohl(batman_ogm_packet->seqno); 1092 bit_pos -= ntohl(batadv_ogm_packet->seqno);
1093 batadv_set_bit(word, bit_pos); 1093 batadv_set_bit(word, bit_pos);
1094 weight = &orig_neigh_node->bcast_own_sum[if_num]; 1094 weight = &orig_neigh_node->bcast_own_sum[if_num];
1095 *weight = bitmap_weight(word, 1095 *weight = bitmap_weight(word,
@@ -1110,18 +1110,18 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
1110 return; 1110 return;
1111 } 1111 }
1112 1112
1113 if (batman_ogm_packet->flags & BATADV_NOT_BEST_NEXT_HOP) { 1113 if (batadv_ogm_packet->flags & BATADV_NOT_BEST_NEXT_HOP) {
1114 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 1114 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
1115 "Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n", 1115 "Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n",
1116 ethhdr->h_source); 1116 ethhdr->h_source);
1117 return; 1117 return;
1118 } 1118 }
1119 1119
1120 orig_node = batadv_get_orig_node(bat_priv, batman_ogm_packet->orig); 1120 orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig);
1121 if (!orig_node) 1121 if (!orig_node)
1122 return; 1122 return;
1123 1123
1124 is_duplicate = batadv_iv_ogm_update_seqnos(ethhdr, batman_ogm_packet, 1124 is_duplicate = batadv_iv_ogm_update_seqnos(ethhdr, batadv_ogm_packet,
1125 if_incoming); 1125 if_incoming);
1126 1126
1127 if (is_duplicate == -1) { 1127 if (is_duplicate == -1) {
@@ -1131,7 +1131,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
1131 goto out; 1131 goto out;
1132 } 1132 }
1133 1133
1134 if (batman_ogm_packet->tq == 0) { 1134 if (batadv_ogm_packet->tq == 0) {
1135 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 1135 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
1136 "Drop packet: originator packet with tq equal 0\n"); 1136 "Drop packet: originator packet with tq equal 0\n");
1137 goto out; 1137 goto out;
@@ -1145,11 +1145,11 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
1145 (batadv_compare_eth(router->addr, ethhdr->h_source))) 1145 (batadv_compare_eth(router->addr, ethhdr->h_source)))
1146 is_from_best_next_hop = true; 1146 is_from_best_next_hop = true;
1147 1147
1148 prev_sender = batman_ogm_packet->prev_sender; 1148 prev_sender = batadv_ogm_packet->prev_sender;
1149 /* avoid temporary routing loops */ 1149 /* avoid temporary routing loops */
1150 if (router && router_router && 1150 if (router && router_router &&
1151 (batadv_compare_eth(router->addr, prev_sender)) && 1151 (batadv_compare_eth(router->addr, prev_sender)) &&
1152 !(batadv_compare_eth(batman_ogm_packet->orig, prev_sender)) && 1152 !(batadv_compare_eth(batadv_ogm_packet->orig, prev_sender)) &&
1153 (batadv_compare_eth(router->addr, router_router->addr))) { 1153 (batadv_compare_eth(router->addr, router_router->addr))) {
1154 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 1154 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
1155 "Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM)\n", 1155 "Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM)\n",
@@ -1178,26 +1178,26 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
1178 } 1178 }
1179 1179
1180 is_bidirect = batadv_iv_ogm_calc_tq(orig_node, orig_neigh_node, 1180 is_bidirect = batadv_iv_ogm_calc_tq(orig_node, orig_neigh_node,
1181 batman_ogm_packet, if_incoming); 1181 batadv_ogm_packet, if_incoming);
1182 1182
1183 batadv_bonding_save_primary(orig_node, orig_neigh_node, 1183 batadv_bonding_save_primary(orig_node, orig_neigh_node,
1184 batman_ogm_packet); 1184 batadv_ogm_packet);
1185 1185
1186 /* update ranking if it is not a duplicate or has the same 1186 /* update ranking if it is not a duplicate or has the same
1187 * seqno and similar ttl as the non-duplicate 1187 * seqno and similar ttl as the non-duplicate
1188 */ 1188 */
1189 sameseq = orig_node->last_real_seqno == ntohl(batman_ogm_packet->seqno); 1189 sameseq = orig_node->last_real_seqno == ntohl(batadv_ogm_packet->seqno);
1190 simlar_ttl = orig_node->last_ttl - 3 <= batman_ogm_packet->header.ttl; 1190 simlar_ttl = orig_node->last_ttl - 3 <= batadv_ogm_packet->header.ttl;
1191 if (is_bidirect && (!is_duplicate || (sameseq && simlar_ttl))) 1191 if (is_bidirect && (!is_duplicate || (sameseq && simlar_ttl)))
1192 batadv_iv_ogm_orig_update(bat_priv, orig_node, ethhdr, 1192 batadv_iv_ogm_orig_update(bat_priv, orig_node, ethhdr,
1193 batman_ogm_packet, if_incoming, 1193 batadv_ogm_packet, if_incoming,
1194 tt_buff, is_duplicate); 1194 tt_buff, is_duplicate);
1195 1195
1196 /* is single hop (direct) neighbor */ 1196 /* is single hop (direct) neighbor */
1197 if (is_single_hop_neigh) { 1197 if (is_single_hop_neigh) {
1198 1198
1199 /* mark direct link on incoming interface */ 1199 /* mark direct link on incoming interface */
1200 batadv_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, 1200 batadv_iv_ogm_forward(orig_node, ethhdr, batadv_ogm_packet,
1201 is_single_hop_neigh, 1201 is_single_hop_neigh,
1202 is_from_best_next_hop, if_incoming); 1202 is_from_best_next_hop, if_incoming);
1203 1203
@@ -1221,7 +1221,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
1221 1221
1222 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 1222 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
1223 "Forwarding packet: rebroadcast originator packet\n"); 1223 "Forwarding packet: rebroadcast originator packet\n");
1224 batadv_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, 1224 batadv_iv_ogm_forward(orig_node, ethhdr, batadv_ogm_packet,
1225 is_single_hop_neigh, is_from_best_next_hop, 1225 is_single_hop_neigh, is_from_best_next_hop,
1226 if_incoming); 1226 if_incoming);
1227 1227
@@ -1243,7 +1243,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
1243 struct hard_iface *if_incoming) 1243 struct hard_iface *if_incoming)
1244{ 1244{
1245 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 1245 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
1246 struct batman_ogm_packet *batman_ogm_packet; 1246 struct batadv_ogm_packet *batadv_ogm_packet;
1247 struct ethhdr *ethhdr; 1247 struct ethhdr *ethhdr;
1248 int buff_pos = 0, packet_len; 1248 int buff_pos = 0, packet_len;
1249 unsigned char *tt_buff, *packet_buff; 1249 unsigned char *tt_buff, *packet_buff;
@@ -1266,22 +1266,22 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
1266 packet_len = skb_headlen(skb); 1266 packet_len = skb_headlen(skb);
1267 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1267 ethhdr = (struct ethhdr *)skb_mac_header(skb);
1268 packet_buff = skb->data; 1268 packet_buff = skb->data;
1269 batman_ogm_packet = (struct batman_ogm_packet *)packet_buff; 1269 batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff;
1270 1270
1271 /* unpack the aggregated packets and process them one by one */ 1271 /* unpack the aggregated packets and process them one by one */
1272 do { 1272 do {
1273 tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN; 1273 tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN;
1274 1274
1275 batadv_iv_ogm_process(ethhdr, batman_ogm_packet, tt_buff, 1275 batadv_iv_ogm_process(ethhdr, batadv_ogm_packet, tt_buff,
1276 if_incoming); 1276 if_incoming);
1277 1277
1278 buff_pos += BATADV_OGM_HLEN; 1278 buff_pos += BATADV_OGM_HLEN;
1279 buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes); 1279 buff_pos += batadv_tt_len(batadv_ogm_packet->tt_num_changes);
1280 1280
1281 batman_ogm_packet = (struct batman_ogm_packet *) 1281 batadv_ogm_packet = (struct batadv_ogm_packet *)
1282 (packet_buff + buff_pos); 1282 (packet_buff + buff_pos);
1283 } while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len, 1283 } while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len,
1284 batman_ogm_packet->tt_num_changes)); 1284 batadv_ogm_packet->tt_num_changes));
1285 1285
1286 kfree_skb(skb); 1286 kfree_skb(skb);
1287 return NET_RX_SUCCESS; 1287 return NET_RX_SUCCESS;