X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-print.c;h=4572db4440d55589e8fb3dbdd178201076d0c21a;hb=80642190644ae6fbcf485924b1c59e67d0be8a87;hp=2591484af66e699e1039e966f7366fac81e5b79d;hpb=ae412e7dd89489911a32c6723d4109c6d1de3a38;p=openvswitch diff --git a/lib/ofp-print.c b/lib/ofp-print.c index 2591484a..4572db44 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -26,16 +26,17 @@ #include #include +#include "byte-order.h" #include "compiler.h" #include "dynamic-string.h" #include "flow.h" +#include "ofp-util.h" #include "ofpbuf.h" #include "openflow/openflow.h" #include "openflow/nicira-ext.h" #include "packets.h" #include "pcap.h" #include "util.h" -#include "xtoxll.h" static void ofp_print_port_name(struct ds *string, uint16_t port); static void ofp_print_queue_name(struct ds *string, uint32_t port); @@ -183,6 +184,22 @@ static void ofp_print_port_name(struct ds *string, uint16_t port) ds_put_cstr(string, name); } +static void +print_note(struct ds *string, const struct nx_action_note *nan) +{ + size_t len; + size_t i; + + ds_put_cstr(string, "note:"); + len = ntohs(nan->len) - offsetof(struct nx_action_note, note); + for (i = 0; i < len; i++) { + if (i) { + ds_put_char(string, '.'); + } + ds_put_format(string, "%02"PRIx8, nan->note[i]); + } +} + static void ofp_print_nx_action(struct ds *string, const struct nx_action_header *nah) { @@ -216,6 +233,10 @@ ofp_print_nx_action(struct ds *string, const struct nx_action_header *nah) ds_put_cstr(string, "pop_queue"); break; + case NXAST_NOTE: + print_note(string, (const struct nx_action_note *) nah); + break; + default: ds_put_format(string, "***unknown Nicira action:%d***", ntohs(nah->subtype)); @@ -294,10 +315,10 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah, return -1; } - if ((len % 8) != 0) { + if ((len % OFP_ACTION_ALIGN) != 0) { ds_put_format(string, - "***action %"PRIu16" length not a multiple of 8***\n", - type); + "***action %"PRIu16" length not a multiple of %d***\n", + type, OFP_ACTION_ALIGN); return -1; } @@ -737,10 +758,10 @@ ofp_match_to_string(const struct ofp_match *om, int verbosity) } else { print_wild(&f, "nw_proto=", w & OFPFW_NW_PROTO, verbosity, "%u", om->nw_proto); - print_wild(&f, "nw_tos=", w & OFPFW_NW_TOS, verbosity, - "%u", om->nw_tos); } } + print_wild(&f, "nw_tos=", w & OFPFW_NW_TOS, verbosity, + "%u", om->nw_tos); if (om->nw_proto == IP_TYPE_ICMP) { print_wild(&f, "icmp_type=", w & OFPFW_ICMP_TYPE, verbosity, "%d", ntohs(om->icmp_type));