aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorMartin Hundebøll <martin@hundeboll.net>2013-01-25 05:12:42 -0500
committerAntonio Quartulli <ordex@autistici.org>2013-03-13 17:53:50 -0400
commit612d2b4fe0a1ff2f8389462a6f8be34e54124c05 (patch)
tree033dc44cbb8a68965e2eb0b7e5039a46ed845a52 /net/batman-adv/routing.c
parent3c12de9a5c756b23fe7c9ab332474ece1568914c (diff)
batman-adv: network coding - save overheard and tx packets for decoding
To be able to decode a network coded packet, a node must already know one of the two coded packets. This is done by buffering skbs before transmission and buffering packets sniffed with promiscuous mode from other hosts. Packets are kept in a buffer similar to the one with forward-skbs: A hash table, where each entry, which corresponds to a src-dst pair, has a linked list packets. Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 44fda7c6171e..8f88967ff14b 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1047,7 +1047,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
1047 struct batadv_unicast_4addr_packet *unicast_4addr_packet; 1047 struct batadv_unicast_4addr_packet *unicast_4addr_packet;
1048 uint8_t *orig_addr; 1048 uint8_t *orig_addr;
1049 struct batadv_orig_node *orig_node = NULL; 1049 struct batadv_orig_node *orig_node = NULL;
1050 int hdr_size = sizeof(*unicast_packet); 1050 int check, hdr_size = sizeof(*unicast_packet);
1051 bool is4addr; 1051 bool is4addr;
1052 1052
1053 unicast_packet = (struct batadv_unicast_packet *)skb->data; 1053 unicast_packet = (struct batadv_unicast_packet *)skb->data;
@@ -1058,7 +1058,16 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
1058 if (is4addr) 1058 if (is4addr)
1059 hdr_size = sizeof(*unicast_4addr_packet); 1059 hdr_size = sizeof(*unicast_4addr_packet);
1060 1060
1061 if (batadv_check_unicast_packet(skb, hdr_size) < 0) 1061 /* function returns -EREMOTE for promiscuous packets */
1062 check = batadv_check_unicast_packet(skb, hdr_size);
1063
1064 /* Even though the packet is not for us, we might save it to use for
1065 * decoding a later received coded packet
1066 */
1067 if (check == -EREMOTE)
1068 batadv_nc_skb_store_sniffed_unicast(bat_priv, skb);
1069
1070 if (check < 0)
1062 return NET_RX_DROP; 1071 return NET_RX_DROP;
1063 1072
1064 if (!batadv_check_unicast_ttvn(bat_priv, skb)) 1073 if (!batadv_check_unicast_ttvn(bat_priv, skb))