struct sctp_header *sh = ofpbuf_l4(&buf);
ds_put_format(&ds, " sctp_csum:%"PRIx32,
ntohl(get_16aligned_be32(&sh->sctp_csum)));
+ } else if (flow.nw_proto == IPPROTO_ICMP && l4_size >= ICMP_HEADER_LEN) {
+ struct icmp_header *icmph = ofpbuf_l4(&buf);
+ ds_put_format(&ds, " icmp_csum:%"PRIx16,
+ ntohs(icmph->icmp_csum));
+ } else if (flow.nw_proto == IPPROTO_ICMPV6 && l4_size >= ICMP6_HEADER_LEN) {
+ struct icmp6_header *icmp6h = ofpbuf_l4(&buf);
+ ds_put_format(&ds, " icmp6_csum:%"PRIx16,
+ ntohs(icmp6h->icmp6_cksum));
}
ds_put_char(&ds, '\n');
ds_put_format(string, " tun_dst="IP_FMT, IP_ARGS(pin.fmd.tun_dst));
}
+ if (pin.fmd.gbp_id != htons(0)) {
+ ds_put_format(string, " gbp_id=%"PRIu16,
+ ntohs(pin.fmd.gbp_id));
+ }
+
+ if (pin.fmd.gbp_flags) {
+ ds_put_format(string, " gbp_flags=0x%02"PRIx8, pin.fmd.gbp_flags);
+ }
+
if (pin.fmd.metadata != htonll(0)) {
ds_put_format(string, " metadata=0x%"PRIx64, ntohll(pin.fmd.metadata));
}
static void print_wild(struct ds *string, const char *leader, int is_wild,
int verbosity, const char *format, ...)
- PRINTF_FORMAT(5, 6);
+ OVS_PRINTF_FORMAT(5, 6);
static void print_wild(struct ds *string, const char *leader, int is_wild,
int verbosity, const char *format, ...)
print_wild(&f, "tp_dst=", w & OFPFW10_TP_DST, verbosity,
"%d", ntohs(om->tp_dst));
}
- if (ds_last(&f) == ',') {
- f.length--;
- }
+ ds_chomp(&f, ',');
return ds_cstr(&f);
}
if (fm.hard_timeout != OFP_FLOW_PERMANENT) {
ds_put_format(s, "hard:%"PRIu16" ", fm.hard_timeout);
}
+ if (fm.importance != 0) {
+ ds_put_format(s, "importance:%"PRIu16" ", fm.importance);
+ }
if (fm.priority != OFP_DEFAULT_PRIORITY && need_priority) {
ds_put_format(s, "pri:%"PRIu16" ", fm.priority);
}
if (fs->flags) {
ofp_print_flow_flags(string, fs->flags);
}
+ if (fs->importance != 0) {
+ ds_put_format(string, "importance=%"PRIu16", ", fs->importance);
+ }
if (fs->idle_age >= 0) {
ds_put_format(string, "idle_age=%d, ", fs->idle_age);
}
ofp_print_version(oh, string);
}
+static void
+ofp_print_bucket_id(struct ds *s, const char *label, uint32_t bucket_id,
+ enum ofp_version ofp_version)
+{
+ if (ofp_version < OFP15_VERSION) {
+ return;
+ }
+
+ ds_put_cstr(s, label);
+
+ switch (bucket_id) {
+ case OFPG15_BUCKET_FIRST:
+ ds_put_cstr(s, "first");
+ break;
+ case OFPG15_BUCKET_LAST:
+ ds_put_cstr(s, "last");
+ break;
+ case OFPG15_BUCKET_ALL:
+ ds_put_cstr(s, "all");
+ break;
+ default:
+ ds_put_format(s, "%"PRIu32, bucket_id);
+ break;
+ }
+
+ ds_put_char(s, ',');
+}
+
static void
ofp_print_group(struct ds *s, uint32_t group_id, uint8_t type,
- struct list *p_buckets)
+ struct ovs_list *p_buckets, enum ofp_version ofp_version,
+ bool suppress_type)
{
- static const char *type_str[] = { "all", "select", "indirect",
- "ff", "unknown" };
struct ofputil_bucket *bucket;
- ds_put_format(s, "group_id=%"PRIu32",type=%s",
- group_id, type_str[type > 4 ? 4 : type]);
+ ds_put_format(s, "group_id=%"PRIu32, group_id);
+
+ if (!suppress_type) {
+ static const char *type_str[] = { "all", "select", "indirect",
+ "ff", "unknown" };
+ ds_put_format(s, ",type=%s", type_str[type > 4 ? 4 : type]);
+ }
+
if (!p_buckets) {
return;
}
+ ds_put_char(s, ',');
+
LIST_FOR_EACH (bucket, list_node, p_buckets) {
- ds_put_cstr(s, ",bucket=");
+ ds_put_cstr(s, "bucket=");
+ ofp_print_bucket_id(s, "bucket_id:", bucket->bucket_id, ofp_version);
if (bucket->weight != 1) {
ds_put_format(s, "weight:%"PRIu16",", bucket->weight);
}
ds_put_cstr(s, "actions=");
ofpacts_format(bucket->ofpacts, bucket->ofpacts_len, s);
+ ds_put_char(s, ',');
}
+
+ ds_chomp(s, ',');
}
static void
ds_put_char(s, '\n');
ds_put_char(s, ' ');
- ofp_print_group(s, gd.group_id, gd.type, &gd.buckets);
+ ofp_print_group(s, gd.group_id, gd.type, &gd.buckets, oh->version,
+ false);
+ ofputil_bucket_list_destroy(&gd.buckets);
}
}
{
struct ofputil_group_mod gm;
int error;
+ bool bucket_command = false;
error = ofputil_decode_group_mod(oh, &gm);
if (error) {
ds_put_cstr(s, "DEL");
break;
+ case OFPGC15_INSERT_BUCKET:
+ ds_put_cstr(s, "INSERT_BUCKET");
+ bucket_command = true;
+ break;
+
+ case OFPGC15_REMOVE_BUCKET:
+ ds_put_cstr(s, "REMOVE_BUCKET");
+ bucket_command = true;
+ break;
+
default:
ds_put_format(s, "cmd:%"PRIu16"", gm.command);
}
ds_put_char(s, ' ');
- ofp_print_group(s, gm.group_id, gm.type, &gm.buckets);
+ if (bucket_command) {
+ ofp_print_bucket_id(s, "command_bucket_id:",
+ gm.command_bucket_id, oh->version);
+ }
+
+ ofp_print_group(s, gm.group_id, gm.type, &gm.buckets, oh->version,
+ bucket_command);
+ ofputil_bucket_list_destroy(&gm.buckets);
}
static void