[ovs-dev] [PATCH] flow: Fix parsing invalid LLC/SNAP ethertypes

Rich Lane rich.lane at bigswitch.com
Sun Feb 17 22:00:56 UTC 2013


Valid ethertypes start at 1536.

Signed-off-by: Rich Lane <rlane at bigswitch.com>
---
This is the userspace equivalent of "datapath: Fix parsing invalid LLC/SNAP
ethertypes".

 lib/flow.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/flow.c b/lib/flow.c
index 5e7d1d4..397bda1 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -147,7 +147,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
-- 
1.7.9.5




More information about the dev mailing list