/* Appends to 'b' a set of OXM or NXM matches for the IPv4 or IPv6 fields in * 'match'. */ static void nxm_put_ip(struct ofpbuf *b, const struct match *match, enum ofp_version oxm) { const struct flow *flow = &match->flow; if (flow->dl_type == htons(ETH_TYPE_IP)) { nxm_put_32m(b, mf_oxm_header(MFF_IPV4_SRC, oxm), flow->nw_src, match->wc.masks.nw_src); nxm_put_32m(b, mf_oxm_header(MFF_IPV4_DST, oxm), flow->nw_dst, match->wc.masks.nw_dst); } else { nxm_put_ipv6(b, mf_oxm_header(MFF_IPV6_SRC, oxm), &flow->ipv6_src, &match->wc.masks.ipv6_src); nxm_put_ipv6(b, mf_oxm_header(MFF_IPV6_DST, oxm), &flow->ipv6_dst, &match->wc.masks.ipv6_dst); } nxm_put_frag(b, match, oxm); if (match->wc.masks.nw_tos & IP_DSCP_MASK) { if (oxm) { nxm_put_8(b, mf_oxm_header(MFF_IP_DSCP_SHIFTED, oxm), flow->nw_tos >> 2); } else { nxm_put_8(b, mf_oxm_header(MFF_IP_DSCP, oxm), flow->nw_tos & IP_DSCP_MASK); } }
static void nxm_put_ip(struct ofpbuf *b, const struct match *match, uint8_t icmp_proto, uint32_t icmp_type, uint32_t icmp_code, bool oxm) { const struct flow *flow = &match->flow; nxm_put_frag(b, match); if (match->wc.masks.nw_tos & IP_DSCP_MASK) { if (oxm) { nxm_put_8(b, OXM_OF_IP_DSCP, flow->nw_tos >> 2); } else { nxm_put_8(b, NXM_OF_IP_TOS, flow->nw_tos & IP_DSCP_MASK); } }