Skip to content

Commit

Permalink
netfilter: nf_flow_table: check ttl value in flow offload data path
Browse files Browse the repository at this point in the history
nf_flow_offload_ip_hook() and nf_flow_offload_ipv6_hook() do not check
ttl value. So, ttl value overflow may occur.

Fixes: 97add9f ("netfilter: flow table support for IPv4")
Fixes: 0995210 ("netfilter: flow table support for IPv6")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Taehee Yoo authored and Pablo Neira Ayuso committed Apr 30, 2019
1 parent 26a302a commit 33cc3c0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/netfilter/nf_flow_table_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ static int nf_flow_tuple_ip(struct sk_buff *skb, const struct net_device *dev,
iph->protocol != IPPROTO_UDP)
return -1;

if (iph->ttl <= 1)
return -1;

thoff = iph->ihl * 4;
if (!pskb_may_pull(skb, thoff + sizeof(*ports)))
return -1;
Expand Down Expand Up @@ -411,6 +414,9 @@ static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev,
ip6h->nexthdr != IPPROTO_UDP)
return -1;

if (ip6h->hop_limit <= 1)
return -1;

thoff = sizeof(*ip6h);
if (!pskb_may_pull(skb, thoff + sizeof(*ports)))
return -1;
Expand Down

0 comments on commit 33cc3c0

Please sign in to comment.