Skip to content

Commit

Permalink
gtp: gtp_check_src_ms_ipv4() always return success
Browse files Browse the repository at this point in the history
gtp_check_src_ms_ipv4() did not find the PDP context matching with the
UE IP address because the memory location is not right, but the result
is inverted by the Boolean "not" operator.  So whatever is the PDP
context, any call to this function is successful.

Signed-off-by: Lionel Gauthier <Lionel.Gauthier@eurecom.fr>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lionel Gauthier authored and David S. Miller committed Dec 17, 2016
1 parent e999cb4 commit 88edf10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/gtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ static bool gtp_check_src_ms_ipv4(struct sk_buff *skb, struct pdp_ctx *pctx,
if (!pskb_may_pull(skb, hdrlen + sizeof(struct iphdr)))
return false;

iph = (struct iphdr *)(skb->data + hdrlen + sizeof(struct iphdr));
iph = (struct iphdr *)(skb->data + hdrlen);

return iph->saddr != pctx->ms_addr_ip4.s_addr;
return iph->saddr == pctx->ms_addr_ip4.s_addr;
}

/* Check if the inner IP source address in this packet is assigned to any
Expand Down

0 comments on commit 88edf10

Please sign in to comment.