git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
man: fix pic issue at the source
[sliver-openvswitch.git]
/
lib
/
ofp-util.c
diff --git
a/lib/ofp-util.c
b/lib/ofp-util.c
index
1b16279
..
11b0f15
100644
(file)
--- a/
lib/ofp-util.c
+++ b/
lib/ofp-util.c
@@
-101,18
+101,20
@@
static const flow_wildcards_t WC_INVARIANTS = 0
void
ofputil_wildcard_from_openflow(uint32_t ofpfw, struct flow_wildcards *wc)
{
void
ofputil_wildcard_from_openflow(uint32_t ofpfw, struct flow_wildcards *wc)
{
- BUILD_ASSERT_DECL(FLOW_WC_SEQ ==
5
);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ ==
7
);
/* Initialize most of rule->wc. */
flow_wildcards_init_catchall(wc);
wc->wildcards = (OVS_FORCE flow_wildcards_t) ofpfw & WC_INVARIANTS;
/* Wildcard fields that aren't defined by ofp_match or tun_id. */
/* Initialize most of rule->wc. */
flow_wildcards_init_catchall(wc);
wc->wildcards = (OVS_FORCE flow_wildcards_t) ofpfw & WC_INVARIANTS;
/* Wildcard fields that aren't defined by ofp_match or tun_id. */
- wc->wildcards |= (FWW_ARP_SHA | FWW_ARP_THA | FWW_N
D_TARGET
- | FWW_IPV6_LABEL);
+ wc->wildcards |= (FWW_ARP_SHA | FWW_ARP_THA | FWW_N
W_ECN | FWW_NW_TTL
+ | FWW_
ND_TARGET | FWW_
IPV6_LABEL);
- if (!(ofpfw & OFPFW_NW_TOS)) {
- wc->tos_mask |= IP_DSCP_MASK;
+ if (ofpfw & OFPFW_NW_TOS) {
+ /* OpenFlow 1.0 defines a TOS wildcard, but it's much later in
+ * the enum than we can use. */
+ wc->wildcards |= FWW_NW_DSCP;
}
wc->nw_src_mask = ofputil_wcbits_to_netmask(ofpfw >> OFPFW_NW_SRC_SHIFT);
}
wc->nw_src_mask = ofputil_wcbits_to_netmask(ofpfw >> OFPFW_NW_SRC_SHIFT);
@@
-155,7
+157,7
@@
ofputil_cls_rule_from_match(const struct ofp_match *match,
rule->flow.tp_dst = match->tp_dst;
memcpy(rule->flow.dl_src, match->dl_src, ETH_ADDR_LEN);
memcpy(rule->flow.dl_dst, match->dl_dst, ETH_ADDR_LEN);
rule->flow.tp_dst = match->tp_dst;
memcpy(rule->flow.dl_src, match->dl_src, ETH_ADDR_LEN);
memcpy(rule->flow.dl_dst, match->dl_dst, ETH_ADDR_LEN);
- rule->flow.tos = match->nw_tos & IP_DSCP_MASK;
+ rule->flow.
nw_
tos = match->nw_tos & IP_DSCP_MASK;
rule->flow.nw_proto = match->nw_proto;
/* Translate VLANs. */
rule->flow.nw_proto = match->nw_proto;
/* Translate VLANs. */
@@
-194,7
+196,7
@@
ofputil_cls_rule_to_match(const struct cls_rule *rule, struct ofp_match *match)
ofpfw = (OVS_FORCE uint32_t) (wc->wildcards & WC_INVARIANTS);
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_src_mask) << OFPFW_NW_SRC_SHIFT;
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_dst_mask) << OFPFW_NW_DST_SHIFT;
ofpfw = (OVS_FORCE uint32_t) (wc->wildcards & WC_INVARIANTS);
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_src_mask) << OFPFW_NW_SRC_SHIFT;
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_dst_mask) << OFPFW_NW_DST_SHIFT;
- if (
!(wc->tos_mask & IP_DSCP_MASK)
) {
+ if (
wc->wildcards & FWW_NW_DSCP
) {
ofpfw |= OFPFW_NW_TOS;
}
ofpfw |= OFPFW_NW_TOS;
}
@@
-228,7
+230,7
@@
ofputil_cls_rule_to_match(const struct cls_rule *rule, struct ofp_match *match)
match->dl_type = ofputil_dl_type_to_openflow(rule->flow.dl_type);
match->nw_src = rule->flow.nw_src;
match->nw_dst = rule->flow.nw_dst;
match->dl_type = ofputil_dl_type_to_openflow(rule->flow.dl_type);
match->nw_src = rule->flow.nw_src;
match->nw_dst = rule->flow.nw_dst;
- match->nw_tos = rule->flow.tos & IP_DSCP_MASK;
+ match->nw_tos = rule->flow.
nw_
tos & IP_DSCP_MASK;
match->nw_proto = rule->flow.nw_proto;
match->tp_src = rule->flow.tp_src;
match->tp_dst = rule->flow.tp_dst;
match->nw_proto = rule->flow.nw_proto;
match->tp_src = rule->flow.tp_src;
match->tp_dst = rule->flow.tp_dst;
@@
-859,7
+861,7
@@
ofputil_min_flow_format(const struct cls_rule *rule)
{
const struct flow_wildcards *wc = &rule->wc;
{
const struct flow_wildcards *wc = &rule->wc;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ ==
5
);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ ==
7
);
/* Only NXM supports separately wildcards the Ethernet multicast bit. */
if (!(wc->wildcards & FWW_DL_DST) != !(wc->wildcards & FWW_ETH_MCAST)) {
/* Only NXM supports separately wildcards the Ethernet multicast bit. */
if (!(wc->wildcards & FWW_DL_DST) != !(wc->wildcards & FWW_ETH_MCAST)) {
@@
-888,7
+890,7
@@
ofputil_min_flow_format(const struct cls_rule *rule)
}
/* Only NXM supports matching fragments. */
}
/* Only NXM supports matching fragments. */
- if (wc->frag_mask) {
+ if (wc->
nw_
frag_mask) {
return NXFF_NXM;
}
return NXFF_NXM;
}
@@
-898,7
+900,12
@@
ofputil_min_flow_format(const struct cls_rule *rule)
}
/* Only NXM supports matching IP ECN bits. */
}
/* Only NXM supports matching IP ECN bits. */
- if (wc->tos_mask & IP_ECN_MASK) {
+ if (!(wc->wildcards & FWW_NW_ECN)) {
+ return NXFF_NXM;
+ }
+
+ /* Only NXM supports matching IP TTL/hop limit. */
+ if (!(wc->wildcards & FWW_NW_TTL)) {
return NXFF_NXM;
}
return NXFF_NXM;
}
@@
-2204,7
+2211,8
@@
validate_actions(const union ofp_action *actions, size_t n_actions,
case OFPUTIL_OFPAT_ENQUEUE:
port = ntohs(((const struct ofp_action_enqueue *) a)->port);
case OFPUTIL_OFPAT_ENQUEUE:
port = ntohs(((const struct ofp_action_enqueue *) a)->port);
- if (port >= max_ports && port != OFPP_IN_PORT) {
+ if (port >= max_ports && port != OFPP_IN_PORT
+ && port != OFPP_LOCAL) {
error = ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_OUT_PORT);
}
break;
error = ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_OUT_PORT);
}
break;
@@
-2516,10
+2524,10
@@
ofputil_normalize_rule(struct cls_rule *rule, enum nx_flow_format flow_format)
MAY_NW_ADDR = 1 << 0, /* nw_src, nw_dst */
MAY_TP_ADDR = 1 << 1, /* tp_src, tp_dst */
MAY_NW_PROTO = 1 << 2, /* nw_proto */
MAY_NW_ADDR = 1 << 0, /* nw_src, nw_dst */
MAY_TP_ADDR = 1 << 1, /* tp_src, tp_dst */
MAY_NW_PROTO = 1 << 2, /* nw_proto */
- MAY_IPVx = 1 << 3, /* tos, frag */
+ MAY_IPVx = 1 << 3, /* tos, frag
, ttl
*/
MAY_ARP_SHA = 1 << 4, /* arp_sha */
MAY_ARP_THA = 1 << 5, /* arp_tha */
MAY_ARP_SHA = 1 << 4, /* arp_sha */
MAY_ARP_THA = 1 << 5, /* arp_tha */
- MAY_IPV6
_ADDR = 1 << 6, /* ipv6_src, ipv6_dst
*/
+ MAY_IPV6
= 1 << 6, /* ipv6_src, ipv6_dst, ipv6_label
*/
MAY_ND_TARGET = 1 << 7 /* nd_target */
} may_match;
MAY_ND_TARGET = 1 << 7 /* nd_target */
} may_match;
@@
-2535,7
+2543,7
@@
ofputil_normalize_rule(struct cls_rule *rule, enum nx_flow_format flow_format)
}
} else if (rule->flow.dl_type == htons(ETH_TYPE_IPV6)
&& flow_format == NXFF_NXM) {
}
} else if (rule->flow.dl_type == htons(ETH_TYPE_IPV6)
&& flow_format == NXFF_NXM) {
- may_match = MAY_NW_PROTO | MAY_IPVx | MAY_IPV6
_ADDR
;
+ may_match = MAY_NW_PROTO | MAY_IPVx | MAY_IPV6;
if (rule->flow.nw_proto == IPPROTO_TCP ||
rule->flow.nw_proto == IPPROTO_UDP) {
may_match |= MAY_TP_ADDR;
if (rule->flow.nw_proto == IPPROTO_TCP ||
rule->flow.nw_proto == IPPROTO_UDP) {
may_match |= MAY_TP_ADDR;
@@
-2568,8
+2576,9
@@
ofputil_normalize_rule(struct cls_rule *rule, enum nx_flow_format flow_format)
wc.wildcards |= FWW_NW_PROTO;
}
if (!(may_match & MAY_IPVx)) {
wc.wildcards |= FWW_NW_PROTO;
}
if (!(may_match & MAY_IPVx)) {
- wc.tos_mask = 0;
- wc.frag_mask = 0;
+ wc.wildcards |= FWW_NW_DSCP;
+ wc.wildcards |= FWW_NW_ECN;
+ wc.wildcards |= FWW_NW_TTL;
}
if (!(may_match & MAY_ARP_SHA)) {
wc.wildcards |= FWW_ARP_SHA;
}
if (!(may_match & MAY_ARP_SHA)) {
wc.wildcards |= FWW_ARP_SHA;
@@
-2577,7
+2586,7
@@
ofputil_normalize_rule(struct cls_rule *rule, enum nx_flow_format flow_format)
if (!(may_match & MAY_ARP_THA)) {
wc.wildcards |= FWW_ARP_THA;
}
if (!(may_match & MAY_ARP_THA)) {
wc.wildcards |= FWW_ARP_THA;
}
- if (!(may_match & MAY_IPV6
_ADDR
)) {
+ if (!(may_match & MAY_IPV6)) {
wc.ipv6_src_mask = wc.ipv6_dst_mask = in6addr_any;
wc.wildcards |= FWW_IPV6_LABEL;
}
wc.ipv6_src_mask = wc.ipv6_dst_mask = in6addr_any;
wc.wildcards |= FWW_IPV6_LABEL;
}