aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/batman-adv/routing.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 319f2906c71a..7de033667ebc 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -924,7 +924,7 @@ out:
924} 924}
925 925
926static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, 926static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
927 struct sk_buff *skb) { 927 struct sk_buff *skb, int hdr_len) {
928 uint8_t curr_ttvn, old_ttvn; 928 uint8_t curr_ttvn, old_ttvn;
929 struct batadv_orig_node *orig_node; 929 struct batadv_orig_node *orig_node;
930 struct ethhdr *ethhdr; 930 struct ethhdr *ethhdr;
@@ -933,7 +933,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
933 int is_old_ttvn; 933 int is_old_ttvn;
934 934
935 /* check if there is enough data before accessing it */ 935 /* check if there is enough data before accessing it */
936 if (pskb_may_pull(skb, sizeof(*unicast_packet) + ETH_HLEN) < 0) 936 if (pskb_may_pull(skb, hdr_len + ETH_HLEN) < 0)
937 return 0; 937 return 0;
938 938
939 /* create a copy of the skb (in case of for re-routing) to modify it. */ 939 /* create a copy of the skb (in case of for re-routing) to modify it. */
@@ -941,7 +941,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
941 return 0; 941 return 0;
942 942
943 unicast_packet = (struct batadv_unicast_packet *)skb->data; 943 unicast_packet = (struct batadv_unicast_packet *)skb->data;
944 ethhdr = (struct ethhdr *)(skb->data + sizeof(*unicast_packet)); 944 ethhdr = (struct ethhdr *)(skb->data + hdr_len);
945 945
946 /* check if the destination client was served by this node and it is now 946 /* check if the destination client was served by this node and it is now
947 * roaming. In this case, it means that the node has got a ROAM_ADV 947 * roaming. In this case, it means that the node has got a ROAM_ADV
@@ -1048,8 +1048,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
1048 1048
1049 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) 1049 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
1050 return NET_RX_DROP; 1050 return NET_RX_DROP;
1051 1051 if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size))
1052 if (!batadv_check_unicast_ttvn(bat_priv, skb))
1053 return NET_RX_DROP; 1052 return NET_RX_DROP;
1054 1053
1055 /* packet for me */ 1054 /* packet for me */
@@ -1093,7 +1092,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
1093 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) 1092 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
1094 return NET_RX_DROP; 1093 return NET_RX_DROP;
1095 1094
1096 if (!batadv_check_unicast_ttvn(bat_priv, skb)) 1095 if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size))
1097 return NET_RX_DROP; 1096 return NET_RX_DROP;
1098 1097
1099 unicast_packet = (struct batadv_unicast_frag_packet *)skb->data; 1098 unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;