X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fofp-actions.c;h=e7a90b6edc4a93420c034f4bb0815c72a58b1efc;hb=0c20dbe410f011354dda72e1534b4070e77603d4;hp=03465919617e54d5f13d7323970492d5f2ff7f07;hpb=ff14eb7ac9569ae09f7dc6672667cff907b35fc6;p=sliver-openvswitch.git diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 034659196..e7a90b6ed 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -45,6 +45,7 @@ union ofp_action { struct ofp_action_nw_addr nw_addr; struct ofp_action_nw_tos nw_tos; struct ofp11_action_nw_ecn nw_ecn; + struct ofp11_action_nw_ttl nw_ttl; struct ofp_action_tp_port tp_port; }; OFP_ASSERT(sizeof(union ofp_action) == 8); @@ -855,6 +856,10 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out) ofpact_put_SET_IP_ECN(out)->ecn = a->nw_ecn.nw_ecn; break; + case OFPUTIL_OFPAT11_SET_NW_TTL: + ofpact_put_SET_IP_TTL(out)->ttl = a->nw_ttl.nw_ttl; + break; + case OFPUTIL_OFPAT11_SET_TP_SRC: ofpact_put_SET_L4_SRC_PORT(out)->port = ntohs(a->tp_port.tp_port); break; @@ -926,6 +931,7 @@ ofpact_is_set_action(const struct ofpact *a) case OFPACT_SET_ETH_SRC: case OFPACT_SET_IP_DSCP: case OFPACT_SET_IP_ECN: + case OFPACT_SET_IP_TTL: case OFPACT_SET_IPV4_DST: case OFPACT_SET_IPV4_SRC: case OFPACT_SET_L4_DST_PORT: @@ -988,6 +994,7 @@ ofpact_is_allowed_in_actions_set(const struct ofpact *a) case OFPACT_SET_ETH_SRC: case OFPACT_SET_IP_DSCP: case OFPACT_SET_IP_ECN: + case OFPACT_SET_IP_TTL: case OFPACT_SET_IPV4_DST: case OFPACT_SET_IPV4_SRC: case OFPACT_SET_L4_DST_PORT: @@ -1259,6 +1266,7 @@ ovs_instruction_type_from_ofpact_type(enum ofpact_type type) case OFPACT_SET_IPV4_DST: case OFPACT_SET_IP_DSCP: case OFPACT_SET_IP_ECN: + case OFPACT_SET_IP_TTL: case OFPACT_SET_L4_SRC_PORT: case OFPACT_SET_L4_DST_PORT: case OFPACT_REG_MOVE: @@ -1579,6 +1587,7 @@ ofpact_check__(const struct ofpact *a, struct flow *flow, ofp_port_t max_ports, case OFPACT_SET_IPV4_DST: case OFPACT_SET_IP_DSCP: case OFPACT_SET_IP_ECN: + case OFPACT_SET_IP_TTL: case OFPACT_SET_L4_SRC_PORT: case OFPACT_SET_L4_DST_PORT: return 0; @@ -1966,6 +1975,7 @@ ofpact_to_nxast(const struct ofpact *a, struct ofpbuf *out) case OFPACT_SET_IPV4_DST: case OFPACT_SET_IP_DSCP: case OFPACT_SET_IP_ECN: + case OFPACT_SET_IP_TTL: case OFPACT_SET_L4_SRC_PORT: case OFPACT_SET_L4_DST_PORT: case OFPACT_WRITE_ACTIONS: @@ -2081,6 +2091,7 @@ ofpact_to_openflow10(const struct ofpact *a, struct ofpbuf *out) case OFPACT_STACK_POP: case OFPACT_DEC_TTL: case OFPACT_SET_IP_ECN: + case OFPACT_SET_IP_TTL: case OFPACT_SET_MPLS_TTL: case OFPACT_DEC_MPLS_TTL: case OFPACT_SET_TUNNEL: @@ -2207,6 +2218,11 @@ ofpact_to_openflow11(const struct ofpact *a, struct ofpbuf *out) = ofpact_get_SET_IP_ECN(a)->ecn; break; + case OFPACT_SET_IP_TTL: + ofputil_put_OFPAT11_SET_NW_TTL(out)->nw_ttl + = ofpact_get_SET_IP_TTL(a)->ttl; + break; + case OFPACT_SET_L4_SRC_PORT: ofputil_put_OFPAT11_SET_TP_SRC(out)->tp_port = htons(ofpact_get_SET_L4_SRC_PORT(a)->port); @@ -2412,6 +2428,7 @@ ofpact_outputs_to_port(const struct ofpact *ofpact, ofp_port_t port) case OFPACT_SET_IPV4_DST: case OFPACT_SET_IP_DSCP: case OFPACT_SET_IP_ECN: + case OFPACT_SET_IP_TTL: case OFPACT_SET_L4_SRC_PORT: case OFPACT_SET_L4_DST_PORT: case OFPACT_REG_MOVE: @@ -2677,6 +2694,10 @@ ofpact_format(const struct ofpact *a, struct ds *s) ds_put_format(s, "mod_nw_ecn:%d", ofpact_get_SET_IP_ECN(a)->ecn); break; + case OFPACT_SET_IP_TTL: + ds_put_format(s, "mod_nw_ttl:%d", ofpact_get_SET_IP_TTL(a)->ttl); + break; + case OFPACT_SET_L4_SRC_PORT: ds_put_format(s, "mod_tp_src:%d", ofpact_get_SET_L4_SRC_PORT(a)->port); break;