diff options
| author | Ben Pfaff <blp@nicira.com> | 2010-06-22 12:47:03 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2010-06-22 12:47:03 -0700 |
| commit | 4d326addd3cb44e9608f7d1ef527adf4be26edec (patch) | |
| tree | 466b7f5daf166d9e336fa7e47a145de046ffc32c /lib/ofp-util.c | |
| parent | 36a7b32d790f2cee735520060a9b6221b7ae25ef (diff) | |
| download | openvswitch-4d326addd3cb44e9608f7d1ef527adf4be26edec.tar.gz | |
ofp-util: Also normalize nw_tos in normalize_match().
The OpenFlow reference implementation was sensibly normalizing these
fields but OVS did not. This change should make OVS resemble the OpenFlow
reference implementation at least in this respect.
For more information:
https://mailman.stanford.edu/pipermail/openflow-spec/2010-June/001040.html
Reported-by: Takayuki HAMA <t-hama@cb.jp.nec.com>
Diffstat (limited to 'lib/ofp-util.c')
| -rw-r--r-- | lib/ofp-util.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/ofp-util.c b/lib/ofp-util.c index e990f0f44..94682eb47 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -691,7 +691,7 @@ normalize_match(struct ofp_match *m) /* Can't sensibly match on network or transport headers if the * data link type is unknown. */ wc |= OFPFW_NW | OFPFW_TP; - m->nw_src = m->nw_dst = m->nw_proto = 0; + m->nw_src = m->nw_dst = m->nw_proto = m->nw_tos = 0; m->tp_src = m->tp_dst = 0; } else if (m->dl_type == htons(ETH_TYPE_IP)) { if (wc & OFPFW_NW_PROTO) { @@ -722,6 +722,11 @@ normalize_match(struct ofp_match *m) if (wc & OFPFW_NW_DST_MASK) { m->nw_dst &= flow_nw_bits_to_mask(wc, OFPFW_NW_DST_SHIFT); } + if (wc & OFPFW_NW_TOS) { + m->nw_tos = 0; + } else { + m->nw_tos &= IP_DSCP_MASK; + } } else if (m->dl_type == htons(ETH_TYPE_ARP)) { if (wc & OFPFW_NW_PROTO) { m->nw_proto = 0; @@ -732,12 +737,12 @@ normalize_match(struct ofp_match *m) if (wc & OFPFW_NW_DST_MASK) { m->nw_dst &= flow_nw_bits_to_mask(wc, OFPFW_NW_DST_SHIFT); } - m->tp_src = m->tp_dst = 0; + m->tp_src = m->tp_dst = m->nw_tos = 0; } else { /* Network and transport layer fields will always be extracted as * zeros, so we can do an exact-match on those values. */ wc &= ~(OFPFW_NW | OFPFW_TP); - m->nw_proto = m->nw_src = m->nw_dst = 0; + m->nw_proto = m->nw_src = m->nw_dst = m->nw_tos = 0; m->tp_src = m->tp_dst = 0; } if (wc & OFPFW_DL_SRC) { |
