routing.c (f097e25dbe9144447f46b6b61ca3da1a2ba432d4) | routing.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 * --- 14 unchanged lines hidden (view full) --- 23#include "soft-interface.h" 24#include "hard-interface.h" 25#include "icmp_socket.h" 26#include "translation-table.h" 27#include "originator.h" 28#include "bridge_loop_avoidance.h" 29#include "distributed-arp-table.h" 30#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 * --- 14 unchanged lines hidden (view full) --- 23#include "soft-interface.h" 24#include "hard-interface.h" 25#include "icmp_socket.h" 26#include "translation-table.h" 27#include "originator.h" 28#include "bridge_loop_avoidance.h" 29#include "distributed-arp-table.h" 30#include "network-coding.h" |
31#include "fragmentation.h" |
|
31 32static int batadv_route_unicast_packet(struct sk_buff *skb, 33 struct batadv_hard_iface *recv_if); 34 35static void _batadv_update_route(struct batadv_priv *bat_priv, 36 struct batadv_orig_node *orig_node, 37 struct batadv_neigh_node *neigh_node) 38{ --- 969 unchanged lines hidden (view full) --- 1008 tvlv_buff, tvlv_buff_len); 1009 1010 if (ret != NET_RX_SUCCESS) 1011 ret = batadv_route_unicast_packet(skb, recv_if); 1012 1013 return ret; 1014} 1015 | 32 33static int batadv_route_unicast_packet(struct sk_buff *skb, 34 struct batadv_hard_iface *recv_if); 35 36static void _batadv_update_route(struct batadv_priv *bat_priv, 37 struct batadv_orig_node *orig_node, 38 struct batadv_neigh_node *neigh_node) 39{ --- 969 unchanged lines hidden (view full) --- 1009 tvlv_buff, tvlv_buff_len); 1010 1011 if (ret != NET_RX_SUCCESS) 1012 ret = batadv_route_unicast_packet(skb, recv_if); 1013 1014 return ret; 1015} 1016 |
1017/** 1018 * batadv_recv_frag_packet - process received fragment 1019 * @skb: the received fragment 1020 * @recv_if: interface that the skb is received on 1021 * 1022 * This function does one of the three following things: 1) Forward fragment, if 1023 * the assembled packet will exceed our MTU; 2) Buffer fragment, if we till 1024 * lack further fragments; 3) Merge fragments, if we have all needed parts. 1025 * 1026 * Return NET_RX_DROP if the skb is not consumed, NET_RX_SUCCESS otherwise. 1027 */ 1028int batadv_recv_frag_packet(struct sk_buff *skb, 1029 struct batadv_hard_iface *recv_if) 1030{ 1031 struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); 1032 struct batadv_orig_node *orig_node_src = NULL; 1033 struct batadv_frag_packet *frag_packet; 1034 int ret = NET_RX_DROP; 1035 1036 if (batadv_check_unicast_packet(bat_priv, skb, 1037 sizeof(*frag_packet)) < 0) 1038 goto out; 1039 1040 frag_packet = (struct batadv_frag_packet *)skb->data; 1041 orig_node_src = batadv_orig_hash_find(bat_priv, frag_packet->orig); 1042 if (!orig_node_src) 1043 goto out; 1044 1045 /* Route the fragment if it is not for us and too big to be merged. */ 1046 if (!batadv_is_my_mac(bat_priv, frag_packet->dest) && 1047 batadv_frag_skb_fwd(skb, recv_if, orig_node_src)) { 1048 ret = NET_RX_SUCCESS; 1049 goto out; 1050 } 1051 1052 batadv_inc_counter(bat_priv, BATADV_CNT_FRAG_RX); 1053 batadv_add_counter(bat_priv, BATADV_CNT_FRAG_RX_BYTES, skb->len); 1054 1055 /* Add fragment to buffer and merge if possible. */ 1056 if (!batadv_frag_skb_buffer(&skb, orig_node_src)) 1057 goto out; 1058 1059 /* Deliver merged packet to the appropriate handler, if it was 1060 * merged 1061 */ 1062 if (skb) 1063 batadv_batman_skb_recv(skb, recv_if->net_dev, 1064 &recv_if->batman_adv_ptype, NULL); 1065 1066 ret = NET_RX_SUCCESS; 1067 1068out: 1069 if (orig_node_src) 1070 batadv_orig_node_free_ref(orig_node_src); 1071 1072 return ret; 1073} 1074 |
|
1016int batadv_recv_bcast_packet(struct sk_buff *skb, 1017 struct batadv_hard_iface *recv_if) 1018{ 1019 struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); 1020 struct batadv_orig_node *orig_node = NULL; 1021 struct batadv_bcast_packet *bcast_packet; 1022 struct ethhdr *ethhdr; 1023 int hdr_size = sizeof(*bcast_packet); --- 92 unchanged lines hidden --- | 1075int batadv_recv_bcast_packet(struct sk_buff *skb, 1076 struct batadv_hard_iface *recv_if) 1077{ 1078 struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); 1079 struct batadv_orig_node *orig_node = NULL; 1080 struct batadv_bcast_packet *bcast_packet; 1081 struct ethhdr *ethhdr; 1082 int hdr_size = sizeof(*bcast_packet); --- 92 unchanged lines hidden --- |