From 6c08c24913e4c6700a8aac4cc93bccbc0a4ba102 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 16 May 2008 20:20:14 -0700 Subject: [PATCH] Print more special ports by name in ofp-print.c. --- lib/ofp-print.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/lib/ofp-print.c b/lib/ofp-print.c index d3f5cb4a5..8579cab59 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -180,15 +180,34 @@ ofp_packet_in(struct ds *string, const void *oh, size_t len, int verbosity) static void ofp_print_port_name(struct ds *string, uint16_t port) { - if (port == UINT16_MAX) { - ds_put_cstr(string, "none"); - } else if (port == OFPP_FLOOD) { - ds_put_cstr(string, "flood"); - } else if (port == OFPP_CONTROLLER) { - ds_put_cstr(string, "controller"); - } else { + const char *name; + switch (port) { + case OFPP_TABLE: + name = "TABLE"; + break; + case OFPP_NORMAL: + name = "NORMAL"; + break; + case OFPP_FLOOD: + name = "FLOOD"; + break; + case OFPP_ALL: + name = "ALL"; + break; + case OFPP_CONTROLLER: + name = "CONTROLLER"; + break; + case OFPP_LOCAL: + name = "LOCAL"; + break; + case OFPP_NONE: + name = "NONE"; + break; + default: ds_put_format(string, "%"PRIu16, port); + return; } + ds_put_cstr(string, name); } static void -- 2.43.0