Don't allow unsupported flags to be set in the switch.
[openvswitch] / switch / datapath.c
index 4391634bdb78614abaff27535dc881af8f33b2cd..13d06ff1d3c07a12352efa0686a82b8c31c5125d 100644 (file)
@@ -983,7 +983,14 @@ recv_set_config(struct datapath *dp, const struct sender *sender UNUSED,
                 const void *msg)
 {
     const struct ofp_switch_config *osc = msg;
-    dp->flags = ntohs(osc->flags);
+    int flags;
+
+    flags = ntohs(osc->flags) & ~(OFPC_SEND_FLOW_EXP | OFPC_FRAG_MASK);
+    if ((flags & OFPC_FRAG_MASK) != OFPC_FRAG_NORMAL
+        && (flags & OFPC_FRAG_MASK) != OFPC_FRAG_DROP) {
+        flags = (flags & ~OFPC_FRAG_MASK) | OFPC_FRAG_DROP;
+    }
+    dp->flags = flags;
     dp->miss_send_len = ntohs(osc->miss_send_len);
     return 0;
 }