[ovs-dev] [RFC PATCH 10/13] tunneling: add ipv6 tunnel endpoints to flow_metadata
Jiri Benc
jbenc at redhat.com
Thu May 14 18:12:41 UTC 2015
Signed-off-by: Jiri Benc <jbenc at redhat.com>
---
lib/flow.c | 2 ++
lib/flow.h | 2 ++
lib/ofp-print.c | 10 ++++++++++
lib/ofp-util.c | 8 ++++++++
4 files changed, 22 insertions(+)
diff --git a/lib/flow.c b/lib/flow.c
index 752cf5f15c50..c1202bd6ce7c 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -769,6 +769,8 @@ flow_get_metadata(const struct flow *flow, struct flow_metadata *fmd)
fmd->tun_id = flow->tunnel.tun_id;
fmd->tun_src = flow->tunnel.ip_src;
fmd->tun_dst = flow->tunnel.ip_dst;
+ fmd->tun_ipv6_src = flow->tunnel.ipv6_src;
+ fmd->tun_ipv6_dst = flow->tunnel.ipv6_dst;
fmd->gbp_id = flow->tunnel.gbp_id;
fmd->gbp_flags = flow->tunnel.gbp_flags;
fmd->metadata = flow->metadata;
diff --git a/lib/flow.h b/lib/flow.h
index dcb5bb030603..921399e74fd9 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -186,6 +186,8 @@ struct flow_metadata {
ovs_be64 tun_id; /* Encapsulating tunnel ID. */
ovs_be32 tun_src; /* Tunnel outer IPv4 src addr */
ovs_be32 tun_dst; /* Tunnel outer IPv4 dst addr */
+ struct in6_addr tun_ipv6_src; /* Tunnel outer IPv6 src addr */
+ struct in6_addr tun_ipv6_dst; /* Tunnel outer IPv6 dst addr */
ovs_be16 gbp_id; /* Group policy ID */
uint8_t gbp_flags; /* Group policy flags */
ovs_be64 metadata; /* OpenFlow 1.1+ metadata field. */
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index cec074f1e9bd..1d5ebfa19e13 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -135,6 +135,16 @@ ofp_print_packet_in(struct ds *string, const struct ofp_header *oh,
ds_put_format(string, " tun_dst="IP_FMT, IP_ARGS(pin.fmd.tun_dst));
}
+ if (ipv6_addr_is_set(&pin.fmd.tun_ipv6_src)) {
+ ds_put_cstr(string, " tun_ipv6_src=");
+ ds_put_in6_addr(string, &pin.fmd.tun_ipv6_src);
+ }
+
+ if (ipv6_addr_is_set(&pin.fmd.tun_ipv6_dst)) {
+ ds_put_cstr(string, " tun_ipv6_dst=");
+ ds_put_in6_addr(string, &pin.fmd.tun_ipv6_dst);
+ }
+
if (pin.fmd.gbp_id != htons(0)) {
ds_put_format(string, " gbp_id=%"PRIu16,
ntohs(pin.fmd.gbp_id));
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 6366919a435a..1a4dd979d0d5 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -3306,6 +3306,8 @@ ofputil_decode_packet_in_finish(struct ofputil_packet_in *pin,
pin->fmd.tun_id = match->flow.tunnel.tun_id;
pin->fmd.tun_src = match->flow.tunnel.ip_src;
pin->fmd.tun_dst = match->flow.tunnel.ip_dst;
+ pin->fmd.tun_ipv6_src = match->flow.tunnel.ipv6_src;
+ pin->fmd.tun_ipv6_dst = match->flow.tunnel.ipv6_dst;
pin->fmd.gbp_id = match->flow.tunnel.gbp_id;
pin->fmd.gbp_flags = match->flow.tunnel.gbp_flags;
pin->fmd.metadata = match->flow.metadata;
@@ -3433,6 +3435,12 @@ ofputil_packet_in_to_match(const struct ofputil_packet_in *pin,
if (pin->fmd.tun_dst != htonl(0)) {
match_set_tun_dst(match, pin->fmd.tun_dst);
}
+ if (ipv6_addr_is_set(&pin->fmd.tun_ipv6_src)) {
+ match_set_tun_ipv6_src(match, &pin->fmd.tun_ipv6_src);
+ }
+ if (ipv6_addr_is_set(&pin->fmd.tun_ipv6_dst)) {
+ match_set_tun_ipv6_dst(match, &pin->fmd.tun_ipv6_dst);
+ }
if (pin->fmd.gbp_id != htons(0)) {
match_set_tun_gbp_id(match, pin->fmd.gbp_id);
}
--
1.8.3.1
More information about the dev
mailing list