From 3b62feba9839bc341770ac7540976e6afd7d905b Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
Date: Tue, 14 Dec 2010 12:08:10 -0800
Subject: [PATCH] ofp-print: Print fragment handling in OpenFlow switch config
 messages.

---
 lib/ofp-print.c  | 16 ++++++++++++++++
 tests/ofproto.at |  4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 9d1b3b0c0..ac841ccdd 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -663,6 +663,22 @@ ofp_print_switch_config(struct ds *string, const struct ofp_switch_config *osc)
     uint16_t flags;
 
     flags = ntohs(osc->flags);
+
+    ds_put_cstr(string, " frags=");
+    switch (flags & OFPC_FRAG_MASK) {
+    case OFPC_FRAG_NORMAL:
+        ds_put_cstr(string, "normal");
+        flags &= ~OFPC_FRAG_MASK;
+        break;
+    case OFPC_FRAG_DROP:
+        ds_put_cstr(string, "drop");
+        flags &= ~OFPC_FRAG_MASK;
+        break;
+    case OFPC_FRAG_REASM:
+        ds_put_cstr(string, "reassemble");
+        flags &= ~OFPC_FRAG_MASK;
+        break;
+    }
     if (flags) {
         ds_put_format(string, " ***unknown flags 0x%04"PRIx16"***", flags);
     }
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 6b430e56f..a7dda06f0 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -31,7 +31,7 @@ OFPT_FEATURES_REPLY: ver:0x1, dpid:fedcba9876543210
 n_tables:2, n_buffers:256
 features: capabilities:0x87, actions:0xfff
  LOCAL(br0): addr:aa:55:aa:55:00:00, config: 0x1, state:0x1
-OFPT_GET_CONFIG_REPLY: miss_send_len=0
+OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
 ])
 OFPROTO_STOP
 AT_CLEANUP
@@ -53,7 +53,7 @@ OFPT_FEATURES_REPLY: ver:0x1, dpid:fedcba9876543210
 n_tables:2, n_buffers:256
 features: capabilities:0x87, actions:0xfff
  LOCAL(br0): addr:aa:55:aa:55:00:00, config: $config, state:$state
-OFPT_GET_CONFIG_REPLY: miss_send_len=0
+OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
 ])
 done
 OFPROTO_STOP
-- 
2.47.0