void
cls_rule_set_nw_src(struct cls_rule *rule, ovs_be32 nw_src)
{
- cls_rule_set_nw_src_masked(rule, nw_src, htonl(UINT32_MAX));
+ rule->flow.nw_src = nw_src;
+ rule->wc.nw_src_mask = htonl(UINT32_MAX);
}
-bool
-cls_rule_set_nw_src_masked(struct cls_rule *rule, ovs_be32 ip, ovs_be32 mask)
+void
+cls_rule_set_nw_src_masked(struct cls_rule *rule,
+ ovs_be32 nw_src, ovs_be32 mask)
{
- if (flow_wildcards_set_nw_src_mask(&rule->wc, mask)) {
- rule->flow.nw_src = ip & mask;
- return true;
- } else {
- return false;
- }
+ rule->flow.nw_src = nw_src & mask;
+ rule->wc.nw_src_mask = mask;
}
void
cls_rule_set_nw_dst(struct cls_rule *rule, ovs_be32 nw_dst)
{
- cls_rule_set_nw_dst_masked(rule, nw_dst, htonl(UINT32_MAX));
+ rule->flow.nw_dst = nw_dst;
+ rule->wc.nw_dst_mask = htonl(UINT32_MAX);
}
-bool
+void
cls_rule_set_nw_dst_masked(struct cls_rule *rule, ovs_be32 ip, ovs_be32 mask)
{
- if (flow_wildcards_set_nw_dst_mask(&rule->wc, mask)) {
- rule->flow.nw_dst = ip & mask;
- return true;
- } else {
- return false;
- }
+ rule->flow.nw_dst = ip & mask;
+ rule->wc.nw_dst_mask = mask;
}
void
void
cls_rule_set_ipv6_src(struct cls_rule *rule, const struct in6_addr *src)
{
- cls_rule_set_ipv6_src_masked(rule, src, &in6addr_exact);
+ rule->flow.ipv6_src = *src;
+ rule->wc.ipv6_src_mask = in6addr_exact;
}
-bool
+void
cls_rule_set_ipv6_src_masked(struct cls_rule *rule, const struct in6_addr *src,
const struct in6_addr *mask)
{
- if (flow_wildcards_set_ipv6_src_mask(&rule->wc, mask)) {
- rule->flow.ipv6_src = ipv6_addr_bitand(src, mask);
- return true;
- } else {
- return false;
- }
+ rule->flow.ipv6_src = ipv6_addr_bitand(src, mask);
+ rule->wc.ipv6_src_mask = *mask;
}
void
cls_rule_set_ipv6_dst(struct cls_rule *rule, const struct in6_addr *dst)
{
- cls_rule_set_ipv6_dst_masked(rule, dst, &in6addr_exact);
+ rule->flow.ipv6_dst = *dst;
+ rule->wc.ipv6_dst_mask = in6addr_exact;
}
-bool
+void
cls_rule_set_ipv6_dst_masked(struct cls_rule *rule, const struct in6_addr *dst,
const struct in6_addr *mask)
{
- if (flow_wildcards_set_ipv6_dst_mask(&rule->wc, mask)) {
- rule->flow.ipv6_dst = ipv6_addr_bitand(dst, mask);
- return true;
- } else {
- return false;
- }
+ rule->flow.ipv6_dst = ipv6_addr_bitand(dst, mask);
+ rule->wc.ipv6_dst_mask = *mask;
}
void
void cls_rule_set_tp_dst(struct cls_rule *, ovs_be16);
void cls_rule_set_nw_proto(struct cls_rule *, uint8_t);
void cls_rule_set_nw_src(struct cls_rule *, ovs_be32);
-bool cls_rule_set_nw_src_masked(struct cls_rule *, ovs_be32 ip, ovs_be32 mask);
+void cls_rule_set_nw_src_masked(struct cls_rule *, ovs_be32 ip, ovs_be32 mask);
void cls_rule_set_nw_dst(struct cls_rule *, ovs_be32);
-bool cls_rule_set_nw_dst_masked(struct cls_rule *, ovs_be32 ip, ovs_be32 mask);
+void cls_rule_set_nw_dst_masked(struct cls_rule *, ovs_be32 ip, ovs_be32 mask);
void cls_rule_set_nw_dscp(struct cls_rule *, uint8_t);
void cls_rule_set_nw_ecn(struct cls_rule *, uint8_t);
void cls_rule_set_nw_ttl(struct cls_rule *, uint8_t);
void cls_rule_set_arp_sha(struct cls_rule *, const uint8_t[6]);
void cls_rule_set_arp_tha(struct cls_rule *, const uint8_t[6]);
void cls_rule_set_ipv6_src(struct cls_rule *, const struct in6_addr *);
-bool cls_rule_set_ipv6_src_masked(struct cls_rule *, const struct in6_addr *,
+void cls_rule_set_ipv6_src_masked(struct cls_rule *, const struct in6_addr *,
const struct in6_addr *);
void cls_rule_set_ipv6_dst(struct cls_rule *, const struct in6_addr *);
-bool cls_rule_set_ipv6_dst_masked(struct cls_rule *, const struct in6_addr *,
+void cls_rule_set_ipv6_dst_masked(struct cls_rule *, const struct in6_addr *,
const struct in6_addr *);
void cls_rule_set_ipv6_label(struct cls_rule *, ovs_be32);
void cls_rule_set_nd_target(struct cls_rule *, const struct in6_addr *);
|| (a->vlan_tci_mask & b->vlan_tci_mask) != b->vlan_tci_mask);
}
-static bool
-set_nw_mask(ovs_be32 *maskp, ovs_be32 mask)
-{
- if (ip_is_cidr(mask)) {
- *maskp = mask;
- return true;
- } else {
- return false;
- }
-}
-
-/* Sets the IP (or ARP) source wildcard mask to CIDR 'mask' (consisting of N
- * high-order 1-bit and 32-N low-order 0-bits). Returns true if successful,
- * false if 'mask' is not a CIDR mask. */
-bool
-flow_wildcards_set_nw_src_mask(struct flow_wildcards *wc, ovs_be32 mask)
-{
- return set_nw_mask(&wc->nw_src_mask, mask);
-}
-
-/* Sets the IP (or ARP) destination wildcard mask to CIDR 'mask' (consisting of
- * N high-order 1-bit and 32-N low-order 0-bits). Returns true if successful,
- * false if 'mask' is not a CIDR mask. */
-bool
-flow_wildcards_set_nw_dst_mask(struct flow_wildcards *wc, ovs_be32 mask)
-{
- return set_nw_mask(&wc->nw_dst_mask, mask);
-}
-
-static bool
-set_ipv6_mask(struct in6_addr *maskp, const struct in6_addr *mask)
-{
- if (ipv6_is_cidr(mask)) {
- *maskp = *mask;
- return true;
- } else {
- return false;
- }
-}
-
-/* Sets the IPv6 source wildcard mask to CIDR 'mask' (consisting of N
- * high-order 1-bit and 128-N low-order 0-bits). Returns true if successful,
- * false if 'mask' is not a CIDR mask. */
-bool
-flow_wildcards_set_ipv6_src_mask(struct flow_wildcards *wc,
- const struct in6_addr *mask)
-{
- return set_ipv6_mask(&wc->ipv6_src_mask, mask);
-}
-
-/* Sets the IPv6 destination wildcard mask to CIDR 'mask' (consisting of
- * N high-order 1-bit and 128-N low-order 0-bits). Returns true if
- * successful, false if 'mask' is not a CIDR mask. */
-bool
-flow_wildcards_set_ipv6_dst_mask(struct flow_wildcards *wc,
- const struct in6_addr *mask)
-{
- return set_ipv6_mask(&wc->ipv6_dst_mask, mask);
-}
-
/* Sets the wildcard mask for register 'idx' in 'wc' to 'mask'.
* (A 0-bit indicates a wildcard bit.) */
void
bool flow_wildcards_is_exact(const struct flow_wildcards *);
bool flow_wildcards_is_catchall(const struct flow_wildcards *);
-bool flow_wildcards_set_nw_src_mask(struct flow_wildcards *, ovs_be32);
-bool flow_wildcards_set_nw_dst_mask(struct flow_wildcards *, ovs_be32);
-bool flow_wildcards_set_ipv6_src_mask(struct flow_wildcards *,
- const struct in6_addr *);
-bool flow_wildcards_set_ipv6_dst_mask(struct flow_wildcards *,
- const struct in6_addr *);
void flow_wildcards_set_reg_mask(struct flow_wildcards *,
int idx, uint32_t mask);