diff options
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/gateway_client.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index a9209466ddaf..4ed410f73de4 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -726,7 +726,20 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | |||
726 | return true; | 726 | return true; |
727 | } | 727 | } |
728 | 728 | ||
729 | /* this call might reallocate skb data */ | 729 | /** |
730 | * batadv_gw_out_of_range - check if the dhcp request destination is the best gw | ||
731 | * @bat_priv: the bat priv with all the soft interface information | ||
732 | * @skb: the outgoing packet | ||
733 | * | ||
734 | * Check if the skb is a DHCP request and if it is sent to the current best GW | ||
735 | * server. Due to topology changes it may be the case that the GW server | ||
736 | * previously selected is not the best one anymore. | ||
737 | * | ||
738 | * Returns true if the packet destination is unicast and it is not the best gw, | ||
739 | * false otherwise. | ||
740 | * | ||
741 | * This call might reallocate skb data. | ||
742 | */ | ||
730 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, | 743 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, |
731 | struct sk_buff *skb) | 744 | struct sk_buff *skb) |
732 | { | 745 | { |
@@ -737,6 +750,9 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, | |||
737 | bool ret, out_of_range = false; | 750 | bool ret, out_of_range = false; |
738 | unsigned int header_len = 0; | 751 | unsigned int header_len = 0; |
739 | uint8_t curr_tq_avg; | 752 | uint8_t curr_tq_avg; |
753 | unsigned short vid; | ||
754 | |||
755 | vid = batadv_get_vid(skb, 0); | ||
740 | 756 | ||
741 | ret = batadv_gw_is_dhcp_target(skb, &header_len); | 757 | ret = batadv_gw_is_dhcp_target(skb, &header_len); |
742 | if (!ret) | 758 | if (!ret) |
@@ -744,8 +760,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, | |||
744 | 760 | ||
745 | ethhdr = (struct ethhdr *)skb->data; | 761 | ethhdr = (struct ethhdr *)skb->data; |
746 | orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, | 762 | orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, |
747 | ethhdr->h_dest, | 763 | ethhdr->h_dest, vid); |
748 | BATADV_NO_FLAGS); | ||
749 | if (!orig_dst_node) | 764 | if (!orig_dst_node) |
750 | goto out; | 765 | goto out; |
751 | 766 | ||