Add OF11 set IPv4 ECN action.
[sliver-openvswitch.git] / lib / ofp-parse.c
index 0e0d2f8..ee56477 100644 (file)
@@ -602,7 +602,7 @@ parse_named_action(enum ofputil_action_code code,
     char *error = NULL;
     uint16_t ethertype = 0;
     uint16_t vid = 0;
-    uint8_t tos = 0;
+    uint8_t tos = 0, ecn;
     uint8_t pcp = 0;
 
     switch (code) {
@@ -700,6 +700,18 @@ parse_named_action(enum ofputil_action_code code,
         ofpact_put_SET_IP_DSCP(ofpacts)->dscp = tos;
         break;
 
+    case OFPUTIL_OFPAT11_SET_NW_ECN:
+        error = str_to_u8(arg, "ECN", &ecn);
+        if (error) {
+            return error;
+        }
+
+        if (ecn & ~IP_ECN_MASK) {
+            return xasprintf("%s: not a valid ECN", arg);
+        }
+        ofpact_put_SET_IP_ECN(ofpacts)->ecn = ecn;
+        break;
+
     case OFPUTIL_OFPAT11_DEC_NW_TTL:
         NOT_REACHED();