aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/routing.c')
-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 2f1f88923df8..b27a4d792d15 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -939,7 +939,7 @@ out:
939} 939}
940 940
941static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, 941static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
942 struct sk_buff *skb) { 942 struct sk_buff *skb, int hdr_len) {
943 uint8_t curr_ttvn, old_ttvn; 943 uint8_t curr_ttvn, old_ttvn;
944 struct batadv_orig_node *orig_node; 944 struct batadv_orig_node *orig_node;
945 struct ethhdr *ethhdr; 945 struct ethhdr *ethhdr;
@@ -948,7 +948,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
948 int is_old_ttvn; 948 int is_old_ttvn;
949 949
950 /* check if there is enough data before accessing it */ 950 /* check if there is enough data before accessing it */
951 if (pskb_may_pull(skb, sizeof(*unicast_packet) + ETH_HLEN) < 0) 951 if (pskb_may_pull(skb, hdr_len + ETH_HLEN) < 0)
952 return 0; 952 return 0;
953 953
954 /* create a copy of the skb (in case of for re-routing) to modify it. */ 954 /* create a copy of the skb (in case of for re-routing) to modify it. */
@@ -956,7 +956,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
956 return 0; 956 return 0;
957 957
958 unicast_packet = (struct batadv_unicast_packet *)skb->data; 958 unicast_packet = (struct batadv_unicast_packet *)skb->data;
959 ethhdr = (struct ethhdr *)(skb->data + sizeof(*unicast_packet)); 959 ethhdr = (struct ethhdr *)(skb->data + hdr_len);
960 960
961 /* check if the destination client was served by this node and it is now 961 /* check if the destination client was served by this node and it is now
962 * roaming. In this case, it means that the node has got a ROAM_ADV 962 * roaming. In this case, it means that the node has got a ROAM_ADV
@@ -1072,8 +1072,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
1072 1072
1073 if (check < 0) 1073 if (check < 0)
1074 return NET_RX_DROP; 1074 return NET_RX_DROP;
1075 1075 if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size))
1076 if (!batadv_check_unicast_ttvn(bat_priv, skb))
1077 return NET_RX_DROP; 1076 return NET_RX_DROP;
1078 1077
1079 /* packet for me */ 1078 /* packet for me */
@@ -1117,7 +1116,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
1117 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) 1116 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
1118 return NET_RX_DROP; 1117 return NET_RX_DROP;
1119 1118
1120 if (!batadv_check_unicast_ttvn(bat_priv, skb)) 1119 if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size))
1121 return NET_RX_DROP; 1120 return NET_RX_DROP;
1122 1121
1123 unicast_packet = (struct batadv_unicast_frag_packet *)skb->data; 1122 unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;