Skip to content

Commit

Permalink
openvswitch: Fix parsing invalid LLC/SNAP ethertypes
Browse files Browse the repository at this point in the history
Before this patch, if an LLC/SNAP packet with OUI 00:00:00 had an
ethertype less than 1536 the flow key given to userspace in the upcall
would contain the invalid ethertype (for example, 3). If userspace
attempted to insert a kernel flow for this key it would be rejected
by ovs_flow_from_nlattrs.

This patch allows OVS to pass the OFTest pktact.DirectBadLlcPackets.

Signed-off-by: Rich Lane <rlane@bigswitch.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
  • Loading branch information
Rich Lane authored and Jesse Gross committed Feb 23, 2013
1 parent a15ff76 commit 17b682a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/openvswitch/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,11 @@ static __be16 parse_ethertype(struct sk_buff *skb)
return htons(ETH_P_802_2);

__skb_pull(skb, sizeof(struct llc_snap_hdr));
return llc->ethertype;

if (ntohs(llc->ethertype) >= 1536)
return llc->ethertype;

return htons(ETH_P_802_2);
}

static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,
Expand Down

0 comments on commit 17b682a

Please sign in to comment.