batman-adv: agglomerate all batman iv ogm processing functions in a single file
[deliverable/linux.git] / net / batman-adv / bat_iv_ogm.c
CommitLineData
fc957275
ML
1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
3 *
4 * Marek Lindner, Simon Wunderlich
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA
19 *
20 */
21
22#include "main.h"
23#include "bat_ogm.h"
24#include "translation-table.h"
25#include "ring_buffer.h"
26#include "originator.h"
27#include "routing.h"
28#include "gateway_common.h"
29#include "gateway_client.h"
30#include "hard-interface.h"
31#include "send.h"
32
33/* is there another aggregated packet here? */
34static int bat_ogm_aggr_packet(int buff_pos, int packet_len,
35 int tt_num_changes)
36{
37 int next_buff_pos = buff_pos + BATMAN_OGM_LEN + tt_len(tt_num_changes);
38
39 return (next_buff_pos <= packet_len) &&
40 (next_buff_pos <= MAX_AGGREGATION_BYTES);
41}
42
43static void bat_ogm_orig_update(struct bat_priv *bat_priv,
44 struct orig_node *orig_node,
45 const struct ethhdr *ethhdr,
46 const struct batman_ogm_packet
47 *batman_ogm_packet,
48 struct hard_iface *if_incoming,
49 const unsigned char *tt_buff, int is_duplicate)
50{
51 struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
52 struct neigh_node *router = NULL;
53 struct orig_node *orig_node_tmp;
54 struct hlist_node *node;
55 uint8_t bcast_own_sum_orig, bcast_own_sum_neigh;
56
57 bat_dbg(DBG_BATMAN, bat_priv, "update_originator(): "
58 "Searching and updating originator entry of received packet\n");
59
60 rcu_read_lock();
61 hlist_for_each_entry_rcu(tmp_neigh_node, node,
62 &orig_node->neigh_list, list) {
63 if (compare_eth(tmp_neigh_node->addr, ethhdr->h_source) &&
64 (tmp_neigh_node->if_incoming == if_incoming) &&
65 atomic_inc_not_zero(&tmp_neigh_node->refcount)) {
66 if (neigh_node)
67 neigh_node_free_ref(neigh_node);
68 neigh_node = tmp_neigh_node;
69 continue;
70 }
71
72 if (is_duplicate)
73 continue;
74
75 spin_lock_bh(&tmp_neigh_node->tq_lock);
76 ring_buffer_set(tmp_neigh_node->tq_recv,
77 &tmp_neigh_node->tq_index, 0);
78 tmp_neigh_node->tq_avg =
79 ring_buffer_avg(tmp_neigh_node->tq_recv);
80 spin_unlock_bh(&tmp_neigh_node->tq_lock);
81 }
82
83 if (!neigh_node) {
84 struct orig_node *orig_tmp;
85
86 orig_tmp = get_orig_node(bat_priv, ethhdr->h_source);
87 if (!orig_tmp)
88 goto unlock;
89
90 neigh_node = create_neighbor(orig_node, orig_tmp,
91 ethhdr->h_source, if_incoming);
92
93 orig_node_free_ref(orig_tmp);
94 if (!neigh_node)
95 goto unlock;
96 } else
97 bat_dbg(DBG_BATMAN, bat_priv,
98 "Updating existing last-hop neighbor of originator\n");
99
100 rcu_read_unlock();
101
102 orig_node->flags = batman_ogm_packet->flags;
103 neigh_node->last_valid = jiffies;
104
105 spin_lock_bh(&neigh_node->tq_lock);
106 ring_buffer_set(neigh_node->tq_recv,
107 &neigh_node->tq_index,
108 batman_ogm_packet->tq);
109 neigh_node->tq_avg = ring_buffer_avg(neigh_node->tq_recv);
110 spin_unlock_bh(&neigh_node->tq_lock);
111
112 if (!is_duplicate) {
113 orig_node->last_ttl = batman_ogm_packet->ttl;
114 neigh_node->last_ttl = batman_ogm_packet->ttl;
115 }
116
117 bonding_candidate_add(orig_node, neigh_node);
118
119 /* if this neighbor already is our next hop there is nothing
120 * to change */
121 router = orig_node_get_router(orig_node);
122 if (router == neigh_node)
123 goto update_tt;
124
125 /* if this neighbor does not offer a better TQ we won't consider it */
126 if (router && (router->tq_avg > neigh_node->tq_avg))
127 goto update_tt;
128
129 /* if the TQ is the same and the link not more symmetric we
130 * won't consider it either */
131 if (router && (neigh_node->tq_avg == router->tq_avg)) {
132 orig_node_tmp = router->orig_node;
133 spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
134 bcast_own_sum_orig =
135 orig_node_tmp->bcast_own_sum[if_incoming->if_num];
136 spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
137
138 orig_node_tmp = neigh_node->orig_node;
139 spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
140 bcast_own_sum_neigh =
141 orig_node_tmp->bcast_own_sum[if_incoming->if_num];
142 spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
143
144 if (bcast_own_sum_orig >= bcast_own_sum_neigh)
145 goto update_tt;
146 }
147
148 update_route(bat_priv, orig_node, neigh_node);
149
150update_tt:
151 /* I have to check for transtable changes only if the OGM has been
152 * sent through a primary interface */
153 if (((batman_ogm_packet->orig != ethhdr->h_source) &&
154 (batman_ogm_packet->ttl > 2)) ||
155 (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP))
156 tt_update_orig(bat_priv, orig_node, tt_buff,
157 batman_ogm_packet->tt_num_changes,
158 batman_ogm_packet->ttvn,
159 batman_ogm_packet->tt_crc);
160
161 if (orig_node->gw_flags != batman_ogm_packet->gw_flags)
162 gw_node_update(bat_priv, orig_node,
163 batman_ogm_packet->gw_flags);
164
165 orig_node->gw_flags = batman_ogm_packet->gw_flags;
166
167 /* restart gateway selection if fast or late switching was enabled */
168 if ((orig_node->gw_flags) &&
169 (atomic_read(&bat_priv->gw_mode) == GW_MODE_CLIENT) &&
170 (atomic_read(&bat_priv->gw_sel_class) > 2))
171 gw_check_election(bat_priv, orig_node);
172
173 goto out;
174
175unlock:
176 rcu_read_unlock();
177out:
178 if (neigh_node)
179 neigh_node_free_ref(neigh_node);
180 if (router)
181 neigh_node_free_ref(router);
182}
183
184static int bat_ogm_calc_tq(struct orig_node *orig_node,
185 struct orig_node *orig_neigh_node,
186 struct batman_ogm_packet *batman_ogm_packet,
187 struct hard_iface *if_incoming)
188{
189 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
190 struct neigh_node *neigh_node = NULL, *tmp_neigh_node;
191 struct hlist_node *node;
192 uint8_t total_count;
193 uint8_t orig_eq_count, neigh_rq_count, tq_own;
194 int tq_asym_penalty, ret = 0;
195
196 /* find corresponding one hop neighbor */
197 rcu_read_lock();
198 hlist_for_each_entry_rcu(tmp_neigh_node, node,
199 &orig_neigh_node->neigh_list, list) {
200
201 if (!compare_eth(tmp_neigh_node->addr, orig_neigh_node->orig))
202 continue;
203
204 if (tmp_neigh_node->if_incoming != if_incoming)
205 continue;
206
207 if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
208 continue;
209
210 neigh_node = tmp_neigh_node;
211 break;
212 }
213 rcu_read_unlock();
214
215 if (!neigh_node)
216 neigh_node = create_neighbor(orig_neigh_node,
217 orig_neigh_node,
218 orig_neigh_node->orig,
219 if_incoming);
220
221 if (!neigh_node)
222 goto out;
223
224 /* if orig_node is direct neighbor update neigh_node last_valid */
225 if (orig_node == orig_neigh_node)
226 neigh_node->last_valid = jiffies;
227
228 orig_node->last_valid = jiffies;
229
230 /* find packet count of corresponding one hop neighbor */
231 spin_lock_bh(&orig_node->ogm_cnt_lock);
232 orig_eq_count = orig_neigh_node->bcast_own_sum[if_incoming->if_num];
233 neigh_rq_count = neigh_node->real_packet_count;
234 spin_unlock_bh(&orig_node->ogm_cnt_lock);
235
236 /* pay attention to not get a value bigger than 100 % */
237 total_count = (orig_eq_count > neigh_rq_count ?
238 neigh_rq_count : orig_eq_count);
239
240 /* if we have too few packets (too less data) we set tq_own to zero */
241 /* if we receive too few packets it is not considered bidirectional */
242 if ((total_count < TQ_LOCAL_BIDRECT_SEND_MINIMUM) ||
243 (neigh_rq_count < TQ_LOCAL_BIDRECT_RECV_MINIMUM))
244 tq_own = 0;
245 else
246 /* neigh_node->real_packet_count is never zero as we
247 * only purge old information when getting new
248 * information */
249 tq_own = (TQ_MAX_VALUE * total_count) / neigh_rq_count;
250
251 /*
252 * 1 - ((1-x) ** 3), normalized to TQ_MAX_VALUE this does
253 * affect the nearly-symmetric links only a little, but
254 * punishes asymmetric links more. This will give a value
255 * between 0 and TQ_MAX_VALUE
256 */
257 tq_asym_penalty = TQ_MAX_VALUE - (TQ_MAX_VALUE *
258 (TQ_LOCAL_WINDOW_SIZE - neigh_rq_count) *
259 (TQ_LOCAL_WINDOW_SIZE - neigh_rq_count) *
260 (TQ_LOCAL_WINDOW_SIZE - neigh_rq_count)) /
261 (TQ_LOCAL_WINDOW_SIZE *
262 TQ_LOCAL_WINDOW_SIZE *
263 TQ_LOCAL_WINDOW_SIZE);
264
265 batman_ogm_packet->tq = ((batman_ogm_packet->tq * tq_own
266 * tq_asym_penalty) /
267 (TQ_MAX_VALUE * TQ_MAX_VALUE));
268
269 bat_dbg(DBG_BATMAN, bat_priv,
270 "bidirectional: "
271 "orig = %-15pM neigh = %-15pM => own_bcast = %2i, "
272 "real recv = %2i, local tq: %3i, asym_penalty: %3i, "
273 "total tq: %3i\n",
274 orig_node->orig, orig_neigh_node->orig, total_count,
275 neigh_rq_count, tq_own, tq_asym_penalty, batman_ogm_packet->tq);
276
277 /* if link has the minimum required transmission quality
278 * consider it bidirectional */
279 if (batman_ogm_packet->tq >= TQ_TOTAL_BIDRECT_LIMIT)
280 ret = 1;
281
282out:
283 if (neigh_node)
284 neigh_node_free_ref(neigh_node);
285 return ret;
286}
287
288/* processes a batman packet for all interfaces, adjusts the sequence number and
289 * finds out whether it is a duplicate.
290 * returns:
291 * 1 the packet is a duplicate
292 * 0 the packet has not yet been received
293 * -1 the packet is old and has been received while the seqno window
294 * was protected. Caller should drop it.
295 */
296static int bat_ogm_update_seqnos(const struct ethhdr *ethhdr,
297 const struct batman_ogm_packet
298 *batman_ogm_packet,
299 const struct hard_iface *if_incoming)
300{
301 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
302 struct orig_node *orig_node;
303 struct neigh_node *tmp_neigh_node;
304 struct hlist_node *node;
305 int is_duplicate = 0;
306 int32_t seq_diff;
307 int need_update = 0;
308 int set_mark, ret = -1;
309
310 orig_node = get_orig_node(bat_priv, batman_ogm_packet->orig);
311 if (!orig_node)
312 return 0;
313
314 spin_lock_bh(&orig_node->ogm_cnt_lock);
315 seq_diff = batman_ogm_packet->seqno - orig_node->last_real_seqno;
316
317 /* signalize caller that the packet is to be dropped. */
318 if (window_protected(bat_priv, seq_diff,
319 &orig_node->batman_seqno_reset))
320 goto out;
321
322 rcu_read_lock();
323 hlist_for_each_entry_rcu(tmp_neigh_node, node,
324 &orig_node->neigh_list, list) {
325
326 is_duplicate |= get_bit_status(tmp_neigh_node->real_bits,
327 orig_node->last_real_seqno,
328 batman_ogm_packet->seqno);
329
330 if (compare_eth(tmp_neigh_node->addr, ethhdr->h_source) &&
331 (tmp_neigh_node->if_incoming == if_incoming))
332 set_mark = 1;
333 else
334 set_mark = 0;
335
336 /* if the window moved, set the update flag. */
337 need_update |= bit_get_packet(bat_priv,
338 tmp_neigh_node->real_bits,
339 seq_diff, set_mark);
340
341 tmp_neigh_node->real_packet_count =
342 bit_packet_count(tmp_neigh_node->real_bits);
343 }
344 rcu_read_unlock();
345
346 if (need_update) {
347 bat_dbg(DBG_BATMAN, bat_priv,
348 "updating last_seqno: old %d, new %d\n",
349 orig_node->last_real_seqno, batman_ogm_packet->seqno);
350 orig_node->last_real_seqno = batman_ogm_packet->seqno;
351 }
352
353 ret = is_duplicate;
354
355out:
356 spin_unlock_bh(&orig_node->ogm_cnt_lock);
357 orig_node_free_ref(orig_node);
358 return ret;
359}
360
361static void bat_ogm_process(const struct ethhdr *ethhdr,
362 struct batman_ogm_packet *batman_ogm_packet,
363 const unsigned char *tt_buff,
364 struct hard_iface *if_incoming)
365{
366 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
367 struct hard_iface *hard_iface;
368 struct orig_node *orig_neigh_node, *orig_node;
369 struct neigh_node *router = NULL, *router_router = NULL;
370 struct neigh_node *orig_neigh_router = NULL;
371 int has_directlink_flag;
372 int is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0;
373 int is_broadcast = 0, is_bidirectional, is_single_hop_neigh;
374 int is_duplicate;
375 uint32_t if_incoming_seqno;
376
377 /* Silently drop when the batman packet is actually not a
378 * correct packet.
379 *
380 * This might happen if a packet is padded (e.g. Ethernet has a
381 * minimum frame length of 64 byte) and the aggregation interprets
382 * it as an additional length.
383 *
384 * TODO: A more sane solution would be to have a bit in the
385 * batman_ogm_packet to detect whether the packet is the last
386 * packet in an aggregation. Here we expect that the padding
387 * is always zero (or not 0x01)
388 */
389 if (batman_ogm_packet->packet_type != BAT_OGM)
390 return;
391
392 /* could be changed by schedule_own_packet() */
393 if_incoming_seqno = atomic_read(&if_incoming->seqno);
394
395 has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0);
396
397 is_single_hop_neigh = (compare_eth(ethhdr->h_source,
398 batman_ogm_packet->orig) ? 1 : 0);
399
400 bat_dbg(DBG_BATMAN, bat_priv,
401 "Received BATMAN packet via NB: %pM, IF: %s [%pM] "
402 "(from OG: %pM, via prev OG: %pM, seqno %d, ttvn %u, "
403 "crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n",
404 ethhdr->h_source, if_incoming->net_dev->name,
405 if_incoming->net_dev->dev_addr, batman_ogm_packet->orig,
406 batman_ogm_packet->prev_sender, batman_ogm_packet->seqno,
407 batman_ogm_packet->ttvn, batman_ogm_packet->tt_crc,
408 batman_ogm_packet->tt_num_changes, batman_ogm_packet->tq,
409 batman_ogm_packet->ttl, batman_ogm_packet->version,
410 has_directlink_flag);
411
412 rcu_read_lock();
413 list_for_each_entry_rcu(hard_iface, &hardif_list, list) {
414 if (hard_iface->if_status != IF_ACTIVE)
415 continue;
416
417 if (hard_iface->soft_iface != if_incoming->soft_iface)
418 continue;
419
420 if (compare_eth(ethhdr->h_source,
421 hard_iface->net_dev->dev_addr))
422 is_my_addr = 1;
423
424 if (compare_eth(batman_ogm_packet->orig,
425 hard_iface->net_dev->dev_addr))
426 is_my_orig = 1;
427
428 if (compare_eth(batman_ogm_packet->prev_sender,
429 hard_iface->net_dev->dev_addr))
430 is_my_oldorig = 1;
431
432 if (is_broadcast_ether_addr(ethhdr->h_source))
433 is_broadcast = 1;
434 }
435 rcu_read_unlock();
436
437 if (batman_ogm_packet->version != COMPAT_VERSION) {
438 bat_dbg(DBG_BATMAN, bat_priv,
439 "Drop packet: incompatible batman version (%i)\n",
440 batman_ogm_packet->version);
441 return;
442 }
443
444 if (is_my_addr) {
445 bat_dbg(DBG_BATMAN, bat_priv,
446 "Drop packet: received my own broadcast (sender: %pM"
447 ")\n",
448 ethhdr->h_source);
449 return;
450 }
451
452 if (is_broadcast) {
453 bat_dbg(DBG_BATMAN, bat_priv, "Drop packet: "
454 "ignoring all packets with broadcast source addr (sender: %pM"
455 ")\n", ethhdr->h_source);
456 return;
457 }
458
459 if (is_my_orig) {
460 unsigned long *word;
461 int offset;
462
463 orig_neigh_node = get_orig_node(bat_priv, ethhdr->h_source);
464 if (!orig_neigh_node)
465 return;
466
467 /* neighbor has to indicate direct link and it has to
468 * come via the corresponding interface */
469 /* save packet seqno for bidirectional check */
470 if (has_directlink_flag &&
471 compare_eth(if_incoming->net_dev->dev_addr,
472 batman_ogm_packet->orig)) {
473 offset = if_incoming->if_num * NUM_WORDS;
474
475 spin_lock_bh(&orig_neigh_node->ogm_cnt_lock);
476 word = &(orig_neigh_node->bcast_own[offset]);
477 bit_mark(word,
478 if_incoming_seqno -
479 batman_ogm_packet->seqno - 2);
480 orig_neigh_node->bcast_own_sum[if_incoming->if_num] =
481 bit_packet_count(word);
482 spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock);
483 }
484
485 bat_dbg(DBG_BATMAN, bat_priv, "Drop packet: "
486 "originator packet from myself (via neighbor)\n");
487 orig_node_free_ref(orig_neigh_node);
488 return;
489 }
490
491 if (is_my_oldorig) {
492 bat_dbg(DBG_BATMAN, bat_priv,
493 "Drop packet: ignoring all rebroadcast echos (sender: "
494 "%pM)\n", ethhdr->h_source);
495 return;
496 }
497
498 orig_node = get_orig_node(bat_priv, batman_ogm_packet->orig);
499 if (!orig_node)
500 return;
501
502 is_duplicate = bat_ogm_update_seqnos(ethhdr, batman_ogm_packet,
503 if_incoming);
504
505 if (is_duplicate == -1) {
506 bat_dbg(DBG_BATMAN, bat_priv,
507 "Drop packet: packet within seqno protection time "
508 "(sender: %pM)\n", ethhdr->h_source);
509 goto out;
510 }
511
512 if (batman_ogm_packet->tq == 0) {
513 bat_dbg(DBG_BATMAN, bat_priv,
514 "Drop packet: originator packet with tq equal 0\n");
515 goto out;
516 }
517
518 router = orig_node_get_router(orig_node);
519 if (router)
520 router_router = orig_node_get_router(router->orig_node);
521
522 /* avoid temporary routing loops */
523 if (router && router_router &&
524 (compare_eth(router->addr, batman_ogm_packet->prev_sender)) &&
525 !(compare_eth(batman_ogm_packet->orig,
526 batman_ogm_packet->prev_sender)) &&
527 (compare_eth(router->addr, router_router->addr))) {
528 bat_dbg(DBG_BATMAN, bat_priv,
529 "Drop packet: ignoring all rebroadcast packets that "
530 "may make me loop (sender: %pM)\n", ethhdr->h_source);
531 goto out;
532 }
533
534 /* if sender is a direct neighbor the sender mac equals
535 * originator mac */
536 orig_neigh_node = (is_single_hop_neigh ?
537 orig_node :
538 get_orig_node(bat_priv, ethhdr->h_source));
539 if (!orig_neigh_node)
540 goto out;
541
542 orig_neigh_router = orig_node_get_router(orig_neigh_node);
543
544 /* drop packet if sender is not a direct neighbor and if we
545 * don't route towards it */
546 if (!is_single_hop_neigh && (!orig_neigh_router)) {
547 bat_dbg(DBG_BATMAN, bat_priv,
548 "Drop packet: OGM via unknown neighbor!\n");
549 goto out_neigh;
550 }
551
552 is_bidirectional = bat_ogm_calc_tq(orig_node, orig_neigh_node,
553 batman_ogm_packet, if_incoming);
554
555 bonding_save_primary(orig_node, orig_neigh_node, batman_ogm_packet);
556
557 /* update ranking if it is not a duplicate or has the same
558 * seqno and similar ttl as the non-duplicate */
559 if (is_bidirectional &&
560 (!is_duplicate ||
561 ((orig_node->last_real_seqno == batman_ogm_packet->seqno) &&
562 (orig_node->last_ttl - 3 <= batman_ogm_packet->ttl))))
563 bat_ogm_orig_update(bat_priv, orig_node, ethhdr,
564 batman_ogm_packet, if_incoming,
565 tt_buff, is_duplicate);
566
567 /* is single hop (direct) neighbor */
568 if (is_single_hop_neigh) {
569
570 /* mark direct link on incoming interface */
571 schedule_forward_packet(orig_node, ethhdr, batman_ogm_packet,
572 1, if_incoming);
573
574 bat_dbg(DBG_BATMAN, bat_priv, "Forwarding packet: "
575 "rebroadcast neighbor packet with direct link flag\n");
576 goto out_neigh;
577 }
578
579 /* multihop originator */
580 if (!is_bidirectional) {
581 bat_dbg(DBG_BATMAN, bat_priv,
582 "Drop packet: not received via bidirectional link\n");
583 goto out_neigh;
584 }
585
586 if (is_duplicate) {
587 bat_dbg(DBG_BATMAN, bat_priv,
588 "Drop packet: duplicate packet received\n");
589 goto out_neigh;
590 }
591
592 bat_dbg(DBG_BATMAN, bat_priv,
593 "Forwarding packet: rebroadcast originator packet\n");
594 schedule_forward_packet(orig_node, ethhdr, batman_ogm_packet,
595 0, if_incoming);
596
597out_neigh:
598 if ((orig_neigh_node) && (!is_single_hop_neigh))
599 orig_node_free_ref(orig_neigh_node);
600out:
601 if (router)
602 neigh_node_free_ref(router);
603 if (router_router)
604 neigh_node_free_ref(router_router);
605 if (orig_neigh_router)
606 neigh_node_free_ref(orig_neigh_router);
607
608 orig_node_free_ref(orig_node);
609}
610
611void bat_ogm_receive(const struct ethhdr *ethhdr, unsigned char *packet_buff,
612 int packet_len, struct hard_iface *if_incoming)
613{
614 struct batman_ogm_packet *batman_ogm_packet;
615 int buff_pos = 0;
616 unsigned char *tt_buff;
617
618 batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;
619
620 /* unpack the aggregated packets and process them one by one */
621 do {
622 /* network to host order for our 32bit seqno and the
623 orig_interval */
624 batman_ogm_packet->seqno = ntohl(batman_ogm_packet->seqno);
625 batman_ogm_packet->tt_crc = ntohs(batman_ogm_packet->tt_crc);
626
627 tt_buff = packet_buff + buff_pos + BATMAN_OGM_LEN;
628
629 bat_ogm_process(ethhdr, batman_ogm_packet,
630 tt_buff, if_incoming);
631
632 buff_pos += BATMAN_OGM_LEN +
633 tt_len(batman_ogm_packet->tt_num_changes);
634
635 batman_ogm_packet = (struct batman_ogm_packet *)
636 (packet_buff + buff_pos);
637 } while (bat_ogm_aggr_packet(buff_pos, packet_len,
638 batman_ogm_packet->tt_num_changes));
639}
This page took 0.047363 seconds and 5 git commands to generate.