ofp_print_packet_out(struct ds *string, const struct ofp_packet_out *opo,
int verbosity)
{
- size_t len = ntohs(opo->header.length);
- size_t actions_len = ntohs(opo->actions_len);
-
- ds_put_cstr(string, " in_port=");
- ofputil_format_port(ntohs(opo->in_port), string);
+ struct ofputil_packet_out po;
+ enum ofperr error;
- ds_put_format(string, " actions_len=%zu ", actions_len);
- if (actions_len > (ntohs(opo->header.length) - sizeof *opo)) {
- ds_put_format(string, "***packet too short for action length***\n");
+ error = ofputil_decode_packet_out(&po, opo);
+ if (error) {
+ ofp_print_error(string, error);
return;
}
- if (actions_len % sizeof(union ofp_action)) {
- ds_put_format(string, "***action length not a multiple of %zu***\n",
- sizeof(union ofp_action));
- }
- ofp_print_actions(string, (const union ofp_action *) opo->actions,
- actions_len / sizeof(union ofp_action));
- if (ntohl(opo->buffer_id) == UINT32_MAX) {
- int data_len = len - sizeof *opo - actions_len;
- ds_put_format(string, " data_len=%d", data_len);
- if (verbosity > 0 && len > sizeof *opo) {
- char *packet = ofp_packet_to_string(
- (uint8_t *) opo->actions + actions_len, data_len);
+ ds_put_cstr(string, " in_port=");
+ ofputil_format_port(po.in_port, string);
+
+ ds_put_char(string, ' ');
+ ofp_print_actions(string, po.actions, po.n_actions);
+
+ if (po.buffer_id == UINT32_MAX) {
+ ds_put_format(string, " data_len=%d", po.packet_len);
+ if (verbosity > 0 && po.packet_len > 0) {
+ char *packet = ofp_packet_to_string(po.packet, po.packet_len);
ds_put_char(string, '\n');
ds_put_cstr(string, packet);
free(packet);
}
} else {
- ds_put_format(string, " buffer=0x%08"PRIx32, ntohl(opo->buffer_id));
+ ds_put_format(string, " buffer=0x%08"PRIx32, po.buffer_id);
}
ds_put_char(string, '\n');
}
ds_put_format(s, "buf:0x%"PRIx32" ", fm.buffer_id);
}
if (fm.flags != 0) {
- ds_put_format(s, "flags:0x%"PRIx16" ", fm.flags);
+ uint16_t flags = fm.flags;
+
+ if (flags & OFPFF_SEND_FLOW_REM) {
+ ds_put_cstr(s, "send_flow_rem ");
+ }
+ if (flags & OFPFF_CHECK_OVERLAP) {
+ ds_put_cstr(s, "check_overlap ");
+ }
+ if (flags & OFPFF_EMERG) {
+ ds_put_cstr(s, "emerg ");
+ }
+
+ flags &= ~(OFPFF_SEND_FLOW_REM | OFPFF_CHECK_OVERLAP | OFPFF_EMERG);
+ if (flags) {
+ ds_put_format(s, "flags:0x%"PRIx16" ", flags);
+ }
}
ofp_print_actions(s, fm.actions, fm.n_actions);
struct ofputil_flow_stats fs;
int retval;
- retval = ofputil_decode_flow_stats_reply(&fs, &b);
+ retval = ofputil_decode_flow_stats_reply(&fs, &b, true);
if (retval) {
if (retval != EOF) {
ds_put_cstr(string, " ***parse error***");
if (fs.hard_timeout != OFP_FLOW_PERMANENT) {
ds_put_format(string, "hard_timeout=%"PRIu16",", fs.hard_timeout);
}
+ if (fs.idle_age >= 0) {
+ ds_put_format(string, "idle_age=%d,", fs.idle_age);
+ }
+ if (fs.hard_age >= 0 && fs.hard_age != fs.duration_sec) {
+ ds_put_format(string, "hard_age=%d,", fs.hard_age);
+ }
cls_rule_format(&fs.rule, string);
if (string->string[string->length - 1] != ' ') {
break;
case OFPUTIL_OFPT_FLOW_MOD:
+ case OFPUTIL_NXT_FLOW_MOD:
ofp_print_flow_mod(string, msg, code, verbosity);
break;
ofp_print_nxt_set_packet_in_format(string, msg);
break;
- case OFPUTIL_NXT_FLOW_MOD:
- ofp_print_flow_mod(string, msg, code, verbosity);
+ case OFPUTIL_NXT_FLOW_AGE:
break;
case OFPUTIL_NXST_AGGREGATE_REPLY: