aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRich Lane <rlane@bigswitch.com>2013-02-08 15:29:57 -0800
committerJesse Gross <jesse@nicira.com>2013-02-19 11:08:27 -0800
commit5984ece8084f37f288bda821d773ab29fdf9c6ac (patch)
treeed31ed9d0220970f1d450f8e6d7a2148d2d164b4 /lib
parentce680be7f7315dcfb29b1dc82c21bcb74efd47c1 (diff)
datapath: Fix parsing invalid LLC/SNAP ethertypes
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/flow.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/flow.c b/lib/flow.c
index 2a3dd3d9..4e87ef2e 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -132,7 +132,12 @@ parse_ethertype(struct ofpbuf *b)
}
ofpbuf_pull(b, sizeof *llc);
- return llc->snap.snap_type;
+
+ if (ntohs(llc->snap.snap_type) >= ETH_TYPE_MIN) {
+ return llc->snap.snap_type;
+ }
+
+ return htons(FLOW_DL_TYPE_NONE);
}
static int