X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fmeta-flow.c;h=6c899e1fd5a85f76d54a03f7919516955d5a1203;hb=HEAD;hp=6bd0b999ad4e3937ac692c73533d16e79fce2225;hpb=7dad8e9a50cd11dbb2c69dc64855f8133346a1ab;p=cascardo%2Fovs.git diff --git a/lib/meta-flow.c b/lib/meta-flow.c index 6bd0b999a..6c899e1fd 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 2013, 2014, 2015 Nicira, Inc. + * Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -171,6 +171,13 @@ mf_subvalue_shift(union mf_subvalue *value, int n) } } +/* Appends a formatted representation of 'sv' to 's'. */ +void +mf_subvalue_format(const union mf_subvalue *sv, struct ds *s) +{ + ds_put_hex(s, sv, sizeof *sv); +} + /* Returns true if 'wc' wildcards all the bits in field 'mf', false if 'wc' * specifies at least one bit in the field. * @@ -264,6 +271,8 @@ mf_is_all_wild(const struct mf_field *mf, const struct flow_wildcards *wc) return !(wc->masks.mpls_lse[0] & htonl(MPLS_TC_MASK)); case MFF_MPLS_BOS: return !(wc->masks.mpls_lse[0] & htonl(MPLS_BOS_MASK)); + case MFF_MPLS_TTL: + return !(wc->masks.mpls_lse[0] & htonl(MPLS_TTL_MASK)); case MFF_IPV4_SRC: return !wc->masks.nw_src; @@ -520,6 +529,7 @@ mf_is_value_valid(const struct mf_field *mf, const union mf_value *value) case MFF_ETH_DST: case MFF_ETH_TYPE: case MFF_VLAN_TCI: + case MFF_MPLS_TTL: case MFF_IPV4_SRC: case MFF_IPV4_DST: case MFF_IPV6_SRC: @@ -734,6 +744,10 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow, value->u8 = mpls_lse_to_bos(flow->mpls_lse[0]); break; + case MFF_MPLS_TTL: + value->u8 = mpls_lse_to_ttl(flow->mpls_lse[0]); + break; + case MFF_IPV4_SRC: value->be32 = flow->nw_src; break; @@ -988,6 +1002,10 @@ mf_set_value(const struct mf_field *mf, match_set_mpls_bos(match, 0, value->u8); break; + case MFF_MPLS_TTL: + match_set_mpls_ttl(match, 0, value->u8); + break; + case MFF_IPV4_SRC: match_set_nw_src(match, value->be32); break; @@ -1294,6 +1312,10 @@ mf_set_flow_value(const struct mf_field *mf, flow_set_mpls_bos(flow, 0, value->u8); break; + case MFF_MPLS_TTL: + flow_set_mpls_ttl(flow, 0, value->u8); + break; + case MFF_IPV4_SRC: flow->nw_src = value->be32; break; @@ -1616,6 +1638,10 @@ mf_set_wild(const struct mf_field *mf, struct match *match, char **err_str) match_set_any_mpls_bos(match, 0); break; + case MFF_MPLS_TTL: + match_set_any_mpls_ttl(match, 0); + break; + case MFF_IPV4_SRC: case MFF_ARP_SPA: match_set_nw_src_masked(match, htonl(0), htonl(0)); @@ -1772,6 +1798,7 @@ mf_set(const struct mf_field *mf, case MFF_MPLS_LABEL: case MFF_MPLS_TC: case MFF_MPLS_BOS: + case MFF_MPLS_TTL: case MFF_IP_PROTO: case MFF_IP_TTL: case MFF_IP_DSCP: