X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fovs-ofctl.c;fp=utilities%2Fovs-ofctl.c;h=4a5a60136b2afdd466b6cffca77490c24c359eeb;hb=476a0e9e7c0aae41f5b3bd093b5b5d666142f630;hp=e5c52555536e7e2ceae5634785aa9d5fcd4ef539;hpb=8069b0da045f1b8a5879f5d2dfedcaa7e7c86578;p=openvswitch diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index e5c52555..4a5a6013 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -2580,6 +2580,30 @@ ofctl_check_vlan(int argc OVS_UNUSED, char *argv[]) free(nxm_s); ofpbuf_uninit(&nxm); + /* Convert to and from OXM. */ + ofpbuf_init(&nxm, 0); + nxm_match_len = nx_put_match(&nxm, true, &rule, htonll(0), htonll(0)); + nxm_s = nx_match_to_string(nxm.data, nxm_match_len); + error = nx_pull_match(&nxm, nxm_match_len, 0, &nxm_rule, NULL, NULL); + printf("OXM: %s -> ", nxm_s); + if (error) { + printf("%s\n", ofperr_to_string(error)); + } else { + uint16_t vid = ntohs(nxm_rule.flow.vlan_tci) & + (VLAN_VID_MASK | VLAN_CFI); + uint16_t mask = ntohs(nxm_rule.wc.vlan_tci_mask) & + (VLAN_VID_MASK | VLAN_CFI); + + printf("%04"PRIx16"/%04"PRIx16",", vid, mask); + if (vid && vlan_tci_to_pcp(nxm_rule.wc.vlan_tci_mask)) { + printf("%02"PRIx8"\n", vlan_tci_to_pcp(nxm_rule.flow.vlan_tci)); + } else { + printf("--\n"); + } + } + free(nxm_s); + ofpbuf_uninit(&nxm); + /* Convert to and from OpenFlow 1.0. */ ofputil_cls_rule_to_ofp10_match(&rule, &of10_match); ofputil_cls_rule_from_ofp10_match(&of10_match, 0, &of10_rule);