[ovs-dev] [PATCH 2/7] tc: Add ip layer ttl matching
Roi Dayan
roid at mellanox.com
Mon Aug 7 15:19:06 UTC 2017
From: Paul Blakey <paulb at mellanox.com>
Add matching on ip layer ttl, to be used later.
Signed-off-by: Paul Blakey <paulb at mellanox.com>
Reviewed-by: Roi Dayan <roid at mellanox.com>
---
lib/tc.c | 11 +++++++++++
lib/tc.h | 2 ++
2 files changed, 13 insertions(+)
diff --git a/lib/tc.c b/lib/tc.c
index 5c36d0d..ce3e070 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -196,6 +196,10 @@ static const struct nl_policy tca_flower_policy[] = {
.optional = true, },
[TCA_FLOWER_KEY_ENC_UDP_DST_PORT] = { .type = NL_A_U16,
.optional = true, },
+ [TCA_FLOWER_KEY_IP_TTL] = { .type = NL_A_U8,
+ .optional = true, },
+ [TCA_FLOWER_KEY_IP_TTL_MASK] = { .type = NL_A_U8,
+ .optional = true, },
};
static void
@@ -344,6 +348,12 @@ nl_parse_flower_ip(struct nlattr **attrs, struct tc_flower *flower) {
nl_attr_get_be16(attrs[TCA_FLOWER_KEY_SCTP_DST_MASK]);
}
}
+
+ if (attrs[TCA_FLOWER_KEY_IP_TTL_MASK]) {
+ key->ip_ttl = nl_attr_get_u8(attrs[TCA_FLOWER_KEY_IP_TTL]);
+ mask->ip_ttl = nl_attr_get_u8(attrs[TCA_FLOWER_KEY_IP_TTL_MASK]);
+ }
+
}
static const struct nl_policy tunnel_key_policy[] = {
@@ -1036,6 +1046,7 @@ nl_msg_put_flower_options(struct ofpbuf *request, struct tc_flower *flower)
if (host_eth_type == ETH_P_IP) {
FLOWER_PUT_MASKED_VALUE(ipv4.ipv4_src, TCA_FLOWER_KEY_IPV4_SRC);
FLOWER_PUT_MASKED_VALUE(ipv4.ipv4_dst, TCA_FLOWER_KEY_IPV4_DST);
+ FLOWER_PUT_MASKED_VALUE(ip_ttl, TCA_FLOWER_KEY_IP_TTL);
} else if (host_eth_type == ETH_P_IPV6) {
FLOWER_PUT_MASKED_VALUE(ipv6.ipv6_src, TCA_FLOWER_KEY_IPV6_SRC);
FLOWER_PUT_MASKED_VALUE(ipv6.ipv6_dst, TCA_FLOWER_KEY_IPV6_DST);
diff --git a/lib/tc.h b/lib/tc.h
index 5f363d0..362e751 100644
--- a/lib/tc.h
+++ b/lib/tc.h
@@ -90,6 +90,8 @@ struct tc_flower_key {
ovs_be16 encap_eth_type;
+ uint8_t ip_ttl;
+
struct {
ovs_be32 ipv4_src;
ovs_be32 ipv4_dst;
--
2.8.0
More information about the dev
mailing list