Skip to content

Commit

Permalink
openvswitch: Read tcp flags only then the tranport header is present.
Browse files Browse the repository at this point in the history
Only the first IP fragment can have a TCP header, check for this.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
  • Loading branch information
Jarno Rajahalme authored and Jesse Gross committed Feb 16, 2014
1 parent 3c7eacf commit 04382a3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/openvswitch/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void ovs_flow_stats_update(struct sw_flow *flow, struct sk_buff *skb)

if ((flow->key.eth.type == htons(ETH_P_IP) ||
flow->key.eth.type == htons(ETH_P_IPV6)) &&
flow->key.ip.frag != OVS_FRAG_TYPE_LATER &&
flow->key.ip.proto == IPPROTO_TCP &&
likely(skb->len >= skb_transport_offset(skb) + sizeof(struct tcphdr))) {
tcp_flags = TCP_FLAGS_BE16(tcp_hdr(skb));
Expand Down

0 comments on commit 04382a3

Please sign in to comment.