Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
commit d2995e968a6b9c397bb37c030ed669038492e9d4 Merge: a90037d 974dfa5 Author: Marek Lindner lindner_marek@yahoo.de Date: Wed Aug 7 19:24:21 2013 +0800
Merge branch 'next'
Conflicts: gateway_client.c unicast.c
d2995e968a6b9c397bb37c030ed669038492e9d4 bridge_loop_avoidance.c | 2 + gateway_client.c | 15 +- gateway_client.h | 3 +- soft-interface.c | 9 +- unicast.c | 489 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 513 insertions(+), 5 deletions(-)
diff --cc gateway_client.c index edf61da,7614af3..36729dd --- a/gateway_client.c +++ b/gateway_client.c @@@ -713,25 -642,14 +721,27 @@@ bool batadv_gw_is_dhcp_target(struct sk return true; }
-/* this call might reallocate skb data */ +/** + * batadv_gw_out_of_range - check if the dhcp request destination the best gw + * @bat_priv: the bat priv with all the soft interface information + * @skb: the outgoing packet - * @ethhdr: the inner ethernet header + * + * Check if the skb is a DHCP request and if it is sent to the current best GW + * server. Due to topology changes it may be the case that the GW server + * previously selected is not the best one anymore. + * + * Returns true if the packet destination is unicast and it is not the best gw, + * false otherwise. ++ * ++ * This call might reallocate skb data. + */ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, - struct sk_buff *skb, struct ethhdr *ethhdr) + struct sk_buff *skb) { struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL; struct batadv_orig_node *orig_dst_node = NULL; - struct batadv_gw_node *curr_gw = NULL; + struct batadv_gw_node *gw_node = NULL, *curr_gw = NULL; + struct ethhdr *ethhdr; bool ret, out_of_range = false; unsigned int header_len = 0; uint8_t curr_tq_avg; @@@ -743,8 -658,9 +753,9 @@@ if (!ret) goto out;
+ ethhdr = (struct ethhdr *)skb->data; orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, - ethhdr->h_dest); + ethhdr->h_dest, vid); if (!orig_dst_node) goto out;
diff --cc soft-interface.c index 25662d9,0f04e1c..f4e3323 --- a/soft-interface.c +++ b/soft-interface.c @@@ -192,10 -180,12 +192,13 @@@ static int batadv_interface_tx(struct s if (batadv_bla_tx(bat_priv, skb, vid)) goto dropped;
+ /* skb->data might have been reallocated by batadv_bla_tx() */ + ethhdr = (struct ethhdr *)skb->data; + /* Register the client MAC in the transtable */ if (!is_multicast_ether_addr(ethhdr->h_source)) - batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif); + batadv_tt_local_add(soft_iface, ethhdr->h_source, vid, + skb->skb_iif);
/* don't accept stp packets. STP does not help in meshes. * better use the bridge loop avoidance ...