main.c (e23c34bb41da65f354fb7eee04300c56ee48f60c) main.c (a40d9b075c21f06872de3f05cc2eb3d06665e2ff)
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 *

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

378 goto err_free;
379
380 /* discard frames on not active interfaces */
381 if (hard_iface->if_status != BATADV_IF_ACTIVE)
382 goto err_free;
383
384 batadv_ogm_packet = (struct batadv_ogm_packet *)skb->data;
385
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 *

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

378 goto err_free;
379
380 /* discard frames on not active interfaces */
381 if (hard_iface->if_status != BATADV_IF_ACTIVE)
382 goto err_free;
383
384 batadv_ogm_packet = (struct batadv_ogm_packet *)skb->data;
385
386 if (batadv_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
386 if (batadv_ogm_packet->version != BATADV_COMPAT_VERSION) {
387 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
388 "Drop packet: incompatible batman version (%i)\n",
387 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
388 "Drop packet: incompatible batman version (%i)\n",
389 batadv_ogm_packet->header.version);
389 batadv_ogm_packet->version);
390 goto err_free;
391 }
392
393 /* all receive handlers return whether they received or reused
394 * the supplied skb. if not, we have to free the skb.
395 */
390 goto err_free;
391 }
392
393 /* all receive handlers return whether they received or reused
394 * the supplied skb. if not, we have to free the skb.
395 */
396 idx = batadv_ogm_packet->header.packet_type;
396 idx = batadv_ogm_packet->packet_type;
397 ret = (*batadv_rx_handler[idx])(skb, hard_iface);
398
399 if (ret == NET_RX_DROP)
400 kfree_skb(skb);
401
402 /* return NET_RX_SUCCESS in any case as we
403 * most probably dropped the packet for
404 * routing-logical reasons.

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

1114 skb = netdev_alloc_skb_ip_align(NULL, ETH_HLEN + hdr_len + tvlv_len);
1115 if (!skb)
1116 goto out;
1117
1118 skb->priority = TC_PRIO_CONTROL;
1119 skb_reserve(skb, ETH_HLEN);
1120 tvlv_buff = skb_put(skb, sizeof(*unicast_tvlv_packet) + tvlv_len);
1121 unicast_tvlv_packet = (struct batadv_unicast_tvlv_packet *)tvlv_buff;
397 ret = (*batadv_rx_handler[idx])(skb, hard_iface);
398
399 if (ret == NET_RX_DROP)
400 kfree_skb(skb);
401
402 /* return NET_RX_SUCCESS in any case as we
403 * most probably dropped the packet for
404 * routing-logical reasons.

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

1114 skb = netdev_alloc_skb_ip_align(NULL, ETH_HLEN + hdr_len + tvlv_len);
1115 if (!skb)
1116 goto out;
1117
1118 skb->priority = TC_PRIO_CONTROL;
1119 skb_reserve(skb, ETH_HLEN);
1120 tvlv_buff = skb_put(skb, sizeof(*unicast_tvlv_packet) + tvlv_len);
1121 unicast_tvlv_packet = (struct batadv_unicast_tvlv_packet *)tvlv_buff;
1122 unicast_tvlv_packet->header.packet_type = BATADV_UNICAST_TVLV;
1123 unicast_tvlv_packet->header.version = BATADV_COMPAT_VERSION;
1124 unicast_tvlv_packet->header.ttl = BATADV_TTL;
1122 unicast_tvlv_packet->packet_type = BATADV_UNICAST_TVLV;
1123 unicast_tvlv_packet->version = BATADV_COMPAT_VERSION;
1124 unicast_tvlv_packet->ttl = BATADV_TTL;
1125 unicast_tvlv_packet->reserved = 0;
1126 unicast_tvlv_packet->tvlv_len = htons(tvlv_len);
1127 unicast_tvlv_packet->align = 0;
1128 memcpy(unicast_tvlv_packet->src, src, ETH_ALEN);
1129 memcpy(unicast_tvlv_packet->dst, dst, ETH_ALEN);
1130
1131 tvlv_buff = (unsigned char *)(unicast_tvlv_packet + 1);
1132 tvlv_hdr = (struct batadv_tvlv_hdr *)tvlv_buff;

--- 82 unchanged lines hidden ---
1125 unicast_tvlv_packet->reserved = 0;
1126 unicast_tvlv_packet->tvlv_len = htons(tvlv_len);
1127 unicast_tvlv_packet->align = 0;
1128 memcpy(unicast_tvlv_packet->src, src, ETH_ALEN);
1129 memcpy(unicast_tvlv_packet->dst, dst, ETH_ALEN);
1130
1131 tvlv_buff = (unsigned char *)(unicast_tvlv_packet + 1);
1132 tvlv_hdr = (struct batadv_tvlv_hdr *)tvlv_buff;

--- 82 unchanged lines hidden ---