From 7462f2e8bd3ed2170d6a5da5295b176a1914de6a Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
Date: Thu, 7 Aug 2008 13:19:09 -0700
Subject: [PATCH] Fix bug in clearing unsupported switch flags.

We need to keep the flags we support, not drop them.
---
 datapath/forward.c | 2 +-
 switch/datapath.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/datapath/forward.c b/datapath/forward.c
index 318cfb3c..524ee14f 100644
--- a/datapath/forward.c
+++ b/datapath/forward.c
@@ -308,7 +308,7 @@ recv_set_config(struct sw_chain *chain, const struct sender *sender,
 	const struct ofp_switch_config *osc = msg;
 	int flags;
 
-	flags = ntohs(osc->flags) & ~(OFPC_SEND_FLOW_EXP | OFPC_FRAG_MASK);
+	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;
diff --git a/switch/datapath.c b/switch/datapath.c
index 13d06ff1..4d52dda9 100644
--- a/switch/datapath.c
+++ b/switch/datapath.c
@@ -985,7 +985,7 @@ recv_set_config(struct datapath *dp, const struct sender *sender UNUSED,
     const struct ofp_switch_config *osc = msg;
     int flags;
 
-    flags = ntohs(osc->flags) & ~(OFPC_SEND_FLOW_EXP | OFPC_FRAG_MASK);
+    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;
-- 
2.30.2