Signed-off-by: Ben Pfaff <[email protected]>
---
NEWS | 4 ++--
lib/ofp-actions.c | 4 +++-
tests/ofp-actions.at | 18 ++++++++++++++++++
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 15fa165..6496dc1 100644
--- a/NEWS
+++ b/NEWS
@@ -22,8 +22,8 @@ Post-v2.5.0
- Improved OpenFlow version compatibility for actions:
* New OpenFlow extension to support the "group" action in OpenFlow 1.0.
* OpenFlow 1.0 "enqueue" action now properly translated to OpenFlow 1.1+.
- * OpenFlow 1.1 "mod_nw_ecn" action now properly translated to
- OpenFlow 1.0.
+ * OpenFlow 1.1 "mod_nw_ecn" and OpenFlow 1.1+ "mod_nw_ttl" actions now
+ properly translated to OpenFlow 1.0.
- ovs-ofctl:
* queue-get-config command now allows a queue ID to be specified.
* '--bundle' option can now be used with OpenFlow 1.3.
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 232e728..aa681c0 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -1970,7 +1970,9 @@ encode_SET_IP_TTL(const struct ofpact_ip_ttl *ttl,
if (ofp_version >= OFP11_VERSION) {
put_OFPAT11_SET_NW_TTL(out, ttl->ttl);
} else {
- /* XXX */
+ struct mf_subfield dst = { .field = mf_from_id(MFF_IP_TTL),
+ .ofs = 0, .n_bits = 8 };
+ put_reg_load(out, &dst, ttl->ttl);
}
}
diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at
index b177893..5e2474f 100644
--- a/tests/ofp-actions.at
+++ b/tests/ofp-actions.at
@@ -772,6 +772,23 @@ OFPST_FLOW reply (OF1.3):
OVS_VSWITCHD_STOP
AT_CLEANUP
+AT_SETUP([mod_nw_ttl action for OF1.0])
+AT_KEYWORDS([ofp-actions])
+OVS_VSWITCHD_START
+dnl OpenFlow 1.1+ have a mod_nw_ttl action. For OpenFlow 1.0, we translate
+dnl it to an Open vSwitch extension.
+AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ttl:123'])
+AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
+NXST_FLOW reply:
+ ip actions=load:0x7b->NXM_NX_IP_TTL[[]]
+])
+AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply (OF1.1):
+ ip actions=mod_nw_ttl:123
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
AT_SETUP([mod_nw_ecn action translation])
AT_KEYWORDS([ofp-actions])
OVS_VSWITCHD_START
@@ -808,3 +825,4 @@ OFPST_FLOW reply (OF1.1):
])
OVS_VSWITCHD_STOP
AT_CLEANUP
+
--
2.1.3
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev