Repository : ssh://git@open-mesh.org/batman-adv
On branch : next
commit 4669c9cec49229d327f8c2535c2a8b36be358ab0 Merge: 0e59ab2 647d23f Author: Marek Lindner lindner_marek@yahoo.de Date: Tue Apr 16 22:08:38 2013 +0800
Merge branch 'maint' into next
Conflicts: routing.c
4669c9cec49229d327f8c2535c2a8b36be358ab0 main.c | 5 ++++- main.h | 2 +- routing.c | 38 ++++++++++++++++++++------------------ translation-table.c | 2 +- vis.c | 4 ++-- 5 files changed, 28 insertions(+), 23 deletions(-)
diff --cc routing.c index 8f88967,319f290..addeff8 --- a/routing.c +++ b/routing.c @@@ -549,17 -548,8 +549,18 @@@ batadv_find_ifalter_router(struct batad return router; }
+/** + * batadv_check_unicast_packet - Check for malformed unicast packets + * @skb: packet to check + * @hdr_size: size of header to pull + * + * Check for short header and bad addresses in given packet. Returns negative + * value when check fails and 0 otherwise. The negative value depends on the + * reason: -ENODATA for bad header, -EBADR for broadcast destination or source, + * and -EREMOTE for non-local (other host) destination. + */ - static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) + static int batadv_check_unicast_packet(struct batadv_priv *bat_priv, + struct sk_buff *skb, int hdr_size) { struct ethhdr *ethhdr;
@@@ -575,11 -565,11 +576,11 @@@
/* packet with broadcast sender address */ if (is_broadcast_ether_addr(ethhdr->h_source)) - return -1; + return -EBADR;
/* not for me */ - if (!batadv_is_my_mac(ethhdr->h_dest)) + if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest)) - return -1; + return -EREMOTE;
return 0; } @@@ -1058,16 -1046,7 +1060,16 @@@ int batadv_recv_unicast_packet(struct s if (is4addr) hdr_size = sizeof(*unicast_4addr_packet);
- if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) + /* function returns -EREMOTE for promiscuous packets */ - check = batadv_check_unicast_packet(skb, hdr_size); ++ check = batadv_check_unicast_packet(bat_priv, skb, hdr_size); + + /* Even though the packet is not for us, we might save it to use for + * decoding a later received coded packet + */ + if (check == -EREMOTE) + batadv_nc_skb_store_sniffed_unicast(bat_priv, skb); + + if (check < 0) return NET_RX_DROP;
if (!batadv_check_unicast_ttvn(bat_priv, skb))