routing.c (30d3c5113f9a3f162d65d01b771b122afac0ce79) routing.c (9455e34cb2ded22e01abb6daa65ba1caeed8d7fe)
1/*
2 * Copyright (C) 2007-2012 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.

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

314
315 icmp_packet = (struct icmp_packet_rr *)skb->data;
316
317 memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
318 memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
319 icmp_packet->msg_type = ECHO_REPLY;
320 icmp_packet->header.ttl = TTL;
321
1/*
2 * Copyright (C) 2007-2012 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.

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

314
315 icmp_packet = (struct icmp_packet_rr *)skb->data;
316
317 memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
318 memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
319 icmp_packet->msg_type = ECHO_REPLY;
320 icmp_packet->header.ttl = TTL;
321
322 send_skb_packet(skb, router->if_incoming, router->addr);
322 batadv_send_skb_packet(skb, router->if_incoming, router->addr);
323 ret = NET_RX_SUCCESS;
324
325out:
326 if (primary_if)
327 hardif_free_ref(primary_if);
328 if (router)
329 batadv_neigh_node_free_ref(router);
330 if (orig_node)

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

369
370 icmp_packet = (struct icmp_packet *)skb->data;
371
372 memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
373 memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
374 icmp_packet->msg_type = TTL_EXCEEDED;
375 icmp_packet->header.ttl = TTL;
376
323 ret = NET_RX_SUCCESS;
324
325out:
326 if (primary_if)
327 hardif_free_ref(primary_if);
328 if (router)
329 batadv_neigh_node_free_ref(router);
330 if (orig_node)

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

369
370 icmp_packet = (struct icmp_packet *)skb->data;
371
372 memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
373 memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
374 icmp_packet->msg_type = TTL_EXCEEDED;
375 icmp_packet->header.ttl = TTL;
376
377 send_skb_packet(skb, router->if_incoming, router->addr);
377 batadv_send_skb_packet(skb, router->if_incoming, router->addr);
378 ret = NET_RX_SUCCESS;
379
380out:
381 if (primary_if)
382 hardif_free_ref(primary_if);
383 if (router)
384 batadv_neigh_node_free_ref(router);
385 if (orig_node)

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

454 goto out;
455
456 icmp_packet = (struct icmp_packet_rr *)skb->data;
457
458 /* decrement ttl */
459 icmp_packet->header.ttl--;
460
461 /* route it */
378 ret = NET_RX_SUCCESS;
379
380out:
381 if (primary_if)
382 hardif_free_ref(primary_if);
383 if (router)
384 batadv_neigh_node_free_ref(router);
385 if (orig_node)

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

454 goto out;
455
456 icmp_packet = (struct icmp_packet_rr *)skb->data;
457
458 /* decrement ttl */
459 icmp_packet->header.ttl--;
460
461 /* route it */
462 send_skb_packet(skb, router->if_incoming, router->addr);
462 batadv_send_skb_packet(skb, router->if_incoming, router->addr);
463 ret = NET_RX_SUCCESS;
464
465out:
466 if (router)
467 batadv_neigh_node_free_ref(router);
468 if (orig_node)
469 batadv_orig_node_free_ref(orig_node);
470 return ret;

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

876 unicast_packet->header.ttl--;
877
878 /* Update stats counter */
879 batadv_inc_counter(bat_priv, BAT_CNT_FORWARD);
880 batadv_add_counter(bat_priv, BAT_CNT_FORWARD_BYTES,
881 skb->len + ETH_HLEN);
882
883 /* route it */
463 ret = NET_RX_SUCCESS;
464
465out:
466 if (router)
467 batadv_neigh_node_free_ref(router);
468 if (orig_node)
469 batadv_orig_node_free_ref(orig_node);
470 return ret;

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

876 unicast_packet->header.ttl--;
877
878 /* Update stats counter */
879 batadv_inc_counter(bat_priv, BAT_CNT_FORWARD);
880 batadv_add_counter(bat_priv, BAT_CNT_FORWARD_BYTES,
881 skb->len + ETH_HLEN);
882
883 /* route it */
884 send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
884 batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
885 ret = NET_RX_SUCCESS;
886
887out:
888 if (neigh_node)
889 batadv_neigh_node_free_ref(neigh_node);
890 if (orig_node)
891 batadv_orig_node_free_ref(orig_node);
892 return ret;

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

1090
1091 spin_unlock_bh(&orig_node->bcast_seqno_lock);
1092
1093 /* check whether this has been sent by another originator before */
1094 if (batadv_bla_check_bcast_duplist(bat_priv, bcast_packet, hdr_size))
1095 goto out;
1096
1097 /* rebroadcast packet */
885 ret = NET_RX_SUCCESS;
886
887out:
888 if (neigh_node)
889 batadv_neigh_node_free_ref(neigh_node);
890 if (orig_node)
891 batadv_orig_node_free_ref(orig_node);
892 return ret;

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

1090
1091 spin_unlock_bh(&orig_node->bcast_seqno_lock);
1092
1093 /* check whether this has been sent by another originator before */
1094 if (batadv_bla_check_bcast_duplist(bat_priv, bcast_packet, hdr_size))
1095 goto out;
1096
1097 /* rebroadcast packet */
1098 add_bcast_packet_to_list(bat_priv, skb, 1);
1098 batadv_add_bcast_packet_to_list(bat_priv, skb, 1);
1099
1100 /* don't hand the broadcast up if it is from an originator
1101 * from the same backbone.
1102 */
1103 if (batadv_bla_is_backbone_gw(skb, orig_node, hdr_size))
1104 goto out;
1105
1106 /* broadcast for me */

--- 59 unchanged lines hidden ---
1099
1100 /* don't hand the broadcast up if it is from an originator
1101 * from the same backbone.
1102 */
1103 if (batadv_bla_is_backbone_gw(skb, orig_node, hdr_size))
1104 goto out;
1105
1106 /* broadcast for me */

--- 59 unchanged lines hidden ---