main.c (f097e25dbe9144447f46b6b61ca3da1a2ba432d4) main.c (610bfc6bc99bc83680d190ebc69359a05fc7f605)
1/* Copyright (C) 2007-2013 B.A.T.M.A.N. contributors:
2 *
3 * Marek Lindner, Simon Wunderlich
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public
7 * License as published by the Free Software Foundation.
8 *

--- 26 unchanged lines hidden (view full) ---

35#include "hard-interface.h"
36#include "gateway_client.h"
37#include "bridge_loop_avoidance.h"
38#include "distributed-arp-table.h"
39#include "gateway_common.h"
40#include "hash.h"
41#include "bat_algo.h"
42#include "network-coding.h"
1/* Copyright (C) 2007-2013 B.A.T.M.A.N. contributors:
2 *
3 * Marek Lindner, Simon Wunderlich
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public
7 * License as published by the Free Software Foundation.
8 *

--- 26 unchanged lines hidden (view full) ---

35#include "hard-interface.h"
36#include "gateway_client.h"
37#include "bridge_loop_avoidance.h"
38#include "distributed-arp-table.h"
39#include "gateway_common.h"
40#include "hash.h"
41#include "bat_algo.h"
42#include "network-coding.h"
43#include "fragmentation.h"
43
44
45/* List manipulations on hardif_list have to be rtnl_lock()'ed,
46 * list traversals just rcu-locked
47 */
48struct list_head batadv_hardif_list;
49static int (*batadv_rx_handler[256])(struct sk_buff *,
50 struct batadv_hard_iface *);

--- 343 unchanged lines hidden (view full) ---

394
395 for (i = BATADV_UNICAST_MIN; i <= BATADV_UNICAST_MAX; i++)
396 batadv_rx_handler[i] = batadv_recv_unhandled_unicast_packet;
397
398 /* compile time checks for struct member offsets */
399 BUILD_BUG_ON(offsetof(struct batadv_unicast_4addr_packet, src) != 10);
400 BUILD_BUG_ON(offsetof(struct batadv_unicast_packet, dest) != 4);
401 BUILD_BUG_ON(offsetof(struct batadv_unicast_tvlv_packet, dst) != 4);
44
45
46/* List manipulations on hardif_list have to be rtnl_lock()'ed,
47 * list traversals just rcu-locked
48 */
49struct list_head batadv_hardif_list;
50static int (*batadv_rx_handler[256])(struct sk_buff *,
51 struct batadv_hard_iface *);

--- 343 unchanged lines hidden (view full) ---

395
396 for (i = BATADV_UNICAST_MIN; i <= BATADV_UNICAST_MAX; i++)
397 batadv_rx_handler[i] = batadv_recv_unhandled_unicast_packet;
398
399 /* compile time checks for struct member offsets */
400 BUILD_BUG_ON(offsetof(struct batadv_unicast_4addr_packet, src) != 10);
401 BUILD_BUG_ON(offsetof(struct batadv_unicast_packet, dest) != 4);
402 BUILD_BUG_ON(offsetof(struct batadv_unicast_tvlv_packet, dst) != 4);
403 BUILD_BUG_ON(offsetof(struct batadv_frag_packet, dest) != 4);
402 BUILD_BUG_ON(offsetof(struct batadv_icmp_packet, dst) != 4);
403 BUILD_BUG_ON(offsetof(struct batadv_icmp_packet_rr, dst) != 4);
404
405 /* broadcast packet */
406 batadv_rx_handler[BATADV_BCAST] = batadv_recv_bcast_packet;
407
408 /* unicast packets ... */
409 /* unicast with 4 addresses packet */
410 batadv_rx_handler[BATADV_UNICAST_4ADDR] = batadv_recv_unicast_packet;
411 /* unicast packet */
412 batadv_rx_handler[BATADV_UNICAST] = batadv_recv_unicast_packet;
413 /* unicast tvlv packet */
414 batadv_rx_handler[BATADV_UNICAST_TVLV] = batadv_recv_unicast_tvlv;
415 /* batman icmp packet */
416 batadv_rx_handler[BATADV_ICMP] = batadv_recv_icmp_packet;
404 BUILD_BUG_ON(offsetof(struct batadv_icmp_packet, dst) != 4);
405 BUILD_BUG_ON(offsetof(struct batadv_icmp_packet_rr, dst) != 4);
406
407 /* broadcast packet */
408 batadv_rx_handler[BATADV_BCAST] = batadv_recv_bcast_packet;
409
410 /* unicast packets ... */
411 /* unicast with 4 addresses packet */
412 batadv_rx_handler[BATADV_UNICAST_4ADDR] = batadv_recv_unicast_packet;
413 /* unicast packet */
414 batadv_rx_handler[BATADV_UNICAST] = batadv_recv_unicast_packet;
415 /* unicast tvlv packet */
416 batadv_rx_handler[BATADV_UNICAST_TVLV] = batadv_recv_unicast_tvlv;
417 /* batman icmp packet */
418 batadv_rx_handler[BATADV_ICMP] = batadv_recv_icmp_packet;
419 /* Fragmented packets */
420 batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_frag_packet;
417}
418
419int
420batadv_recv_handler_register(uint8_t packet_type,
421 int (*recv_handler)(struct sk_buff *,
422 struct batadv_hard_iface *))
423{
424 int (*curr)(struct sk_buff *,

--- 732 unchanged lines hidden ---
421}
422
423int
424batadv_recv_handler_register(uint8_t packet_type,
425 int (*recv_handler)(struct sk_buff *,
426 struct batadv_hard_iface *))
427{
428 int (*curr)(struct sk_buff *,

--- 732 unchanged lines hidden ---