IPv4 DSCP match: Add IPv4 ToS/DSCP description capability to dpctl
This commit is contained in:
1 parent
9b78488f60
commit
75edc57072
3 files changed
+13
-7
No files matched your search
+4
-4
@@ -303,7 +303,7 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (type) {
|
||||
case OFPAT_OUTPUT: {
|
||||
struct ofp_action_output *oa = (struct ofp_action_output *)ah;
|
||||
@@ -350,7 +350,7 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah,
|
||||
|
||||
case OFPAT_SET_DL_SRC: {
|
||||
struct ofp_action_dl_addr *da = (struct ofp_action_dl_addr *)ah;
|
||||
ds_put_format(string, "mod_dl_src:"ETH_ADDR_FMT,
|
||||
ds_put_format(string, "mod_dl_src:"ETH_ADDR_FMT,
|
||||
ETH_ADDR_ARGS(da->dl_addr));
|
||||
break;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah,
|
||||
|
||||
case OFPAT_SET_NW_TOS: {
|
||||
struct ofp_action_nw_tos *nt = (struct ofp_action_nw_tos *)ah;
|
||||
ds_put_format(string, "mod_ip_tos:%d", nt->nw_tos);
|
||||
ds_put_format(string, "mod_nw_tos:0x%"PRIx8, nt->nw_tos);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -715,7 +715,7 @@ ofp_match_to_string(const struct ofp_match *om, int verbosity)
|
||||
print_ip_netmask(&f, "nw_dst=", om->nw_dst,
|
||||
(w & OFPFW_NW_DST_MASK) >> OFPFW_NW_DST_SHIFT, verbosity);
|
||||
print_wild(&f, "nw_tos=", w & OFPFW_NW_TOS, verbosity,
|
||||
"%u", om->nw_tos);
|
||||
"0x%02x", om->nw_tos);
|
||||
if (!skip_proto) {
|
||||
print_wild(&f, "nw_proto=", w & OFPFW_NW_PROTO, verbosity,
|
||||
"%u", om->nw_proto);
|
||||
|
||||
@@ -301,6 +301,11 @@ Matches IP protocol type \fIproto\fR, which should be specified as a
|
||||
decimal number between 0 and 255, inclusive, e.g. 6 to match TCP
|
||||
packets.
|
||||
|
||||
.IP \fBnw_tos=\fItos/dscp\fR
|
||||
Matches ToS/DSCP (only 6-bits, not modify reserved 2-bits for future
|
||||
use) field of IPv4 header \fItos/dscp\fR, which should be specified as
|
||||
a decimal number between 0 and 255, inclusive.
|
||||
|
||||
.IP \fBtp_src=\fIport\fR
|
||||
Matches UDP or TCP source port \fIport\fR, which should be specified
|
||||
as a decimal number between 0 and 65535, inclusive, e.g. 80 to match
|
||||
|
||||
+4
-3
@@ -951,21 +951,22 @@ struct field {
|
||||
};
|
||||
|
||||
static bool
|
||||
parse_field(const char *name, const struct field **f_out)
|
||||
parse_field(const char *name, const struct field **f_out)
|
||||
{
|
||||
#define F_OFS(MEMBER) offsetof(struct ofp_match, MEMBER)
|
||||
static const struct field fields[] = {
|
||||
static const struct field fields[] = {
|
||||
{ "in_port", OFPFW_IN_PORT, F_U16, F_OFS(in_port), 0 },
|
||||
{ "dl_vlan", OFPFW_DL_VLAN, F_U16, F_OFS(dl_vlan), 0 },
|
||||
{ "dl_vlan_pcp", OFPFW_DL_VLAN_PCP, F_U8, F_OFS(dl_vlan_pcp), 0 },
|
||||
{ "dl_src", OFPFW_DL_SRC, F_MAC, F_OFS(dl_src), 0 },
|
||||
{ "dl_dst", OFPFW_DL_DST, F_MAC, F_OFS(dl_dst), 0 },
|
||||
{ "dl_type", OFPFW_DL_TYPE, F_U16, F_OFS(dl_type), 0 },
|
||||
{ "nw_tos", OFPFW_NW_TOS, F_U8, F_OFS(nw_tos), 0 },
|
||||
{ "nw_proto", OFPFW_NW_PROTO, F_U8, F_OFS(nw_proto), 0 },
|
||||
{ "nw_src", OFPFW_NW_SRC_MASK, F_IP,
|
||||
F_OFS(nw_src), OFPFW_NW_SRC_SHIFT },
|
||||
{ "nw_dst", OFPFW_NW_DST_MASK, F_IP,
|
||||
F_OFS(nw_dst), OFPFW_NW_DST_SHIFT },
|
||||
{ "nw_proto", OFPFW_NW_PROTO, F_U8, F_OFS(nw_proto), 0 },
|
||||
{ "tp_src", OFPFW_TP_SRC, F_U16, F_OFS(tp_src), 0 },
|
||||
{ "tp_dst", OFPFW_TP_DST, F_U16, F_OFS(tp_dst), 0 },
|
||||
{ "icmp_type", OFPFW_ICMP_TYPE, F_U16, F_OFS(icmp_type), 0 },
|
||||
|
||||
Reference in new issue
Block a user