Fix a bug: there are two ECN bits in the IPv4 header, not three.
Change-Id: Ibdfce817f2a506644e0f9cd16f46cf6ab1f75eb7
Showing
2 changed files
with
7 additions
and
7 deletions
| ... | @@ -133,7 +133,7 @@ public final class Criteria { | ... | @@ -133,7 +133,7 @@ public final class Criteria { |
| 133 | /** | 133 | /** |
| 134 | * Creates a match on IP ECN field using the specified value. | 134 | * Creates a match on IP ECN field using the specified value. |
| 135 | * | 135 | * |
| 136 | - * @param ipEcn ip ecn value (3 bits) | 136 | + * @param ipEcn ip ecn value (2 bits) |
| 137 | * @return match criterion | 137 | * @return match criterion |
| 138 | */ | 138 | */ |
| 139 | public static Criterion matchIPEcn(byte ipEcn) { | 139 | public static Criterion matchIPEcn(byte ipEcn) { |
| ... | @@ -770,16 +770,16 @@ public final class Criteria { | ... | @@ -770,16 +770,16 @@ public final class Criteria { |
| 770 | 770 | ||
| 771 | /** | 771 | /** |
| 772 | * Implementation of IP ECN (Explicit Congestion Notification) criterion | 772 | * Implementation of IP ECN (Explicit Congestion Notification) criterion |
| 773 | - * (3 bits). | 773 | + * (2 bits). |
| 774 | */ | 774 | */ |
| 775 | public static final class IPEcnCriterion implements Criterion { | 775 | public static final class IPEcnCriterion implements Criterion { |
| 776 | - private static final byte MASK = 0x7; | 776 | + private static final byte MASK = 0x3; |
| 777 | - private final byte ipEcn; // IP ECN value: 3 bits | 777 | + private final byte ipEcn; // IP ECN value: 2 bits |
| 778 | 778 | ||
| 779 | /** | 779 | /** |
| 780 | * Constructor. | 780 | * Constructor. |
| 781 | * | 781 | * |
| 782 | - * @param ipEcn the IP ECN value to match (3 bits) | 782 | + * @param ipEcn the IP ECN value to match (2 bits) |
| 783 | */ | 783 | */ |
| 784 | public IPEcnCriterion(byte ipEcn) { | 784 | public IPEcnCriterion(byte ipEcn) { |
| 785 | this.ipEcn = (byte) (ipEcn & MASK); | 785 | this.ipEcn = (byte) (ipEcn & MASK); |
| ... | @@ -793,7 +793,7 @@ public final class Criteria { | ... | @@ -793,7 +793,7 @@ public final class Criteria { |
| 793 | /** | 793 | /** |
| 794 | * Gets the IP ECN value to match. | 794 | * Gets the IP ECN value to match. |
| 795 | * | 795 | * |
| 796 | - * @return the IP ECN value to match (3 bits) | 796 | + * @return the IP ECN value to match (2 bits) |
| 797 | */ | 797 | */ |
| 798 | public byte ipEcn() { | 798 | public byte ipEcn() { |
| 799 | return ipEcn; | 799 | return ipEcn; | ... | ... |
| ... | @@ -173,7 +173,7 @@ public class CriterionCodecTest { | ... | @@ -173,7 +173,7 @@ public class CriterionCodecTest { |
| 173 | */ | 173 | */ |
| 174 | @Test | 174 | @Test |
| 175 | public void matchIPEcnTest() { | 175 | public void matchIPEcnTest() { |
| 176 | - Criterion criterion = Criteria.matchIPEcn((byte) 7); | 176 | + Criterion criterion = Criteria.matchIPEcn((byte) 3); |
| 177 | ObjectNode result = criterionCodec.encode(criterion, context); | 177 | ObjectNode result = criterionCodec.encode(criterion, context); |
| 178 | assertThat(result, matchesCriterion(criterion)); | 178 | assertThat(result, matchesCriterion(criterion)); |
| 179 | } | 179 | } | ... | ... |
-
Please register or login to post a comment