X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-print.c;h=f6560747e492076272167a3bc71b6ad24843c39a;hb=8e39921d51591d3eb59a6789104e53e170dd99cc;hp=bc777568b259c7dd6a16ebbbc517607a4589f282;hpb=1a960c80853305dfad361fe169c5134403d7bc64;p=openvswitch diff --git a/lib/ofp-print.c b/lib/ofp-print.c index bc777568..f6560747 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -30,6 +30,7 @@ #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" @@ -132,12 +133,11 @@ ofp_packet_in(struct ds *string, const void *oh, size_t len, int verbosity) if (verbosity > 0) { struct flow flow; struct ofpbuf packet; - struct ofp_match match; + packet.data = (void *) op->data; packet.size = data_len; flow_extract(&packet, 0, ntohs(op->in_port), &flow); - flow_to_match(&flow, 0, false, &match); - ofp_print_match(string, &match, verbosity); + flow_format(string, &flow); ds_put_char(string, '\n'); } if (verbosity > 1) { @@ -183,6 +183,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 +232,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 +314,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; } @@ -1575,7 +1595,7 @@ ofp_to_string(const void *oh_, size_t len, int verbosity) } } - ds_put_format(&string, "%s (xid=0x%"PRIx32"):", pkt->name, oh->xid); + ds_put_format(&string, "%s (xid=0x%"PRIx32"):", pkt->name, ntohl(oh->xid)); if (ntohs(oh->length) > len) ds_put_format(&string, " (***truncated to %zu bytes from %"PRIu16"***)",